is there a way to get back the shape that Graphic3D_Structure is referring to?

eue

Active CAD practitioner
so Prs3d_Presentation is presenting my shape on view, I want to alter the graphic.
The way I took is by altering the shape by its dimensions with builder API. To do so I need the shape back from Prs3d_Presentation. How could I do so? Or is there a way to change Graphic3D_Structure directly, not simple gp_Trsf but gp_GTrsf.
 

natalia

Moderator
Staff member
Hi @eue,

Prs3d, Graphic3D levels knows nothing about shape, shape is one of possible ways to fill this gemetrical structures. As the simpliest way, you should update them providing Compute() called of AIS_Shape(if you use this interactive object).
Change shape in the AIS_Shape and cal Redisplay Redisplay of AIS_InteractiveContext for this object.

Regards, Natalia
 

eue

Active CAD practitioner
Hi @eue,

Prs3d, Graphic3D levels knows nothing about shape, shape is one of possible ways to fill this gemetrical structures. As the simpliest way, you should update them providing Compute() called of AIS_Shape(if you use this interactive object).
Change shape in the AIS_Shape and cal Redisplay Redisplay of AIS_InteractiveContext for this object.

Regards, Natalia
Thank you so much for the reply, so what I really want is like any CAD software where I could construct a prime shape dynamically every step of the way by using my mouse.
What I did right now, as you suggested, is Compute() on every change step with mouse move, however it is not efficient because it lags graphically due to inefficiency of calling StdPrs_ShadedShape's Add function. I would like a quicker way to alter the graphics of the shape in view.
 

natalia

Moderator
Staff member
Yes, I see.
When you just move a presentation, the change of local transformation helps to have appropriate performance due to not recompute presentations.

But when you drammatically change geometry, you'll need to fill these structures again.
Here, you may try to prepare these structures inside Compute by yourself, without using StdPrs.. Better here to analise which function takes most time/memory on your data. May be on the first step try to switch off drawing edges on the shape(if you draw it) in time of mouse move processing?

Good luck in investigations)
 

natalia

Moderator
Staff member
Hello @eue

Some additional ways to investigate, if you need.

1. Visualization depends on mesh prepared on your shape. This mesh is computed using BRepMesh_IncrementalMesh and depends on deflection paramerers provided. So, to improve performance, you may try to change these parameters. The suggestion is using more rude deflection values during the model move by the mouse.
If your algorithms does not prepare this mesh and you don't call this class, StdPrs will do this by itself with some default deflection parameters.
You may try to check a case where the mesh will not be computed at all by StdPrs. To do this, just set the next parameter for AIS_Shape:
C++:
Attributes()->SetAutoTriangulation(Standard_False)

If the mesh was not prepared for the shape, you'll see only the contour of your shape in the viewer. In this case you'll know how much the shaded presentation build takes from the performace point of view.

2. Another or additional way might be the introducing some timer(like QTimer) and reconstruct the shapes by it's ticks? The matter is that the mouse move happens too often and therefore may require too much calls of algo+visualization.

And the question here, what if not StdPrs but prime shape construction takes time? May be it's worth also to check it.)

Regards, Natalia
 
Top