Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

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

Anonymous

(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
Reply
865 Views
2 Replies
Replies (2)

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

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