Override Graphics Settings DirectShape

Override Graphics Settings DirectShape

Anonymous
Not applicable
1,741 Views
1 Reply
Message 1 of 2

Override Graphics Settings DirectShape

Anonymous
Not applicable

Hi guys,

 

I am overriding the Grahic Settings via the OverrideGraphicSettings class. I have been sucessfull in only changing the transparendy of the surface as well as the line color. But What is most of interest for me is to change the surface color. 

Via the Revit UI it can be done :

 

Capture.PNG

 

Is there a way were I can set the forground pattern to be solid in the API?

 

here is the code I have tried

 

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 tips would be great!

 

Thanks

0 Likes
1,742 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

The best way to control the direct shape graphic settings is via the category, cf. 

 

https://thebuildingcoder.typepad.com/blog/2018/01/directshape-topics-and-happy-new-year.html#7

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes