' Start of iLogic rule ********************************************** ' This rule changes the whole part appearance *********************** ' Define stuff..... Dim tobjs As TransientObjects = ThisApplication.TransientObjects Dim doc As PartDocument Try doc = ThisApplication.ActiveEditDocument Catch MsgBox("You need a part open to run this rule!") End Try Dim feat As PartFeature = Nothing Dim docAssets As Assets = doc.Assets Dim App As Asset = Nothing Try ' Does the asset already exist? App = docAssets.Item("Cadline iLogic Colour") Catch ' Asset doesn't exist yet - create it App = docAssets.Add(AssetTypeEnum.kAssetTypeAppearance, "Generic", _ "Cadline iLogic Adjust Colour", "Cadline iLogic Colour") End Try Dim color As ColorAssetValue = App.Item("generic_diffuse") color.Value = tobjs.CreateColor(R, G, B) Dim floatValue As FloatAssetValue = App.Item("generic_reflectivity_at_0deg") floatValue.Value = Reflectivity floatValue = App.Item("generic_reflectivity_at_90deg") floatValue.Value = Reflectivity ' Control the colour of the whole part ********************** doc.ActiveAppearance = App ' *********************************************************** ' End of iLogic rule ********************************************** ' ***************************************************************************** ' GAP BETWEEN RULES! ' ***************************************************************************** ' Start of iLogic rule ********************************************** ' This rule changes the appearance of a specific feature (called Extrusion1) ' Define stuff..... Dim tobjs As TransientObjects = ThisApplication.TransientObjects Dim doc As PartDocument Try doc = ThisApplication.ActiveEditDocument Catch MsgBox("You need a part open to run this rule!") End Try Dim feat As PartFeature = Nothing Dim docAssets As Assets = doc.Assets Dim App As Asset = Nothing Try ' Does the asset already exist? App = docAssets.Item("Cadline iLogic Feat Colour") Catch ' Asset doesn't exist yet - create it App = docAssets.Add(AssetTypeEnum.kAssetTypeAppearance, "Generic", _ "Cadline iLogic Adjust Feat Colour", "Cadline iLogic Feat Colour") End Try Dim color As ColorAssetValue = App.Item("generic_diffuse") color.Value = tobjs.CreateColor(R, G, B) Dim floatValue As FloatAssetValue = App.Item("generic_reflectivity_at_0deg") floatValue.Value = Reflectivity floatValue = App.Item("generic_reflectivity_at_90deg") floatValue.Value = Reflectivity ' Control the colour of a feature *************************** Try feat = doc.ComponentDefinition.Features.Item("Extrusion1") Catch MsgBox("No feature with that name exists in this part!") Return End Try ' Set the colour of the feature feat.Appearance = App ' ***********************************************************