Color change using i logic

Color change using i logic

justin.johnsonQLTK2
Contributor Contributor
1,384 Views
5 Replies
Message 1 of 6

Color change using i logic

justin.johnsonQLTK2
Contributor
Contributor

Hi All,

I am new to ilogic. I would like to use part color based on different material and processes, I am using manual appearance change now. Is it possible to automate the processes?

 

The processes flow will be.

 

Open part > Select part > Click the I logic button Change color (Run the script)

 

Open and select part or surface will be manual.

 

Is it possible to add RGB in I logic instead of color name like read, green ec..?

 

Thanks in Advance,

Justin

0 Likes
Accepted solutions (1)
1,385 Views
5 Replies
Replies (5)
Message 2 of 6

Stakin
Collaborator
Collaborator
0 Likes
Message 3 of 6

JMGunnar
Collaborator
Collaborator
0 Likes
Message 4 of 6

JelteDeJong
Mentor
Mentor

If you want a bit more information out of the colouring of your parts (then the rule that Clint wrote) have a look at this post: "Set different colour for each component of Assembly based on the PN." Here the colours are based on the part number.

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

0 Likes
Message 5 of 6

justin.johnsonQLTK2
Contributor
Contributor

Thanks all for your help..

0 Likes
Message 6 of 6

justin.johnsonQLTK2
Contributor
Contributor
Accepted solution
Dim oDoc As PartDocument = ThisDoc.Document
Dim oRenderStyles As RenderStyles = oDoc.RenderStyles
Dim oName As String = "ALUMINIUM_MACHINING"
Dim styleExists As Boolean = False
Dim myStyle As RenderStyle
For Each oRenderStyle As RenderStyle In oRenderStyles
 If oRenderStyle.Name = oName
  styleExists = True
  myStyle = oRenderStyle
  Exit For
 End If
Next
If Not styleExists
 myStyle = oRenderStyles.Add(oName)
 myStyle.SetAmbientColor(255, 190, 190)
 myStyle.SetDiffuseColor(255, 190, 190)
End If

For Each oSurfBod As SurfaceBody In oDoc.ComponentDefinition.SurfaceBodies
 For Each oFace As Face In oSurfBod.Faces
  oFace.SetRenderStyle(37123, myStyle)
 Next
Next


I found this helpful
0 Likes