pass value between external ilogic rules

pass value between external ilogic rules

cadman777
Advisor Advisor
1,958 Views
12 Replies
Message 1 of 13

pass value between external ilogic rules

cadman777
Advisor
Advisor

Hey Guys,

 

I'm hacking my way though a rule and have wasted a day fiddle farting around with it.

Maybe someone can help?

 

What I want to do is call an External rule and use the value of a declared variable from the parent rule (that is, that calls it the external rule).

 

Here's basically what I'm trying to do:

1. create all flatpattern files in individual idw files then run some other external commands on them (good to go on that stuff...only thing is all the idw files don't get saved after they're made)

2.  then save each idw file and close it by calling an external file that uses the filename that the parent iLogic rule created. the idw file had not yet been saved before the rule is called that saves it.

 

I just can't figure out how to do any of that from within the parent rule b/c it keeps saving and closing the iam file instead of the idw files.

 

Actually, I'm resorting to saving the idw file b/c I can't figure out how to make a dxf file from the idw file without saving it, and then closing the idw file without saving it after creating the dxf file. Plus, I want to save the dxf file by the name created in the parent iLogic file that gets its iProperties from each part file. This is a clusterf**k of coding that I just can't figure out. Incidentally, I've read at least 4 hours of stuff online to try to figure this out, but just can't find what I need to know to do it successfully. Plus I tried adapting at least 8 ilogic rules to do it, but can't figure it out. I even tried starting w/the embedded iLogic sippet "export dxf from idw" but it got me all knotted up, even though I KNOW I got the ini file and template names correct.

 

Any guidance is appreciated.

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
1,959 Views
12 Replies
Replies (12)
Message 2 of 13

JelteDeJong
Mentor
Mentor

I know that you can pass arguments to a rule. have look at this article:

https://adndevblog.typepad.com/manufacturing/2015/01/pass-parameters-to-an-ilogic-rule.html

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 13

A.Acheson
Mentor
Mentor

Can you post the rules you are using and note the order they are to be triggered. Let us know if they are internal or external and if they are run manually and from which files. The connection of multiple rules run from each other is likely the hardest piece of rule creation as  the document being processed is changing constantly. One method could be to combine all rules in to one large rule driven by sub routine. This can have the benefit of seeing all rules together.

 

Alternately 

It will be best to check the filepath through a message box/ logger in each rule related to the document object being used. This way you can check if the correct document is being processed. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 4 of 13

cadman777
Advisor
Advisor

@JelteDeJong,

Thanx for the link.

I'll look at it and see if it's doable or 'over my head' at this point.

Cheers!

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 5 of 13

cadman777
Advisor
Advisor

Thanx Alan, you're right, it's complicated!

Probably the most important thing I can learn now is how to structure a rule, like you mention.

I'm at the point where I'm getting the hang of combining parts of rules that others have coded but only when they're simple. But when I run into something new, I have to spend hours upon hours hunting down explanations until it makes sense. But even then, I have a tough time incorporating that stuff into my rule.

 

So can you link me to some simple but accurate learning on how to structure a rule?

