Hey all, I'm making a quick macro to change the color of the assembly that I have selected in the tree. I thought it would be really simple, but it's malfunctioning for some reason. First off, I'd like to change the color of the assembly I have selected, not just it's appearance in the assembly in which it's selected. Second, the color does change, but it goes totally black!! If I remove the appearance, it goes back to the default color. Any ideas?
<p>Dim swApp As SldWorks.SldWorks</p><p>Dim Part As Object</p><p>Dim swModel As SldWorks.ModelDoc2</p><p>Dim swSelMgr As SldWorks.SelectionMgr</p><p>Dim swSelComp As SldWorks.Component2</p><p>Dim dMatProps As Variant</p><p>Dim vNames As Variant</p><p></p><p>Sub main()</p><p></p><p>Set swApp = Application.SldWorks</p><p>Set swModelDoc = swApp.ActiveDoc</p><p>Set swSelMgr = swModelDoc.SelectionManager</p><p></p><p>Set swSelComp = swSelMgr.GetSelectedObjectsComponent4(1, -1)</p><p></p><p>dMatProps = swSelComp.GetMaterialPropertyValues2(1, vNames)</p><p></p><p>'set the properties array to the desires color</p><p>dMatProps(0) = 0</p><p>dMatProps(1) = 255 / 256</p><p>dMatProps(2) = 255 / 256</p><p></p><p>'set the component properties to the changed array properties</p><p>swSelComp.SetMaterialPropertyValues2 dMatProps, 1, vNames</p><p></p><p>End Sub</p>SolidworksApi macros
