]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Sources formated by autopep8.py
authorsbh <sergey.belash@opencascade.com>
Mon, 24 Nov 2014 11:50:06 +0000 (14:50 +0300)
committersbh <sergey.belash@opencascade.com>
Mon, 24 Nov 2014 11:50:06 +0000 (14:50 +0300)
For more info:
https://www.python.org/dev/peps/pep-0008

src/PythonFeaturesPlugin/FeaturesAPI.py
src/PythonFeaturesPlugin/PythonFeaturesPlugin.py
src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py
src/PythonFeaturesPlugin/SketchResult.py
src/PythonFeaturesPlugin/examples.py
src/PythonFeaturesPlugin/extrusion.py
src/PythonFeaturesPlugin/sketch.py

index feef52528b6a757a377c499b049fbb8cca45e2a2..f47ba3f705d9d9726a21d3d2383fa96d39049d84 100644 (file)
@@ -2,41 +2,46 @@ from ModelAPI import *
 from GeomDataAPI import *
 from GeomAlgoAPI import *
 
-# NOTE : I think this style should be chosen 
+# NOTE : I think this style should be chosen
 # for function as recommended by Python programming
 # standards
-def build_face_from_sketch (sketch, edges=None) :
-  # If no edges have been selected, get the whole sketch 
-  # edges
-  if edges == None:
-    result = sketch.firstResult()
-    edges  = modelAPI_ResultConstruction(result).shape()
-  
-  # Build the face
-  origin = geomDataAPI_Point( sketch.attribute("Origin") ).pnt()
-  dirX   = geomDataAPI_Dir( sketch.attribute("DirX") ).dir()
-  dirY   = geomDataAPI_Dir( sketch.attribute("DirY") ).dir()
-  normal = geomDataAPI_Dir( sketch.attribute("Norm") ).dir()
-  faces  = ShapeList()
-  GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, dirY, normal, edges, faces)
-  return faces[0]
+
+
+def build_face_from_sketch(sketch, edges=None):
+    # If no edges have been selected, get the whole sketch
+    # edges
+    if edges == None:
+        result = sketch.firstResult()
+        edges = modelAPI_ResultConstruction(result).shape()
+
+    # Build the face
+    origin = geomDataAPI_Point(sketch.attribute("Origin")).pnt()
+    dirX = geomDataAPI_Dir(sketch.attribute("DirX")).dir()
+    dirY = geomDataAPI_Dir(sketch.attribute("DirY")).dir()
+    normal = geomDataAPI_Dir(sketch.attribute("Norm")).dir()
+    faces = ShapeList()
+    GeomAlgoAPI_SketchBuilder.createFaces(
+        origin, dirX, dirY, normal, edges, faces)
+    return faces[0]
 
 # NOTE : with an optional argument it is not
 # a so good idea to put part as last argument
 # it would result in a mandatory argument
 # put after an optionnal one
+
+
 def addExtrusion(part, sketch, size, reverse=False, subshapes=None):
-  feature = part.addFeature("Extrusion")
-  
-  # Build apropriate face
-  face = build_face_from_sketch(sketch, subshapes)
-  # Get sketch result
-  sketchResult = sketch.firstResult()
-  
-  # Set attributes and execute the feature
-  feature.selection("extrusion_face").setValue(sketchResult, face)
-  feature.real("extrusion_size").setValue(size)
-  feature.boolean("extrusion_reverse").setValue(False)
-  feature.execute()
-  
-  return feature
+    feature = part.addFeature("Extrusion")
+
+    # Build apropriate face
+    face = build_face_from_sketch(sketch, subshapes)
+    # Get sketch result
+    sketchResult = sketch.firstResult()
+
+    # Set attributes and execute the feature
+    feature.selection("extrusion_face").setValue(sketchResult, face)
+    feature.real("extrusion_size").setValue(size)
+    feature.boolean("extrusion_reverse").setValue(False)
+    feature.execute()
+
+    return feature
index 4795eaf033032519414191338b30199cc52af178..ca671e1449df5c7d037c81d73b1bbe8d3e9d5b75 100644 (file)
@@ -1,17 +1,18 @@
 import ModelAPI
 from PythonFeaturesPlugin_Box import PythonFeaturesPlugin_Box
 
+
 class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
-  
-  def __init__(self):
-    ModelAPI.ModelAPI_Plugin.__init__(self)
-    pass
 
