Occurrence material color change

Occurrence material color change

PACDrafting
Collaborator Collaborator
735 Views
2 Replies
Message 1 of 3

Occurrence material color change

PACDrafting
Collaborator
Collaborator

Hi

 

How do I change the a part material render style within an assembly?

 

I have tried this below. It changes the name but doesn't update the render style.

Sub Material()

Dim oassy As AssemblyDocument
Set oassy = ThisApplication.ActiveDocument

Dim ocompdef As AssemblyComponentDefinition
Set ocompdef = oassy.ComponentDefinition

Dim ooccurr As ComponentOccurrences
Set ooccurr = ocompdef.Occurrences

Dim opartdef As ComponentDefinition
Set opartdef = ooccurr.Item(11).Definition

opartdef.Material.RenderStyle.Name = "Red"

End Sub

 

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

xiaoyan.qi
Alumni
Alumni
Accepted solution

hi

 

you can try to change the last statement as below

 

   opartdef.Material.RenderStyle = opartdef.Document.RenderStyles.Item("Red")

   ' the original statement  opartdef.Material.RenderStyle.Name = "Red"

 

Let me know if it works

Thanks

Mick

0 Likes
Message 3 of 3

PACDrafting
Collaborator
Collaborator

Hi Mick,  works fine.

 

Thanks

0 Likes