Last active
June 17, 2024 09:08
-
-
Save hyOzd/2e75a9816cfabeb5b4aa to your computer and use it in GitHub Desktop.
A small FreeCAD script to export all visible parts as STL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Export All STL | |
# | |
# This is a small FreeCAD script to export all visible parts in STL | |
# mesh format. Files will be named as "documentname_partlabel.stl". | |
# | |
import FreeCAD | |
import os.path | |
doc = FreeCAD.activeDocument() | |
base_filename = os.path.splitext(doc.FileName)[0] | |
for obj in doc.Objects: | |
if obj.ViewObject.Visibility: | |
filename = base_filename + "_" + obj.Label + ".stl" | |
obj.Shape.exportStl(filename) |
Expanded on it to handle a bunch of edge cases:
https://gist.github.com/carlosbaraza/8c91b6dd6f1c977912fec59b3f4a0cd2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting