+ unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
35
src/Mod/Sketcher/SketcherExample.py
Normal file
35
src/Mod/Sketcher/SketcherExample.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Example hwo to use the basic sketcher tools
|
||||
from Sketcher import *
|
||||
from Part import *
|
||||
from FreeCAD import *
|
||||
|
||||
# set some constances for the constraints
|
||||
StartPoint = 1
|
||||
EndPoint = 2
|
||||
MiddlePoint = 3
|
||||
|
||||
# create a document and a Sketch object
|
||||
if(App.activeDocument() == None):App.newDocument()
|
||||
|
||||
f = App.activeDocument().addObject("Sketcher::SketchObject","Sketch")
|
||||
|
||||
# add geometry to the sketch
|
||||
f.Geometry = [Line(Vector(0,0,0),Vector(2,20,0)),Line(Vector(0,0,0),Vector(20,2,0))]
|
||||
|
||||
# add constraints to the sketch
|
||||
f.Constraints = [Constraint('Vertical',0),Constraint('Horizontal',1)]
|
||||
|
||||
# recompute (solving) the sketch
|
||||
App.activeDocument().recompute()
|
||||
|
||||
# add another constraint to tie the start points together
|
||||
l = f.Constraints
|
||||
l.append(Constraint('Coincident',0,StartPoint,1,StartPoint))
|
||||
f.Constraints = l
|
||||
|
||||
# again recompute
|
||||
App.activeDocument().recompute()
|
||||
|
||||
f.Geometry
|
||||
|
||||
|
||||
Reference in New Issue
Block a user