Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

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: 

Can I use iLogic to write a description similar to how the "<>" works in the iproperties "description"?

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
chris
603 Views, 8 Replies

Can I use iLogic to write a description similar to how the "<>" works in the iproperties "description"?

I am wondering how to create a description from parameters and regular text similar to how you are able to create descriptions in the iProperties "Description" slot.

 

Description example: =<TUBING, SQUARE <Width> X <Height> X <Length> LONG

 

how would I write this same type of "description" in iLogic using the parameters (Width, Height, Length) and the plain text of TUBING, SQUARE & Long)

8 REPLIES 8
Message 2 of 9
tyler.warner
in reply to: chris

How about something like this. The underscores are to break the text into multiple lines.

 

 

iProperties.Value("Project", "Description") = "<TUBING, SQUARE <" _
& Parameter("Width") _
& "> X <" & Parameter("Height") _
& "> X <" & Parameter("Length") _
& "> LONG"

 

 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
Message 3 of 9
Curtis_Waguespack
in reply to: chris

Hi @chris 

 

I don't think you can insert the Parameters to be a "live" formula in this way, instead you must use iproperties.

 

Meaning that if you use Parameters it will simply get the value of the parameter at the moment, and will not update the description if the parameter changes in the future ( unless the rule runs).

 

What you can do though is export the parameter as an iProperty:

 

Curtis_Waguespack_0-1674688023931.png

 

Then you can use something like this to set the formula in the description:

 

iProperties.Value("Project", "Description") = _
"= TUBING, SQUARE <Width> X <Height> X <Length> LONG"

 

This will give you a result such as this:

 

Curtis_Waguespack_4-1674688344243.png

 

 

Recall that you can format the way the parameter export by right clicking them as shown:

Curtis_Waguespack_3-1674688177298.png

 

And then using these options:

 

Curtis_Waguespack_2-1674688160077.png

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Message 4 of 9
chris
in reply to: Curtis_Waguespack

@Curtis_Waguespack Yes, this is how I have always done this, except last night it wasn't working.

 

see video

 

Message 5 of 9
chris
in reply to: chris

what I want to do with the square / Rect tubing is to have the parameter "Shape" be available in the description... but it's not working 

chris_0-1674689471502.png

 

 

Message 6 of 9
A.Acheson
in reply to: chris

If the parameter is a text parameter this won't work directly because of the lack of export option to iproperty.

 

You need the ilogic rule first to create a custom iproperty and set it to the parameter value.  

iProperties.Value("Custom", "Shape") = Shape

What is being used in the forumula is not the parameter but rather the iproperty name either. 

AAcheson_0-1674693283351.png

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 7 of 9
chris
in reply to: A.Acheson

@A.Acheson @Curtis_Waguespack @tyler.warner 

 

Tyler, I've never seen the "case" word in iLogic, what is that?

 

Message 8 of 9
A.Acheson
in reply to: chris

Here is how to remove unit identifier for inches [ " ]  from a string. Use the string function replace. 

 

AAcheson_3-1674703042640.png

 

 

1. Populate Description by code

 

 

'Trigering Criteria, Local Parameters are only used to trigger the rule to run. 
a = Width 
b = Height
c = Thk

'Replaces " with Empty String.
Dim width As String = iProperties.Value("Custom", "Width").ToString.Replace("""", "")
Dim height As String = iProperties.Value("Custom", "Height").ToString.Replace("""", "")
Dim thk As String = iProperties.Value("Custom", "Thk").ToString.Replace("""", "")

'Set Description iproperty.
iProperties.Value("Project", "Description") = "L " & width & " x " & height & " x " & thk & " x "

 

 

 Result:

AAcheson_2-1674701145488.png

 

2. Populate Description by expression:

= L <Width> X <Height> X <Thk>

 

AAcheson_5-1674703974214.png

 

 

 

 

'Trigering Criteria, Local Parameters are only used to trigger the rule to run. 
a = Width 
b = Height
c = Thk

'Replaces " with Empty String.
iProperties.Value("Custom", "Width") = iProperties.Value("Custom", "Width").ToString.Replace("""", "")
iProperties.Value("Custom", "Height") = iProperties.Value("Custom", "Height").ToString.Replace("""", "")
iProperties.Value("Custom", "Thk") = iProperties.Value("Custom", "Thk").ToString.Replace("""", "")

 

 

 

 

Triggering this rule was a lot trickier than I had imagined.

What did Work:

It is necessary to have the local parameters in the rule in order for the rule to be automatically triggered on parameter change.

What didn't work:

  • Simply setting the rule to run on the event trigger of change of iproperties did not work. Changing the parameter and exporting the parameter is not considered a change to iproperty it seems. 

AAcheson_4-1674703307703.png

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 9 of 9
chris
in reply to: chris

FYI, I got it figured out !!!!!

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

Post to forums  

Autodesk Design & Make Report