@@ -182,11 +182,12 @@ def assembly_to_gmsh(self, mesh_path="tagged_mesh.msh"):
182182 gmsh .finalize ()
183183
184184
185- def assembly_to_imprinted_gmsh (self , mesh_path = "tagged_mesh.msh" ):
185+ def get_imprinted_gmsh (self ):
186186 """
187- Exports an imprinted assembly to capture conformal meshes .
187+ Allows the user to get a gmsh object from the assembly, with the assembly being imprinted .
188188 """
189189
190+ # Initialize gmsh and create a new model
190191 gmsh .initialize ()
191192 gmsh .option .setNumber ("General.Terminal" , 0 )
192193 gmsh .model .add ("assembly" )
@@ -208,7 +209,6 @@ def assembly_to_imprinted_gmsh(self, mesh_path="tagged_mesh.msh"):
208209 cq .occ_impl .assembly .imprint (self )
209210 )
210211
211- print (imprinted_solids_with_orginal_ids )
212212 for solid , id in imprinted_solids_with_orginal_ids .items ():
213213 # Add the current solid to the mesh
214214 # Work-around for a segfault with in-memory passing of OCCT objects
@@ -297,6 +297,17 @@ def assembly_to_imprinted_gmsh(self, mesh_path="tagged_mesh.msh"):
297297
298298 gmsh .model .occ .synchronize ()
299299
300+ return gmsh
301+
302+
303+ def assembly_to_imprinted_gmsh (self , mesh_path = "tagged_mesh.msh" ):
304+ """
305+ Exports an imprinted assembly to capture conformal meshes.
306+ """
307+
308+ # Turn this assembly into a imprinted gmsh object
309+ gmsh = get_imprinted_gmsh (self )
310+
300311 gmsh .model .mesh .field .setAsBackgroundMesh (2 )
301312
302313 gmsh .model .mesh .generate (3 )
@@ -310,3 +321,4 @@ def assembly_to_imprinted_gmsh(self, mesh_path="tagged_mesh.msh"):
310321cq .Assembly .saveToGmsh = assembly_to_gmsh # Alias name that works better on cq.Assembly
311322cq .Assembly .getTaggedGmsh = get_tagged_gmsh
312323cq .Assembly .assemblyToImprintedGmsh = assembly_to_imprinted_gmsh
324+ cq .Assembly .getImprintedGmsh = get_imprinted_gmsh
0 commit comments