It would be good if it had running examples using iLogic (like some of the VB.Net web sites I've visited).

 

I've been wanting to understand how to use Class, Sub Main, Sub (public, private), etc., but really don't understand basics after much reading on the subject. It just seems like everyone I read has a different opinion on how to use them and what's involved. The thing that keeps eluding me is understanding how it works without 'getting into the weeds' and being overwhelmed by irrelevant or partial info. I need to know what I'm working with before I can work with it.

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 6 of 13

A.Acheson
Mentor
Mentor

Here is a sample I used to learn the passing arguments method based on the same link above. Here

To use, save both rules attached as external rules. Simply run the "arguments passing" in any sample document. This will trigger the name of an iProperty to be passed to the second rule "arguments receiving" and the second rule does the action of creating the iProperty and then an optional extra the first rule receives the value of the iProperty back. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 7 of 13

A.Acheson
Mentor
Mentor

I would understand  everyone's opinion as being there personal style of coding based on what industry they are in either in the software industry, add-in development,  industry driven automation or just hobbyist in the field adapting there daily workflow. The more you learn the more you can formalize your style and right fewer and fewer lines to accomplish the same outcome. 

Regarding Class, Sub (public, private), etc., these can be tricky to utilize and understand especially when using vb.net in the ilogic environment. I think these are more suited to be structured when using visual studio or VBA editors and as your skill level improves.  

 

VBA (public, private) controls the accessibility from classes of these sub's. If you write a private sub you will not be able to call that sub from the macro editor where as a public sub you can.

Public:

AAcheson_0-1638134912293.png

 

Private:

AAcheson_1-1638135015380.png

Here is a good link to a video on explaining a class ran from VBA excel. 

Here is the vb.net explanation of a class from Microsoft, hard to understand for newbies 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 8 of 13

cadman777
Advisor
Advisor

Hi Alan,

 

Thanx for the rules.

I'll check them out as soon as I get a chance.

 

Right now I'm trying to get acquainted w/VisualStudio2017 b/c it's become glaringly obvious to me that I'm not going to succeed at this unless I have some way to troubleshoot my code. The iLogic editor ain't cuttin' it.

 

Rant: Far as I'm concerned, iLogic is a LIE. It was designed as an answer to SW's 'Configuations', and it works good for that to a large degree. But everybody's tried to turn it into a programming language. It was never meant to be that, and it never will be that. It's just one more pile of sh*t that Autodesk gobbed onto their obese software to entice prospective buyers to empty their wallets based on the LIE that it's a 'macro language'. It ain't that and never will be. Instead, Rhino3D's 'Grasshopper' is a macro language, the likes of which SHOULD BE part of Inventor, no doubt about it. So now I have to continue trying to become a coder, something that's equivalent to being married to a high-dollar bioch. Lotta wasted time, energy and money for a needed but non-lucrative return.

 

I'll get back to you when I find out how your code works. Hopefully I can figure it out for myself before diving into your code!

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 9 of 13

cadman777
Advisor
Advisor

Thanx for that info.

 

Yes, I already read MicroSnot's explanation and you're right, it's esoteric for newbies.

 

I found this to be true back in my AutoLISP days: "The more you learn the more you can formalize your style and right fewer and fewer lines to accomplish the same outcome."

 

Like I said above, I need to 'take the dive' and 'bite the bullet' into VB.Net, or my constant hacking will never amount to anything. The only 'teacher' who makes sense to me is Brian Ekins'. Everybody else who attempts to teach this stuff online talks like a Russian spy or an attorney turned public official.

 

Again, thanx for the help!

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 10 of 13

cadman777
Advisor
Advisor

That 'class' video is excellent! Need to watch it at least 4 more times. That's EXACTLY what I asked in this forum a year or so ago, but never got a good enough answer to be able to do anything about it. It's also EXACTLY what I want to do b/c it's how I build my 3D models and make drawings of them.

 

I also found a very good beginner video on 'debugging' in VBA. It was simple and practical, and had more education in it than the entire 'my first inventor plugin' (what a POS!).

 

The key for me is finding good linear instructional videos on VBA/VB.Net for Inventor. Everything on the internet is for Excel and Word. The only thing I can conclude about Autodesk in this regard is that they DELIBERATELY WITHHELD this learning process from us so the programmers, corporate elites and other monopolists can hoard it all to themselves. It's part of the globalist paradigm of monopolies on labor and production. Communist manifesto all the way...

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 11 of 13

WCrihfield
Mentor
Mentor

Just thought I would add a quick note here about the other possible option we have available to us through iLogic called 'SharedVariable'.  There are 4 standard iLogic snippets available within the iLogic Rule Editor's Snippets, under the System side, then under the Variables folder.

WCrihfield_0-1638898439328.png

 

 

Here is the online help page that documents those snippets.  It is just basically a way to create a variable that will stay in Inventor's session memory, even after rules have finished, so they can be read from by other rules.  Unfortunately, I don't believe they are accessible from VBA though.  I have always preferred the NameValueMap & RuleArguments (Link) resources already mentioned by the others here, but just wanted you to know that these were available too.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 12 of 13

cadman777
Advisor
Advisor

Thanx for this referral.

It looks promising.

Presently I took this down another rabbit hole that seems easier at the present time.

But think I will look at this again in the near future.

Again, thanx for your help!

 

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes
Message 13 of 13

matt_jlt
Collaborator
Collaborator

Not to make it more complicated for you, is there a specific reason you want to create an idw? such as you want to add a titleblock / labels / sketched symbols etc. to the flat pattern export?

If you are only after an export of the flat pattern, you can export / save copy as of the flat pattern directly from the part. This is also available as a manual right click on the flat pattern node in the browser select save copy etc.

 

Just a thought that might save you some additional work / increase speed of operations and bypass the need for any IDW's.



0 Likes