[Back to Blog](/blog) # Convert Entities to Surfaces

Yurii Pylnyk April 23, 2020 [\#getting started](/blog/tag/getting-started) [\#Example](/blog/tag/example)

<a class="a2a_button_facebook"></a><a class="a2a_button_twitter"></a><a class="a2a_button_linkedin"></a>

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

![OdDbSurface](/files/inline-images/scheme%20OdDbSurface.png)#### Convert an entity to a surface

The following method converts an entity to surface:

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

The method creates an extruded surface (OdDbExtrudedSurface) from a 2D entity with thickness or creates a planar surface (OdDbPlanarSurface) 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 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 was created successfully or an appropriate error code in the other case.

This method is implemented for SpaModeler and for ModelerGeometry.

There is also a thickness parameter that can create an OdDbExtrudedSurface from 2D entities.

Code example:

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

#### Example of a 3D Solid Conversion

Here is a 3D solid before conversion to a surface:

![3D solid before conversion to a surface](/files/inline-images/3D%20solid.png)Here is the 3D solid converted to a surface:

![3D solid converted to a surface](/files/inline-images/3D%20solid%20converted%20to%20a%20surface.png)#### Example of a Closed Polyline Conversion

Here is a closed polyline with thickness 2.0 before and after conversion to an extruded surface.

![a closed polyline with thickness 2.0 before and after conversion to an extruded surface](/files/inline-images/closed%20polyline%20and%20extruded%20surface.png)#### Example of a Closed Region Conversion

Here is a closed region before and after conversion to a planar surface.

![Example of a Closed Region Conversion](/files/inline-images/Example%20of%20a%20Closed%20Region%20Conversion.png)#### Try Conversion 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.

![conversion of an OdDb3dSolid (the snowman) to a surface](/files/inline-images/createFrom.gif)

## Get started today

**Try ODA software free for 60 days.  
No risk, no credit card required.**

[Try for Free](https://staging.opendesign.com/free-trial)
