<?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: HELP: How get the &amp;quot;StringValue&amp;quot; of shared parameter? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545623#M73387</link>
    <description>&lt;P&gt;It looks like you are dealing with a type parameter in this situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As such, you need to retrieve the parameter from the FamilySymbol, and not from the FamilyInstance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you change&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;Parameter&lt;/FONT&gt; &lt;STRONG&gt;gymCategoria&lt;/STRONG&gt; = fi.LookupParameter("&lt;STRONG&gt;Categoria GyM&lt;/STRONG&gt;");&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;Parameter&lt;/FONT&gt; &lt;STRONG&gt;gymCategoria&lt;/STRONG&gt; = fi.Symbol.LookupParameter("&lt;STRONG&gt;Categoria GyM&lt;/STRONG&gt;");&lt;/PRE&gt;&lt;P&gt;then you should be able to correctly read its value.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Mar 2015 23:24:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-03-17T23:24:23Z</dc:date>
    <item>
      <title>HELP: How get the "StringValue" of shared parameter?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545462#M73386</link>
      <description>&lt;P&gt;Hello everyone:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can getting of a Element the value the properties and shared parameters efficiently?.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See image:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG width="578" title="parameter_shared.png" height="471" src="https://forums.autodesk.com/t5/image/serverpage/image-id/158657iC3D96D11964EC95E/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="parameter_shared.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code, but not works because the result is "&lt;STRONG&gt;none&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;Parameter&lt;/FONT&gt; &lt;STRONG&gt;gymCategoria&lt;/STRONG&gt; = fi.LookupParameter("&lt;STRONG&gt;Categoria GyM&lt;/STRONG&gt;");

&lt;FONT color="#3366FF"&gt;TaskDialog&lt;/FONT&gt;.Show(&lt;FONT color="#FF0000"&gt;"GYM-BIM", "Collector = "&lt;/FONT&gt; + ParameterToString(&lt;STRONG&gt;gymCategoria&lt;/STRONG&gt;));

