09-04-2020
08:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-04-2020
08:33 AM
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 ![]()
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)
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website