Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Sergio.D.Suárez
in reply to: Cosmin_V

Hi, welcome to the forum, you should open the assembly and in your rules you should not put the name to identify a component in an assembly, because the name is what will change later. For instance, suppose you have a rule like this (they compared it recently in another forum thread)

Parameter("Flange_DIN.ipt","DN") = DN_DIN

you should identify the component in another way, for example, through the occurrence item.

Then I leave you a code so you can identify the item that defines your component in the assembly, each item has a component

    Dim oDoc As AssemblyDocument
    oDoc = ThisApplication.ActiveDocument
    Dim oDef As AssemblyComponentDefinition
    oDef = oDoc.ComponentDefinition

	For i As Integer = 2 To oDef.Occurrences.Count
	    Dim oOcc As ComponentOccurrence = oDef.Occurrences.Item(i)
		MessageBox.Show("Item Number: " & i & vbCrLf & "Occurrence Name: " & oOcc.Name )
	Next

For instance, if for your part "Flange_DIN.ipt" you  find that it corresponds to item 3 . you should change the line

Parameter("Flange_DIN.ipt","DN") = DN_DIN

by the lines (  you must completely define the syntax oDef at the beginning of the rule)

Dim oFlangeDIN As ComponentOccurrence = oDef.Occurrences.Item(3)
Parameter(oFlangeDIN.name,"DN") = DN_DIN

If you identify each component through the item, you can rename them and the rules will continue to work correctly.
I hope it will help you solve your problem


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn