Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 4
johnasp1
162 Views, 3 Replies

loops

I am having some problems useing Intent 2 loops in Intent 3. Here is a loop from Intent 2

(List) %NoseParts: Loop {For $p In %NoseRawParts:;
If !ref($p, isNull?) Collect $p;};

This is my attempt to write it for Intent 3

Rule %NoseParts as List = Loop {For $p In %NoseRawParts _
If not ref($p, isNull?) Collect $p}

This does not run...Basically what I want to do is loop thru a list of children parts
and if the child part is not null then collect that child part into a list.
3 REPLIES 3
Message 2 of 4
jeff.pek
in reply to: johnasp1

Hi -

It might be easier to use the For/Next syntax for V3 language, something like this:

Rule %NoseParts as List
%NoseParts = {}
For Each p As Part in %NoseRawParts
if Not p.IsNull? Then %NoseParts = %NoseParts + { p }
Next p
End Rule


I haven't run this, so I'm not 100% confident that it will work exactly as-is, but it's close, and should point you in the right direction.

BTW, to fix what you have, you'll need to add %% prefixes to the legacy keywords like for, collect, and loop.

Jeff
Message 3 of 4
johnasp1
in reply to: johnasp1

Thanks for the example, I tried it last week but was unsuccessful. Do you know of a book or a site that has multiple examples of loops that work in Automation Intent version 3 language?
I looked in the help section and the examples seem minimal in comparison to the help section for version 2.
If anyone could post any of their successful loops with a short description of what it does I would be very grateful.
Thanks
Message 4 of 4
johnasp1
in reply to: johnasp1

Jeff
I got your loop to work by changing a couple of things.

Rule %NoseParts as List
%NoseParts = {}
dim p as part
For Each p in %NoseRawParts
if Not p.IsNull? Then %NoseParts = %NoseParts + { p }
Next p
End Rule

Thanks for helping

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

Post to forums  

Autodesk Design & Make Report