- if (myAspect.IsNull())
- return;
-
- std::shared_ptr<GeomAPI_Edge> aLine1 = SketcherPrs_Tools::getLine(myConstraint, SketchPlugin_Constraint::ENTITY_A());
- if (aLine1.get() == NULL)
- return;
-
- std::shared_ptr<GeomAPI_Edge> aLine2 = SketcherPrs_Tools::getLine(myConstraint, SketchPlugin_Constraint::ENTITY_B());
- if (aLine2.get() == NULL)
- return;
-
- std::shared_ptr<GeomAPI_Pnt> aPnt1 = aLine1->firstPoint();
- std::shared_ptr<GeomAPI_Pnt> aPnt2 = aLine1->lastPoint();
- gp_Pnt aP1((aPnt1->x() + aPnt2->x())/2.,
- (aPnt1->y() + aPnt2->y())/2.,
- (aPnt1->z() + aPnt2->z())/2.);
-
- gp_Vec aVec1(aPnt1->impl<gp_Pnt>(), aPnt2->impl<gp_Pnt>());
- gp_Vec aShift = aVec1.Crossed(myPlane->norm()->impl<gp_Dir>());
- aShift.Normalize();
- aShift.Multiply(20);
- aP1.Translate(aShift);
-
- aPnt1 = aLine2->firstPoint();
- aPnt2 = aLine2->lastPoint();
- gp_Pnt aP2((aPnt1->x() + aPnt2->x())/2.,
- (aPnt1->y() + aPnt2->y())/2.,
- (aPnt1->z() + aPnt2->z())/2.);
-
- gp_Vec aVec2(aPnt1->impl<gp_Pnt>(), aPnt2->impl<gp_Pnt>());
- aShift = aVec1.Crossed(myPlane->norm()->impl<gp_Dir>());
- aShift.Normalize();
- aShift.Multiply(20);
- aP2.Translate(aShift);
-
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
- aGroup->SetPrimitivesAspect(myAspect);
- myPntArray->SetVertice(1, aP1);
- myPntArray->SetVertice(2, aP2);
- aGroup->AddPrimitiveArray(myPntArray);