@@ -24,7 +24,7 @@ def RunCommand():
2424 # Get stuff from session
2525 # =============================================================================
2626
27- meshobj : RhinoCableMeshObject = session .scene . find_by_name ( name = "CableMesh" )
27+ meshobj : RhinoCableMeshObject = session .find_cablemesh ( )
2828
2929 # =============================================================================
3030 # Confirmation
@@ -43,7 +43,9 @@ def RunCommand():
4343 # Make a CableMesh "Pattern"
4444 # =============================================================================
4545
46- option = rs .GetString (message = "CableMesh From" , strings = ["RhinoBox" , "RhinoCylinder" , "RhinoMesh" , "RhinoSurface" , "MeshGrid" , "JSON" ])
46+ mesh : CableMesh
47+
48+ option = rs .GetString (message = "CableMesh From" , strings = ["RhinoBox" , "RhinoCylinder" , "RhinoMesh" , "RhinoSurface" , "MeshGrid" , "Json" ])
4749
4850 if option == "RhinoBox" :
4951 guid = compas_rhino .objects .select_object ("Select a box" )
@@ -75,6 +77,9 @@ def RunCommand():
7577
7678 obj = compas_rhino .objects .find_object (guid )
7779 cylinder = compas_rhino .conversions .extrusion_to_compas_cylinder (obj .Geometry )
80+ if not cylinder :
81+ return
82+
7883 mesh = cylinder_to_cablemesh (cylinder , U , V , name = "CableMesh" )
7984
8085 rs .HideObject (guid )
@@ -85,7 +90,7 @@ def RunCommand():
8590 return
8691
8792 obj = compas_rhino .objects .find_object (guid )
88- mesh = compas_rhino .conversions .mesh_to_compas (obj .Geometry , cls = CableMesh )
93+ mesh = compas_rhino .conversions .mesh_to_compas (obj .Geometry , cls = CableMesh ) # type: ignore
8994
9095 rs .HideObject (guid )
9196
@@ -110,7 +115,7 @@ def RunCommand():
110115
111116 # ------------------------------------------------
112117
113- mesh = compas_rhino .conversions .surface_to_compas_mesh (surface , nu = U , nv = V , weld = True , cls = CableMesh )
118+ mesh = compas_rhino .conversions .surface_to_compas_mesh (surface , nu = U , nv = V , weld = True , cls = CableMesh ) # type: ignore
114119
115120 rs .HideObject (guid )
116121
@@ -131,14 +136,14 @@ def RunCommand():
131136 if not NY :
132137 return
133138
134- mesh = CableMesh .from_meshgrid (dx = DX , nx = NX , dy = DY , ny = NY )
139+ mesh = CableMesh .from_meshgrid (dx = DX , nx = NX , dy = DY , ny = NY ) # type: ignore
135140
136- elif option == "JSON " :
141+ elif option == "Json " :
137142 filepath = FileForm .open (session .basedir )
138143 if not filepath :
139144 return
140145
141- temp : Mesh = compas .json_load (filepath )
146+ temp : Mesh = compas .json_load (filepath ) # type: ignore
142147 mesh : CableMesh = temp .copy (cls = CableMesh )
143148
144149 else :
@@ -148,7 +153,7 @@ def RunCommand():
148153 # Update scene
149154 # =============================================================================
150155
151- meshobj = session .scene .add (mesh , name = mesh .name )
156+ meshobj = session .scene .add (mesh , name = mesh .name ) # type: ignore
152157
153158 meshobj .show_vertices = list (meshobj .mesh .vertices_where (is_support = True ))
154159 meshobj .show_edges = True
0 commit comments