<?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: Change DisplayUnitSystem or Unit Formats in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11700962#M48425</link>
    <description>&lt;P&gt;Maybe it does work. Create a wall in your project that is 1 metre long. Look at its length in the user interface. Change the project units.&amp;nbsp;Look at its length in the user interface again. Hasn't it changed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2023 07:33:07 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2023-01-24T07:33:07Z</dc:date>
    <item>
      <title>Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8175207#M48413</link>
      <description>&lt;P&gt;If the doc.DisplayUnitSystem is set to Imperial and I change all the Units format by SetFormatOptions to metric format, will that be same as a doc.DisplayUnitSystem set to Metric...??&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 06:58:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8175207#M48413</guid>
      <dc:creator>ratno123s</dc:creator>
      <dc:date>2018-08-03T06:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179041#M48414</link>
      <description>&lt;P&gt;Have you tried it out yet? What is the result, please? Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 06:23:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179041#M48414</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-08-06T06:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179517#M48415</link>
      <description>&lt;P&gt;Since you asked me to test myself... I wrote the following code and bumped into another problem..The Unit formats doesn't change!!! Even when I change the units_doc.SetFormatOptions(ut, nFt);!!!&lt;/P&gt;&lt;P&gt;I opened two documents in my Revit Session. One with the basic Imperial template and the other one with basic Metric template. Then i tried to copy the units.FormatOptions of one document to another document for all the UnitTypes...There was not exceptions faced while debugging.. and "quick watch" ing while debug suggested that the Units.Formatoptions had changed.. However when the program ended nothing reflected in the revit .. as if no changes had taken place...&lt;/P&gt;&lt;P&gt;below is the code:&lt;/P&gt;&lt;PRE&gt;Document doc;
