Hi.
My name is WJ Lee, KOREA.
I Tried to access part document of ipt file.
My model has 1 Assembly file with 30 part model.
I want to access one of 30 part.
So I tried this.
Application *app
app->get_ActiveDocument(&pDoc);
CComPtr<PartDocument> pPartDocument(pDoc);
But Active Document is iam document.
So I tried this
pAssemCompDef->get_Occurrences(&pCompOccs);
CComPtr<ComponentOccurrences> pCompOccs;
CComPtr<ComponentOccurrence> pCompOcc;
CComPtr<PartDocument> pPartDocument;
pCompOccs->get_Item(index_part, &pCompOcc);
pCompOcc->Definition()->get_Document(&pPartDocument);
But get_Document function variable needs
get_Document (IDisPatch **p_result );
I Stucked here.
Is there any way to get pPartDocument from IDisPatch ??
Or is there anyway to access part document?
I just access part document internaly.
In VBA I can access Partdocument file just like this.
Dim oPartDocument As PartDocument
RedimDim oPartDoc(number) As ComponentOccurrence
For Each oOcc In oCompDef.Occurrences
If oOcc.SubOccurrences.Count = 0 Then
iPartCount = iPartCount + 1
Set oPartDoc(iPartCount) = oOcc
Else
Call PartSet(oOcc, oPartDoc(), oPartName(), iPartCount)
End If
Next
For i = 1 To oPartCoun
Set oPartDocument = oPartDoc(i).Definition.Document
Next
Thanks for reading.