Error Message Box When You Select a Certain Model State

Error Message Box When You Select a Certain Model State

fsnyderE8767
Enthusiast Enthusiast
604 Views
8 Replies
Message 1 of 9

Error Message Box When You Select a Certain Model State

fsnyderE8767
Enthusiast
Enthusiast

Hi,

 

I think I have a fairly basic iLogic issue but i can't seem to figure it out completely.  I'm fairly new to using iLogic so the rule I have is really basic.  I attached the files I'm talking about.

 

The issue is that there is a certain valve we have used for 40 plus years that is now obsolete.  So I want an error message to pop up stating that this part is obsolete and you need to be required to select another part.  The way I have the parts setup is with different model states.  The part that is now obsolete is "FCV7-10-S-0-20".

 

Also, this valve is placed in multiple other assemblies throughout our library.  So I have a feeling in some assemblies the main part might be "FCV7:2", but the iLogic rule is referencing "FCV7:1".   Would there be a way to have an logic rule to look for any part with just "FCV7" in the part number and also in any assembly I were to open that has this part in it?

 

And lastly, I have an Event Trigger set to run the rule with any model state activated, but it doesn't seem to run when I switch through model states.  When I get back to "FCV7-10-S-0-20" which is when I want the message box to appear, I actually have to manually run the rule to get that message box to pop up.

 

Sorry for going all over the place there.

0 Likes
605 Views
8 Replies
Replies (8)
Message 2 of 9

AndrewHumiston
Advocate
Advocate

good morning,

 

that trigger is only if the model state is changed in that file. i think you are changing a model state of the part that is in the assembly, that won't trigger the rule, you'd have to change the model state of the assembly. i hope that makes sense.

 

as far as your other ask:

Are you looking for a rule to check the model state for the obsolete part? Such as on an open or before a save would be good triggers.

 

Creating a rule to search through an assembly should be pretty straight forward. let me see what i can come up with.

0 Likes
Message 3 of 9

fsnyderE8767
Enthusiast
Enthusiast

Thanks for the response.  The model state trigger makes sense on your first statement.  That's exactly why I was doing.

 

And I guess I am looking for a rule that when you open an assembly, if it has that obsolete part in it, to have a message box pop up with a warning.  Or if you were to place an existing sub assembly that has that obsolete part in it, into another assembly, that warning box would pop up.  Basically just trying to make it as foolproof as possible to not use that part but since it's in other existing subassemblies that have been in the filed for years, having the warning message would be a good start.

0 Likes
Message 4 of 9

AndrewHumiston
Advocate
Advocate

Here is the code for searching an assembly or a part file. it will throw the error and show you what part is in the assembly.

 

as far as how to trigger it, i would start with (After Open Document) and (Before Save Document). i think this will be a good start. this will help narrow down very quickly where these are used. 

AMHumiston_1-1721738874845.png

 

i hope this helps if you agree please like and accept as a solution. if not let me know and i'm more than willing to help!

 

have a great day.

 

 

0 Likes
Message 5 of 9

fsnyderE8767
Enthusiast
Enthusiast

I tried this rule and I noticed that if you have the obsolete part, FCV7-10-S-0-20, selected, then the rule works great.  However, if it is not selected in then you get an error.  I attached an updated basic assembly.  You'll get an error that says 

 

Error on line 18 in rule: Obsolete Part, in document: FCV7.iam

Object variable or With block variable not set.

0 Likes
Message 6 of 9

AndrewHumiston
Advocate
Advocate

Ive changed the access to the modelstate name. 

 

try this code and let me know if it works.

0 Likes
Message 7 of 9

fsnyderE8767
Enthusiast
Enthusiast

Sorry for the late response.  I just ran the rule you sent and it doesn't give a warning anymore but it's still not perfect.  The way it is operating now, it pulls up the error message on every single model state.  if there was a way to have that message pop up, only when that part is active in the model state, that would be much better.  So even if say part FCV7-10-S-0-40 is active in the model state, it gives the warning message stating that FCV7-10-S-0-20 is being used.

0 Likes
Message 8 of 9

AndrewHumiston
Advocate
Advocate

would you send me the string you would like to search for?

0 Likes
Message 9 of 9

fsnyderE8767
Enthusiast
Enthusiast

I think the best way i can explain it with the assembly I have attached is, if the model state called "FCV7-10-S-0-20" is selected then id like to automatically show the message in the rule you made.  This is so if someone opens an assembly that contains that now obsolete part, this message stands out to them to change the part to something available.  But if you select either "[Primary]", "FCV7-10-S-0-30", or "FCV7-10-S-0-40" then you get no message at all.  This is because the assembly model state called "FCV7-10-S-0-20" contains an ipt part also called "FCV7-10-S-0-20".  

0 Likes