Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Convert Entities to Surfaces

Introduction

A surface is a 3D object that is an infinitely thin shell. In ODA Software, there are several types of surfaces. You can see the class dependency below.

Convert an Entity to a Surface

You can convert an OdDbEntity object to an OdDbSurface object using the createFrom() method.

static OdResult createFrom ( const OdDbEntity* pFromEntity, OdDbSurfacePtr& pNewSurface );

This method creates an extruded surface (OdDbExtrudedSurface) from a 2D entity with thickness or creates a planar surface (OdDbPlaneSurface) from a closed curve or region. Just a surface (OdDbSurface) is created for an OdDb3dSolid. In general, this method copies Spatial® ACIS® data from different entities and inserts the data in an OdDbSurface. The parameters this method accepts are:

The method returns eOk if a surface is created successfully or an appropriate error code in the other case.

You can use this method as follows.

OdDbSurfacePtr pSurface; // resulting surface
OdDbEntityPtr pEntity = pDb->getObject… // input object
OdResult res = OdDbSurface::createFrom(pEntity, pSurface);

Note that this method is implemented for SpaModeler and for ModelerGeometry.

Example Results

Here you can see a 3D solid before conversion to a surface:

And here's the same solid converted to a surface:

Convert Using a Sample Command

There is a sample command createSurface available in ExCommands. The sample command allows you to convert different types of entities to a surface. You can select one or more entities, and the command calls the OdDbSurface::createFrom() method for conversion. Below is an image that demonstrates conversion of an OdDb3dSolid (the snowman) to a surface.

See Also

Working with Entities

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