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

Hi @mikejones 

The place new component command creates the new document invisible in Inventor and then places it into the assembly. It creates a document only in inventor memory, so no filepath exists meaning occurrences.add will not work.

You'll have to add by component definition. like this :slightly_smiling_face:

Dim oTemplate As String = "C:\Users\Public\Documents\Templates\Master Hopper.ipt"
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDocumentDefinition As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oMatrix As Matrix = oTG.CreateMatrix
Dim pDoc As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplate, False)
oDocumentDefinition.Occurrences.AddByComponentDefinition(pDoc.ComponentDefinition, oMatrix)