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

Place assembly and display its form

Hi, 

I want a program that will add my assembly from a defined location and after placing it (this is working in my code), it will show me the form of newly added assembly.

 

I don't know if it's possible but it will be great if program will stop after this line:

ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute	

and after user will place it, form ("FORM1") will popup

 

 

Sub main

Dim Path As String = ThisDoc.Path & "\"
Dim AssyDoc As Document = ThisApplication.Documents.Open("D:\3_TEST\ACCESSDOOR\CUSTOM.iam", False)

ProjectNo = InputBox("Project Number", "iLogic", "000")
AssyDoc.SaveAs(Path & ProjectNo & "-ASSEMBLY-" & ".iam", False)

For Each oDoc In AssyDoc.AllReferencedDocuments 'loop through all part in assembly	

	TAG_NO = InputBox("TAG", "iLogic", "001")
	oDoc.SaveAs(Path & ProjectNo & "item-" & TAG_NO & ".ipt", False)

Next

Dim oMatrix As Matrix
oMatrix = ThisApplication.TransientGeometry.CreateMatrix
Call oMatrix.SetTranslation(ThisApplication.TransientGeometry.CreateVector(50, 50, 50), True)

ThisApplication.CommandManager.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, AssyDoc.FullDocumentName) 
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyPlaceComponentCmd").Execute	

ThisApplication.Documents.Open(AssyDoc.FullDocumentName, False)

Trace.Write(AssyDoc.FullDocumentName)
iLogicForm.Show("FORM1")
End Sub