Created
February 17, 2018 19:20
-
-
Save kuri65536/09f081f01d8538edc95459e4e3d5e572 to your computer and use it in GitHub Desktop.
FreeCAD Macro, Export Group to STL
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import os | |
import FreeCAD | |
import Mesh | |
__objs__ = Gui.Selection.getSelection() | |
if len(__objs__) > 0: | |
fname = FreeCAD.ActiveDocument.FileName | |
dname = os.path.dirname(fname) | |
fname, fext = os.path.splitext(os.path.basename(fname)) | |
seq = os.path.basename(fname).split("-") # versioning | |
if len(seq) > 1: | |
ver = "-" + seq[-1] | |
else: | |
ver = "" | |
for i in __objs__: | |
if "Group" not in str(i.TypeId): | |
continue | |
fname = i.Label | |
fname = os.path.join(dname, fname + ver + u".stl") | |
Mesh.export(__objs__, fname) | |
else: | |
print("no objects selected") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment