Skip to content

Instantly share code, notes, and snippets.

@edrex
Created September 8, 2012 17:12
Show Gist options
  • Save edrex/3677323 to your computer and use it in GitHub Desktop.
Save edrex/3677323 to your computer and use it in GitHub Desktop.
FreeCAD Scripting Examples
import FreeCAD
import Part
App.newDocument()
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")
box = App.ActiveDocument.addObject("Part::Box","Box")
box.Placement = App.Placement(App.Vector(1,1,1),App.Rotation(0,0,0,1))
box.Height = 5.00
box.Length = 5.00
box.Width = 5.00
sphere = App.ActiveDocument.addObject("Part::Sphere","Sphere")
sphere.Placement = App.Placement(App.Vector(5,5,5),App.Rotation(0,0,0,1))
App.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment