Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Working with Lofted Solids

ODA Drawings SDK allows you to create lofted OdDb3dSolid objects. 3D solids are objects that can be created as basic primitives, or as extruded, swept, revolved, or lofted profiles.

The lofting functionality is implemented for creating 3D solid objects from a set of curves - cross section curves. There are different parameters which influence the shape of a resulting solid, such as the path curve and the guide curves.

To create a lofted solid you can use the createLoftedSolid() method. Below, you can find description for each parameter:

  • crossSectionCurves is a parameter that represents an input array of section profiles which are used for the creation of a lofted solid;
  • guideCurves is an optional parameter represents an input array of guide curves which have an influence on the resulting body shape;
  • pPathCurve is an optional parameter that represents a curve that has an influence on the resulting body shape;
  • loftOptions is a parameter through which the loft options can be set.

There are several properties that can be set to the loft options.

  • First one is using a normal:
    OdDbLoftOptions loftOptions; // loft options
    loftOptions.setNormal(OdDbLoftOptions::kNoNormal);

    Possible parameter values passed to setNormal can be found in API Reference.

  • The second one is a twist option:
    loftOptions.setNoTwist(true);

    Depending on a parameter, it twists or doesn't twist a body.

  • The third option allows you to make a surface closed:
    loftOptions.setClosed()
  • The last option creates a simple surface (such as a plane, cylinder, cone, sphere and a torus) whenever all of the cross sections lie on such a surface and if the passed value is true.
    loftOptions.setSimplify(true)

These options can be used all together or one-by-one, depending on your needs.

There are three possible ways to create a lofted solid and below you can find information on each one.

Create lofted solids from the cross-section curves only

To perform such operation, use the following method's template:

createLoftedSolid(crossSectionCurves, NULL, NULL, loftOptions);

On the picture below you can see an illustration of how the method works.

Create lofted solids from the cross-section curves and the path curve

To perform such operation, use the following method's template:

createLoftedSolid(crossSectionCurves, NULL, pPathCurve, loftOptions);

On the picture below you can see an illustration of how the method works.

Create lofted solids from the cross-section curves and the guide curves

To perform such operation, use the following method's template:

createLoftedSolid(crossSectionCurves, guideCurvesArray, NULL, loftOptions);

On the picture below you can see an illustration of how the method works.

For example, here's a code sample that demonstrates a possible lofted solid creation scenario:

OdDbLoftOptions loftOptions; // loft options
loftOptions.setNormal(OdDbLoftOptions::kNoNormal);
OdDb3dSolidPtr pSolid = OdDb3dSolid::createObject(); // resulting 3D solid
OdDbEntityPtr pPathCurve = pDb->getObject; // get the path curve 
OdDbEntityPtrArray crossSectionCurves = pDb->getObjects(); // get the cross-section curves
OdDbEntityPtrArray guideCurvesArray = pDb->getObjects(); // get the guide curves
OdResult res = pSolid->createLoftedSolid(crossSectionCurves, guideCurvesArray, pPathCurve, loftOptions); //create a lofted solid, setting either guideCurvesArray or pPathCurve to NULL.

There is also a command for ExCustObjs sample - createloftedsolid. It allows you to create lofted solids with parameters:

  • The cross-section curves only;
  • The cross-section curves and the path curve;
  • The cross-section curves and the guide curves;

This functionality is available only in SpaModeler (based on Spatial library).

See Also

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.