Skip to content

Commit ff7f8d0

Browse files
committed
fix_ball_node
1 parent 58bad69 commit ff7f8d0

3 files changed

Lines changed: 32 additions & 13 deletions

File tree

src/compas_timber/connections/ball_node.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,31 +70,27 @@ def generated_elements(self):
7070

7171
@property
7272
def elements(self):
73-
return self.beams + [self.generated_elements]
73+
return list(self.beams) + self.generated_elements
7474

7575
@property
7676
def interactions(self):
7777
for beam in self.beams:
7878
yield (beam, self.fastener)
7979

8080
@classmethod
81-
def create(cls, model, *elements, **kwargs):
82-
"""Creates an instance of the BallNodeJoint and creates the new connection in `model`.
81+
def from_element_list(cls, elements, **kwargs):
82+
"""Creates an instance of the BallNodeJoint.
8383
8484
This differs fom the generic `Joint.create()` method in that it passes the `beams` to
8585
the constructor of the BallNodeJoint as a list instead of as separate arguments.
8686
87-
`beams` are expected to have been added to `model` before calling this method.
88-
8987
This code does not verify that the given beams are adjacent and/or lie in a topology which allows connecting
9088
them. This is the responsibility of the calling code.
9189
9290
A `ValueError` is raised if `beams` contains less than two `Beam` objects.
9391
9492
Parameters
9593
----------
96-
model : :class:`~compas_timber.model.TimberModel`
97-
The model to which the beams and this joing belong.
9894
beams : list(:class:`~compas_timber.parts.Beam`)
9995
A list containing beams that whould be joined together
10096
@@ -104,10 +100,8 @@ def create(cls, model, *elements, **kwargs):
104100
The instance of the created joint.
105101
106102
"""
107-
elements = list(elements)
108-
joint = cls(elements, **kwargs)
109-
model.add_joint(joint)
110-
return joint
103+
return cls(elements, **kwargs)
104+
111105

112106
@property
113107
def node_point(self):

src/compas_timber/connections/joint.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,31 @@ def create(cls, model, *elements, **kwargs):
185185
186186
"""
187187

188-
joint = cls(*elements, **kwargs)
188+
joint = cls.from_element_list(elements, **kwargs)
189189
model.add_joint(joint)
190190
return joint
191+
192+
193+
@classmethod
194+
def from_element_list(cls, elements, **kwargs):
195+
"""Creates an instance of this joint from a list of elements. This should be overridden when a joint type takes a list of elements.
196+
197+
This code does not verify that the given elements are adjacent and/or lie in a topology which allows connecting
198+
them. This is the responsibility of the calling code.
199+
200+
Parameters
201+
----------
202+
*elements : :class:`~compas_model.elements.Element`
203+
The elements to be connected by this joint. The number of elements must comply with the `Joint` class's
204+
`MIN_ELEMENT_COUNT` and `MAX_ELEMENT_COUNT` attributes.
205+
**kwargs : dict
206+
Additional keyword arguments that are passed to the joint's constructor.
207+
208+
Returns
209+
-------
210+
:class:`compas_timber.connections.Joint`
211+
The instance of the created joint.
212+
213+
"""
214+
215+
return cls(*elements, **kwargs)

src/compas_timber/elements/fasteners/ball_node_fastener.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def interface_plate(self):
153153
"""Generate a plate from outline_points, thickness, and holes."""
154154
if not self.base_interface.outline_points:
155155
return None
156-
outline_points = correct_polyline_direction(self.base_interface.outline_points, Vector(0, 0, 1))
156+
outline_points = correct_polyline_direction(self.base_interface.outline_points, Vector(0, 0, 1), clockwise=True)
157157
outline = NurbsCurve.from_points(outline_points, degree=1)
158158
holes = self.base_interface.holes
159159
thickness = self.base_interface.thickness

0 commit comments

Comments
 (0)