-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export to STL format capability added #176
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,23 +250,29 @@ def import_step_cubit(self): | |
|
||
self.volume_ids = list(range(first_vol_id, last_vol_id + 1)) | ||
|
||
def export_step(self, step_filename="magnet_set", export_dir=""): | ||
"""Export CAD solids as a STEP file via CadQuery. | ||
def export_components( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of calling this |
||
self, filetype="step", filename="magnet_set", export_dir="" | ||
): | ||
Comment on lines
+253
to
+255
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to combine |
||
"""Export CAD solids as a STEP or STL file via CadQuery. | ||
|
||
Arguments: | ||
step_filename (str): name of STEP output file, excluding '.step' | ||
extension (optional, defaults to 'magnet_set'). | ||
export_dir (str): directory to which to export the STEP output file | ||
filetype (str): extension, excluding '.', to which to export the output file | ||
(defaults to STEP). | ||
filename (str): name of output file, excluding extension | ||
(optional, defaults to 'magnet_set'). | ||
export_dir (str): directory to which to export the output file | ||
(optional, defaults to empty string). | ||
""" | ||
self._logger.info("Exporting STEP file for magnet coils...") | ||
self._logger.info( | ||
f"Exporting {filetype.upper()} file for magnet coils..." | ||
) | ||
|
||
self.export_dir = export_dir | ||
self.step_filename = step_filename | ||
self.filename = filename | ||
|
||
export_path = Path(self.export_dir) / Path( | ||
self.step_filename | ||
).with_suffix(".step") | ||
export_path = Path(self.export_dir) / Path(self.filename).with_suffix( | ||
f".{filetype}" | ||
) | ||
|
||
coil_set = cq.Compound.makeCompound( | ||
[coil.solid for coil in self.magnet_coils] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to include some kind of check on filetype input, unless we want to rely on CadQuery to issue an error if an incorrect filetype is supplied.