Skip to content

Instantly share code, notes, and snippets.

@5263
Created February 15, 2014 14:03
Show Gist options
  • Save 5263/9019709 to your computer and use it in GitHub Desktop.
Save 5263/9019709 to your computer and use it in GitHub Desktop.
Convert FreeCAD Minkowski Sum Features to Offset Features
import FreeCAD,OpenSCADFeatures
for obj in FreeCAD.ActiveDocument.Objects:
if obj.TypeId == "Part::FeaturePython" and hasattr(obj,'Proxy') and isinstance(obj.Proxy,OpenSCADFeatures.CGALFeature) \
and len(obj.Children) == 2:
print [(child.TypeId,child.PropertiesList) for child in obj.Children]
if obj.Children[0].TypeId in ['Part::Cylinder','Part::Sphere']:
OpenSCADFeatures.OffsetShape(obj,obj.Children[1],float(obj.Children[0].Radius))
obj.touch()
elif obj.Children[1].TypeId in ['Part::Cylinder','Part::Sphere']:
OpenSCADFeatures.OffsetShape(obj,obj.Children[0],float(obj.Children[1].Radius))
obj.touch()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment