<?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: Unable to get parameter.AsString() value when the parameter is readonly in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10712298#M22907</link>
    <description>&lt;P&gt;Since the parameter in question is a shared parameter do you get the same result when you access the parameter via Element.get_Parameter(GUID)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value appears accessible on RevitLookup in it's read only state. If you get to the same RevitLookup information page via 'Snoop DB' is the value still available or not i.e. when coming from a collection there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there more to this picture such as having the same parameter on host and secondary nested elements etc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Oct 2021 17:06:02 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2021-10-25T17:06:02Z</dc:date>
    <item>
      <title>Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711444#M22898</link>
      <description>&lt;P&gt;I've been struggling with this weird problem for a few hours now &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have some elements that has a parameter called PANEL ID. sometimes this parameter is in readonly mode.&lt;/P&gt;&lt;P&gt;When I'm accessing the element directly, like in this example, I can get the parameter value perfectly fine:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Element element = doc.GetElement(new ElementId(3697816));
Definition parameterDefinition = element1.LookupParameter("PANEL ID")?.Definition;
Parameter par = element1.get_Parameter(parameterDefinition);
string parValue = par.AsString();&lt;/LI-CODE&gt;&lt;P&gt;Here above, the ID number is the number of such element that has a Panel ID value which is readonly. This code works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here, when accessing the same kinds of elements as part of any collection, parValue is empty (""):&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; foreach (Element element1 in elementsList)
            {
                Definition parameterDefinition = element1.LookupParameter("PANEL ID")?.Definition;
                if(parameterDefinition == null)
                    continue;
                Parameter par = element1.get_Parameter(parameterDefinition);
                string parValue = par.AsString();
            }&lt;/LI-CODE&gt;&lt;P&gt;In here above, parValue is empty for elements that their PANEL ID parameter is readonly. It works fine when the PANEL ID parameter is not readonly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 11:11:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711444#M22898</guid>
      <dc:creator>tomerFUNPJ</dc:creator>
      <dc:date>2021-10-25T11:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711479#M22899</link>
      <description>&lt;P&gt;Where does the collection of Elements come from and what is their IsValidObject property?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sometimes you'll get elements but due to document state they don't have readable values e.g. when you hold onto out of context objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LookupParameter is not an great way of getting parameters, should only be used with non-shared family and project parameters i.e. those without GUID or BuiltInParameter value to use instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also get the parameter directly without the definition (check returned parameter is null instead of checking the definition is null).&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 11:35:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711479#M22899</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-10-25T11:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711491#M22900</link>
      <description>From what I experienced it can be in any kind of collection. For example&lt;BR /&gt;List&amp;lt;Element&amp;gt; elemetsList = GetSelection();&lt;BR /&gt;&lt;BR /&gt;public static List&amp;lt;Element&amp;gt; GetSelection()&lt;BR /&gt;{&lt;BR /&gt;ICollection&amp;lt;ElementId&amp;gt; ids = RevitDBUtils.uidoc.Selection.GetElementIds();&lt;BR /&gt;if (!ids.Any())&lt;BR /&gt;return new List&amp;lt;Element&amp;gt;();&lt;BR /&gt;return ids.Select(x =&amp;gt; x.ToElement()).ToList();&lt;BR /&gt;}</description>
      <pubDate>Mon, 25 Oct 2021 11:33:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711491#M22900</guid>
      <dc:creator>tomerFUNPJ</dc:creator>
      <dc:date>2021-10-25T11:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711525#M22901</link>
      <description>&lt;P&gt;So this comes directly before your previous code block?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What type of parameter is it? The below are some of the reasons for parameters being read only. Some can be ruled out because they are always read only.&lt;/P&gt;&lt;P&gt;Is on element nested in other instance: always read only.&lt;/P&gt;&lt;P&gt;Is built-in parameter that doesn't allow setting via API: always read only.&lt;/P&gt;&lt;P&gt;Is built-in parameter not applicable due to other values: sometimes read only&lt;/P&gt;&lt;P&gt;Is read only due to document state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So why is the parameter you are trying to get a value of read only what is the current state of the document at the time?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 11:52:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711525#M22901</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-10-25T11:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711553#M22902</link>
      <description>It's a parameter type and it's value is a string. The problem is not that some of them are randomly readonly. Some of them are readonly from the model and that's ok (That's how they are in the document as you said). The problem is that I'm unable to read them to parValue if they are readonly. I'm able to read parameters that are not readonly this way.&lt;BR /&gt;Thank you.</description>
      <pubDate>Mon, 25 Oct 2021 11:59:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711553#M22902</guid>
      <dc:creator>tomerFUNPJ</dc:creator>
      <dc:date>2021-10-25T11:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711600#M22903</link>
      <description>&lt;P&gt;You code looks weird to me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In both your samples, you are asking the element for its parameter, then the parameter for the definition, then the definition for the corresponding parameter value on the specific element:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Element &amp;gt; Parameter &amp;gt; Definition &amp;gt; Parameter &amp;gt; AsString&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can skip two of those steps, and just ask the element for its parameter and value directly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Element &amp;gt; Parameter &amp;gt; AsString&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would confuse me a lot less.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe it will confuse Revit and yourself less as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 12:21:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711600#M22903</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-10-25T12:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711658#M22904</link>
      <description>&lt;P&gt;Can you show me with Revitlookup this parameter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it a built-in parameter, shared, non-shared? You say it is has a string value, are you getting that from it's StorageType?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably you have invalid objects or are not getting the exact parameter you think you are, that's all I can say from what you have told me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 12:42:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711658#M22904</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-10-25T12:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711711#M22905</link>
      <description>&lt;P&gt;Thanks. Now I am closer to the problem origin. The problem now only happens on a list which is filtered by a&amp;nbsp;BoundingBoxIntersectsFilter:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Outline outline = new Outline(bb.Min, bb.Max);
            BoundingBoxIntersectsFilter bbfilter = new BoundingBoxIntersectsFilter(outline); //filters if element falls within BBox

            FilteredElementCollector collector = new FilteredElementCollector(doc); //create collector, on current document
            ElementMulticategoryFilter filter1 = new ElementMulticategoryFilter(ElementsCategories); //create filter using categories list
            ICollection&amp;lt;ElementId&amp;gt; AllElements = collector.WherePasses(filter1).WhereElementIsNotElementType().ToElementIds(); //add filters  to collector and get elements
            if (AllElements.Count == 0)
                return new List&amp;lt;Element&amp;gt;();
            List&amp;lt;Element&amp;gt; res = new List&amp;lt;Element&amp;gt;(new FilteredElementCollector(doc, AllElements).WherePasses(bbfilter).ToElements());
            foreach (Element element1 in res)
            {
                Parameter par = element1.LookupParameter("PANEL ID");
                if (par == null)
                    continue;
                int id = element1.Id.IntegerValue;
                string parValue = par.AsString();
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Here I create the list where the problem occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 12:59:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10711711#M22905</guid>
      <dc:creator>tomerFUNPJ</dc:creator>
      <dc:date>2021-10-25T12:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10712298#M22907</link>
      <description>&lt;P&gt;Since the parameter in question is a shared parameter do you get the same result when you access the parameter via Element.get_Parameter(GUID)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value appears accessible on RevitLookup in it's read only state. If you get to the same RevitLookup information page via 'Snoop DB' is the value still available or not i.e. when coming from a collection there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there more to this picture such as having the same parameter on host and secondary nested elements etc?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 17:06:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10712298#M22907</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-10-25T17:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10713499#M22908</link>
      <description>&lt;P&gt;Seems like my problem was not using doc.Regenerate();&lt;/P&gt;&lt;P&gt;My readonly params were updated from other elements, that that parameters were changed. But I couldn't see it in the API until I used&amp;nbsp;doc.Regenerate();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 06:49:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10713499#M22908</guid>
      <dc:creator>tomerFUNPJ</dc:creator>
      <dc:date>2021-10-26T06:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10713533#M22909</link>
      <description>&lt;P&gt;Another interesting context that could be added to the list of situations requiring regen:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.33" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.33&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 07:07:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/10713533#M22909</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-10-26T07:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/12076181#M22910</link>
      <description>&lt;P&gt;Good day,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to the Revit API and I think the issue I am experiencing is similar to the above though I cannot get it to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to read the value of a parameter as a sting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a particular element, as I understand it, the below should work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;element.LookupParameter()metod.AsSting()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sure I am missing a basic thing, but I really got stuck here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would appreciate the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 10:46:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/12076181#M22910</guid>
      <dc:creator>wagnerhNA49Z</dc:creator>
      <dc:date>2023-07-03T10:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/12076987#M22911</link>
      <description>&lt;P&gt;Reading a parameter as a sting sounds painful!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your screen snapshot, you display an error trying to call a method by the name&amp;nbsp;&lt;SPAN&gt;LookupParameters.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Revit API does not define any such method. Do you mean &lt;SPAN&gt;LookupParameter?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2023/4400b9f8-3787-0947-5113-2522ff5e5de2.htm" target="_blank"&gt;https://www.revitapidocs.com/2023/4400b9f8-3787-0947-5113-2522ff5e5de2.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lesson 1 in computer programming: unfortunately, it will do (exactly) what you tell it to do, not what you think, or hope.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 17:30:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/12076987#M22911</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-07-03T17:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get parameter.AsString() value when the parameter is readonly</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/12078047#M22912</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the response. Apologies I made a mistake in the code when I took the screenshot. The real error I get is in the attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried the ToString() method.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 07:15:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/unable-to-get-parameter-asstring-value-when-the-parameter-is/m-p/12078047#M22912</guid>
      <dc:creator>wagnerhNA49Z</dc:creator>
      <dc:date>2023-07-04T07:15:56Z</dc:date>
    </item>
  </channel>
</rss>

