Set graphic overrides for an element in a view

2014 includes a new View.SetElementOverrides that can be used to set view-specific graphic overrides for a specific element.

public void ElementOverride()
{
    Document doc = this.ActiveUIDocument.Document;
    UIDocument uidoc = this.ActiveUIDocument;
    ElementId id = uidoc.Selection.PickObject(ObjectType.Element,"Select an element").ElementId;
    OverrideGraphicSettings ogs = new OverrideGraphicSettings();
    ogs.SetProjectionLineColor(new Color(0,255,0));
    using (Transaction t = new Transaction(doc,"Set Element Override"))
    {
        t.Start();
        doc.ActiveView.SetElementOverrides(id, ogs);
        t.Commit();
    }
}
Advertisements

8 thoughts on “Set graphic overrides for an element in a view

  1. Hello Harry,

    Do you think it would be possible to create a tool for elevations and sections to add the lineweight to elements based on their distance from the cut line?

    • oops I`m looking to set halftone to items but inside a macro not by filters or worksets (altho I should look that up since I want to make an existing / modified diagram (I could use cad but where’s the fun in that))

      • In 2012 I think the best you can do is use View.CutColorOverrideByElement & View.ProjColorOverrideByElement to override the cut and projection line color for individual elements in a specified view

    • Its kind of odd but I figured out that you have to override each element inside the group instead of the group itself. Interestingly enough, you can reset the override at the group level instead of editing group an resetting the individual elements.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s