Brief information about all classes derived from the OdPrcRepresentationItem class is found in the table below.
Class name | Description |
---|---|
OdPrcBrepModel | This class implements a boundary representation model. In the case where the body of the Brep model is allocated in the exact geometry section of the .prc file structure, it is identified with a topological context index and a body's index in this context. To indicate whether the body is closed, a special boolean flag is used. Even if there is no body in the exact geometry section, tessellation data may represent a closed body. |
OdPrcCoordinateSystem | A coordinate system can be included into a part definition tree as a representing item. Or it can play a role of an entity used to position other representation entities. In the second case, the coordinate system is allocated in the global section of the .prc file structure. |
OdPrcConstructionPlane | Implements a construction plane instead of a specified planar surface. In the case where a plane body is allocated in the exact geometry section of the .prc file structure, the plane's body can be determined with an index of a topological context and a body's index within the context. |
OdPrcDirection | Represents a direction vector with an optional origin. It is possible to determine infinite construction lines through the direction vector. |
OdPrcPointSet | Implements a set of 3D points. |
OdPrcPolyBrepModel | A poly Brep model is defined by the tessellation data (encapsulated in an OdPrcRepresentationItemContent object). A special boolean flag indicates whether the tessellation is closed or open. |
OdPrcPolyWire | A poly wire is determined with the tessellation data of an OdPrcRepresentationItemContent object. |
OdPrcSet | Implements a logical grouping of an arbitrary number of representation items. |
OdPrcWireCurve | Implements a curve entity. In the case where a wire body is allocated in the exact geometry section of the .prc file structure, the wire body is determined with the index of the topological context and the body's index within the context. |
MyServices svcs;
OdStreamBufPtr pPrcStream = odrxSystemServices()->createFile(prcName, (Oda::FileAccessMode)(Oda::kFileWrite), Oda::kShareDenyNo, Oda::kCreateAlways);
OdDb3dSolidPtr p3dSolid = OdDb3dSolid::createObject();
p3dSolid->createSphere(10);
OdDbDatabasePtr pDb = svcs.hostTD().createDatabase();
OdDbBlockTableRecordPtr pRec = pDb->getModelSpaceId().safeOpenObject(OdDb::kForWrite);
pRec->appendOdDbEntity(p3dSolid);
OdBrBrep brep;
p3dSolid->brep(brep);
OdGeExtents3d extents;
p3dSolid->getGeomExtents(extents);
PrcExportModulePtr pModule = odrxDynamicLinker()->loadModule(OdDwg2PrcExportModuleName);
OdResult res = pModule->exportPrc(pDb, *p3dSolid, brep, pPrcStream, extents, OdRxDictionaryPtr());
if (res != eOk)
{
throw OdError(res);
}
For details about exporting to a .prc file, see
Export a Drawing to a .prc File.
pFile
is a smart pointer to
an OdPrcFile object):
OdPrcFileStructurePtr newStructure = pFile->fileStructures().last();
OdPrcPartDefinitionPtr newDefinition = newStructure->fileStructureTree().partDefinition().last().safeOpenObject(kForWrite);
OdPrcBrepModelPtr newBrep = OdPrcBrepModel::createObject();
newStructure->addObject(newBrep);
newBrep->setIsClosed(true);
newDefinition->representationItem().push_back(newBrep->objectId());
extents
represents extents passed from the calling subroutine):
OdGePoint3d min = extents.minPoint(),
max = extents.maxPoint();
OdPrcBoundingBox box;
box.minPoint().set(min.x,min.y,min.z);
box.maxPoint().set(max.x,max.y,max.z);
newDefinition->boundingBox() = box;
OdPrcContextAndBodies &newContextAndBodies = newStructure->fileStructureGeometry().fileStructureExactGeometry().topologicalContext().last();
OdPrcBrepDataPtr brepData = OdPrcBrepData::createObject();
newStructure->addObject(brepData);
box.minPoint().set(min.x,min.y,min.z);
box.maxPoint().set(max.x,max.y,max.z);
brepData->boundingBox() = box;
brepData->contentBody().setBoundingBoxBehaviour(2);
newBrep->setReferenceToBody(brepData);
newContextAndBodies.bodies().push_back(brepData->objectId());
OdPrcFileStructure &newStructure = *(pFile->fileStructures().last());
OdPrcFileStructureGlobals &globalData = newStructure.fileStructureGlobals();
OdPrcRgbColorArray &colorArr = globalData.colors();
colorArr.append()->set(r, g, b);
OdPrcObjectIdArray &lineStyleArr = globalData.category1LineStyles();
OdPrcCategory1LineStylePtr lineStyle = OdPrcCategory1LineStyle::createObject();
newStructure.addObject(lineStyle);
lineStyle->setLineWidth(1.0f);
lineStyle->setColorIdx(1);
lineStyleArr.push_back(lineStyle->objectId());
addLineStyleForBrep(newStructure, 1.0f, 0.0f, 0.0f);
OdPrcFileStructureTree &tree = newStructure.fileStructureTree();
OdPrcObjectIdArray &partArr = tree.partDefinition();
OdPrcPartDefinitionPtr part = partArr.last().safeOpenObject(kForWrite);
OdPrcObjectIdArray &itemArr = part->representationItem();
OdPrcRepresentationItemPtr item = itemArr.last().safeOpenObject(kForWrite);
OdPrcGraphics &graphics = item->graphics();
graphics.lineAttr().setLineStyleID(newStructure.fileStructureGlobals().category1LineStyles()[0]);
graphics.setBehaviourBitField(PRC_GRAPHICS_Show);
OdPrcContextAndBodies &newContextAndBodies = newStructure.fileStructureGeometry().fileStructureExactGeometry().topologicalContext().last();
OdPrcBrepDataPtr brepData = newContextAndBodies.bodies().last().safeOpenObject(kForWrite);
OdPrcRepresentationItemPtr newRepItem = ((OdPrcPartDefinitionPtr)(newStructure.fileStructureTree().partDefinition().last().safeOpenObject(kForWrite)))->representationItem().last().safeOpenObject(kForWrite);
newRepItem->name().setName("Sphere");
OdPrcSpherePtr pPrcSphere = OdPrcSphere::createObject();
{
OdPrcContentSurface &srfContent = pPrcSphere->contentSurface();
srfContent.baseGeometry().name().setName("named sphere in srfContent");
pPrcSphere->setUVParameterization(OdPrcUVParameterization(-OdaPI, OdaPI, -OdaPI/2, OdaPI/2));
pPrcSphere->setRadius(1);
}
brepData
is a smart pointer to the Brep data object, pSurface
is a smart pointer to the created sphere):
OdPrcConnexPtr pCurConnex = OdPrcConnex::createObject();
brepData->addConnex(pCurConnex);
{
OdPrcShellPtr pCurShell = OdPrcShell::createObject();
pCurConnex->addShell(pCurShell);
{
OdPrcFacePtr pCurFace = OdPrcFace::createObject();
pCurFace->baseSurface() = pSurface;
pCurFace->orientationSurfaceWithShell() = kSame;
pCurFace->setSurfaceTrimDomain(0);
pCurFace->setHaveTolerance(false);
pCurShell->addFace(pCurFace);
}
pCurShell->setShellIsClosed(false);
}
OdPrcPartDefinitionPtr newDefinition = newStructure.fileStructureTree().partDefinition().last().safeOpenObject(kForWrite);
OdPrcBrepModelPtr pBrepModel = newDefinition->representationItem().last().openObject(kForWrite);
ODA_VERIFY(pBrepModel->updateIsClosedFlag() == eOk);
pPrcStream
is an input parameter containing a smart pointer
to the stream buffer associated with a .prc file):
pFile->writeFile(pPrcStream);
Working with representation entities are illustrated in the OdPrcCreate sample application. Created by the OdPrcCreate application, .prc files can be opened with specialized viewers, such as the following Brep model sphere and Brep model cylinder.
![]() |
![]() |
|
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.
|