Not zoomable AIS_Trihedron object

Hello everyone,

I want a trihedron which should not be zoomed in or out, I mean, trihedron should be same size when zoom in or out. Actually I managed that with "SetTransformPersistence" but doesn't work exactly as I want. For example I give a point as (300,0,0) and will create a trihedron on this point. Without setting transform persistence, everthing is okay and trihedron is really on this point. But when I set the transform persistence, trihedron size will be fixed but when I zoom in or out, trihedron looks totally on different point. I attached a photo for example. Thanks in advance and can't wait to see your replies.

My code:

auto originTrihedron = gp_Pnt(originX, originY, originZ);
gp_Ax2 position;

position.Rotate(gp_Ax1(originTrihedron, gp_Dir(1, 0, 0)), originA * M_PI / 180);
position.Rotate(gp_Ax1(originTrihedron, gp_Dir(0, 1, 0)), originB * M_PI / 180);
position.Rotate(gp_Ax1(originTrihedron, gp_Dir(0, 0, 1)), originC * M_PI / 180);

Handle_Geom_Axis2Placement axis = new Geom_Axis2Placement(position);
Handle(AIS_Trihedron) ais_trihedron_shape = new AIS_Trihedron(axis);

ais_trihedron_shape->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, originTrihedron));
ais_trihedron_shape->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers));

both version doesn't work

Batuhan Cengiz's picture

Dear Batuhan,

solution is like code below;

Handle(AIS_Trihedron) MyCreateTrihedron(gp_Ax2 theAxis, double theSize)
	gp_Pnt anOrg = theAxis.Location();
	Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(theAxis);
	Handle(AIS_Trihedron) anAisTrihedron = new AIS_Trihedron(anAxis);

	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);

	Handle(Graphic3d_TransformPers) trsf = new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, anOrg);

	return anAisTrihedron;