AIS_Trihedron SetTransformPersistence Problem

The trihedrom is located wrong place.

 

Handle(AIS_Trihedron) MyCreateTrihedron(gp_Ax2 thePos)
{
	Handle(Geom_Axis2Placement) axis = new Geom_Axis2Placement(thePos);
	Handle(AIS_Trihedron) anAisTrihedron = new AIS_Trihedron(axis);

	Handle(Graphic3d_TransformPers) trsf = new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, thePos.Location());
	anAisTrihedron->SetTransformPersistence(trsf);
	anAisTrihedron->SetInfiniteState(true);

	return anAisTrihedron;
}

 

Kadir Canik's picture

Dear Kadir,

Create the trihedron at origin always. Use the axis locattion only for anchor point.

Handle(AIS_Trihedron) MyCreateTrihedron(gp_Ax2 theAxis, double theSize)
{
	gp_Pnt anOrg = theAxis.Location();
	Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(theAxis);
	anAxis->SetLocation(gp::Origin());
	Handle(AIS_Trihedron) anAisTrihedron = new AIS_Trihedron(anAxis);

	anAisTrihedron->SetDatumDisplayMode(Prs3d_DM_WireFrame);
	anAisTrihedron->SetDatumPartColor(Prs3d_DP_XArrow, Quantity_NOC_RED2);
	anAisTrihedron->SetDatumPartColor(Prs3d_DP_YArrow, Quantity_NOC_GREEN2);
	anAisTrihedron->SetDatumPartColor(Prs3d_DP_ZArrow, Quantity_NOC_BLUE2);
	anAisTrihedron->SetDatumPartColor(Prs3d_DP_XAxis, Quantity_NOC_RED2);
	anAisTrihedron->SetDatumPartColor(Prs3d_DP_YAxis, Quantity_NOC_GREEN2);
	anAisTrihedron->SetDatumPartColor(Prs3d_DP_ZAxis, Quantity_NOC_BLUE2);
	anAisTrihedron->SetSize(theSize);

	Handle(Graphic3d_TransformPers) trsf = new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, anOrg);
	anAisTrihedron->SetTransformPersistence(trsf);
	anAisTrihedron->SetInfiniteState(true);

	return anAisTrihedron;
}
Batuhan Cengiz's picture

you are the best!