1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_ConstraintRigid.cpp
4 // Created: 13 Oct 2014
5 // Author: Artem ZHIDKOV
7 #include "SketchPlugin_ConstraintRigid.h"
8 #include "SketchPlugin_ConstraintParallel.h"
9 #include "SketchPlugin_Feature.h"
11 #include <SketcherPrs_Factory.h>
13 #include <ModelAPI_ResultConstruction.h>
14 #include <Config_PropManager.h>
16 #include <GeomDataAPI_Point2D.h>
17 #include <GeomAlgoAPI_PointBuilder.h>
19 SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid()
23 void SketchPlugin_ConstraintRigid::initAttributes()
25 data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
28 void SketchPlugin_ConstraintRigid::execute()
32 AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious)
37 AISObjectPtr anAIS = thePrevious;
38 if (anAIS.get() == NULL) {
39 std::shared_ptr<ModelAPI_Data> aData = data();
40 std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
41 std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
42 ObjectPtr aObj = anAttr->object();
43 if (aObj.get() != NULL) {
44 FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
45 std::shared_ptr<SketchPlugin_Feature> aSkFea =
46 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
47 if (!aSkFea->isExternal())
48 anAIS = SketcherPrs_Factory::rigidConstraint(this, sketch()->coordinatePlane());