1 // File: SketchPlugin_ConstraintRigid.cpp
2 // Created: 13 Oct 2014
3 // Author: Artem ZHIDKOV
5 #include "SketchPlugin_ConstraintRigid.h"
7 #include <ModelAPI_ResultConstruction.h>
9 SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid()
13 void SketchPlugin_ConstraintRigid::initAttributes()
15 data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
18 void SketchPlugin_ConstraintRigid::execute()
22 AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious)
27 boost::shared_ptr<ModelAPI_Data> aData = data();
28 boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
29 ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
30 if (!anAttr || !anAttr->isObject())
33 boost::shared_ptr<ModelAPI_ResultConstruction> aConst =
34 boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr->object());
38 boost::shared_ptr<GeomAPI_Shape> aShape;
39 aShape = aConst->shape();
41 AISObjectPtr anAIS = thePrevious;
43 anAIS = AISObjectPtr(new GeomAPI_AISObject);
45 boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
46 anAIS->createFixed(aShape, aPlane);
48 // Set color from preferences
49 //std::vector<int> aRGB = Config_PropManager::color("Visualization", "perpendicular_color",
50 // PERPENDICULAR_COLOR);
51 //anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);