Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
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 code

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
michelouwerkerk
309 Views, 4 Replies

Ilogic code

I proberbly make a smal mistake in my code can someone correct me and explain what i do wrong here.

 

We have two type of pumps a big one and smal one ( Groot & Klein in dutch )

I have an form where i can enter Groot or Klein with an Drop down menu this works fine!

Now i need the shaft of the pump to extend 10mm when its a small pump.

 

I used the Part from the content center and i also made it extend en retract whenever the pump gets longer or shorter, this also works fine! Now i need to ad an aditional 10mm when the form is set to "short" 

 

The parameter "Aslengte:" = parameter "Length:" + 185 + 62

"Length:" is filled in on the form

I do this because i wil remember how much the shaft goes into the head and the pump itself.

 

4 REPLIES 4
Message 2 of 5

I also tryd this: 

 

michelouwerkerk_0-1699880485331.png

 

If Pomp: "Groot" Then Parameter("EN 10060 - 35", "B_L") = AslengteGroot:
End If

If Pomp: "Klein" Then Parameter("EN 10060 - 35", "B_L") = AslengteKlein:
End If

 

Message 3 of 5

First I got quite confused by the presence of ':' in your code, then I realized you have it in the name of your parameter.
Have you tried something along the lines of:

If Parameter("Pomp:") = "Groot" Then
	Parameter("EN 10060 - 35", "B_L") = Parameter("Length:") + 247
Else
	Parameter("EN 10060 - 35", "B_L") = Parameter("Length:") + 257
End If
Message 4 of 5

thankyou, it worked! 

 

AslengteGroot:

 

because this was blue i already tought i had the parameter selected. 

Message 5 of 5

Happy to help. 🙂

 

You sort-of had a reference to the parameter, just not explicitly the value of it.

As a rule-of-thumb, anything not a-Z or '_' is wibbly-wobbly to reference as anything other than a string (" here "). And ':' especially, since something like 

Label1:
'do stuff
Label2:
'OtherStuff

is actually  a way to navigate code.

So, even if you could/would reference "AslengteGroot:" that way, if you ever tried assigning it's value like that, and your settings and syntax was just right, it would be treated as a label (an address in the code) and your result would be more funny than correct.

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

Post to forums  

Autodesk Design & Make Report