raise AttributeError()
+ def _fillAttribute(self, attribute, value):
+ """Fill ModelAPI_Attribute* with value."""
+ tools.fill_attribute(attribute, value)
+
def feature(self):
"""Return ModelAPI_Feature."""
return self._feature
- def execute(self):
- """Computes or recomputes the results"""
- return self._feature.execute()
-
def getKind(self):
"""Return the unique kind of the feature"""
return self._feature.getKind()
"""Return the result in the list of results"""
return self._feature.lastResult()
- def _fillAttribute(self, attribute, value):
- """Fill ModelAPI_Attribute* with value."""
- tools.fill_attribute(attribute, value)
-
def setRealInput(self, inputid, value):
"""I.setRealInput(str, float) -- set real value to the attribute"""
self._feature.data().real(inputid).setValue(value)
validators = ModelAPI.ModelAPI_Session.get().validators()
return validators.validate(self._feature)
- def _execute(self):
- """I._execute() -- validate and execute the feature.
+ def execute(self):
+ """I.execute() -- validate and execute the feature.
Raises RuntimeError if validation fails.
"""
constraint = self._feature.addFeature("SketchConstraintCoincidence")
constraint.data().refattr("ConstraintEntityA").setAttr(p1)
constraint.data().refattr("ConstraintEntityB").setAttr(p2)
- self._execute()
+ self.execute()
return constraint
def setParallel(self, l1, l2):
constraint = self._feature.addFeature("SketchConstraintParallel")
constraint.data().refattr("ConstraintEntityA").setObject(l1)
constraint.data().refattr("ConstraintEntityB").setObject(l2)
- self._execute()
+ self.execute()
return constraint
def setPerpendicular(self, l1, l2):
constraint = self._feature.addFeature("SketchConstraintPerpendicular")
constraint.data().refattr("ConstraintEntityA").setObject(l1)
constraint.data().refattr("ConstraintEntityB").setObject(l2)
- self._execute()
+ self.execute()
return constraint
def setHorizontal(self, line):
constraint to this Sketch."""
constraint = self._feature.addFeature("SketchConstraintHorizontal")
constraint.data().refattr("ConstraintEntityA").setObject(line)
- self._execute()
+ self.execute()
return constraint
def setVertical(self, line):
constraint to this Sketch."""
constraint = self._feature.addFeature("SketchConstraintVertical")
constraint.data().refattr("ConstraintEntityA").setObject(line)
- self._execute()
+ self.execute()
return constraint
def setDistance(self, point, line, length):
constraint.data().refattr("ConstraintEntityA").setAttr(point)
constraint.data().refattr("ConstraintEntityB").setObject(line)
constraint.data().real("ConstraintValue").setValue(length)
- self._execute()
+ self.execute()
return constraint
def setLength(self, line, length):
constraint = self._feature.addFeature("SketchConstraintLength")
constraint.data().refattr("ConstraintEntityA").setObject(line)
constraint.data().real("ConstraintValue").setValue(length)
- self._execute()
+ self.execute()
return constraint
def setRadius(self, circle, radius):
constraint = self._feature.addFeature("SketchConstraintRadius")
constraint.data().refattr("ConstraintEntityA").setObject(circle)
constraint.data().real("ConstraintValue").setValue(radius)
- self._execute()
+ self.execute()
return constraint
def setEqual(self, object_1, object_2):
constraint = self._feature.addFeature("SketchConstraintEqual")
constraint.data().refattr("ConstraintEntityA").setObject(object_1)
constraint.data().refattr("ConstraintEntityB").setObject(object_2)
- self._execute()
+ self.execute()
return constraint
def setAngle(self, line_1, line_2, angle):
constraint.data().refattr("ConstraintEntityA").setObject(line_1)
constraint.data().refattr("ConstraintEntityB").setObject(line_2)
constraint.data().real("ConstraintValue").setValue(angle)
- self._execute()
+ self.execute()
return constraint
def setTangent(self, object_1, object_2):
constraint = self._feature.addFeature("SketchConstraintTangent")
constraint.data().refattr("ConstraintEntityA").setObject(object_1)
constraint.data().refattr("ConstraintEntityB").setObject(object_2)
- self._execute()
+ self.execute()
return constraint
def setFillet(self, line_1, line_2, radius):
constraint.data().refattr("ConstraintEntityA").setObject(line_1)
constraint.data().refattr("ConstraintEntityB").setObject(line_2)
constraint.data().real("ConstraintValue").setValue(radius)
- self._execute()
+ self.execute()
return constraint
#-------------------------------------------------------------