Could not change a part multi-value parameter from Assembly using ilogic

Could not change a part multi-value parameter from Assembly using ilogic

Anonymous
Not applicable
1,135 Views
3 Replies
Message 1 of 4

Could not change a part multi-value parameter from Assembly using ilogic

Anonymous
Not applicable

Hi,

   greetings, can anyone help me around with the code i am using in inventor to change the repeated Parts Multivalue text parameter from the assembly level (Eg. to change value "OFF" for a feature appearance, where  the same part is used  in different names in an assembly (500 times) so, what am i trying is not to open individually the parts i am trying to run the code which shown below (and the CODE IS VERY GOOD FOR THE METRIC VALUE CHANGE BUT ONCE IT IS A MULTIVALUE THE CODE IS NOT WORKING ITS RUNNING BIT NO CHANGES HAPPENING)...Will be a great help if any one helps me in changing this multivalue parameter..

 

Note:

i) i cannot get the 500 parts repeated file name list, but the existing code works fine for metric values with variable part file names in the assembly (see text or multi values needs some alteration).

 

Attaching a part file image/ Assembly little one for reference

 

Below the used code:

SyntaxEditor Code Snippet

' set a reference to the assembly component definintion.' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components'(in case a virtual component trips things up)
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
Parameter.Quiet = True
Parameter(oOccurrence.Name, "CABLE_TRAY_VISI") = "OFF"
Else
End If
Next

 

Thanks will be great help if the up code is made feasible for  text too....

 

 

Thanks & Regards,

Suresh.RM

+91 87544 03310

0 Likes
Accepted solutions (1)
1,136 Views
3 Replies
Replies (3)
Message 2 of 4

HermJan.Otterman
Advisor
Advisor

hello,

 

try

 

Parameter(Occurence.displayname, "CABLE_TRY_VISI") = "Off"

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 3 of 4

Anonymous
Not applicable

Hi Herm jan

        Thank you for your support and reply, my older code itself changing the value inside the parameter (Attached the image refers the same) but today only i found out that the assembly is not updating if i open the rule and close in individual file it automatically makes the components to suppress as written in the rule.

 

But here i am not even changing any thing manually it just needs an update control to be run so the each segments responds to the inbuilt rule and make the cable tray hide or suppress...

 

Can you help me around i didn't use the the string you gave.....

 

 

Thanks & Regards,

Suresh.RM

 

0 Likes
Message 4 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Hoping that below iLogic code would help. After updating MultiValue parameter, use "iLogicVb.UpdateWhenDone = True" to update parameter. Are

 

 

' set a reference to the assembly component definintion.' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components'(in case a virtual component trips things up)
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
Parameter.Quiet = True
Parameter(oOccurrence.Name, "CABLE_TRAY_VISI") = "OFF"
iLogicVb.UpdateWhenDone = True
Else End If Next

 

On the other hand, "Component.IsActive(Occurrence.Name) = False" can be used to hide parts.

 

' set a reference to the assembly component definintion.' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components'(in case a virtual component trips things up)
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
Component.IsActive(oOccurrence.Name) = False
Else
End If
Next

Please feel free to contact if there is any queries.

 

If solves problem, click on "Accept as solution" / give a "Kudo".

 

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network