TestSketcherSetPerpendicular.py
TestSketcherSetHorizontal.py
TestSketcherSetVertical.py
- TestSketcherSetRigid.py
+ TestSketcherSetFixed.py
TestSketcherSetLength.py
TestSketcherSetRadius.py
#TestSketcherSetAngle.py
--- /dev/null
+import unittest
+import model
+from TestSketcher import SketcherTestCase
+
+class SketcherSetFixed(SketcherTestCase):
+ def runTest(self):
+ circle = self.sketch.addCircle(0, 10, 20)
+ self.sketch.setFixed(circle)
+ model.do()
+ circle.setCenter(0, 0)
+ model.do()
+ self.assertEqual((circle.center().x(), circle.center().y()), (0, 10))
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
+++ /dev/null
-import unittest
-import model
-from TestSketcher import SketcherTestCase
-
-class SketcherSetRigid(SketcherTestCase):
- def runTest(self):
- circle = self.sketch.addCircle(0, 10, 20)
- self.sketch.setRigid(circle)
- model.do()
- circle.setCenter(0, 0)
- model.do()
- self.assertEqual((circle.center().x(), circle.center().y()), (0, 10))
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
left, top, right, bottom = model.addPolygon(sketch, *geom_points)
# Set constraints
- sketch.setRigid(left.startPoint())
+ sketch.setFixed(left.startPoint())
sketch.setHorizontal(bottom)
sketch.setHorizontal(top)
{
std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
LinePtr aLine(new SketchAPI_Line(aFeature, theExternal));
- setRigid(InterfacePtr(aLine));
+ setFixed(InterfacePtr(aLine));
return aLine;
}
std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
{
std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
LinePtr aLine(new SketchAPI_Line(aFeature, theExternalName));
- setRigid(InterfacePtr(aLine));
+ setFixed(InterfacePtr(aLine));
return aLine;
}
return aFeature;
}
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setFixed(
+ const ModelHighAPI_RefAttr & theObject)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
+ fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ aFeature->execute();
+ return aFeature;
+}
+
std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setHorizontal(
const ModelHighAPI_RefAttr & theLine)
{
return aFeature;
}
-std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRigid(
- const ModelHighAPI_RefAttr & theObject)
-{
- // TODO(spo): should it be renamed to Fixed?
- std::shared_ptr<ModelAPI_Feature> aFeature =
- compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
- fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
- aFeature->execute();
- return aFeature;
-}
-
std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setTangent(
const ModelHighAPI_RefAttr & theLine,
const ModelHighAPI_RefAttr & theCircle)
const std::list<ModelHighAPI_RefAttr> & thePoints,
const ModelHighAPI_Double & theRadius);
+ /// Set fixed
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setFixed(
+ const ModelHighAPI_RefAttr & theObject);
+
/// Set horizontal
SKETCHAPI_EXPORT
std::shared_ptr<ModelAPI_Feature> setHorizontal(
const ModelHighAPI_RefAttr & theCircleOrArc,
const ModelHighAPI_Double & theValue);
- /// Set rigid
- SKETCHAPI_EXPORT
- std::shared_ptr<ModelAPI_Feature> setRigid(
- const ModelHighAPI_RefAttr & theObject);
-
/// Set tangent
SKETCHAPI_EXPORT
std::shared_ptr<ModelAPI_Feature> setTangent(
std::shared_ptr<ModelAPI_Feature> setVertical(
const ModelHighAPI_RefAttr & theLine);
- // TODO(spo): addRectagle, projection
-
/// Set constraint value
SKETCHAPI_EXPORT
void setValue(
const std::shared_ptr<ModelAPI_Feature> & theConstraint,
const ModelHighAPI_Double & theValue);
- // TODO(spo): setText. Is it necessary as setValue accepts text expressions?
-
// TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
/// Select face
SKETCHAPI_EXPORT