#RTCEUR Wish 2: Override graphics by Element

Increasing the complexity a bit from the previous post, this sample shows how to Override Graphics by Element. In this case, the cut & project line weight and color are overridden in the active view for the specified elements.

public void overrideElements()
{
    Document doc = this.ActiveUIDocument.Document;
    OverrideGraphicSettings ogs = new OverrideGraphicSettings();
    ogs.SetCutLineColor(new Color(0,255,0));
    ogs.SetCutLineWeight(6);
    ogs.SetProjectionLineColor(new Color(0,0,255));
    ogs.SetProjectionLineWeight(6);
    using (Transaction t = new Transaction(doc,"Overrides"))
    {
        t.Start();
        foreach (ElementId id in getIds(doc))
        {
            doc.ActiveView.SetElementOverrides(id, ogs);
        }
        t.Commit();
    }
}
Advertisements

One thought on “#RTCEUR Wish 2: Override graphics by Element

  1. I think that the more interesting appraoch would be to be able to reset the override per element or make a selection based upon elements that have an override per element because this is the lowest for of override you can’t manage it anywhere.

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