<?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: Temporarily highlight an element (without selecting) in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8160358#M48552</link>
    <description>&lt;P&gt;I think this is similar to the last suggestion, but maybe slightly different:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2010/06/highlight-elements.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2010/06/highlight-elements.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 13:16:13 GMT</pubDate>
    <dc:creator>stever66</dc:creator>
    <dc:date>2018-07-27T13:16:13Z</dc:date>
    <item>
      <title>Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8158595#M48549</link>
      <description>&lt;P&gt;Is there any way to temporarily highlight an element through the API, other than by selection? I'm working on a script that&amp;nbsp;shows the user the elements that don't have dimensions attached to them. Something similar to the way elements turn orange on an error would be great.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 19:13:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8158595#M48549</guid>
      <dc:creator>jmlovelace</dc:creator>
      <dc:date>2018-07-26T19:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8159297#M48550</link>
      <description>&lt;P&gt;Dear Jake Lovelace,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try element graphic override, see code snippet below:&lt;/P&gt;
&lt;PRE&gt;OverrideGraphicSettings overrideGraphicSettings = new OverrideGraphicSettings();
Color color = new Color(255, 0, 0);
overrideGraphicSettings.SetCutFillColor(color);
overrideGraphicSettings.SetCutLineColor(color);
overrideGraphicSettings.SetCutFillPatternVisible(true);
overrideGraphicSettings.SetProjectionFillColor(color);
overrideGraphicSettings.SetProjectionLineColor(color);
overrideGraphicSettings.SetProjectionFillPatternVisible(true);
doc.ActiveView.SetElementOverrides(elemId, overrideGraphicSettings);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 02:52:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8159297#M48550</guid>
      <dc:creator>JimJia</dc:creator>
      <dc:date>2018-07-27T02:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8159743#M48551</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just an idea.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could post a failure by yourself.&lt;/P&gt;&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2010/11/failure-api-take-two.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2010/11/failure-api-take-two.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've added a line for defining the elements to be highlighted.&lt;/P&gt;&lt;P&gt;I didn't test this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;transaction.Start();
FailureMessage fm = new FailureMessage( m_idWarning );
&lt;STRONG&gt;fm.SetFailingElements(yourElements); // &amp;lt;-- add your elements here&lt;/STRONG&gt;
m_doc.PostFailure( fm );
transaction.Commit();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 08:20:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8159743#M48551</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2018-07-27T08:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8160358#M48552</link>
      <description>&lt;P&gt;I think this is similar to the last suggestion, but maybe slightly different:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2010/06/highlight-elements.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2010/06/highlight-elements.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 13:16:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8160358#M48552</guid>
      <dc:creator>stever66</dc:creator>
      <dc:date>2018-07-27T13:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8164827#M48553</link>
      <description>&lt;P&gt;Thanks guys!&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1149164"&gt;@JimJia&lt;/a&gt;'s solution of overriding graphics seems to work well. Going to write it into an iterative script and see how fast it can process&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 13:35:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8164827#M48553</guid>
      <dc:creator>jmlovelace</dc:creator>
      <dc:date>2018-07-30T13:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8486836#M48554</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4382779"&gt;@jmlovelace&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;But I think &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1149164"&gt;@JimJia&lt;/a&gt; 's solution requires an open Transaction.&lt;/P&gt;
&lt;P&gt;I was thinking of wrapping this Highlight operation into a sub transaction.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open a transaction&lt;/LI&gt;
&lt;LI&gt;Open a sub transaction&lt;/LI&gt;
&lt;LI&gt;Overwrite the settings of several elements to 'highlight' them&lt;/LI&gt;
&lt;LI&gt;Prompt user of some infomation or ask them to do some pick operation&lt;/LI&gt;
&lt;LI&gt;Rollback the subtransaction&lt;/LI&gt;
&lt;LI&gt;Continue other operations.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I will take my time to test if it's gonna work.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If you have already tried some good solutions, do you mind discussion? &lt;img id="manhappy" class="emoticon emoticon-manhappy" src="https://forums.autodesk.com/i/smilies/16x16_man-happy.png" alt="Man Happy" title="Man Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Dec 2018 07:37:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8486836#M48554</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2018-12-25T07:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8496164#M48555</link>
      <description>&lt;P&gt;I believe the problem there will be the persistent open transaction. I'm pretty sure Revit does not allow more than one open transaction at a time, and therefore would not be able to make any further edits to the model until the transaction is closed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I managed to get this to work using&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1149164"&gt;@JimJia&lt;/a&gt;'s solution but the downside is it does require an open transaction, meaning the highlight operation is listed in the undo menu once committed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 16:40:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8496164#M48555</guid>
      <dc:creator>jmlovelace</dc:creator>
      <dc:date>2019-01-02T16:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8497262#M48556</link>
      <description>&lt;P&gt;Thank you for replying:&lt;/P&gt;
