View Issue Details

IDProjectCategoryView StatusLast Update
0032043CommunityOCCT:Visualizationpublic2021-02-15 13:43
Reporterxuweibin Assigned Tobugmaster  
PrioritynormalSeverityjust a question 
Status closedResolutionno change required 
PlatformWindowsOSVC++ 2013 
Product Version7.5.0 
Target Version7.6.0 
Summary0032043: How to set a shape to disable zoom?
DescriptionMy 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?
TagsNo tags attached.
Test case number

Activities

kgv

2021-01-08 13:05

developer   ~0098015

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

xuweibin

2021-01-11 06:05

reporter   ~0098041

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?

kgv

2021-01-11 08:27

developer   ~0098042

> 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.
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

xuweibin

2021-01-11 09:16

reporter   ~0098043

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?

kgv

2021-01-11 09:55

developer   ~0098045

Last edited: 2021-01-11 09:55

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

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


xuweibin

2021-01-11 11:32

reporter   ~0098046

Thank you!I got it!

kgv

2021-01-11 11:35

developer   ~0098047

Dear bugmaster,

please close this issue.

Issue History

Date Modified Username Field Change
2021-01-08 05:32 xuweibin New Issue
2021-01-08 05:32 xuweibin Assigned To => kgv
2021-01-08 13:05 kgv Note Added: 0098015
2021-01-08 13:05 kgv Assigned To kgv => xuweibin
2021-01-08 13:05 kgv Severity minor => just a question
2021-01-08 13:05 kgv Status new => feedback
2021-01-08 13:05 kgv Resolution open => no change required
2021-01-08 13:05 kgv Target Version => 7.6.0
2021-01-11 06:05 xuweibin Note Added: 0098041
2021-01-11 08:27 kgv Note Added: 0098042
2021-01-11 09:16 xuweibin Note Added: 0098043
2021-01-11 09:55 kgv Note Added: 0098045
2021-01-11 09:55 kgv Note Edited: 0098045
2021-01-11 11:32 xuweibin Note Added: 0098046
2021-01-11 11:35 kgv Note Added: 0098047
2021-01-11 11:35 kgv Assigned To xuweibin => bugmaster
2021-02-15 13:43 bugmaster Status feedback => closed