/// &amp;lt;summary&amp;gt;
/// Helper function: return a string form of a given parameter.
/// &amp;lt;/summary&amp;gt;
        &lt;FONT color="#3366FF"&gt;public static string&lt;/FONT&gt; ParameterToString(Parameter param)
        {
            string val = "&lt;STRONG&gt;&lt;FONT color="#000000"&gt;none&lt;/FONT&gt;&lt;/STRONG&gt;";

            if (param == null)
            {
                return val;
            }

            // To get to the parameter value, we need to pause it depending on its storage type 

            switch (param.StorageType)
            {
                case StorageType.Double:
                    double dVal = param.AsDouble() * 0.3048;
                    val = dVal.ToString();
                    break;
                case StorageType.Integer:
                    int iVal = param.AsInteger();
                    val = iVal.ToString();
                    break;
                case StorageType.String:
                    string sVal = param.AsString();
                    val = sVal;
                    break;
                case StorageType.ElementId:
                    ElementId idVal = param.AsElementId();
                    val = idVal.IntegerValue.ToString();
                    break;
                case StorageType.None:
                    break;
            }
            return val;
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 21:44:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545462#M73386</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T21:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: HELP: How get the "StringValue" of shared parameter?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545623#M73387</link>
      <description>&lt;P&gt;It looks like you are dealing with a type parameter in this situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As such, you need to retrieve the parameter from the FamilySymbol, and not from the FamilyInstance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you change&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;Parameter&lt;/FONT&gt; &lt;STRONG&gt;gymCategoria&lt;/STRONG&gt; = fi.LookupParameter("&lt;STRONG&gt;Categoria GyM&lt;/STRONG&gt;");&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;Parameter&lt;/FONT&gt; &lt;STRONG&gt;gymCategoria&lt;/STRONG&gt; = fi.Symbol.LookupParameter("&lt;STRONG&gt;Categoria GyM&lt;/STRONG&gt;");&lt;/PRE&gt;&lt;P&gt;then you should be able to correctly read its value.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 23:24:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545623#M73387</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T23:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: HELP: How get the "StringValue" of shared parameter?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545653#M73388</link>
      <description>&lt;P&gt;I executed the change but does not work :(.&lt;/P&gt;&lt;P&gt;Keeps coming "none"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG width="301" title="parameter_shared2.png" height="210" src="https://forums.autodesk.com/t5/image/serverpage/image-id/158920i2617B994259589E3/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="parameter_shared2.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heré the code complete:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public void GenerateFormworkToElements(string category)
        {
            SubTransaction createFormwork = new SubTransaction(m_revit.ActiveUIDocument.Document);
            try
            {
                createFormwork.Start();                

                FilteredElementCollector collector = new FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(FamilyInstance));

                if (category == "Structural Columns")
                {

                    int i = 0;
                    foreach (FamilyInstance fi in collector)
                    {

                        if (fi.StructuralType == StructuralType.Column)
                        {

                            //Get parameter "Tipo de Altura"                          
                            Parameter tipoAltura = fi.LookupParameter("Tipo de Altura");

                            //Get parameter "H" Height
                            Parameter  height = fi.LookupParameter("H");

                            //Get parameter "Encofrado"
                            Parameter encofrado = fi.LookupParameter("Encofrado");

                            //Get parameter "GyM Categoría"
                            Parameter gymCategoria = fi.&lt;FONT color="#FF0000"&gt;Symbol&lt;/FONT&gt;.LookupParameter("Categoria GyM");
                            
                            TaskDialog.Show("GYM-BIM", "Collector = " + fi.Name
                                            + "\nContador = " + i
                                            + "\nId =" + fi.Id
                                + "\nCategory = " + ParameterToString(gymCategoria)
                                + "\nHeight = " + ParameterToString(height)
                                + "\nTipo Altura = " + ParameterToString(tipoAltura)
                                + "\nEncofrado = " + ParameterToString(encofrado)
                                            );
                            if (i == 5)
                            {

                                break;
                            }
                            //}
                            i++;
                        }
                    }

                    TaskDialog.Show("GYM-BIM", "Collector Total = " + i);
                }

                createFormwork.Commit();
            }
            catch (Exception ex)
            {
                TaskDialog.Show("GenerateFormworkToElements", "Error = " + ex.Message);
                createFormwork.RollBack();
            }

        }

        /// &amp;lt;summary&amp;gt;
        /// Helper function: return a string form of a given parameter.
        /// &amp;lt;/summary&amp;gt;
        public static string ParameterToString(Parameter param)
        {
            string val = "none";

            if (param == null)
            {
                return val;
            }

            // To get to the parameter value, we need to pause it depending on its storage type 

            switch (param.StorageType)
            {
                case StorageType.Double:
                    double dVal = param.AsDouble() * 0.3048;
                    val = dVal.ToString();
                    break;
                case StorageType.Integer:
                    int iVal = param.AsInteger();
                    val = iVal.ToString();
                    break;
                case StorageType.String:
                    string sVal = param.AsString();
                    val = sVal;
                    break;
                case StorageType.ElementId:
                    ElementId idVal = param.AsElementId();
                    val = idVal.IntegerValue.ToString();
                    break;
                case StorageType.None:
                    break;
            }
            return val;
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2015 23:47:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545653#M73388</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-17T23:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: HELP: How get the "StringValue" of shared parameter?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545669#M73389</link>
      <description>&lt;P&gt;Can you find the GUID of the parameter from your shared parameters file, and then attempt to lookup the parameter using&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#3366FF"&gt;Parameter&lt;/FONT&gt; &lt;STRONG&gt;gymCategoria&lt;/STRONG&gt; = fi.get_Parameter(new Guid("GUIDVALUEFROMSHAREDPARAMFILE"));&lt;/PRE&gt;&lt;P&gt;For some reason, the parameter isn't being found when you are looking it up by name. &amp;nbsp;I don't see any other issues with the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't believe that it's possible for a shared parameter to have a StorageType of None.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, to be sure that the error is happening when trying to lookup the parameter, can you change&lt;/P&gt;&lt;PRE&gt;case StorageType.None:
    break;&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;case StorageType.None:&lt;BR /&gt;    val = "StorageTypeNone";
    break;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 00:00:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/help-how-get-the-quot-stringvalue-quot-of-shared-parameter/m-p/5545669#M73389</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-18T00:00:28Z</dc:date>
    </item>
  </channel>
</rss>

