Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic error

41 REPLIES 41
Reply
Message 1 of 42
frank
1458 Views, 41 Replies

iLogic error

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.

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
41 REPLIES 41
Message 21 of 42
Owner2229
in reply to: frank

Well, I've made some changes after I've posted the last message (including a new attached file), so you've probably downloaded the old one.

Nvm. as for the "AuxLight()" it should be "S_AuxLight()". It's one of the functions at the bottom of the code:

Sub S_AuxLight()
    S_AuxLight1()
    S_AuxLight2()
End Sub

As for the "C_IsActiveComponent(...)" error, it should be "C_IsActive(...)". My mistake when I was replacing it.

 

So, I've corrected it and I'm sending you the updated rule in attachment.

 

Note:

I've enclosed some parts of your code (right in the first change I've made to your code) into Sub-Functions like this one:

 

Sub S_TG_Lock()
    's = TG_Lock
    C_IsActive("Bottom Tailgate Lock:1", Parameter("TAIL-GATE-ASSY:1", "Bottom_Locks"))
    C_IsActive("Bottom Tailgate Lock:2", Parameter("TAIL-GATE-ASSY:1", "Bottom_Locks"))
    Select Case TG_Lock
    Case "Barndoor"
        Parameter("AD Floor Complete-CP:1", "Tailgate_Option") = "Barn Door"
        C_IsActive("Bottom Tailgate Lock:1", False)
        C_IsActive("Bottom Tailgate Lock:2", False)
    Case "Air Lock":    Parameter("AD Floor Complete-CP:1", "Tailgate_Option") = "Standard Airlock"
    Case "Manual Lock":    Parameter("AD Floor Complete-CP:1", "Tailgate_Option") = "Standard Manual"
    End Select
    iLogicVb.UpdateWhenDone = True
End Sub

The main part of your code is enclosed in subfunction called "Sub Main()". This is the part that will execute when the rule starts.

