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

Create an assembly template that when used also spawns the 1st part from another template

I frequently create a new assembly from a template, then immediately need to create the 1st part from another template.   Is there a way to create a template that does this for me, in other words, when I create a new assembly, it automatically spawns the 1st part at the same time,  and I can start editing the part right away?

 

 

 

I recommend you to create external iLogic script which:

  • create new assembly
  • create new part
  • place the part to the assembly
  • start editing the part

The script can looks like this

 

Dim asmTemplate As String = "" 'Add your assembly template here (keep empty for default)
Dim partTemplate As String = "" 'Add your part template here (keep empty for default)

Dim asm As AssemblyDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject, asmTemplate)
Dim part As PartDocument = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, partTemplate, False)
Dim partOccurrence As ComponentOccurrence = asm.ComponentDefinition.Occurrences.AddByComponentDefinition(part.ComponentDefinition, ThisApplication.TransientGeometry.CreateMatrix())
part.ReleaseReference()
partOccurrence.Edit()