File tree Expand file tree Collapse file tree 2 files changed +22
-22
lines changed
src/compas_ghpython/scene Expand file tree Collapse file tree 2 files changed +22
-22
lines changed Original file line number Diff line number Diff line change 88from .sceneobject import GHSceneObject
99
1010
11+ def _create_ngon (vertex_count ):
12+ if vertex_count < 3 :
13+ return
14+ if vertex_count == 3 :
15+ return [0 , 1 , 2 ]
16+ if vertex_count == 4 :
17+ return [0 , 1 , 2 , 3 ]
18+ return list (range (vertex_count ))
19+
20+
1121class MeshObject (GHSceneObject , BaseMeshObject ):
1222 """Scene object for drawing mesh data structures.
1323
@@ -146,21 +156,11 @@ def draw_faces(self):
146156 for face in faces :
147157 color = self .facecolor [face ] # type: ignore
148158 vertices = [self .mesh .vertex_attributes (vertex , "xyz" ) for vertex in self .mesh .face_vertices (face )] # type: ignore
149- facet = self . _create_ngon (len (vertices ))
159+ facet = _create_ngon (len (vertices ))
150160
151161 if facet :
152162 geometry = conversions .vertices_and_faces_to_rhino (vertices , [facet ], color = color )
153163 geometry .Transform (transformation )
154164 meshes .append (geometry )
155165
156166 return meshes
157-
158- @staticmethod
159- def _create_ngon (vertex_count ):
160- if vertex_count < 3 :
161- return
162- if vertex_count == 3 :
163- return [0 , 1 , 2 ]
164- if vertex_count == 4 :
165- return [0 , 1 , 2 , 3 ]
166- return list (range (vertex_count ))
Original file line number Diff line number Diff line change 88from .sceneobject import GHSceneObject
99
1010
11+ def _create_ngon (vertex_count ):
12+ if vertex_count < 3 :
13+ return
14+ if vertex_count == 3 :
15+ return [0 , 1 , 2 ]
16+ if vertex_count == 4 :
17+ return [0 , 1 , 2 , 3 ]
18+ return list (range (vertex_count ))
19+
20+
1121class VolMeshObject (GHSceneObject , BaseVolMeshObject ):
1222 """Scene object for drawing volmesh data structures."""
1323
@@ -83,7 +93,7 @@ def draw_faces(self):
8393 for face in faces :
8494 color = self .facecolor [face ]
8595 vertices = [self .vertex_xyz [vertex ] for vertex in self .volmesh .face_vertices (face )]
86- facet = self . _create_ngon (len (vertices ))
96+ facet = _create_ngon (len (vertices ))
8797 if facet :
8898 meshes .append (conversions .vertices_and_faces_to_rhino (vertices , [facet ], color = color ))
8999
@@ -114,13 +124,3 @@ def draw_cells(self):
114124 meshes .append (mesh )
115125
116126 return meshes
117-
118- @staticmethod
119- def _create_ngon (vertex_count ):
120- if vertex_count < 3 :
121- return
122- if vertex_count == 3 :
123- return [0 , 1 , 2 ]
124- if vertex_count == 4 :
125- return [0 , 1 , 2 , 3 ]
126- return list (range (vertex_count ))
You can’t perform that action at this time.
0 commit comments