iLogic error

iLogic error

Anonymous
No aplicable
2.919 Vistas
41 Respuestas
Mensaje 1 de 42

iLogic error

Anonymous
No aplicable

Happy Tuesday all,

   Hope everyone is having a great day. I'm having a challenge with a really large iLogic program I've been working on. I will try to attach all relevant information at the end of this post. So I get the following error when I try to drive my model with the form:  

"Error in rule: New Order Information, in document: AD-Trailer HL.iam

Feature.IsActive: The component named "11.5 HL Gate Rear Post CS:1" was not found." (quotes supplied)

    I also want to mention that iLogic doesn't return me to the line that is causing the error.

This particular bit of iLogic code is over 5k lines long and I know that is pretty big, but It has been working up to the point I placed the "High Lift" side options. This model  has 5 pairs of side models (sub assemblies) among many others relevant sub assemblies (all driven).

  I guess I will paste the iLogic code into a text file and attach it to this post. I will also try to post a screencast as well. Any and all help appreciated.

0 Me gusta
2.920 Vistas
41 Respuestas
Respuestas (41)
Mensaje 2 de 42

Jon.Balgley
Alumni
Alumni

FWIW, in your rule there are only 8 occurrences of this string:

 

    Feature.IsActive("11.5 HL Gate Rear Post CS:1

 

The message means that the "11.5 HL Gate Rear Post CS:1" component isn't there.  Why is it not there -- that's what you need to find out.

 

Hope this is helpful.


Jon Balgley
Mensaje 3 de 42

AlexFielder
Advisor
Advisor

I would suggest you post a screenshot of the error message (both pages).

 

And a screencast would be helpful too.

 

I suspect that one of the "component.isactive" lines is suppressing this particular occurrence but since you aren't checking for the status of the parent component before you try and access one of its children that results in the error you are seeing. 

 

Actually, that doesn't appear to be the case on further inspection of the rule.

 

This is exactly the kind of thing I was alluding to the other day... When a rule gets this large it's a monster of a task to track down bugs.

 

You could create an incrementing line counter that increases in value between each IF statement and if you wrapped the whole rule in a Try Catch when you get an error you could have it display the incremented value - it would only be an approximate location but it's better than the default "solution".

 

As an aside, I've recently been using log4net inside of my .NET addins; I wonder if it could be made to work with iLogic...?

Mensaje 4 de 42

Owner2229
Advisor
Advisor

FWIW, yesterday I've started splitting @Anonymous's code into Subs and Functions. So far I've cut down about 500 lines and counting. I'm in about 1/5 of the code, so it might go down to about 1-3k of lines and even that might go down a little bit more, but that would require some consultations about the specific code-part's functionality. We can discuss that once I'm done with the first cutdown.

I'll continue today in the evening, but due to lack of time I won't be able to finish it today. I should have it done till Friday.

I'm reworking it in such manner that it should be working at any point, so if you want to give it a try, I can post what I have in the evening.

 

I believe it's about time to cut it down, since 5k lines is A LOT for an iLogic rule, even tho they're just simple "If Then Else" selections.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Mensaje 5 de 42

Anonymous
No aplicable

You guys are amazing! Mike, I can't believe your crunching though all that code. Something I should have mentioned in my original post about this error is that the "CS:1" at the end of that line is that "CS" refers to "Curb side". Our company uses this terminology instead of "left side/right side" or "drivers side/passenger side". We use "Curb side/Road Side". I shorten it up in my code to "CS" / "RS". So what is going to happen once the issue with the error I posted is that iLogic will throw another error code for "11.5 HL Gate Rear Post RS:1". Of course once the "CS" error is resolved the next error will be easily resolved. I apologize for omitting this bit of information and can't tell you how much I appreciated all of you efforts.

   Once up and running this morning, I will post a screenshot of the error. Thanks again for all your help.

0 Me gusta
Mensaje 6 de 42

Anonymous
No aplicable

Jon,

  it's there, but not active. I have tried to make sure that when I select specific options to be "made active" and displayed, that in my code, all relative features are set to "true" The particular part referred to in this error is required for the different light options available (called in a separate section of code.) This error didn't surface until I added in the side sub assemblies for the "High Lift" gate option. Prior to that addition, the only issues I had was with some   configurations not updating. This is a minor issue and easily fixed. The good news is that I still have other gate options to add in (a "double acting" gate) which can be hinged from either side. I've been attacking this project in phases so as not to get overwhelmed with many errors all at once. This is the first time I can't seem to find the cause for this error. All the calls for the light options are at the very beginning of the code/rule and involve primarily the different rear posts required for the different side options. If anyone is interested, there is an earlier version of this model in my screencast posts.

  But back to my original statement, as far as I can tell, all of the required parts that are necessary for any given configuration, should be "active" or "true". For some reason I can find no reason for this error. But I really appreciate all the help.

 

0 Me gusta
Mensaje 7 de 42

Owner2229
Advisor
Advisor

Nice, the Screencasts will well serve as the consultation I spoke of.

As I'm looking at the light's form, I see some critical points for improvement.

I'll be even able to speed the whole thing up.

E.g. The color changing should be instant.

 

For others: The screencasts are on @Anonymous's profile:

https://knowledge.autodesk.com/profile/O37DE440AC6249D8/screencasts

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Mensaje 8 de 42

Anonymous
No aplicable

Mike,

Got another question, possibly related. First, each sub assembly contains iLogic rules and forms so that it can be "driven" through all the options for that particular sub assembly. Example: the floor has all the floor related options and can be independently driven if I open only the floor model. Same for sides. tailgates and bulkhead. Would it simplify the problem if I removed the rules and forms from all the subassemblies that make up the complete body? Or are they necessary to make the body model work with its own rules?

   Sort of related, right?

Thanks again for all you help. Please let me know if you need any further files or information from me.

 

Also here is t he screencast of the error....

0 Me gusta
Mensaje 9 de 42

Jon.Balgley
Alumni
Alumni

Something weird is going on.  In the screencast, the error message shows that the missing component is named "17 Rear Post CS:1" (which is a different component than the one you mentioned in the first posting).  But we can see most of the model in the browser pane, and that component is not there.  Now maybe it's just further down, but the scroll bar makes me think that there's not much more there.

 

So it looks like it *is* missing.  If so, why?  Did some components get accidentally deleted?


Jon Balgley
0 Me gusta
Mensaje 10 de 42

Owner2229
Advisor
Advisor

Alright... So, I'm done with the first part (cutting unnecessary lines).

The new lines' count is: 1121

 

Now comes the second part, fixing of the "11.5 HL Gate Rear Post CS:1".

So, I now need you to double check the code and test it out, if it works.

I might have made some mistakes, as jumping back and forth in 5k lines of code might have make me oversee something.

 

Third part would be speeding the thing up a bit, but we'll get to that later.

 

The code is in attachment.

 

As for the rules, if there is a tiniest chance you might need to use them in the subassies. , I'd leave them there.

Aka, if you might need them to change the subassy separately.

Otherwise I'd move them to the top assy, so it is all at one place and you don't have to look for it (switch between assys).

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Mensaje 11 de 42

AlexFielder
Advisor
Advisor

That's some top notch refactoring there Mike +1!

Mensaje 12 de 42

Anonymous
No aplicable

Jon,

    I apologize for the confusion, concerning the error. The screencast I posted was made after I'd made some changes to the rule. But this is a very similar error as it is referring to a similar component. As I stated earlier, the code worked ok until I added the side sub assemblies for the "High Lift" options. There were 4 sub assemblies added (2) sides for the "straight high lift" options and (2) sides for the "tapered high lift" options. Please let me assure you that "no parts were deleted" from any sub assemblies in the making of this model. The problem is iLogic related in that if a part is "suppressed" or

Component.IsActive("17T Rear Post CS:1") = False 

for example, iLogic will return the error shown in the screen cast when processing an operation that requires the component,IsActive to be True. I can't seem to find the area of my rule that is trying process the component in question.

 

 

Frank

0 Me gusta
Mensaje 13 de 42

Anonymous
No aplicable

Mike,

   WOW! I am going to save a copy of my model to try your code on and I will let you know. Thank you for all your time and effort, can't tell you how much I appreciate it. Hope to get back to you today.

 

Frank

0 Me gusta
Mensaje 14 de 42

Anonymous
No aplicable

Mike,

   Sorry it took me so long to trying your hard work. I spent the last day and a half cleaning up my side model assemblies. I made sub assemblies of all mi lights and gaskets. This simplified my side models more than I would have thought. Not a problem, I already know how to transfer all my "updates" to your code. So I suppressed my working rule and created a test rule with your code and had first a minor error easily fixed. (upper case I in a unit). Next I am getting an error I'm not sure how to fix. Attached screencast. Hope you have a great weekend. I'll be online all weekend and maybe I'll even "play" with this a little.

0 Me gusta
Mensaje 15 de 42

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi Frank,

 

 

The attached video seems to be old video.

 

Is it possible to upload whole assembly document?

 

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Me gusta
Mensaje 16 de 42

Anonymous
No aplicable

Chandra,

  Sorry, not an old video. In this video I am using the modified code that Mike worked so hard on. Unfortunately it returns the same error I was getting from my own code. I am still working on the problem and I don't give up easily. I will be posting new videos on my progress, so stay tuned. Happy Monday all.

0 Me gusta
Mensaje 17 de 42

Anonymous
No aplicable

Chandra,

   My apologies, it would seem your are correct and this was an old video. I've made a new screen cast showing what happened when using Mikes modified rule. It is telling me that Mikes AuxLight() needs to be "declared", but I'm not sure how to do that. Or maybe Mike intended that to be a comment. OK, Just tried the comment theory and got past that, fixed some errors caused by me renaming some part files and now am getting this error again... "11.5 HL Gate Rear Post CS:1". I am thinking that the comment theory was incorrect. Also, in Mikes rule I am seeing brown values after the equal sign. Also AuxLight() appears as brown. My understanding of iLogic rules is that if the value following the equal sign is a number value, it needs nothing but the actual value. If it is a "True/False" after the equal sign, nothing else is needed. But if it is a text value ("Boolean"?) it must be in parenthesis and quotes.

is this correct?

0 Me gusta
Mensaje 18 de 42

Owner2229
Advisor
Advisor

Alright, so lets try it like this. I've created a custom function that'll read and set the suppression state for each component:

 

S_IsActive("ComponentName" As String, Optional Enabled As Boolean) As Boolean

Also there's way too many of these:

ThisDoc.Document.ComponentDefinition.RepresentationsManager.LevelOfDetailRepresentations.Item("Custom").Activate()

So, I've reduced them to one at the start of the rule.

 

The code is in attachment. Let's see how it'll work with this function, as it is not using the "Component.IsActive".

 

Also, I've fixed the "AuxLight" error.

It's brown because it is a custom sub-function I've created at the bottom of the code and I'm calling it by using "S_AuxLight()".

It'll force the rule to jump to this sub-function and execute it (and finish it) before continuing to next code-line.

 

... Text must be in quotes, boolean doesn't. Neither of them must be in parenthesis, but there're some exceptions when it's required.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
Mensaje 19 de 42

Anonymous
No aplicable

Mike,

   Thanks so much for all your hard work and time. I have downloaded your latest efforts and will try them as soon as I can. I will need to do a bit of editing as I have already made changes to eliminate some parts (combined lights and gaskets to make sub assemblies) and right now I am renaming some parts in my side sub assemblies in an effort to eliminate the last error I got. Shouldn't take too long. I will get back to you with my results as quickly as I can. I will also post latest version of my rule. Thanks again for your hard work and time.

0 Me gusta
Mensaje 20 de 42

Anonymous
No aplicable

Mike,

   Alright, I pasted your code into a new rule, called it "Test 2". Edited in the changes I made to part names. I'm pretty sure I didn't mess anything up, and got the errors noted in the attached screencast. I was still getting the error on the AuxLight() at the beginning of the rule. Added "ThisDoc.Document." in front of it and that error went away and I don't know why. Are we having fun yet?

   Any how, I've attached a new screencast and the rule code you sent with the edits I made for new part names and such. Thanks again for your hard work and time.

0 Me gusta