Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to "Highlight in Model" using the API's?

5 REPLIES 5
Reply
Message 1 of 6
0001des
963 Views, 5 Replies

How to "Highlight in Model" using the API's?

Anyone know the API's for "Highlight in model," or is that not exposed?

5 REPLIES 5
Message 2 of 6
stever66
in reply to: 0001des

Message 3 of 6
karim.djenkal
in reply to: 0001des

Hi,

Have you found anything interesting since?

Thanks.

Message 4 of 6
0001des
in reply to: karim.djenkal

Lol. No.

That project ended ages ago and i stopped asking Autodesk for help.
Message 5 of 6

ElementId elementId = new ElementId(id);
List<ElementId> ids = new List<ElementId>();
ids.Add(elementId);
UIDocument uiDoc = app.ActiveUIDocument;
uiDoc.Selection.SetElementIds(ids);
uiDoc.ShowElements(ids);

Message 6 of 6

Try This:

                Element myElement = doc.GetElement(uidoc.Selection.GetElementIds().First());

                using (Transaction tx = new Transaction(doc))
                {
                    tx.Start("Manual Color Override");

                    OverrideGraphicSettings ogs = new OverrideGraphicSettings();
                    OverrideGraphicSettings ogsCheeck = doc.ActiveView.GetElementOverrides(myElement.Id);
                    FillPatternElement myFillPattern = new FilteredElementCollector(doc).OfClass(typeof(FillPatternElement)).Cast<FillPatternElement>().First(a => a.Name.Contains("Solid fill"));

                    ogs.SetSurfaceBackgroundPatternId(myFillPattern.Id);
                    ogs.SetSurfaceBackgroundPatternColor(new Autodesk.Revit.DB.Color(255, 255, 0));

                    if (ogsCheeck.SurfaceBackgroundPatternId.IntegerValue != -1) 
                    {
                        doc.ActiveView.SetElementOverrides(myElement.Id, new OverrideGraphicSettings()); //if it already has overwrites, this removes it.
                    }
                    else
                    {
                        doc.ActiveView.SetElementOverrides(myElement.Id, ogs);
                    }

                    uidoc.ActiveView.get_Parameter(BuiltInParameter.VIEW_DESCRIPTION).Set(myElement.Id.IntegerValue.ToString());
                    tx.Commit();
                }

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community