- return anAIS;
-
- boost::shared_ptr<GeomAPI_Shape> aLine1 = aLine1Feature->preview();
- boost::shared_ptr<GeomAPI_Shape> aLine2 = aLine2Feature->preview();
- Handle(Geom_Plane) aPlane = new Geom_Plane(sketch()->plane()->impl<gp_Pln>());
-
- boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
- boost::shared_ptr<GeomAPI_Pnt2d> aFOPnt2d = aFlyoutAttr->pnt();
- boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = sketch()->to3D(aFOPnt2d->x(), aFOPnt2d->y());
-
- if (anAIS.IsNull())
- {
- Handle(AIS_PerpendicularRelation) aPerpendicular =
- new AIS_PerpendicularRelation(aLine1->impl<TopoDS_Shape>(), aLine2->impl<TopoDS_Shape>(), aPlane);
- aPerpendicular->SetPosition(aFlyoutPnt->impl<gp_Pnt>());
- anAIS = aPerpendicular;
- }
- else
- {
- Handle(AIS_PerpendicularRelation) aPerpendicular = Handle(AIS_PerpendicularRelation)::DownCast(anAIS);
- if (!aPerpendicular.IsNull())
- {
- aPerpendicular->SetFirstShape(aLine1->impl<TopoDS_Shape>());
- aPerpendicular->SetSecondShape(aLine2->impl<TopoDS_Shape>());
- aPerpendicular->SetPlane(aPlane);
- aPerpendicular->SetPosition(aFlyoutPnt->impl<gp_Pnt>());
- aPerpendicular->Redisplay(Standard_True);
- }
- }
+ return thePrevious;
+
+ std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
+ std::shared_ptr<GeomAPI_Shape> aLine1, aLine2;
+ std::shared_ptr<ModelAPI_ResultConstruction> aConst1 = std::dynamic_pointer_cast<
+ ModelAPI_ResultConstruction>(anAttr1->object());
+ if (aConst1)
+ aLine1 = aConst1->shape();
+ std::shared_ptr<ModelAPI_ResultConstruction> aConst2 = std::dynamic_pointer_cast<
+ ModelAPI_ResultConstruction>(anAttr2->object());
+ if (aConst2)
+ aLine2 = aConst2->shape();
+
+ AISObjectPtr anAIS = thePrevious;
+ if (!anAIS)
+ anAIS = AISObjectPtr(new GeomAPI_AISObject);
+ anAIS->createPerpendicular(aLine1, aLine2, aPlane);
+
+ // Set color from preferences
+ std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_parallel_color",
+ SKETCH_CONSTRAINT_COLOR);
+ anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);