If we want to execute any of the other "Subs" we have to call them from the Main Sub (this is the case with the "S_AuxLight()".

There are two basic types of functions:

Sub <name>      - will execute where used, the parent sub will wait for the sub-function to finish before continuing

Function <name> As String - same as in Sub, except it can return a value, in this case text (string).

You can look at the way I've used these two in the code and let me know if you'll need further info.

 

Blue highlighted is the name of the sub-function. We can use this name anywhere in the Main Sub (or in any called Sub or Function).

Red highlighted (and commented out) is an auto-execution for a parameter (in this case "TG_Lock").

This is a little bit of code I'd like you to use to improve the speed of your rule, while keeping it all in one place.

So, if we place the "s = TG_Lock" (or "s = <any-other-paramter>" at the start of any Sub, it'll self-execute every time this parameter changes.

There can be more parameters present at once, like:

s = TG_Lock
s = Liner

I've commented them all out because I don't know how you're calling the rule (my guess would be the OK button in the user-form).

You can uncomment them and play with them to execute individual Subs (without the starting the "Sub Main").

This way will execute only the parts of the code that really need to be executed, so the executing speed will improve.

 

I hope I've explained this atleast a bit understandably, so let me know if you need any further info about this as well.

Also, it's just an idea, so you can keep these commented out (or even remove them) and don't use them at all, it's your call.

 

There're some other programming "wonders" we could use to speed this up a little bit, but I believe this code is not as complex for them to be used. They might however come handy if you'll be creating something a little bit more complex in the future, so we can go back to them once we're done with this one, or you can simply summon me here on forum once you'll need me.

 

I can still do some further sorting of the code once we have a function version, so it looks a little more human-readable, clean, easy to maintain, reuse, expand and execute.

 

I'm sorry for the wall of text, I hope it'll be of some use.

EDIT: This time I've edited only some typos and colors. (As a non-native speaker I always have something to improve and fix.)

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
Message 22 of 42
frank
in reply to: Owner2229

Good morning Mike!

    I've been busy working on this project and have made some progress. I've fixed the syntax error with the AuxLight() error. And I've also figured out the other errors, namely how to "Declare" a custom function, well to a point anyhow. Now I am right back to my original error as you will see from the screencast I've included. Also, your (our) rule is suppressing all the side options now. Looking into that as well. I think the more of this I can figure out on my own the better off I'll be. I can tell you that you've been a tremendous help. I'm thinking now that maybe I should implement similar changes in the side sub assemblies. I'm working on linking all of the sub assemblies to the top level assembly parameters and create a form from the linked parameters to drive the top level assembly. Well, onward and upward, and thanks again for your help and time.

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 23 of 42
Owner2229
in reply to: frank

I've created a new function "F_IsActive" (similiar to "C_IsActive", but for features) and I hope this will do for this error.

Both of these functions of course need some testing, if they're always doing what they're intended to do.

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
Message 24 of 42
frank
in reply to: Owner2229

Mike,

   The latest version of your rule:

1. I see no areas "commented out" with the exception of the section titles I placed in my original rule to tell me what a section is supposed to do.

2. As far as how I call the rule, you might get a glimpse of the form from my screencast, but I use a combo of drop downs (for Length and Height, also Side style options and tailgate options) The rest are either check boxes or radio buttons. The changes occur as soon as an option is selected (if all is working as it should). I have also placed a check box to "Reset" the model to its default condition.

   I hope that clears things up as far as how it is all supposed to work. (at least in my mind) I've already tested out your latest version and it went straight to my original error. (Feature.IsActive: The component named "STR Rear Post CS:1" was not found.) Also for some reason, the new rule suppresses all the side options, same as previous version.

   So I'm pouring thru the latest version, looking for where the problem might be. I'm wondering from something you said in your last reply, is there a way to "delay" my option selections until I'm finished picking what options I want. I will spend some time looking for something like that in my form.

  Thank you again for all you time and help.

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 25 of 42
Owner2229
in reply to: frank

If you want to delay the the run of the rule, here's how:

autodesk.com/#M71523

 

But I myself wouldn't do that. Bear with me:

Every time you change anything your current rule goes on rampage of changing all options (un/suppressing components and features and changing colors), but that's not what we want (need). We need it to change only what really changed. That's why I started separating your rule to the Subs and Functions. In the end there should be 16 triggered subs, one for each option:

Trailer Length Option
Side Height Option
Side Style Option
TG Style Option
Trailer Width
TG Lock Option
Rear Bearing Option
Cleaner Plate Option
Double Knuckle Chute Option
Bottom_Locks
Liner Option
Top Rail Angle Option
Single Rear Post LED Light
LED 1 Color
Double Rear Post LED Light
LED 2 Color

It would be triggered by the parameter change ("s = <parameter name>"), as I explained in my post above.

This way it will only have to do a small change (execute a short code), so the change would be almost instant.

Furthermore, changing e.g. "TG Style" would trigger "Side Style" change etc.

 

So (IMO) for now it would be best to focus on this change.

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
Message 26 of 42
frank
in reply to: Owner2229

Mike,

    Not sure when you last reply came in, but I have been working on this almost non stop this all afternoon. Solved the problem of the side options being suppressed. (think you could see that in the last screencast). Which also cleared up the other error. So now almost everything is working as it should. Well I'm not getting any error messages.

   The only issues now are:

1. Tailgate width won't update back to 96" wide from 102" wide and 2. the tailgate won't change from the 9 panel (for posted side options) to the smooth panel tailgate for the smooth panel side options. Also 3. the Chute option for the tailgates won't show. But I'm getting no error messages.

   I found the option in forms to delay the update until all the options have been selected, that was easy. I had hoped that by doing that, I would avoind the error messages relating to part not found.

   Sorry to keep you tied up with this so long. And now it's morning.(I started this yesterday afternoon late) I've read your latest and will remove the apply option from the form. It was interesting to watch the model when I hit "apply". Going to send this now as I kind of lost my train of thought anyway. If you have other things you must take care of, please don't let me hold you up. I really do appreciate all of you help and time. Happy hump day.

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 27 of 42
frank
in reply to: Owner2229

Mike,

   Hope you're having a great Wednesday. I am finding plenty to keep me busy with the latest version of your efforts on my behalf. Figuring  things out as I go along. I don't understand some of your changes to my original code, but at least I am making sense of it (some) as I work through this. If you would like I can try to do a pack and go on these models and forward them to you. I'm not sure how practical this would be, but I'm will to give it a try. Let me know. I'm going to attach my latest edits to your rule, so if you have something else you need to do to it, we're not both starting over again.

   Not sure what is going on, but any updates that have to do with my tailgate models (2) are not updating the tailgates. Just did some checking to confirm this is still true and it is. Will post screen cast and new rule code.

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 28 of 42
Owner2229
in reply to: frank

Pack and Go - that would be great, I was thinking about crating some model-placeholders with the structure of your assy, so I can test the code on it, but it'd be even better if there's the option for you to share your models.

Starting tomorrow I'll have 4 days off, so I'll have plenty of time to play with it.

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
Message 29 of 42
frank
in reply to: Owner2229

Mike,

    How would I "share" this model(s). Is there someplace I could "upload" to. In the mean time I will get started on the pack and go.

 

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 30 of 42
Owner2229
in reply to: frank

You can try this one (it's free and secure):

https://mega.nz

 

If you don't want to make your files public you can pack the file(s) into a pass protected archive (RAR, ZIP, 7Zip, whatever) and send me the pass as a message (or even the link).

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
Message 31 of 42
frank
in reply to: Owner2229

Mike,

Seems I've made significant progress today. Cleared up tailgate issues except for the Chute. The only other outstanding issues are The lights, cleaner plates and the tailgate lock options for the floor. I am attaching what I have so far so you don't have to repeat what I've already done. Happy Easter!

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 32 of 42
Owner2229
in reply to: frank

Thank you, I'll look at it tomorrow (I'm now enjoying a cold one and looking forward to head to bed).

I've send you a mail with some info about tomorrow, so I hope it arrived.

I'm not much into holidays' celebration lately, but for FWIW, Happy Easter too.

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
Message 33 of 42
chandra.shekar.g
in reply to: frank

Hi Frank,

 

Can you please share non - confidential assembly documents? We can also work on it.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 34 of 42
frank
in reply to: chandra.shekar.g

Chandra,

    It's a rather large assembly. Do you have someplace I can upload the files to? Not sure I will have time to do that today, but if you can give me a location to put them I may be able to do it Sunday afternoon, my time.

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 35 of 42
chandra.shekar.g
in reply to: frank

Hi Frank,

 

I have sent you box link. Please upload assembly files there.

 

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 36 of 42

.


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 37 of 42
frank
in reply to: chandra.shekar.g

Chandra,

 If you sent the box link to my work e-mail, I won't be able to access it for the time being. I am working from home. You will need to send the link to my home email address.     fjnagle2nd@hotmail.com

 

Frank

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 38 of 42
chandra.shekar.g
in reply to: frank

Hi Frank,

 

Can you please upload to some cloud storage like "GoogleDrive" or "DropBox"?

 

If it is possible, please send me the link.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 39 of 42
frank
in reply to: chandra.shekar.g

Chandra,

Try this...

 

 

https://mega.nz/

Frank J. Nagle II
Mechanical Design Engineer
Summit Trailer Sales, Inc.
2174 Fair Rd.
Schuylkill Haven Pa. 17972
Message 40 of 42
chandra.shekar.g
in reply to: frank

Hi Frank,

 

Created an account at mega.nz as (chandra.shekar.g@autodesk.com).

 

Please upload assembly document and share it.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report