Change Selected Face Appearance in Part

Change Selected Face Appearance in Part

ngdnam88
Advocate Advocate
442 Views
2 Replies
Message 1 of 3

Change Selected Face Appearance in Part

ngdnam88
Advocate
Advocate

Dear All,

Could you help me the iLogic Code to change the face's color in the part?

I tried this code but I got the error message:

Dim oDOC As PartDocument = ThisApplication.ActiveDocument
Dim oFACE = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select an Item")
Dim oColour As String = "Red"
Dim oStyle As RenderStyle = oDOC.RenderStyles.Item(oColour) 
oFACE.SetRenderStyle(kOverrideRenderStyle, oStyle)

 The Error

ngnam1988_0-1642234018493.png

 

Thanks!

 

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

JelteDeJong
Mentor
Mentor
Accepted solution

I have altered your code a bit and it works for me.

Dim oDOC As PartDocument = ThisApplication.ActiveDocument
Dim oFACE As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select an Item")
Dim oColour As String = "Red"
Dim oStyle As RenderStyle
Try
	oStyle  = oDOC.RenderStyles.Item(oColour)
Catch ex As Exception
	MsgBox("Style 'Red' could not be selected")
	return
End Try
oFACE.SetRenderStyle(StyleSourceTypeEnum.kOverrideRenderStyle, oStyle)

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

ngdnam88
Advocate
Advocate

Thanks @JelteDeJong 
The key of iLogic Code is: 

oFACE.SetRenderStyle(StyleSourceTypeEnum.kOverrideRenderStyle, oStyle)

 Thanks for your help!

0 Likes