&lt;P&gt;I have tried &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1149164"&gt;@JimJia&lt;/a&gt;'s solution and the code ran without exceptions.&lt;/P&gt;
&lt;P&gt;As I post, I wrap the 'highlight' operation into a sub-transaction. I did the following steps:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Start transaction&lt;/LI&gt;
&lt;LI&gt;Pick an element (for example, a duct, I didn't tried many other elements because my work is focused on MEP)&lt;/LI&gt;
&lt;LI&gt;Start subtransaction&lt;/LI&gt;
&lt;LI&gt;Override the graphic settings of the picked Duct element&lt;/LI&gt;
&lt;LI&gt;Commit subtransaction&lt;/LI&gt;
&lt;LI&gt;Now we are back to the open 'main' transaction. I start another pick operation to prompt the user to pick something (for example, a point on the former picked element)&lt;/LI&gt;
&lt;LI&gt;Do other job, like modify the documents .&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Codes ran well, no exception. But, in step 6, when picking, Revit does NOT display the correct graphic settings.&lt;/P&gt;
&lt;P&gt;Here are my codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;            using (SubTransaction subt = new SubTransaction(doc))
            {&lt;BR /&gt;                // GetActiveUIView() is my own extension method
                View v = doc.GetElement(Workspace.UiDoc.GetActiveUIView().ViewId) as View;
                OverrideGraphicSettings oldOgs = new OverrideGraphicSettings(v.GetElementOverrides(mainRefer.Id));
                OverrideGraphicSettings newOgs = new OverrideGraphicSettings(oldOgs);

                // 临时修改求出的参照主管的显示颜色&lt;BR /&gt;                // Temporarily change line color
                subt.Start();
                newOgs.SetProjectionLineColor(new Color(200, 0, 0));
                v.SetElementOverrides(mainRefer.Id, newOgs);&lt;BR /&gt;// Workspace is my own Utility static class for easy approach of common API objects, such as doc, uidoc...
                Workspace.Doc.Regenerate();
                Workspace.UiDoc.RefreshActiveView();
                subt.Commit();

                // 在参照主管上拾取一个用来求出行进方向的参照点
                mainPickRef = Workspace.UiDoc.Selection.PickObject(
                     ObjectType.PointOnElement,
                     filter,
                     "单击拾取一个参照点以确定偏移的行进方向");

                // 复位参照图元的显示设置
                subt.Start();
                v.SetElementOverrides(mainRefer.Id, oldOgs);
                subt.Commit();
            }
&lt;/PRE&gt;
&lt;P&gt;Here is the screen shot of Revit UI:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="图像 1.png" style="width: 294px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/586614i9E32BC7EA5605749/image-size/large?v=v2&amp;amp;px=999" role="button" title="图像 1.png" alt="图像 1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In the View settings, all ducts should be displayed with blue line.&lt;/P&gt;
&lt;P&gt;Notice there is a dark gray line duct. I picked that Duct ahead, and invoke another Pick operation. At this moment, it should be displayed with RED line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking that perhaps it's because I had not commit the main Transaction.&lt;/P&gt;
&lt;P&gt;If I override the graphic settings in a Transaction, it works. But in my former mentioned steps, it does NOT work as I demanded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To be honest, I don't want this CHANGING COLOR operation to be listed in the UNDO list &lt;img id="manfrustrated" class="emoticon emoticon-manfrustrated" src="https://forums.autodesk.com/i/smilies/16x16_man-frustrated.png" alt="Man Frustrated" title="Man Frustrated" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 03:17:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8497262#M48556</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2019-01-03T03:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Temporarily highlight an element (without selecting)</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8498169#M48557</link>
      <description>&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/06/ai-news-and-sub-transaction-regen.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2017/06/ai-news-and-sub-transaction-regen.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See this post regarding transaction commits. Evidently the document won't regenerate changes made on the sub-transaction until the main transaction is committed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 14:09:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/temporarily-highlight-an-element-without-selecting/m-p/8498169#M48557</guid>
      <dc:creator>jmlovelace</dc:creator>
      <dc:date>2019-01-03T14:09:21Z</dc:date>
    </item>
  </channel>
</rss>

