Skip to content

Instantly share code, notes, and snippets.

@hyOzd
Last active September 13, 2023 17:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hyOzd/2e75a9816cfabeb5b4aa to your computer and use it in GitHub Desktop.
Save hyOzd/2e75a9816cfabeb5b4aa to your computer and use it in GitHub Desktop.
A small FreeCAD script to export all visible parts as STL
#
# 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)
@Brandbiko
Copy link

Interesting

@carlosbaraza
Copy link

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