-  def createFeature(self, theFeatureID):
-    if theFeatureID == PythonFeaturesPlugin_Box.ID():
-      return PythonFeaturesPlugin_Box().__disown__()
-    else:
-      raise StandardError("No such feature %s"%theFeatureID)
+    def __init__(self):
+        ModelAPI.ModelAPI_Plugin.__init__(self)
+        pass
+
+    def createFeature(self, theFeatureID):
+        if theFeatureID == PythonFeaturesPlugin_Box.ID():
+            return PythonFeaturesPlugin_Box().__disown__()
+        else:
+            raise StandardError("No such feature %s" % theFeatureID)
 
 plugin = PythonFeaturesPlugin()
 aSession = ModelAPI.ModelAPI_Session.get()
index b0359dc4e9b1350bb8fd35dbded6fa76916816f0..05f6460d6f502f857a8010ae7663ef2669dbfdf3 100644 (file)
@@ -1,47 +1,53 @@
 import ModelAPI
 import examples
 
+
 class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_Feature):
-  "Feature to create a box by drawing a sketch and extruding it"
-  def __init__(self):
-    ModelAPI.ModelAPI_Feature.__init__(self)
-
-  @staticmethod
-  def ID():
-    return "Box"
-
-  @staticmethod
-  def WIDTH_ID():
-    return "box_width"
-  
-  @staticmethod
-  def LENGTH_ID():
-    return "box_length"
-  
-  @staticmethod
-  def HEIGHT_ID():
-    return "box_height"
-
-  def getKind(self):
-    return PythonFeaturesPlugin_Box.ID()
-
-  def initAttributes(self):
-    # C++ static methods (in example "type()" of the ModelAPI_AttributeDouble
-    # should be called like this: moduleName.ClassName_staticMethod()
-    self.data().addAttribute(PythonFeaturesPlugin_Box.WIDTH_ID(), ModelAPI.ModelAPI_AttributeDouble_type())
-    self.data().addAttribute(PythonFeaturesPlugin_Box.LENGTH_ID(), ModelAPI.ModelAPI_AttributeDouble_type())
-    self.data().addAttribute(PythonFeaturesPlugin_Box.HEIGHT_ID(), ModelAPI.ModelAPI_AttributeDouble_type())
-
-  def execute(self):
-    aWidth  = self.real(PythonFeaturesPlugin_Box.WIDTH_ID()).value()
-    aLength = self.real(PythonFeaturesPlugin_Box.LENGTH_ID()).value()
-    aHeight = self.real(PythonFeaturesPlugin_Box.HEIGHT_ID()).value()
-    print ("Box W:{0} L:{1} H:{2}".format(aWidth, aLength, aHeight))
-    aResultBody = self.document().createBody(self.data())
-    aResult = examples.makeBox(aLength, aWidth, aHeight)
-    #aShape = modelAPI_ResultConstruction(aResult).shape()
-    #aResultBody.store(aShape)
-    self.setResult(aResultBody)
+
+    "Feature to create a box by drawing a sketch and extruding it"
+
+    def __init__(self):
+        ModelAPI.ModelAPI_Feature.__init__(self)
+
+    @staticmethod
+    def ID():
+        return "Box"
+
+    @staticmethod
+    def WIDTH_ID():
+        return "box_width"
+
+    @staticmethod
+    def LENGTH_ID():
+        return "box_length"
+
+    @staticmethod
+    def HEIGHT_ID():
+        return "box_height"
+
+    def getKind(self):
+        return PythonFeaturesPlugin_Box.ID()
+
+    def initAttributes(self):
+        # C++ static methods (in example "type()" of the ModelAPI_AttributeDouble
+        # should be called like this: moduleName.ClassName_staticMethod()
+        self.data().addAttribute(PythonFeaturesPlugin_Box.WIDTH_ID(),
+                                 ModelAPI.ModelAPI_AttributeDouble_type())
+        self.data().addAttribute(PythonFeaturesPlugin_Box.LENGTH_ID(),
+                                 ModelAPI.ModelAPI_AttributeDouble_type())
+        self.data().addAttribute(PythonFeaturesPlugin_Box.HEIGHT_ID(),
+                                 ModelAPI.ModelAPI_AttributeDouble_type())
+
+    def execute(self):
+        aWidth = self.real(PythonFeaturesPlugin_Box.WIDTH_ID()).value()
+        aLength = self.real(PythonFeaturesPlugin_Box.LENGTH_ID()).value()
+        aHeight = self.real(PythonFeaturesPlugin_Box.HEIGHT_ID()).value()
+        print ("Box W:{0} L:{1} H:{2}".format(aWidth, aLength, aHeight))
+        aResultBody = self.document().createBody(self.data())
+        aResult = examples.makeBox(aLength, aWidth, aHeight)
+        #aShape = modelAPI_ResultConstruction(aResult).shape()
+        # aResultBody.store(aShape)
+        self.setResult(aResultBody)
 
 # TEST
 """
@@ -56,6 +62,3 @@ if __name__=='__main__':
   feature.execute()
   session.finishOperation()
 """
