Sketcher: /Mod/Sketcher python code black formatted

This commit is contained in:
Abdullah Tahiri
2023-05-25 15:18:51 +02:00
committed by abdullahtahiriyo
parent 96acbaf252
commit 233a337ca5
6 changed files with 116 additions and 95 deletions

View File

@@ -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