How to set custom Iproperty with strings and parameter using Ilogic

How to set custom Iproperty with strings and parameter using Ilogic

Anonymous
Not applicable
3,310 Views
5 Replies
Message 1 of 6

How to set custom Iproperty with strings and parameter using Ilogic

Anonymous
Not applicable

Hi,

I created a sheet metal template with different thicknesses and I am trying to code an Ilogic rule that would set a custom Iproperty named "MATERIAL DESCRIPTION" with 2 different outcomes that would automatically change depending on the thickness value.

 

1- I would like the "MATERIAL DESCRIPTION" property to display "PLATE 3/4" if the thickness is a standard fraction (from 1/8" to 1"). In this case, the value "3/4" is linked to a parameter named EPA that is driven by the thickness of the sheet metal.

 

2- If the thickness value is not a standard fraction (like gauge plate), I want the "MATERIAL DESCRIPTION" property to display "PLATE GAUGE 4 (.2242 in)". In this case, the value "4" is linked to a parameter named GAUGE_SIZE that is driven by an Ilogic rule. This rule is a "Select case" function that changes the GAUGE_SIZE value according to the thickness of the sheet metal. The ".2242" value is linked to the Thickness parameters of the sheet metal.

 

Usually, when I want to link a parameter to this "MATERIAL DESCRIPTION" Iproperty, I would do this :

1-  =PLATE <EPA>

or

2-  =PLATE GAUGE <GAUGE_SIZE> (<Thickness>)

 

This works perfectly fine when I only have one case. Although, in this situation, it can either be case 1 or case 2. How do I write the code so the "MATERIAL DESCRIPTION" would either be case 1 or case 2 depending on the thickness (see pictures to see what I have tried) ?? Material description Ilogic.png

0 Likes
Accepted solutions (1)
3,311 Views
5 Replies
Replies (5)
Message 3 of 6

johnsonshiue
Community Manager
Community Manager

Hi! If I understood VB syntax correctly, Case condition should be unique like what you have on the left. You cannot have multiple case condition within one Case. If you have more elaborated condition, you should use If Else instead of Case.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 4 of 6

Yijiang.Cai
Autodesk
Autodesk
Accepted solution

@Anonymous, I think you got the right direction here. Please see the updated code lines from me -

 

Select Case Thickness
	Case 0.125, 0.5
		iProperties.Value("Custom", "MATERIAL DESCRIPTION")="Plate" & CStr(EPA)
	Case Else
		iProperties.Value("Custom", "MATERIAL DESCRIPTION")="PLATE GAUGE" & CStr(GAUGE_SIZE) & "(" & CStr(Thickness) & ")"
End Select

 

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Email: River-Yijiang.Cai@autodesk.com
Message 5 of 6

Anonymous
Not applicable

Hi,

 

thank you very much that works ! I only added a RoundToFraction function in order to display the Plate thickness in correctly.

 

Ilogic.png

0 Likes
Message 6 of 6

Anonymous
Not applicable

Hi,

that is not correct. You can use Case function with multiple conditions... Using an ElseIf function would only extend the code for no reason.

thank you 

0 Likes