-  
-
-
index 364e89aa8918d7079108d6f68163424d63d88e2a..8d8b77a32b7811470e9b8abf12eed40071455a63 100644 (file)
@@ -5,24 +5,22 @@ from GeomAlgoAPI import *
 
 class SketchResult:
 
-  def __init__(self, sketch):
-    self.geom   = sketch.firstResult()
-    self.faces  = ShapeList()
-    self.edges  = modelAPI_ResultConstruction(self.geom).shape()
-    self.origin = geomDataAPI_Point( sketch.attribute("Origin") ).pnt()
-    self.dirX   = geomDataAPI_Dir( sketch.attribute("DirX") ).dir()
-    self.dirY   = geomDataAPI_Dir( sketch.attribute("DirY") ).dir()
-    self.normal = geomDataAPI_Dir( sketch.attribute("Norm") ).dir()
-
-
-  def setEdges(self, edges):
-    self.edges = edges
-
-
-  def geometry(self):
-    return self.geom
-
-
-  def face(self):
-    GeomAlgoAPI_SketchBuilder.createFaces(self.origin, self.dirX, self.dirY, self.normal, self.edges, self.faces)
-    return self.faces[0]
\ No newline at end of file
+    def __init__(self, sketch):
+        self.geom = sketch.firstResult()
+        self.faces = ShapeList()
+        self.edges = modelAPI_ResultConstruction(self.geom).shape()
+        self.origin = geomDataAPI_Point(sketch.attribute("Origin")).pnt()
+        self.dirX = geomDataAPI_Dir(sketch.attribute("DirX")).dir()
+        self.dirY = geomDataAPI_Dir(sketch.attribute("DirY")).dir()
+        self.normal = geomDataAPI_Dir(sketch.attribute("Norm")).dir()
+
+    def setEdges(self, edges):
+        self.edges = edges
+
+    def geometry(self):
+        return self.geom
+
+    def face(self):
+        GeomAlgoAPI_SketchBuilder.createFaces(
+            self.origin, self.dirX, self.dirY, self.normal, self.edges, self.faces)
+        return self.faces[0]
index d2279de34b4c09f4f5a879176adb44e8b5fbcf4e..3da0d6f57bf5375974eaed14ffbb5504b247b4be 100644 (file)
@@ -2,46 +2,44 @@ from ModelAPI import *
 from SketchResult import *
 import sketch
 import extrusion
-#reload(sketch) # Pour tester plus facilement
-#reload(extrusion) # Pour tester plus facilement
+# reload(sketch) # Pour tester plus facilement
+# reload(extrusion) # Pour tester plus facilement
 
