Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with Solids > Specific Properties of Solids
Specific Properties of Solids

In the following examples, the pSolid variable stores a pointer to the solid object.

Solid points

To get a solid's point at the specified index, use the getPointAt() method, which requires two parameters: an index of a point in the range 0-3 as an integer value and a reference to an object of the OdGePoint3d class in which the point data will be saved. For example:


OdGePoint3d point = OdGePoint3d (0,0,0);
for (int i = 0; i<4; i++)
  {
	  pSolid->getPointAt(i, point);
	  odPrintConsoleString(L"\nSolid point's %d coordinates: %f %f %f", i, point.x, point.y, point.z);
  }

To set new data to a point, use the setPointAt() method, which requires two parameters: an index of a point in the range 0-3 as an integer value and a reference to an object of the OdGePoint3d class that contains new data for the point. For example:


pSolid->setPointAt(0, OdGePoint3d(50,50,10));
pSolid->setPointAt(1, OdGePoint3d(50,60,10));
pSolid->setPointAt(2, OdGePoint3d(60,50,10));
pSolid->setPointAt(3, OdGePoint3d(60,60,10));

Thickness

To get the thickness of a solid, use the thickness() method, which requires no parameters and returns the solid thickness as a double value. For example:


odPrintConsoleString(L"\nSolid thickness: %f ", pSolid->thickness());

To set the thickness to a solid, use the setThickness() method, which requires one double parameter to determine the thickness. For example:


pSolid->setThickness(20);

Normal

The normal defines the orientation of the solid plane in world space. To get the normal of a solid, use the normal() method, which returns the WCS unit vector, which is the normal to the plane as an object of the OdGeVector3d class. For example:


odPrintConsoleString(L"\nSolid normal is (%g * X + %g * Y + %g * Z)", pSolid->normal().x, pSolid->normal().y, pSolid->normal().z);

To set the new value of the normal to a solid object, use the setNormal() method, which requires one parameter: an object of the OdGeVector3d class which contains the data of a new normal vector. For example:


pSolid->setNormal(OdGeVector3d(0,0,1));

Plane

To get the plane for a solid, use the getPlane() method, which requires a reference to a variable of the OdGePlane type in which the plane instance must be saved as the first argument, requires a reference to a variable of the OdDb::Planarity type in which the plane type must be saved as the second argument, and returns the plane properties through arguments and the resulting code. For example:


OdResult eRes; 
OdGePlane plane3d;
double a, b, c, d;
OdDb::Planarity planarity;
eRes = pSolid->getPlane(plane3d, planarity);
if(eRes == eOk && planarity != OdDb::kNonPlanar) 
{
  plane3d.getCoefficients(a, b, c, d);
  odPrintConsoleString(L"\nSolid plane is (%g * X + %g * Y + %g * Z + %g)", a, b, c, d);
}

See Also

Working with Solids

Overview of Solids

Example of Working with Solids

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