Skip to content

Commit f20e2b7

Browse files
UPDATE: add number_joints and total_number_joints to DFBeam and DFAssembly resp.
1 parent 8484987 commit f20e2b7

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/gh/components/DF_joint_segmentator/code.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,13 @@ def RunScript(self,
4040

4141
if not isinstance(i_clusters[0], Rhino.Geometry.PointCloud):
4242
raise ValueError("The input clusters must be PointClouds.")
43-
44-
all_joints = i_assembly.all_joints
45-
if not isinstance(all_joints[0].faces[0].to_mesh(), Rhino.Geometry.Mesh):
46-
raise ValueError("The input joints must be convertible to Meshes.")
4743

4844
# get number of joints
49-
n_joints = max([joint.id for joint in all_joints]) + 1
45+
n_joints = i_assembly.total_number_joints
5046

5147
# prepping the reference meshes
5248
joints = [[] for _ in range(n_joints)]
53-
for joint in all_joints:
49+
for joint in i_assembly.all_joints:
5450
for face in joint.faces:
5551
face = face.to_mesh()
5652
face.Subdivide()

src/gh/diffCheck/diffCheck/df_geometries.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ def __repr__(self):
313313
def id(self):
314314
return self.__id
315315

316+
@property
317+
def number_joints(self):
318+
return max([joint.id for joint in self.joints]) + 1
319+
316320
@property
317321
def joint_faces(self):
318322
return [face for face in self.faces if face.is_joint]
@@ -420,6 +424,10 @@ def dump_xml(self, pretty_xml: str, dir: str):
420424
with open(file_path, "w") as f:
421425
f.write(pretty_xml)
422426

427+
@property
428+
def total_number_joints(self):
429+
return max([joint.id for joint in self.all_joints]) + 1
430+
423431
@property
424432
def all_joint_faces(self):
425433
if len(self._all_jointfaces) == 0:

0 commit comments

Comments
 (0)