-def makeBox(aLength, aWidth, aHeight):
-  # Getting the active document
-  session = ModelAPI_Session.get()
-  part = session.activeDocument()
-
-  # Starting the Sketch
-  base = sketch.addTo(part)
-  sketch.setXOYPlane(base)
-
-  # Creating the lines
-  l1 = sketch.addLine(10, 10, 10, 50, base)
-  l2 = sketch.addLine(10, 50, 60, 60, base)
-  l3 = sketch.addLine(60, 60, 50, 10, base)
-  l4 = sketch.addLine(50, 10, 10, 10, base)
-  base.execute()
-
-
-  # Creating the constraints
-  # NOTE : the following lines are currently not working in BR_PYTHON_PLUGIN branch
-  """
-  sketch.makeCoincident(sketch.getEndPoint(l1), sketch.getStartPoint(l2), base)
-  sketch.makeCoincident(sketch.getEndPoint(l2), sketch.getStartPoint(l3), base)
-  sketch.makeCoincident(sketch.getEndPoint(l3), sketch.getStartPoint(l4), base)
-  sketch.makeCoincident(sketch.getEndPoint(l4), sketch.getStartPoint(l1), base)
 
-  sketch.makeParallel(sketch.getGeometry(l1), sketch.getGeometry(l3))
-  sketch.makeParallel(sketch.getGeometry(l2), sketch.getGeometry(l4))
-
-  sketch.makePerpendicular(sketch.getGeometry(l1), sketch.getGeometry(l4))
-  """
-
-  # Finalisation of the operation
-  builder = SketchResult(base)
-
-  # Creating a feature Extrusion
-  box = extrusion.addNew(builder, 50, part)
-
-  #return base.lastResult()
-  return extrusion.getBody(box)
-  
+def makeBox(aLength, aWidth, aHeight):
+    # Getting the active document
+    session = ModelAPI_Session.get()
+    part = session.activeDocument()
+
+    # Starting the Sketch
+    base = sketch.addTo(part)
+    sketch.setXOYPlane(base)
+
+    # Creating the lines
+    l1 = sketch.addLine(10, 10, 10, 50, base)
+    l2 = sketch.addLine(10, 50, 60, 60, base)
+    l3 = sketch.addLine(60, 60, 50, 10, base)
+    l4 = sketch.addLine(50, 10, 10, 10, base)
+    base.execute()
+
+    # Creating the constraints
+    # NOTE : the following lines are currently not working in BR_PYTHON_PLUGIN
+    # branch
+    # sketch.makeCoincident(sketch.getEndPoint(l1), sketch.getStartPoint(l2), base)
+    # sketch.makeCoincident(sketch.getEndPoint(l2), sketch.getStartPoint(l3), base)
+    # sketch.makeCoincident(sketch.getEndPoint(l3), sketch.getStartPoint(l4), base)
+    # sketch.makeCoincident(sketch.getEndPoint(l4), sketch.getStartPoint(l1), base)
+    #
+    # sketch.makeParallel(sketch.getGeometry(l1), sketch.getGeometry(l3))
+    # sketch.makeParallel(sketch.getGeometry(l2), sketch.getGeometry(l4))
+    #
+    # sketch.makePerpendicular(sketch.getGeometry(l1), sketch.getGeometry(l4))
+
+    # Finalisation of the operation
+    builder = SketchResult(base)
+
+    # Creating a feature Extrusion
+    box = extrusion.addNew(builder, 50, part)
+
+    # return base.lastResult()
+    return extrusion.getBody(box)
index ccd103a81e2473c25302df6f2caea2fd27cf0051..2ce035dca33ad01dd7a6c562f93565ec1ffe862e 100644 (file)
@@ -2,13 +2,14 @@ from ModelAPI import *
 
 
 def addNew(builder, length, part, edges=None, reverse=False):
-  feature = part.addFeature("Extrusion")
-  feature.selection("extrusion_face").setValue(builder.geometry(), builder.face())
-  feature.real("extrusion_size").setValue(length)
-  feature.boolean("extrusion_reverse").setValue(reverse)
-  feature.execute()
-  return feature
+    feature = part.addFeature("Extrusion")
+    feature.selection("extrusion_face").setValue(builder.geometry(),
+                                                 builder.face())
+    feature.real("extrusion_size").setValue(length)
+    feature.boolean("extrusion_reverse").setValue(reverse)
+    feature.execute()
+    return feature
 
 
 def getBody(extrusion):
-  return extrusion.firstResult()
\ No newline at end of file
+    return extrusion.firstResult()
index 6d002d3070afb7c8d52f4de95a41a6b805803d8a..f60fbc16e98c8b503a144f7a87b8e7b47a55a80b 100644 (file)
-from ModelAPI     import *
-from GeomDataAPI  import *
+from ModelAPI import *
+from GeomDataAPI import *
 
 
 # Initialization of the Sketch
 # ----------------------------
 
 def addTo(doc):
-  return modelAPI_CompositeFeature( doc.addFeature("Sketch") )
+    return modelAPI_CompositeFeature(doc.addFeature("Sketch"))
 
 
 def setXOYPlane(sketch):
