Driving model parameter value from external rule

Driving model parameter value from external rule

vitanyi.levente
Explorer Explorer
412 Views
4 Replies
Message 1 of 5

Driving model parameter value from external rule

vitanyi.levente
Explorer
Explorer

Hi there

 

If I run an internal rule that changes a model parameter in an .ipt it changes, works fine... however if I make an external rule to open that part document and then run another external rule to set the parameter  it results an error : "Parameter: Could not find a parameter named: ..."

 

Why is this happening?

Any help would be much appreciated!

0 Likes
Accepted solutions (1)
413 Views
4 Replies
Replies (4)
Message 2 of 5

theo.bot
Collaborator
Collaborator

How do you access you parameter? Can you share your code?

0 Likes
Message 3 of 5

vitanyi.levente
Explorer
Explorer

Let me redefine my question...

Let's say I have a couple hundred files like attached. I need to change "mag" parameter without me manually opening and then creating a rule for it, or manually set the value, since it would take a lot of time.

 

So I would like to select a few of them (with a form in a part document for example). This form could open and "inject" the rules inside the chosen parts, just like Rule1 , in the example file. (simple rectangle sheet metal)

 

I am fairly new in this ilogic coding so I am not sure this is possible or not.

 

 

0 Likes
Message 4 of 5

theo.bot
Collaborator
Collaborator
Accepted solution

@vitanyi.levente 

 

It's possible to do so. 

 

If you want to create a external rule to change the parameter, I would add a check to avoid errors. So if you change your code in your external rule into:

 

Try
Parameter("mag") = 1800

Catch
	MessageBox.Show("parameter mag not found")
End Try

Parameter.UpdateAfterChange = True
iLogicVb.UpdateWhenDone = True

this will try to edit the parameter, but if there is no parameter "mag" it will show an message box.

 

But if you want to edit multiple files and are not familiar with coding, try to find so learnings first how to write your codes and how to go thru your data. You could go thru assembly structures to edit parts or like you mentioned a list of documents.

 

here are some nice starting points:

 

Message 5 of 5

vitanyi.levente
Explorer
Explorer
Thank you for your help. 🙂
0 Likes