<?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: Reading Wrong Type Parameters Values in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693341#M53284</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;Thanks again for elaborating it. I'm struggling with technical inputs, as my background is in software development, I don't know much about how Revit works internally. However, as per our discussion, at least I know the values I'm getting from API is in Imperial Units. Now, I could work on converting imperial units to metric units.&lt;/P&gt;&lt;P&gt;The solution that was shared i.e&amp;nbsp;&lt;SPAN&gt;UnitUtils&amp;nbsp;&lt;/SPAN&gt;class seems interesting, I tried it&amp;nbsp;and again got stuck with the Enum&amp;nbsp; [&lt;EM&gt;DisplayUnitType&lt;/EM&gt;&amp;nbsp;] value because I can see a lot of types to select for conversion and&amp;nbsp;i'm not sure which type to select. &lt;EM&gt;See the below image&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="error code.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/450350iF1CDF1F5B5D06903/image-size/large?v=v2&amp;amp;px=999" role="button" title="error code.png" alt="error code.png" /&gt;&lt;/span&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would appreciate if you could explain how a non-technical person like me can use the convert method to see exact parameter's values as it is being displayed in the Revit 2017. Thank you so much for your kind input.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2018 10:45:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-01-16T10:45:31Z</dc:date>
    <item>
      <title>Reading Wrong Type Parameters Values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693089#M53281</link>
      <description>&lt;P&gt;I've developed a family browser, where I can search and find families and can read their additional information. However, the value I'm reading&amp;nbsp;for type parameter is different from one shows in the Revit 2017. Below is the screenshot of property window of my application and Revit&amp;nbsp;2017. Here the value &lt;STRONG&gt;displays for Dimension's Depth is different from one I can see in the Revit&lt;/STRONG&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="parameter error.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/450319i979E41B5D0DE5B68/image-size/large?v=v2&amp;amp;px=999" role="button" title="parameter error.PNG" alt="parameter error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the &lt;STRONG&gt;code behind:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        static string FamilyParamValueString(FamilyType t, FamilyParameter fp, Document doc)
        {
            
            
            string value = t.AsValueString(fp);

            
            switch (fp.StorageType)
            {
                case StorageType.Double:
                    value = Util.RealString(
                      (double)t.AsDouble(fp))
                      + " (double)";

                    break;

                case StorageType.ElementId:
                    ElementId id = t.AsElementId(fp);
                    Element e = doc.GetElement(id);
                    value = id.IntegerValue.ToString() + " ("
                      + Util.ElementDescription(e) + ")";
                    break;

                case StorageType.Integer:
                    value = t.AsInteger(fp).ToString()
                      + " (int)";
                    break;

                case StorageType.String:
                    value = "'" + t.AsString(fp)
                      + "' (string)";
                    break;
            }

            return value;
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here's how I'm calling the&amp;nbsp;&lt;STRONG&gt;FamilyParamValueString&lt;/STRONG&gt; method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  foreach (FamilyType familytype in mgr.Types)
            {

                string name = familytype.Name;
                MultiValueDictionary&amp;lt;string, Tuple&amp;lt;string, string&amp;gt;&amp;gt; Parameters = new MultiValueDictionary&amp;lt;string, Tuple&amp;lt;string, string&amp;gt;&amp;gt;();

                foreach (string key in keys)
                {
                    FamilyParameter fp = fps[key];
                    var definition = fp.Definition;
                    string ParameterGroupid = LabelUtils.GetLabelFor(definition.ParameterGroup);

                    if (familytype.HasValue(fp))
                    {
                        // Reading type's parameter value
                        string value = FamilyParamValueString(familytype, fp, doc);

                        //store parameter information along with its group
                        Parameters.Add(ParameterGroupid, new Tuple&amp;lt;string, string&amp;gt;(key, value));

                    }
                }

                

            }&lt;/PRE&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;&lt;P&gt;Please guide me, how I can able to read exactly the same values as it displays in the Revit type's properties. Thank you for support!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 08:52:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693089#M53281</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T08:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Wrong Type Parameters Values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693160#M53282</link>
      <description>&lt;P&gt;Just a question:&lt;/P&gt;&lt;P&gt;Do you work in metric units?&lt;/P&gt;&lt;P&gt;What the API shows you is Imperial units (feet, etc...)...&lt;/P&gt;&lt;P&gt;Could be an explanation...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 09:24:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693160#M53282</guid>
      <dc:creator>BenoitE&amp;A</dc:creator>
      <dc:date>2018-01-16T09:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Wrong Type Parameters Values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693187#M53283</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Ali,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for bringing this question here in addition to our discussion in the comments on The Building Coder article on Family Parameter Value:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2009/11/family-parameter-value.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2009/11/family-parameter-value.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As said, the Revit API will always return exactly what you have in the Revit database, unmodified.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In the database, all lengths are stored in imperial units:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2011/03/internal-imperial-units.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2011/03/internal-imperial-units.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That cannot be changed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can easily convert them to any unit you wish yourself, and the Revit API provides support for that as well, e.g. via the ConvertFromInternalUnits method:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://www.revitapidocs.com/2018.1/9cc2c0ea-f59f-9d76-ce19-ae7eede03bbd.htm" target="_blank"&gt;http://www.revitapidocs.com/2018.1/9cc2c0ea-f59f-9d76-ce19-ae7eede03bbd.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Actually, the AsValueString method also sometimes returns what the user sees, and not the internal database value. All the other accessors, such as AsDouble and its siblings, return the raw database values. I mostly avoid using AsValueString for this very reason.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;To see convert values to other units and to determine what units are displayed in the Revit user interface, please refer to the Units and UnitUtils classes:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://www.revitapidocs.com/2018.1/89d89465-897f-4105-b935-27edf67aab3e.htm" target="_blank"&gt;http://www.revitapidocs.com/2018.1/89d89465-897f-4105-b935-27edf67aab3e.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://www.revitapidocs.com/2018.1/128dd879-fea8-5d7b-1eb2-d64f87753990.htm" target="_blank"&gt;http://www.revitapidocs.com/2018.1/128dd879-fea8-5d7b-1eb2-d64f87753990.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The Units class represents a document's default settings for formatting numbers with units as strings.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;UnitUtils helps convert a value from one display unit to another, such as square feet to square meters.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For more information on unit handling, please refer to The Building Coder category on that topic:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/units" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/units&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers, &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 09:31:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693187#M53283</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-01-16T09:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Wrong Type Parameters Values</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693341#M53284</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;Thanks again for elaborating it. I'm struggling with technical inputs, as my background is in software development, I don't know much about how Revit works internally. However, as per our discussion, at least I know the values I'm getting from API is in Imperial Units. Now, I could work on converting imperial units to metric units.&lt;/P&gt;&lt;P&gt;The solution that was shared i.e&amp;nbsp;&lt;SPAN&gt;UnitUtils&amp;nbsp;&lt;/SPAN&gt;class seems interesting, I tried it&amp;nbsp;and again got stuck with the Enum&amp;nbsp; [&lt;EM&gt;DisplayUnitType&lt;/EM&gt;&amp;nbsp;] value because I can see a lot of types to select for conversion and&amp;nbsp;i'm not sure which type to select. &lt;EM&gt;See the below image&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="error code.png" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/450350iF1CDF1F5B5D06903/image-size/large?v=v2&amp;amp;px=999" role="button" title="error code.png" alt="error code.png" /&gt;&lt;/span&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would appreciate if you could explain how a non-technical person like me can use the convert method to see exact parameter's values as it is being displayed in the Revit 2017. Thank you so much for your kind input.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 10:45:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/reading-wrong-type-parameters-values/m-p/7693341#M53284</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-16T10:45:31Z</dc:date>
    </item>
  </channel>
</rss>