-  geomDataAPI_Point( sketch.attribute("Origin") ).setValue(0, 0, 0)
-  geomDataAPI_Dir( sketch.attribute("DirX") ).setValue(1, 0, 0)
-  geomDataAPI_Dir( sketch.attribute("DirY") ).setValue(0, 1, 0)
-  geomDataAPI_Dir( sketch.attribute("Norm") ).setValue(0, 0, 1)
+    geomDataAPI_Point(sketch.attribute("Origin")).setValue(0, 0, 0)
+    geomDataAPI_Dir(sketch.attribute("DirX")).setValue(1, 0, 0)
+    geomDataAPI_Dir(sketch.attribute("DirY")).setValue(0, 1, 0)
+    geomDataAPI_Dir(sketch.attribute("Norm")).setValue(0, 0, 1)
 
 
 # Point geometry
 # --------------
 
 def addPoint(x, y, sketch):
-  point = sketch.addFeature("SketchPoint")
-  geomDataAPI_Point2D( point.attribute("PointCoordindates") ).setValue(x, y)
-  point.execute()     #Required to get the result, if needed for creating constraints
-  return point
+    point = sketch.addFeature("SketchPoint")
+    geomDataAPI_Point2D(point.attribute("PointCoordindates")).setValue(x, y)
+    # Required to get the result, if needed for creating constraints
+    point.execute()
+    return point
 
 
 def getGeometry(point):
-  return geomDataAPI_Point2D( point.attribute("PointCoordindates") )
+    return geomDataAPI_Point2D(point.attribute("PointCoordindates"))
 
 
 # Line geometry
 # -------------
 
 def addClosedBrokenLine(coords, sketch):
-  c0 = coords[0]
-  c1 = coords[1]
-  bl = []
-  l1 = sketch.addFeature("SketchLine")
-  geomDataAPI_Point2D( l1.attribute("StartPoint") ).setValue(c0.x(), c0.y())
-  geomDataAPI_Point2D( l1.attribute("EndPoint") ).setValue(c1.x(), c1.y())
-  l1.execute()
-  bl.append(l1)
-  l0 = l1
-
-  for c2 in coords[2:]:
-    l2 = sketch.addFeature("SketchLine")
-    geomDataAPI_Point2D( l2.attribute("StartPoint") ).setValue(c1.x(), c1.y())
-    geomDataAPI_Point2D( l2.attribute("EndPoint") ).setValue(c2.x(), c2.y())
-    l2.execute()
-    bl.append(l2)
-    constraint = sketch.addFeature("SketchConstraintCoincidence")
-    constraint.refattr("ConstraintEntityA").setAttr( l1.attribute("EndPoint") )
-    constraint.refattr("ConstraintEntityB").setAttr( l2.attribute("StartPoint") )
-    c1 = c2
-    l1 = l2
-
-  if len(coords) > 2:
-    l2 = sketch.addFeature("SketchLine")
-    geomDataAPI_Point2D( l2.attribute("StartPoint") ).setValue(c1.x(), c1.y())
-    geomDataAPI_Point2D( l2.attribute("EndPoint") ).setValue(c0.x(), c0.y())
-    l2.execute()
-    bl.append(l2)
-    constraint = sketch.addFeature("SketchConstraintCoincidence")
-    constraint.refattr("ConstraintEntityA").setAttr( l1.attribute("EndPoint") )
-    constraint.refattr("ConstraintEntityB").setAttr( l2.attribute("StartPoint") )
-
-    constraint = sketch.addFeature("SketchConstraintCoincidence")
-    constraint.refattr("ConstraintEntityA").setAttr( l2.attribute("EndPoint") )
-    constraint.refattr("ConstraintEntityB").setAttr( l0.attribute("StartPoint") )
-
-  return bl
+    c0 = coords[0]
+    c1 = coords[1]
+    bl = []
+    l1 = sketch.addFeature("SketchLine")
+    geomDataAPI_Point2D(l1.attribute("StartPoint")).setValue(c0.x(), c0.y())
+    geomDataAPI_Point2D(l1.attribute("EndPoint")).setValue(c1.x(), c1.y())
+    l1.execute()
+    bl.append(l1)
+    l0 = l1
+
+    for c2 in coords[2:]:
+        l2 = sketch.addFeature("SketchLine")
+        geomDataAPI_Point2D(
+            l2.attribute("StartPoint")).setValue(c1.x(), c1.y())
+        geomDataAPI_Point2D(l2.attribute("EndPoint")).setValue(c2.x(), c2.y())
+        l2.execute()
+        bl.append(l2)
+        constraint = sketch.addFeature("SketchConstraintCoincidence")
+        constraint.refattr("ConstraintEntityA").setAttr(
+            l1.attribute("EndPoint"))
+        constraint.refattr("ConstraintEntityB").setAttr(
+            l2.attribute("StartPoint"))
+        c1 = c2
+        l1 = l2
+
+    if len(coords) > 2:
+        l2 = sketch.addFeature("SketchLine")
+        geomDataAPI_Point2D(
+            l2.attribute("StartPoint")).setValue(c1.x(), c1.y())
+        geomDataAPI_Point2D(l2.attribute("EndPoint")).setValue(c0.x(), c0.y())
+        l2.execute()
+        bl.append(l2)
+        constraint = sketch.addFeature("SketchConstraintCoincidence")
+        constraint.refattr("ConstraintEntityA").setAttr(
+            l1.attribute("EndPoint"))
+        constraint.refattr("ConstraintEntityB").setAttr(
+            l2.attribute("StartPoint"))
+
+        constraint = sketch.addFeature("SketchConstraintCoincidence")
+        constraint.refattr("ConstraintEntityA").setAttr(
+            l2.attribute("EndPoint"))
+        constraint.refattr("ConstraintEntityB").setAttr(
+            l0.attribute("StartPoint"))
+
+    return bl
 
 
 def addLine(x1, y1, x2, y2, sketch):
