Archived issue #0032043
How to set a shape to disable zoom?
Description
My code like below:
TopoDS_Shape box = BRepPrimAPI_MakeBox(gp_Pnt(300,0,0),gp_Pnt(400,100,100));
Handle(AIS_Shape) ais = new AIS_Shape(box);
Handle(Graphic3d_TransformPers) theTrsfPers = new Graphic3d_TransformPers(Graphic3d_TransModeFlags::Graphic3d_TMF_ZoomPers,gp_Pnt(300,0,0));
mycontext->Display(ais,true);
I want to disable zoom the box at point(300,0,0);The result is not what I want.
This is a mistake?Or how can I do to solve this problem?
TopoDS_Shape box = BRepPrimAPI_MakeBox(gp_Pnt(300,0,0),gp_Pnt(400,100,100));
Handle(AIS_Shape) ais = new AIS_Shape(box);
Handle(Graphic3d_TransformPers) theTrsfPers = new Graphic3d_TransformPers(Graphic3d_TransModeFlags::Graphic3d_TMF_ZoomPers,gp_Pnt(300,0,0));
mycontext->Display(ais,true);
I want to disable zoom the box at point(300,0,0);The result is not what I want.
This is a mistake?Or how can I do to solve this problem?
Public activity
7 archived notes
Participants are labeled by their role within this record.
What do you mean result is not what do you expect?
If you expect box being non-zoomable from it's center, you would want to defining it's coordinate system appropriately (e.g. the box itself should be defined relative to 0,0,0, not anchor point 300,0,0 - the latter should be passed to transformation persistence parameters).
If you expect box being non-zoomable from it's center, you would want to defining it's coordinate system appropriately (e.g. the box itself should be defined relative to 0,0,0, not anchor point 300,0,0 - the latter should be passed to transformation persistence parameters).
pload MODELING VISUALIZATION vinit View1 box b -200 -50 -50 400 100 100 vdisplay -dispMode 0 b -trsfPers zoom -trsfPersPos 300 0 0 vtrihedron t -origin 300 0 0
I do not understand.
My box is MakeBox(gp_Pnt(300,0,0),gp_Pnt(400,100,100))
Do you mean I should set the anchor point at the box's center point(50,50,50)?
pload MODELING VISUALIZATION
vinit View1
box b 300 0 0 400 100 100
vdisplay -dispMode 0 b -trsfPers zoom -trsfPersPos 50 50 50
vtrihedron t -origin 50 0 0
The result is not non-zoomable at point(50,50,50).
How can i do?
My box is MakeBox(gp_Pnt(300,0,0),gp_Pnt(400,100,100))
Do you mean I should set the anchor point at the box's center point(50,50,50)?
pload MODELING VISUALIZATION
vinit View1
box b 300 0 0 400 100 100
vdisplay -dispMode 0 b -trsfPers zoom -trsfPersPos 50 50 50
vtrihedron t -origin 50 0 0
The result is not non-zoomable at point(50,50,50).
How can i do?
> My box is MakeBox(gp_Pnt(300,0,0),gp_Pnt(400,100,100))
You are creating a box from 2 points, so that it is of size 100x100x100 and with center (350,50,50) within coordinate system having origin in (0,0,0). Then you are telling it to be non-zoomable at some point; start with anchor point (0,0,0) to see how it works - you will see that anchor point defines the new location of box's coordinate system, not box's center. To make it visible you can display a TopoDS_Compound containing your box and TopoDS_Vertex created from (0,0,0) point.
If you would like box to be non-zoomable from it's center, then you should define the box in the way so that it's center will be (0,0,0) point - like MakeBox(gp_Pnt(-50,-50,-50),gp_Pnt(50,50,50)).
You are creating a box from 2 points, so that it is of size 100x100x100 and with center (350,50,50) within coordinate system having origin in (0,0,0). Then you are telling it to be non-zoomable at some point; start with anchor point (0,0,0) to see how it works - you will see that anchor point defines the new location of box's coordinate system, not box's center. To make it visible you can display a TopoDS_Compound containing your box and TopoDS_Vertex created from (0,0,0) point.
pload MODELING VISUALIZATION box b -min 300 0 0 -max 400 100 100 vertex v 0 0 0 compound b v c vdisplay -dispMode 0 c -trsfPers zoom -trsfPersPos 300 0 0 vtrihedron t -origin 300 0 0
If you would like box to be non-zoomable from it's center, then you should define the box in the way so that it's center will be (0,0,0) point - like MakeBox(gp_Pnt(-50,-50,-50),gp_Pnt(50,50,50)).
pload MODELING VISUALIZATION box b -min -50 -50 -50 -max 50 50 50 vertex v 0 0 0 compound b v c vdisplay -dispMode 0 c -trsfPers zoom -trsfPersPos 300 0 0 vtrihedron t -origin 300 0 0
I test and see the result.
The method is not what I want;
If I want to disable zoon a box at its center,and the center of box is not point(0,0,0).How can I do to realize needs?
The method is not what I want;
If I want to disable zoon a box at its center,and the center of box is not point(0,0,0).How can I do to realize needs?
> If I want to disable zoon a box at its center,and the center of box is not point(0,0,0). How can I do to realize needs?
You need either redefine the box or modify it's coordinate system (AIS_InteractiveObject::SetLocalTransformation()/AIS_InteractiveContext::SetLocation() or apply TopLoc_Location to TopoDS_Shape).
You need either redefine the box or modify it's coordinate system (AIS_InteractiveObject::SetLocalTransformation()/AIS_InteractiveContext::SetLocation() or apply TopLoc_Location to TopoDS_Shape).
pload MODELING VISUALIZATION box b -min 300 0 0 -max 400 100 100 vertex v 0 0 0 compound b v c vdisplay -dispMode 0 c -trsfPers zoom -trsfPersPos 300 0 0 vlocation c -location -350 -50 -50 vtrihedron t -origin 300 0 0
Thank you!I got it!
Dear Commenter 1,
please close this issue.
please close this issue.