UIDocument uiDoc;
Application app;
UIApplication uiApp;

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
this.doc = commandData.Application.ActiveUIDocument.Document;
this.uiDoc = commandData.Application.ActiveUIDocument;
this.app = commandData.Application.Application;
this.uiApp = commandData.Application;
try
{
 Document doc1 = this.app.Documents.Cast&amp;lt;Document&amp;gt;().Where(x =&amp;gt; x.Title != this.doc.Title).FirstOrDefault();&lt;BR /&gt; Units units_doc = this.doc.GetUnits();&lt;BR /&gt; Units units_1 = doc1.GetUnits();&lt;BR /&gt; List&amp;lt;UnitType&amp;gt; unitTypes = Enum.GetValues(typeof(UnitType)).Cast&amp;lt;UnitType&amp;gt;().ToList();//UnitUtils.GetValidUnitTypes().ToList();&lt;BR /&gt; foreach (var ut in unitTypes.Where(x =&amp;gt; x != UnitType.UT_Undefined &amp;amp;&amp;amp; x != UnitType.UT_Custom))&lt;BR /&gt; {&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; FormatOptions fmtOpts_1 = units_1.GetFormatOptions(ut);&lt;BR /&gt; FormatOptions fmtOpts_doc = units_doc.GetFormatOptions(ut);&lt;BR /&gt; //units_doc.SetFormatOptions(ut, fmtOpts_1); //since this did not work i wrote the below two lines&lt;BR /&gt; FormatOptions ft = new FormatOptions(fmtOpts_1);&lt;BR /&gt; ft.UseDefault = false;&lt;BR /&gt; units_doc.SetFormatOptions(ut, ft);&lt;BR /&gt; fmtOpts_doc = units_doc.GetFormatOptions(ut); // during debug this showed that the unit formats had changed.&lt;BR /&gt; }&lt;BR /&gt; catch (Exception ex)&lt;BR /&gt; {&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;
return Result.Succeeded;
}
catch(Exception ex)
{
return Result.Failed;
}

}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;next I tried with just one simple code on a imperial template revit file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;try
{
UnitType ut = UnitType.UT_Length;
FormatOptions ft_doc = units_doc.GetFormatOptions(ut);
//FormatOptions ft_1 = units_1.GetFormatOptions(ut);
FormatOptions nFt = new FormatOptions();
nFt.UseDefault = false;
nFt.DisplayUnits = DisplayUnitType.DUT_MILLIMETERS;
units_doc.SetFormatOptions(ut, nFt);
}
catch (Exception ex)
{
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;even this did not work!!!&lt;/P&gt;&lt;P&gt;Is not possible to change the format options through code??&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 11:33:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179517#M48415</guid>
      <dc:creator>ratno123s</dc:creator>
      <dc:date>2018-08-06T11:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179518#M48416</link>
      <description>&lt;P&gt;Currently i am using revit 2017 to test&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 11:28:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179518#M48416</guid>
      <dc:creator>ratno123s</dc:creator>
      <dc:date>2018-08-06T11:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179525#M48417</link>
      <description>&lt;P&gt;When in doubt, always first check the Revit SDK samples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, the Units sample may be a good place to look.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 11:35:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8179525#M48417</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-08-06T11:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181784#M48418</link>
      <description>&lt;P&gt;Got it...&lt;/P&gt;&lt;P&gt;Document.SetUnit() !!!&lt;/P&gt;&lt;P&gt;Thanks Jeremy... You are a great teacher&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 08:58:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181784#M48418</guid>
      <dc:creator>ratno123s</dc:creator>
      <dc:date>2018-08-07T08:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181827#M48419</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your appreciation and confirmation!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 09:18:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181827#M48419</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-08-07T09:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181869#M48420</link>
      <description>&lt;P&gt;According to my findings... The Document.DisplayUnitSystem depends solely on the format of Units for UnitType.UT_Length....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that correct?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 09:41:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181869#M48420</guid>
      <dc:creator>ratno123s</dc:creator>
      <dc:date>2018-08-07T09:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181872#M48421</link>
      <description>&lt;P&gt;Just by changing the Unit format of UT_Length the DisplayUnitSystem of the document changes automatically changes&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 09:42:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/8181872#M48421</guid>
      <dc:creator>ratno123s</dc:creator>
      <dc:date>2018-08-07T09:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11699068#M48422</link>
      <description>&lt;P&gt;hello , i want to change the unit of my project from meter to&amp;nbsp;&lt;SPAN&gt;millimeter&amp;nbsp; i can do that directly? or i stick to change the value of my parameter from meter to millimeter&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 15:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11699068#M48422</guid>
      <dc:creator>Houba3314</dc:creator>
      <dc:date>2023-01-23T15:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11699338#M48423</link>
      <description>&lt;P&gt;I would suggest researching this from the end user point of view and determining the &lt;U&gt;best practices&lt;/U&gt; there before even starting to think about doing anything on this programmatically. Otherwise, you could easily end up shooting yourself in the foot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://duckduckgo.com/?q=revit+change+project+units&amp;amp;atb=v343-1&amp;amp;ia=web" target="_blank"&gt;https://duckduckgo.com/?q=revit+change+project+units&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 16:29:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11699338#M48423</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-01-23T16:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11700956#M48424</link>
      <description>&lt;P&gt;I tried this but it doesnt seem to work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Units units = doc.GetUnits();&lt;/P&gt;&lt;P&gt;// Change the display units of length to feet&lt;BR /&gt;units.GetFormatOptions(UnitType.UT_Length).DisplayUnits = DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES;&lt;/P&gt;&lt;P&gt;// Apply the new units to the project&lt;BR /&gt;doc.SetUnits(units);&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 07:31:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11700956#M48424</guid>
      <dc:creator>Houba3314</dc:creator>
      <dc:date>2023-01-24T07:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11700962#M48425</link>
      <description>&lt;P&gt;Maybe it does work. Create a wall in your project that is 1 metre long. Look at its length in the user interface. Change the project units.&amp;nbsp;Look at its length in the user interface again. Hasn't it changed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 07:33:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11700962#M48425</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-01-24T07:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Change DisplayUnitSystem or Unit Formats</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11701167#M48426</link>
      <description>&lt;P&gt;when&amp;nbsp; i do that manually project units and change it does work indeed but for some reason when i run the code it doesnt i will try again maybe my revit is slow or something&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 09:14:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/change-displayunitsystem-or-unit-formats/m-p/11701167#M48426</guid>
      <dc:creator>Houba3314</dc:creator>
      <dc:date>2023-01-24T09:14:15Z</dc:date>
    </item>
  </channel>
</rss>