-  line = sketch.addFeature("SketchLine")
-  geomDataAPI_Point2D( line.attribute("StartPoint") ).setValue(x1, y1)
-  geomDataAPI_Point2D( line.attribute("EndPoint") ).setValue(x2, y2)
-  line.execute()      #Required to get the result, if needed for creating constraints
-  return line
+    line = sketch.addFeature("SketchLine")
+    geomDataAPI_Point2D(line.attribute("StartPoint")).setValue(x1, y1)
+    geomDataAPI_Point2D(line.attribute("EndPoint")).setValue(x2, y2)
+    # Required to get the result, if needed for creating constraints
+    line.execute()
+    return line
 
 
 def getGeometry(line):
-  return modelAPI_ResultConstruction(line.firstResult())
+    return modelAPI_ResultConstruction(line.firstResult())
 
 
 def getStartPoint(line):
-  return geomDataAPI_Point2D( line.attribute("StartPoint") )
+    return geomDataAPI_Point2D(line.attribute("StartPoint"))
 
 
 def getEndPoint(line):
-  return geomDataAPI_Point2D( line.attribute("EndPoint") )
+    return geomDataAPI_Point2D(line.attribute("EndPoint"))
 
 
 # Constraints
 # -----------
 
 def makeCoincident(p1, p2, sketch):
-  constraint = sketch.addFeature("SketchConstraintCoincidence")
-  constraint.refattr("ConstraintEntityA").setAttr(p1)
-  constraint.refattr("ConstraintEntityB").setAttr(p2)
+    constraint = sketch.addFeature("SketchConstraintCoincidence")
+    constraint.refattr("ConstraintEntityA").setAttr(p1)
+    constraint.refattr("ConstraintEntityB").setAttr(p2)
 
 
 def makeParallel(l1, l2, sketch):
-  constraint = sketch.addFeature("SketchConstraintParallel")
-  constraint.refattr("ConstraintEntityA").setObject(l1)
-  constraint.refattr("ConstraintEntityB").setObject(l2)
+    constraint = sketch.addFeature("SketchConstraintParallel")
+    constraint.refattr("ConstraintEntityA").setObject(l1)
+    constraint.refattr("ConstraintEntityB").setObject(l2)
 
 
 def makePerpendicular(l1, l2, sketch):
-  constraint  = sketch.addFeature("SketchConstraintPerpendicular")
-  constraint.refattr("ConstraintEntityA").setObject(l1)
-  constraint.refattr("ConstraintEntityB").setObject(l2)
+    constraint = sketch.addFeature("SketchConstraintPerpendicular")
+    constraint.refattr("ConstraintEntityA").setObject(l1)
+    constraint.refattr("ConstraintEntityB").setObject(l2)
+
 
 def makeConstantLength(line, length, sketch):
-  constraint = sketch.addFeature("SketchConstraintLength")
-  constraint.refattr("ConstraintEntityA").setObject(line)
-  constraint.real("ConstraintValue").setValue(length)
+    constraint = sketch.addFeature("SketchConstraintLength")
+    constraint.refattr("ConstraintEntityA").setObject(line)
+    constraint.real("ConstraintValue").setValue(length)