Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everybody,
I would like to obtain the generic appearance color on the MEP curve objects. At this time, I only succeed to retrieve this information on the surface element by using this sample of code.
private Color GetAppearenceColor(Document doc, Face face) { Color appearenceColor = Color.InvalidColorValue; Material material = doc.GetElement(face.MaterialElementId) as Material; AppearanceAssetElement appearanceElem = material.Document.GetElement(material.AppearanceAssetId) as AppearanceAssetElement; Asset theAsset = appearanceElem.GetRenderingAsset(); AssetProperty colorProperty = theAsset["generic_diffuse"]; Type type = colorProperty.GetType(); object apVal = null; try { // using .net reflection to get the value var prop = type.GetProperty("Value"); if (prop != null && prop.GetIndexParameters().Length == 0) { apVal = prop.GetValue(colorProperty); } else { apVal = "<No Value Property>"; } } catch (Exception ex) { apVal = ex.GetType().Name + "-" + ex.Message; } if (apVal is DoubleArray) { var doubles = apVal as DoubleArray; byte r = (byte)(doubles.get_Item(0) * 255); byte g = (byte)(doubles.get_Item(1) * 255); byte b = (byte)(doubles.get_Item(2) * 255); appearenceColor = new Color(r,g,b); } return appearenceColor; }
Could help us to find a similar approach to get this color information on the MEP curve elements?
Thanks for your help,
Philippe
Solved! Go to Solution.