Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have some parts and I need to only change the color for all the features rather than changing the material. I write below codes which works well for a part, however it doesnot work well for a sheet metal part.
Please see below screen shot, when I run the codes for the sheet metal part, it does change the color to orange but it misses two areas on the flange features.
Can someone help and advise where is my problem?
Thanks!
Sub Main() Dim oPDoc As PartDocument = ThisApplication.ActiveDocument Dim oColorList As New ArrayList oColorList.Add("BZ - Blue Zinc Plating") oColorList.Add("Natural Yellow (Ko)") oColorList.Add("Orange (Joy)") oColorList.Add("Tech Pubs - 1st Alternative") Dim oSelectedColor As String oSelectedColor = InputListBox("Choose one color.", oColorList, "BZ - Blue Zinc Plating", "Color List", "List") Dim oLocalAsset As Asset Try oLocalAsset = oPDoc.Assets.Item(oSelectedColor) Catch Dim oAppLib As AssetLibrary = ThisApplication.AssetLibraries.Item("Ko_Matl_App") Dim oLibAsset As Asset = oAppLib.AppearanceAssets.Item(oSelectedColor) oLocalAsset = oLibAsset.CopyTo(oPDoc) End Try Dim oPCompDef As PartComponentDefinition = oPDoc.ComponentDefinition Dim oPFeatures As PartFeatures = oPCompDef.Features Dim oPFeature As PartFeature For Each oPFeature In oPFeatures oPFeature.Appearance = oLocalAsset Next End Sub
Solved! Go to Solution.