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: 

change colour of extrusion object

4 REPLIES 4
Reply
Message 1 of 5
dirk.neethling
3379 Views, 4 Replies

change colour of extrusion object

I successfully created an Extrusion. How can I change the colour of the resulting Sweep object, in this case from the Default Grey to black?

Regards, Dirk

 

extrusion_object.png

4 REPLIES 4
Message 2 of 5

Dear Dirk,

 

The number of possible ways to control the colour of a Revit element is rather daunting:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.24

 

I would say take your pick...

 

Also, always ask a product or content creation expert how this is best achieved through the user interface before even thinking about approaching it programmatically.

 

Please let us know how you end up solving this.

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 3 of 5

Hello Jeremy,

 

the solution under

 

http://thebuildingcoder.typepad.com/blog/2011/03/change-element-colour.html

 

looks good, however it's for a Project. Is there a similar solution for a FamilyDocument?

Regards, Dirk

Message 4 of 5

Hello Jeremy,

 

OK, I found this method under [https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/td-p/5651177] which sort of works:

 

            Color color = new Color(0, 0, 0); // RGB (0, 255, 255)
            OverrideGraphicSettings ogs = new OverrideGraphicSettings();
            ogs.SetProjectionLineColor(color);
            ogs.SetProjectionFillColor(color);
            ogs.SetCutFillColor(color);
            ogs.SetCutLineColor(color);
            doc.ActiveView.SetElementOverrides(fiProfile.Id, ogs); 

The problem is my ELement is a Family instance of a Sweep. So the Projection lines are in the right Color, but the Element itself is not really a solid, but just a composite of the projection lines. Thus the question becomes, how can I convert a FamilyInstance of a Sweep into a solid?

 

Regards, Dirk

Message 5 of 5

Maybe the correct approach is to assign various subelements of your family definition different subcategories, and assign appropriate materials to those.

 

Ask a content creation expert, or explore it from the UI yourself.

 

Cheers,

 

Jeremy



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

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community