paramak
paramak copied to clipboard
Add the ability to convert existing stp files into Shapes
I have found a few cases where stp files provided are difficult to reproduce with the paramak and are already clean enough to be used in the neutronics simulations.
When this is the case it could be useful to import the stp file and combine it with a paramak generated geometry.
I've done this with cadquery code for now but perhaps we could wrap this and add it to the paramak as another method of generating Shapes
def convert_stp_file_to_paramak_part(filename, material_tag, filename_stub, scale_factor=0.1):
part = importers.importStep(str(filename))
part = part.val().scale(scale_factor)
new_part = paramak.Shape()
new_part.material_tag = material_tag
new_part.stl_filename = filename_stub+'.stl'
new_part.stp_filename = filename_stub+'.stp'
# assumes there is just one solid in the geometry
new_part.solid = part.Solids()[0]
# parts can be mirrored and rotated to make the complete geometry
# part2 = part.mirror(mirrorPlane="ZX", basePointVector=(0, 0, 0))
# part4 = part2.rotate((0,0,1),(0,0,-1), 20)
return new_part