Message 1 of 3
Override graphics settings in DirectShape objects

Not applicable
10-30-2019
08:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys,
I am overriding the graphics settings for each of my DirectShape objects I seem to be able to only control the color of the lines, but I can't get access to actually changing the color of the surfaces which I also need, only their transparency.
The only way I could do it is via the Revit UI is there any way I can change the forground pattern to solid via the API?
here is my code:
´´´ for (int i = 0; i < solids.Count; i++) { DirectShape ds = DirectShape.CreateElement(doc, category); ds.ApplicationId = id_addin; ds.ApplicationDataId = areaObjects[i].UniqueId; IList<GeometryObject> list = new List<GeometryObject>(); GeometryObject g = solids[i] as GeometryObject; list.Add(g); ds.SetShape(list);
Color color = new Color(255, 0, 0); OverrideGraphicSettings overrideGS = new OverrideGraphicSettings(); overrideGS.SetProjectionLineColor(color); overrideGS.SetSurfaceForegroundPatternColor(color); overrideGS.SetSurfaceBackgroundPatternColor(color); overrideGS.SetSurfaceForegroundPatternVisible(true); overrideGS.SetSurfaceTransparency(35); overrideGS.SetCutLineColor(color); doc.ActiveView.SetElementOverrides(ds.Id, overrideGS);
ds.Name = "Area volume for " + areaObjects[i].Name; } ´´´
Any hints would be great,
Thanks in advance