Sketcher: /Mod/Sketcher python code black formatted
This commit is contained in:
committed by
abdullahtahiriyo
parent
96acbaf252
commit
233a337ca5
@@ -10,22 +10,26 @@ EndPoint = 2
|
||||
MiddlePoint = 3
|
||||
|
||||
# create a document and a Sketch object
|
||||
if(App.activeDocument() is None):App.newDocument()
|
||||
if App.activeDocument() is None:
|
||||
App.newDocument()
|
||||
|
||||
f = App.activeDocument().addObject("Sketcher::SketchObject","Sketch")
|
||||
f = App.activeDocument().addObject("Sketcher::SketchObject", "Sketch")
|
||||
|
||||
# add geometry to the sketch
|
||||
f.Geometry = [LineSegment(Vector(0,0,0),Vector(2,20,0)),LineSegment(Vector(0,0,0),Vector(20,2,0))]
|
||||
f.Geometry = [
|
||||
LineSegment(Vector(0, 0, 0), Vector(2, 20, 0)),
|
||||
LineSegment(Vector(0, 0, 0), Vector(20, 2, 0)),
|
||||
]
|
||||
|
||||
# add constraints to the sketch
|
||||
f.Constraints = [Constraint('Vertical',0),Constraint('Horizontal',1)]
|
||||
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))
|
||||
l.append(Constraint("Coincident", 0, StartPoint, 1, StartPoint))
|
||||
f.Constraints = l
|
||||
|
||||
# again recompute
|
||||
|
||||
Reference in New Issue
Block a user