Tue, 04/26/2022 - 19:02
Forums:
Dear OCCT Community,
I have added a sphere to a vertex I have chosen in the scene and I am trying to locate a AIS_Trihedron at the origin of this sphere. The direction information is correct, but its position is far from where I set it and it is drawn. I've added the image about this issue and I am sharing my method below:
void VisualizerWidget::createTrihedronWithOriginPoint(TopoDS_Shape ais_shape, gp_Pnt origin_xyz)
{
gp_Ax2 Position;
Position.SetLocation(origin_xyz);
Handle_Geom_Axis2Placement axis = new Geom_Axis2Placement(Position);
Handle_AIS_Trihedron aisTrihedron = new AIS_Trihedron(axis);
aisTrihedron->SetDatumDisplayMode(Prs3d_DM_WireFrame);
aisTrihedron->SetDrawArrows(false);
aisTrihedron->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(2.5);
aisTrihedron->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(2.5);
aisTrihedron->Attributes()->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(2.5);
aisTrihedron->SetDatumPartColor(Prs3d_DP_XAxis, Quantity_NOC_RED2);
aisTrihedron->SetDatumPartColor(Prs3d_DP_YAxis, Quantity_NOC_GREEN2);
aisTrihedron->SetDatumPartColor(Prs3d_DP_ZAxis, Quantity_NOC_BLUE2);
aisTrihedron->SetLabel(Prs3d_DP_XAxis, "X");
aisTrihedron->SetLabel(Prs3d_DP_YAxis, "Y");
aisTrihedron->SetLabel(Prs3d_DP_ZAxis, "Z");
aisTrihedron->SetTextColor(Quantity_NOC_BLACK);
aisTrihedron->SetSize(60);
aisTrihedron->SetTransformPersistence(
new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, axis->Ax2().Location()));
aisTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost);
aisTrihedron->SetInfiniteState(true);
ais_interactive_context_->Display(aisTrihedron, true);
}
I haven't figured out where I went wrong yet. If you have any suggestions for a solution about this issue, I'm looking forward to hearing.
Thank you in advance!
Attachments: