Attempting to change the colour of a part based on a perimeter

Attempting to change the colour of a part based on a perimeter

emilda.chiuye
Enthusiast Enthusiast
363 Views
2 Replies
Message 1 of 3

Attempting to change the colour of a part based on a perimeter

emilda.chiuye
Enthusiast
Enthusiast

Hello

I have a number of tubes(part) with varying wall thicknesses of which I would like the colour of the tubes to change based on the thickness(perimeter), so the range of wall thicknesses and colours are as follows :

3.5-6.4mm should be red, 

6.5-9.4mm should be yellow, 

9.5-12.5mm should be Green and finally any wall thickness less than 3.5 should be grey in colour.

With the help of google I managed to find a solution and tweaked it a bit to suit my situation.

In my head it all makes sense but unfortunately Inventor disagrees, it returns with a massive syntax error!

I have pasted the error and the rule below. 

Please kindly assist me.

emildachiuye_2-1640098403805.png

If WALL_THICKNESS >= 9.5 Then
Feature.Color("Tube A") = "RED"
And If WALL_THICKNESS <= 12.5 Then
Feature.Color("Tube A") = "RED"
End If
If WALL_THICKNESS >= 6.5 Then
Feature.Color("Tube A") = "YELLOW"
And If WALL_THICKNESS <= 9.4 Then
Feature.Color("Tube A") = "YELLOW"
End If
If WALL_THICKNESS >= 3.5 Then
Feature.Color("Tube A") = "GREEN"
And If WALL_THICKNESS <= 6.4 Then
Feature.Color("Tube A") = "GREEN"
End If
If WALL_THICKNESS < 3.5 Then
Feature.Color("Tube A") = "GREY"
End If
 

 

0 Likes
Accepted solutions (1)
364 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

Try this and make sure the colour names exist in your part

If (WALL_THICKNESS < 3.5) Then
    Feature.Color("Tube A") = "GREY"
ElseIf (3.5 <= WALL_THICKNESS And WALL_THICKNESS <= 6.4) Then
    Feature.Color("Tube A") = "RED"
ElseIf (6.5 <= WALL_THICKNESS And WALL_THICKNESS <= 9.4) Then
    Feature.Color("Tube A") = "YELLOW"
ElseIf (9.5 <= WALL_THICKNESS And WALL_THICKNESS <= 12.5) Then
    Feature.Color("Tube A") = "GREEN"
End If

 

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

Message 3 of 3

emilda.chiuye
Enthusiast
Enthusiast

Thank you so much!

Works 👍Perrrfectly 😀

0 Likes