Message 1 of 6
Revit API for getting NWD geometry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
We have a revit file that have a Navis work file .nwd load into Revit as a link. We are trying to extract the geometry.
1. What I do know is that IPhotoRenderContext::OnFaceBegin doesn't get called on it to get faces.
2. Tried recursively the DirectShape's geometry element + geometry object but doesn't hit a
Solid, Face, Mesh, etc... was wondering if there a way to get .nwd geometry.
DirectShape^ pDirectShape = dynamic_cast<DirectShape^>(pElemEntry->m_curElement);
if (pDirectShape)
{
m_pGeometryOption->IncludeNonVisibleObjects = true;
m_pGeometryOption->ComputeReferences = true;
}
GeometryElement ^geoElement = pElemEntry->m_curElement->Geometry::get ( m_pGeometryOption );
for each ( GeometryObject ^pGeometryObject in geomElemt )
{
AddGeometryObjects ( pGeometryObject, ... );
}
----- function ----
void AddGeometryObject( GeometryObject ^pGeometryObject, ... )
{
GeometryInstance ^pGeometryInstance = dynamic_cast<GeometryInstance ^>( pGeometryObject ); <-- It is geometry instance
Solid ^pSolid = dynamic_cast<Solid ^>( pGeometryObject );
Face ^pFace = dynamic_cast<Face ^>( pGeometryObject );
Mesh ^pMesh = dynamic_cast<Mesh ^>( pGeometryObject );
Curve ^pCurve = dynamic_cast<Curve ^>( pGeometryObject );
PolyLine ^pPolyLine = dynamic_cast<PolyLine ^>( pGeometryObject );
Point ^pPoint = dynamic_cast<Point ^>( pGeometryObject );
GeometryElement ^pGeometryElement = dynamic_cast<GeometryElement ^>( pGeometryObject );
Profile ^pProfile = dynamic_cast<Profile^>( pGeometryObject );
Edge^ pEdge = dynamic_cast<Edge^>(pGeometryObject);
DirectShapeType^ pDirectShapeType = dynamic_cast<DirectShapeType^>(pGeometryInstance->Symbol);
Reference^ pRef = gcnew Reference(pDirectShapeType);
GeometryObject^ pGeoObject = pDirectShapeType->GetGeometryObjectFromReference(pRef);
GeometryElement^ pGeoElement = dynamic_cast<GeometryElement^>(pGeoObject);
if (pGeoElement)
{
AddGeoElement(pGeoElement ...);
}
}
---- function ---
AddGeoElement ( GeometryElement ^pGeometryElement... )
{
if ( nullptr == pGeometryElement )
{
return;
}
//get all geometric primitives contained in the GeometryElement
for each ( GeometryObject ^pGeometryObject in pGeometryElement )
{
AddGeometryObjects ( pGeometryObject, mTransform, bCalcSubInstance, a_pTreeNode, level, a_pDocMaterialHash );
}
}
Best.
Alex Chapp