<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How change the color a element? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651824#M72225</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using this code and not works with the parameters element Id and color. I'm doing wrong?.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if (category == "&lt;STRONG&gt;Parts&lt;/STRONG&gt;")&lt;BR /&gt;{&lt;BR /&gt; FilteredElementCollector collector = new FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(FamilyInstance));&lt;BR /&gt;&lt;BR /&gt; int i = 0;foreach (FamilyInstance fi in collector) {
                        
//Get parameters 
//Perforacion y cableado                            
Parameter perforacion = fi.LookupParameter("Dia Planeado de Perforacion e Inyeccion");
//Perfilado                            
Parameter perfilado = fi.LookupParameter("Dia Planeado de Perfilado");
//Acero
Parameter acero = fi.LookupParameter("Dia Planeado de Colocacion de Acero");
//Encofrado                            
Parameter encofrado = fi.LookupParameter("Dia Planeado de Encofrado");
//Concreto                            
Parameter concreto = fi.LookupParameter("Dia Planeado de Concreto");
//Tensado                            
Parameter tensado = fi.LookupParameter("Dia Planeado de Tensado");
&lt;/PRE&gt;
&lt;PRE&gt;if (ParameterToString(perforacion).Equals(day))
{
//change to color: Celeste
Color color = m_revit.ActiveUIDocument.Application.Application.Create.NewColor();
color.Blue = ( byte ) 150;
color.Red = ( byte ) 200;
color.Green = ( byte ) 200;

&lt;FONT color="#FF0000"&gt;m_revit.ActiveUIDocument.Document.ActiveView.&lt;STRONG&gt;SetElementOverrides&lt;/STRONG&gt;(&lt;FONT color="#0000FF"&gt;fi.Id&lt;/FONT&gt;, &lt;FONT color="#0000FF"&gt;color&lt;/FONT&gt;);&lt;/FONT&gt;
                            }
}&lt;/PRE&gt;
&lt;PRE&gt;}&lt;/PRE&gt;
&lt;PRE&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2015 13:46:35 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-05-26T13:46:35Z</dc:date>
    <item>
      <title>How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651177#M72222</link>
      <description>&lt;P&gt;Hello everyone:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying change the color a element but the following code not work. I am using Revit 2015. The element is "Parts".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For to change to color I am using a foreach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;FilteredElementCollector collector = new 

FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(FamilyInstance));


foreach (FamilyInstance fi in collector)
                    {
Color color = m_revit.ActiveUIDocument.Application.Application.Create.NewColor();
                                      color.Blue = ( byte ) 150;
                                      color.Red = ( byte ) 200;
                                      color.Green = ( byte ) 200;

doc.ActiveView.&lt;FONT color="#FF0000"&gt;set_ProjColorOverrideByElement&lt;/FONT&gt;(fi.Id, color);

}&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;set_ProjColoOverrideByElement&lt;/STRONG&gt; is deprecate in Revit 2015?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank's for you help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2015 22:41:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651177#M72222</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-25T22:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651299#M72223</link>
      <description>&lt;P&gt;Here goes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UIApplication uiapp = commandData.Application;&lt;BR /&gt;UIDocument uidoc = uiapp.ActiveUIDocument;&lt;BR /&gt;Application app = uiapp.Application;&lt;BR /&gt;Document doc = uidoc.Document;&lt;/P&gt;
&lt;P&gt;Color color = app.Create.NewColor();&lt;BR /&gt;color.Blue = (byte)150;&lt;BR /&gt;color.Red = (byte)0;&lt;BR /&gt;color.Green = (byte)0;&lt;/P&gt;
&lt;P&gt;Selection sel = uidoc.Selection;&lt;/P&gt;
&lt;P&gt;Reference ref1 = sel.PickObject(&lt;BR /&gt;ObjectType.Element,&lt;BR /&gt;"Pick element to change its colour");&lt;BR /&gt;&lt;BR /&gt;Element elem = doc.GetElement(ref1.ElementId);&lt;/P&gt;
&lt;P&gt;List&amp;lt;ElementId&amp;gt; ids = new List&amp;lt;ElementId&amp;gt;(1);&lt;BR /&gt;ids.Add(elem.Id);&lt;/P&gt;
&lt;P&gt;Transaction trans = new Transaction(doc);&lt;BR /&gt;trans.Start("ChangeColor");&lt;/P&gt;
&lt;P&gt;doc.ActiveView.set_ProjColorOverrideByElement(ids, color);&lt;/P&gt;
&lt;P&gt;trans.Commit();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;
&lt;P&gt;Sanjay Pandey&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 03:38:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651299#M72223</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-26T03:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651756#M72224</link>
      <description>On 2015 this method was replaced with&lt;BR /&gt;&lt;BR /&gt;uiDoc.ActiveView.SetElementOverrides(....)</description>
      <pubDate>Tue, 26 May 2015 12:59:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651756#M72224</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2015-05-26T12:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651824#M72225</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using this code and not works with the parameters element Id and color. I'm doing wrong?.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if (category == "&lt;STRONG&gt;Parts&lt;/STRONG&gt;")&lt;BR /&gt;{&lt;BR /&gt; FilteredElementCollector collector = new FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(FamilyInstance));&lt;BR /&gt;&lt;BR /&gt; int i = 0;foreach (FamilyInstance fi in collector) {
                        
