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.
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:
pFromEntity
— Input entity, which can be OdDbCircle
, OdDbEllipse
, OdDb3dPolyline
,
OdDb2dPolyline
, OdDbPolyline
, OdDbSpline
,
OdDb3dSolid
, OdDbSolid
, or OdDbRegion
.pNewSurface
— Resulting surface.
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.
Here you can see a 3D solid before conversion to a surface:
And here's the same solid converted to a surface:
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.
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|