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

How to create a new component in an assembly template?

Hi all and thanks in advance for any help given.

 

The problem that I am looking to solve is I'm sure quite simple. When creating a new assembly from a template file named "Hopper Fabrication.iam" I want to trigger the creation and placement of a new part from a template called "Master Hopper.ipt" and put it inside the new assembly.

 

So far I have the following

 

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
oDocumentDefinition.Occurrences.Add(oTemplate,oMatrix)

This is placing the actual template in rather than creating a new part based on the template rather than creating a new in-place compoent based on the named template

Can anyone help me out please.

Mike

 

Autodesk Certified Professional
Labels (1)