//Get parameters 
//Perforacion y cableado                            
Parameter perforacion = fi.LookupParameter("Dia Planeado de Perforacion e Inyeccion");
//Perfilado                            
Parameter perfilado = fi.LookupParameter("Dia Planeado de Perfilado");
//Acero
Parameter acero = fi.LookupParameter("Dia Planeado de Colocacion de Acero");
//Encofrado                            
Parameter encofrado = fi.LookupParameter("Dia Planeado de Encofrado");
//Concreto                            
Parameter concreto = fi.LookupParameter("Dia Planeado de Concreto");
//Tensado                            
Parameter tensado = fi.LookupParameter("Dia Planeado de Tensado");
&lt;/PRE&gt;
&lt;PRE&gt;if (ParameterToString(perforacion).Equals(day))
{
//change to color: Celeste
Color color = m_revit.ActiveUIDocument.Application.Application.Create.NewColor();
color.Blue = ( byte ) 150;
color.Red = ( byte ) 200;
color.Green = ( byte ) 200;

&lt;FONT color="#FF0000"&gt;m_revit.ActiveUIDocument.Document.ActiveView.&lt;STRONG&gt;SetElementOverrides&lt;/STRONG&gt;(&lt;FONT color="#0000FF"&gt;fi.Id&lt;/FONT&gt;, &lt;FONT color="#0000FF"&gt;color&lt;/FONT&gt;);&lt;/FONT&gt;
                            }
}&lt;/PRE&gt;
&lt;PRE&gt;}&lt;/PRE&gt;
&lt;PRE&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2015 13:46:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651824#M72225</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-26T13:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651846#M72226</link>
      <description>I believe you need to:&lt;BR /&gt;&lt;BR /&gt;OverrideGraphicSettings ogs= new OverrideGraphicSettings();&lt;BR /&gt;ogs.SetProjectionLineColor(color); // or other here&lt;BR /&gt;&lt;BR /&gt;And then&lt;BR /&gt;&lt;BR /&gt;m_revit.ActiveUIDocument.Document.ActiveView.SetElementOverrides(fi.Id, ogs);</description>
      <pubDate>Tue, 26 May 2015 13:56:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5651846#M72226</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2015-05-26T13:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5653514#M72227</link>
      <description>&lt;P&gt;Hello Augusto:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank's very much for respond.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code not have errores but the execute in Revit displays the following message:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/170502iD06CA124791AC62B/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="change_color_1.png" title="change_color_1.png" width="392" height="347" /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I not understand the problem in this point.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The Code:&lt;/P&gt;
&lt;PRE&gt;foreach (Part fi in collector){&amp;nbsp;...........&lt;/PRE&gt;
&lt;PRE&gt;if (ParameterToString(perforacion) == day)
 {
TaskDialog.Show("GYM-BIM", "Color Celeste = " + day);
//change to color: light blue
Color color = m_revit.ActiveUIDocument.Application.Application.Create.NewColor();
color.Blue = (byte)255;
color.Red = (byte)0;
color.Green = (byte)255;

OverrideGraphicSettings ogs = new OverrideGraphicSettings();
ogs.SetProjectionLineColor(color); // or other here

m_revit.ActiveUIDocument.Document.ActiveView.SetElementOverrides(&lt;STRONG&gt;fi.Id&lt;/STRONG&gt;, &lt;STRONG&gt;ogs&lt;/STRONG&gt;);

                            }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 13:57:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5653514#M72227</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-27T13:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5653941#M72228</link>
      <description>Please try create the color with:&lt;BR /&gt;&lt;BR /&gt;Color color = new Color(0, 255, 255); // RGB</description>
      <pubDate>Wed, 27 May 2015 17:27:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5653941#M72228</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2015-05-27T17:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: How change the color a element?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5654023#M72229</link>
      <description>&lt;P&gt;Augusto:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank's very much.&amp;nbsp;Now works very good.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 18:07:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-change-the-color-a-element/m-p/5654023#M72229</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-27T18:07:56Z</dc:date>
    </item>
  </channel>
</rss>

