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

It appears that the replace reference mentioned above is not functioning and there is no documented sample to do this, so here is another approach.  The  manual replace all correctly keeps the reference to an imported component and the import type referenced model. So the below codes simply automates this procedure. Here is the article that references running commands.

 

AAcheson_1-1656713107293.png

AAcheson_0-1656712994563.png

 

 

 

	' Get the command manager.
    Dim oCommandMgr As CommandManager = ThisApplication.CommandManager
	
	'Pick occurrence
	Dim oAssyoOcc As ComponentOccurrence = oCommandMgr.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Occurence")
	
	'Select the chosen occurrence for processing
	oCommandMgr.DoSelect(oAssyoOcc)
    
	'Clear the clipboard
	oCommandMgr.ClearPrivateEvents
	
	' Post the filename.
    Call oCommandMgr.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent,"C:\Users\Assembly5.stp")

    ' Get control definition for the place component command.
    Dim oControlDef As ControlDefinition= oCommandMgr.ControlDefinitions.Item("AssemblyReplaceAllCmd")

    ' Execute the command synchronously. 
    Call oControlDef.Execute2(True)

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan