Close

Relief for ODA Team in Ukraine

Learn more
ODA PRC SDK
Add Cross Sections for Views

To add a cross section for a view, set a clipping plane for the custom view (the custom view must be created previously).

For example, to create a view with an XZ clipping plane:

  1. Create a custom view. See Create Views for additional information about creation of views.
  2. Create the clipping plane:
    
              OdPrcPlanePtr pPlane = OdPrcPlane::createObject();
              OdGeVector3d normal(0.0, 1.0, 0.0);
              OdGePoint3d origin(0.0, 0.0, 0.0);
              normal.normalize();
              OdGePlane gePlane(origin, normal);
              OdGeInterval intU(-3., 3);
              OdGeInterval intV(-3., 3);
              setPlaneEnvelope(&gePlane, intU, intV);
              pPlane->setFromOdGeSurface(gePlane);
            

    The normal vector of the clipping plane determines the section direction for the object's part that will be removed.

  3. Add created clipping plane to the view:
    
              OdPrcSurfacePtrArray &viewClippingPlanes = ((OdPrcSceneDisplayParameters*)pSceneDisplayParameters)->clippingPlanes();
               viewClippingPlanes.push_back(pPlane);
            

The result of adding a clipping plane to the view is illustrated below.

View with a cross section

Note that the .prc file format specification does not prohibit creating several clipping planes per view, but viewer applications (for example, Adobe® Reader) do not support this feature and can apply only one clipping plane.

Sample applications

Working with clipping planes is illustrated in ODA PRC SDK sample applications:

  • OdPrcCreate application. Sample code is contained in the simpleCrossSectioExample() function defined in the CrossSectionExample.cpp module.
  • OdaPrcApp MFC application. Another example is represented in the _CROSSSECTION_func (OdEdCommandContext* pCmdCtx) function defined in the PrcCrossSectionCommands.cpp module.

    To get access to this function in the OdaPrcApp sample application, select Edit -> Registered Commands -> Cross Section -> CROSSSECTION.

View with a cross section

See Also

Work with Views
Create Views
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.