Lesson4: how to create a section view

natalia

Moderator
Staff member
It’s possible to create section view on the model with help of clipping plane mechanism.
For the model:
section_view_model.png
The result is the next:
section_view_model_clip_plane.png
To implement this we create a clipping plane:
C++:
gp_Pln plane(gp_Pnt(), gp_Dir(1.0, 0.0, 0.0));
Handle(Graphic3d_ClipPlane) clipPlane = new Graphic3d_ClipPlane(plane);

Later, it’s possible setting this plane on AIS_Shape itself or in the view. Below the code is how to set it into the view:
C++:
Handle(Graphic3d_SequenceOfHClipPlane) clipping = view->ClipPlanes()
if (clipping.IsNull())
  clipping = new Graphic3d_SequenceOfHClipPlane;
clipping->Append(clipPlane);
view->SetClipPlanes(clipping);
 

JSlyadne

Administrator
Staff member
A few additions:

  • A section plane usually means not the same as a clipping plane. The clipping plane cut a model graphically only, at the level of openGl primitives, while the section plane - geometrically. The clipping planes are typically used for review needs, while section planes for dimensioning. The code above touches the clipping planes only.
  • The clipping plane is set to the whole view will cut the all AIS objects managed by AIS context attached to this view.
  • OCCT allows several clipping planes in the same view, but it's a matter of performance.
 

DVN1991

CAD practitioner
It’s possible to create section view on the model with help of clipping plane mechanism.
For the model:
View attachment 267
The result is the next:
View attachment 268
To implement this we create a clipping plane:
C++:
gp_Pln plane(gp_Pnt(), gp_Dir(1.0, 0.0, 0.0));
Handle(Graphic3d_ClipPlane) clipPlane = new Graphic3d_ClipPlane(plane);

Later, it’s possible setting this plane on AIS_Shape itself or in the view. Below the code is how to set it into the view:
C++:
Handle(Graphic3d_SequenceOfHClipPlane) clipping = view->ClipPlanes()
if (clipping.IsNull())
  clipping = new Graphic3d_SequenceOfHClipPlane;
clipping->Append(clipPlane);
view->SetClipPlanes(clipping);
How should I define that view?
 
Top