Message 1 of 2
Simple question, or is it?
Not applicable
03-05-2003
04:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How can I get the full filename of a part from an Occurance object?
I need to do this in C++ using Inventor Application object (not Apprentice,
but if this can be done differently using Apprentice, by all means tell me
that also 🙂
I have a recursive function(basically same as the GetOccurancesDispatch from
the SDK samples)
In some cases I need to get the Filename of a part 'behind' the occurance.
How would I do this?
Here is a stripped version of my recursive function...
HRESULT CTree::FillTree(HTREEITEM ParentItem, CTreeCtrl* pTreeToFill,
ComponentOccurrences* pIncomingOccurances)
Result = pIncomingOccurances->get_Count(&nOccMax);
for(long nOccuCount = 1; nOccuCount <= nOccMax;++nOccuCount){
CComPtr pOccu;
CComPtr pOcEn;
HTREEITEM LocalItem;
pOccu = pIncomingOccurances->GetItem(nOccuCount);
strName = (LPCSTR)pOccu->Get_DisplayName();
if(pOccu->GetDefinitionDocumentType() == kAssemblyDocumentObject)
LocalItem = pTreeToFill->InsertItem(strName,0,0,ParentItem);
else
LocalItem = pTreeToFill->InsertItem(strName,1,1,ParentItem);
Result = pOccu->get_SubOccurrences(&pOcEn);
CComQIPtr pOccs(pOcEn);
Result = FillTree(LocalItem, pTreeToFill, pOccs);
}
return Result;
}
I need to do this in C++ using Inventor Application object (not Apprentice,
but if this can be done differently using Apprentice, by all means tell me
that also 🙂
I have a recursive function(basically same as the GetOccurancesDispatch from
the SDK samples)
In some cases I need to get the Filename of a part 'behind' the occurance.
How would I do this?
Here is a stripped version of my recursive function...
HRESULT CTree::FillTree(HTREEITEM ParentItem, CTreeCtrl* pTreeToFill,
ComponentOccurrences* pIncomingOccurances)
Result = pIncomingOccurances->get_Count(&nOccMax);
for(long nOccuCount = 1; nOccuCount <= nOccMax;++nOccuCount){
CComPtr
CComPtr
HTREEITEM LocalItem;
pOccu = pIncomingOccurances->GetItem(nOccuCount);
strName = (LPCSTR)pOccu->Get_DisplayName();
if(pOccu->GetDefinitionDocumentType() == kAssemblyDocumentObject)
LocalItem = pTreeToFill->InsertItem(strName,0,0,ParentItem);
else
LocalItem = pTreeToFill->InsertItem(strName,1,1,ParentItem);
Result = pOccu->get_SubOccurrences(&pOcEn);
CComQIPtr
Result = FillTree(LocalItem, pTreeToFill, pOccs);
}
return Result;
}