Getting triangle data from a surface in cpp

Getting triangle data from a surface in cpp

Anonymous
Not applicable
559 Views
2 Replies
Message 1 of 3

Getting triangle data from a surface in cpp

Anonymous
Not applicable

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...

0 Likes
560 Views
2 Replies
Replies (2)
Message 2 of 3

Jeff_M
Consultant
Consultant
Mary, welcome to the forums!
I don't know cpp, but when using the COM interops with c# I'm fairly certain that the OutputTriangles returns an array of doubles.
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 3

Anonymous
Not applicable

That's the tricky bit, I really need to know the exact cast to get to the points. All the samples I can find are in .NET, and the definition does not go into detail.

0 Likes