Skip to content

Instantly share code, notes, and snippets.

@Foadsf
Created April 13, 2017 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Foadsf/e5acd09123564ad99f364e9b9730df0c to your computer and use it in GitHub Desktop.
Save Foadsf/e5acd09123564ad99f364e9b9730df0c to your computer and use it in GitHub Desktop.
this FreeCAD puthon script/macro creates 3 boxes, fuses two of them together, and then try to cut the fusion out of the bigger box (but it fails)
print("flag 1")
test1 = App.newDocument("Test1")
cylinder=test1.addObject("Part::Box","Cylinder")
cylinder.Height = '20 mm'
cylinder.Width = '5 mm'
cylinder.Length = '40 mm'
myvec = App.Vector(5,0,5)
myvec_2 = App.Vector(0,0,0)
mybox=test1.addObject("Part::Box","Mybox")
mybox.Height = '5 mm'
mybox.Width = '15 mm'
mybox.Length = '10 mm'
mybox.Placement.Base = myvec
mybox_2=test1.addObject("Part::Box","Mybox_2")
mybox_2.Height = '5 mm'
mybox_2.Width = '10 mm'
mybox_2.Length = '20 mm'
mybox_2.Placement.Base = myvec_2
myfus = test1.addObject("Part::Fuse","myFus")
myfus.Base = mybox
myfus.Tool = mybox_2
mybox.Visibility=False
mybox_2.Visibility=False
print("flag 2")
App.activeDocument().addObject("Part::Cut","Cut")
App.activeDocument().Cut.Base = App.activeDocument().Cylinder
App.activeDocument().Cut.Tool = App.activeDocument().myFus
App.ActiveDocument.recompute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment