Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get into PartDocument using C++ API?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
299 Views, 1 Reply

How to get into PartDocument using C++ API?

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.

 

1 REPLY 1
Message 2 of 2
oransen
in reply to: Anonymous

I'd like to know how to do this too!

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report