SketcherExample.py
Go to the documentation of this file.00001
00002 from Sketcher import *
00003 from Part import *
00004 from FreeCAD import *
00005
00006
00007 StartPoint = 1
00008 EndPoint = 2
00009 MiddlePoint = 3
00010
00011
00012 if(App.activeDocument() == None):App.newDocument()
00013
00014 f = App.activeDocument().addObject("Sketcher::SketchObject","Sketch")
00015
00016
00017 f.Geometry = [Line(Vector(0,0,0),Vector(2,20,0)),Line(Vector(0,0,0),Vector(20,2,0))]
00018
00019
00020 f.Constraints = [Constraint('Vertical',0),Constraint('Horizontal',1)]
00021
00022
00023 App.activeDocument().recompute()
00024
00025
00026 l = f.Constraints
00027 l.append(Constraint('Coincident',0,StartPoint,1,StartPoint))
00028 f.Constraints = l
00029
00030
00031 App.activeDocument().recompute()
00032
00033 f.Geometry
00034
00035