(API) Insert the assembly into presentation (Inventor) via API

(API) Insert the assembly into presentation (Inventor) via API

Anonymous
Not applicable
924 Views
2 Replies
Message 1 of 3

(API) Insert the assembly into presentation (Inventor) via API

Anonymous
Not applicable

I created a presentation document
Now I would need to insert the assembly via API.
Is there a command to do this?

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

YuhanZhang
Autodesk
Autodesk

Unfortunately till now there are no presentation APIs exposed yet, but as a workaround you can try below VBA code to insert a scene for a new presentation document:

 

Sub InsertToPrestention()

Dim oCM As CommandManager
Set oCM = ThisApplication.CommandManager
oCM.ClearPrivateEvents

Dim sFile As String
sFile = "C:\Temp\Block.iam"

oCM.PostPrivateEvent kFileNameEvent, sFile


Dim oDoc As PresentationDocument
Set oDoc = ThisApplication.Documents.Add(kPresentationDocumentObject)

End Sub

Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 3

Anonymous
Not applicable

Tank YuhanZhang .

I entered your suggestion and works properly.

 

For vb net place the code I used.

 

Dim oCM As Inventor.CommandManager
oCM = invApplication.CommandManager
oCM.ClearPrivateEvents()
Dim sFile As String = "C:\temp\test.iam"  
Call oCM.PostPrivateEvent(Inventor.PrivateEventTypeEnum.kFileNameEvent, sFile)
Dim oDoc2 As PresentationDocument

oDoc2 = invApplication.Documents.Add(Inventor.DocumentTypeEnum.kPresentationDocumentObject)

oDoc2.SaveAs(namefile & "_P.IPN", False)

 

 

0 Likes