Hello my code for changing Multi value list parameter with another Multi value parameter is not working for some reason. If I change it to another it may update it 1 time, but it's under wrong parameter value and doesn't change after that. I have a form where I change these. This is an external rule.
If Parameter("Kategoria") = "Tyhjä" Then MultiValue.SetList("Tuote", "Tyhjä") InventorVb.DocumentUpdate() ElseIf Parameter("Kategoria") = "Kisko" Then MultiValue.SetList("Tuote", "Suora", "Suorataivutettu", "Kulma") InventorVb.DocumentUpdate() ElseIf Parameter("Kategoria") = "Läpivienti" Then InventorVb.DocumentUpdate() MultiValue.SetList("Tuote", "Lattia", "Katto") InventorVb.DocumentUpdate() End If
Solved! Go to Solution.
Solved by dimamazutaMMJ32. Go to Solution.
Okay after I changed it, I got it to work every time I change parameter and run the rule manually, but is there a way to run the rule immediately automatically.
If Parameter("Kategoria") = "Tyhjä" Then MultiValue.SetList("Tuote", "Tyhjä") ElseIf Parameter("Kategoria") = "Kisko" Then MultiValue.SetList("Tuote", "Suora", "Suorataivutettu", "Kulma") ElseIf Parameter("Kategoria") = "Läpivienti" Then MultiValue.SetList("Tuote", "Lattia", "Katto") End If MultiValue.UpdateAfterChange = True
Hi @e2000773 . You need to add your rule to Event Triggers. Yes, you can. Follow the steps as in the screenshot.
Andrii Humeniuk - Leading design engineer
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
I have my "Refresh" rule (this code) there on both Parts and Assemblies tabs. Still no Dice. My form currently has no buttons so it's not about the apply button either (Didn't work with that either when I tried). This is External rule and Global form.
Ok @e2000773 let's try this:
1. - I don't understand why rule "Refresh" is in "Any Model Parameter Change" in Event Triggers. Are these Text Parameters users?
2. - I've created these parameters in Users Parameters, added external rule to the "Any User Parameter Change" in Event Triggers, created Global form and it's work for me.
Please check new code and video how it works.
MultiValue.UpdateAfterChange = True
MultiValue.SetValueOptions(True, 0)
If Parameter("Kategoria") = "Tyhjä" Then
MultiValue.SetList("Tuote", "Tyhjä")
ElseIf Parameter("Kategoria") = "Kisko" Then
MultiValue.SetList("Tuote", "Suora", "Suorataivutettu", "Kulma")
ElseIf Parameter("Kategoria") = "Läpivienti" Then
MultiValue.SetList("Tuote", "Lattia", "Katto")
End If
Hi @e2000773
Can you place the rule as a button in your form? I am not certain if there is a simple solution for triggering parameters from an external rule otherwise.
Also, if you are using a global iLogic form, you will need to make sure you edit that form to include the Apply button, because when you make parameter value changes in a global form, those changes will not effect the model until after you click the Apply button. And if you click the apply button, that will send the changes to the document, without closing the form. Dragging that external rule over into your global form as a rule button is also an option, because then clicking that button will run the rule, but you would still need to click apply before running the rule to make sure that any edits have been sent to the document first.
Wesley Crihfield
(Not an Autodesk Employee)
What I’m trying to do is a preselect of directory folders in a path for automatic save & replace code initial directory in the file dialog.
The initial directory in the code is: ”C:\Users\Name\Desktop\” + Parameter(”Kategoria”) + ”\” + Parameter(”Tuote”). Both Parameters multivalue list contains the names of the folders. And yes later there will be more folders.
Currently in the form between these two parameters sits my Refresh rule as a button. So the process now goes like choose the first parameter value -> refresh button -> choose now from parameter multivalue the refresh button just limited smaller. I want to get rid of that refresh button to just the second parameter changing dynamically based on the first ones value.
When I have chosen the correct values, in the form I press my Save & Replace button and the initial directory in the file dialog opens the correct locations, I open the file and press Esc to get a new dialog asking for a new name for the file to be replaced on the assembly tree. I know this form is a primitive way to do this, but it works.
The reason why I have to have External rules and Global form is that it needs to work in a new empty assembly. Now if the External rules are the problem… Is there a code to create a internal rule with the code of the refresh rule on the fly when a new document is created or old one opened?
Hey that works! It was there, because I was testing my form in empty part file too, because in the zero document my button for the form doesn't work (missing files or something). Thank you!
Can't find what you're looking for? Ask the community or share your knowledge.