Getting triangle data from a surface in cpp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have modified some of the sample code provided, but what I really want is to be able to iterate through the vertices of a surface. Here is what I have so far:
m_oAcadApp = static_cast<Autodesk::AutoCAD::Interop::AcadApplication^ >(System::Runtime::InteropServices::Marshal::GetActiveObject(m_sAcadProdID));
m_oAeccApp = static_cast<Autodesk::AECC::Interop::UiLand::AeccApplication^>(m_oAcadApp->GetInterfaceObject(m_sAeccAppProgId));
//m_oAeccDb = dynamic_cast<Autodesk::AECC::Interop::Land::IAeccDatabase^>(m_oAeccApp->ActiveDocument->Database);
m_oAeccDb = dynamic_cast<Autodesk::AECC::Interop::Land::AeccDatabase^>(m_oAeccApp->ActiveDocument->Database);
//m_oAcadApp->ActiveDocument->Database
String^ sResult;
long lCount = m_oAeccDb->PointGroups->Count;
sResult = String::Concat("Number of PointGroups: ", lCount.ToString(), "\n");
lCount = m_oAeccDb->Surfaces->Count;
sResult = String::Concat(sResult, "Number of Surfaces: ", lCount.ToString(), "\n");
lCount = m_oAeccDb->Sites->Count;
sResult = String::Concat(sResult, "Number of Sites: ", lCount.ToString(), "\n");
IEnumerator^ surfItems = m_oAeccDb->Surfaces->GetEnumerator();
Autodesk::AECC::Interop::Land::AeccSurface^ surfItem;
Autodesk::AECC::Interop::Land::AeccTinSurface^ tinItem;
HRESULT hr = S_OK;
while (surfItems->MoveNext() == true)
{
surfItem = static_cast<Autodesk::AECC::Interop::Land::AeccSurface^>(surfItems->Current);
sResult = String::Concat(sResult, " Surface Name: ", surfItem->DisplayName, "\n");
if (surfItem->Type == Autodesk::AECC::Interop::Land::AeccSurfaceType::aecckTinSurface)
{
Autodesk::AECC::Interop::Land::IAeccSurface^ iSurf = static_cast<Autodesk::AECC::Interop::Land::IAeccSurface^>(surfItems->Current);
tinItem = static_cast<Autodesk::AECC::Interop::Land::AeccTinSurface^>(surfItems->Current);
Object^ triangles = tinItem->OutputTriangles;
So now I have an Object^ triangles, how do I cast it or convert it so an array or similar that I can navigate? It doesn't help that when I try to run this under debug, all the break points are disabled...