<?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: How to define Document ParameterBindings Definition is shared parameter and get GUID? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10783558#M22202</link>
    <description>&lt;P&gt;I am sorry, I can't find the GetTypeId&amp;nbsp;&lt;SPAN&gt;method on InternalDefinitions class.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can you explain in more detail to define the&amp;nbsp;external parameter in BindingMap Class?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2021.1/1f5f93dd-0ddc-c7d6-9ac1-332f0f14a5ae.htm" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://www.revitapidocs.com/2021.1/1f5f93dd-0ddc-c7d6-9ac1-332f0f14a5ae.htm&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Nov 2021 12:03:08 GMT</pubDate>
    <dc:creator>s04049</dc:creator>
    <dc:date>2021-11-26T12:03:08Z</dc:date>
    <item>
      <title>How to define Document ParameterBindings Definition is shared parameter and get GUID?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10779385#M22197</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to define shared Parameter and project parameter form&amp;nbsp;doc.ParameterBindings function,&lt;/P&gt;&lt;P&gt;however I got Object reference not set to an instance of an object error, even is shared parameter object.&lt;/P&gt;&lt;P&gt;I am following an old blog post , is there any change on revit 2021?&lt;/P&gt;&lt;P&gt;&lt;A href="https://spiderinnet.typepad.com/blog/2011/05/parameter-of-revit-api-30-project-parameter-information.html" target="_blank" rel="noopener"&gt;https://spiderinnet.typepad.com/blog/2011/05/parameter-of-revit-api-30-project-parameter-information.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;	        BindingMap I_BM=_doc.ParameterBindings;
            DefinitionBindingMapIterator it = I_BM.ForwardIterator();
            it.Reset();
            while(it.MoveNext())
            {
                Definition def = it.Key;
                try
                {
                    ExternalDefinition extDef = def as ExternalDefinition;
                    MessageBox.Show(extDef.GUID.ToString());
                }
                catch(Exception ex)
                {
                    //Normal Project Parameter
                    MessageBox.Show(ex.Message+ex.StackTrace);
                }
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 14:56:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10779385#M22197</guid>
      <dc:creator>s04049</dc:creator>
      <dc:date>2021-11-24T14:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Document ParameterBindings Definition is shared parameter and get GUID?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10779879#M22198</link>
      <description>&lt;P&gt;Instances of the ExternalDefinition class only exist in the shared parameter file (DefinitionsFile) and are only used for methods that deal with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You therefore can't cast to one from the bindings keys, these I think are of type InternalDefinition. If so this has the method&amp;nbsp;InternalDefinition.GetTypeId that will hold the GUID (if definition is for a shared parameter).&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 18:31:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10779879#M22198</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-11-24T18:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Document ParameterBindings Definition is shared parameter and get GUID?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10781375#M22199</link>
      <description>&lt;P&gt;Getting into the Building Map with Revit Lookup, there are only show Instance Binding and Type Binding.&lt;/P&gt;&lt;P&gt;nothing to get from there.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="s04049_0-1637835975660.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/993684i7D4D54C979E39AFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="s04049_0-1637835975660.png" alt="s04049_0-1637835975660.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 11:21:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10781375#M22199</guid>
      <dc:creator>s04049</dc:creator>
      <dc:date>2021-11-25T11:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Document ParameterBindings Definition is shared parameter and get GUID?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10781381#M22200</link>
      <description>&lt;P&gt;Yes, but you were iterating the map with&amp;nbsp;DefinitionBindingMapIterator and getting the key values (Keys are the Definitions not the values). RevitLookup doesn't do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e. BindingMap.Item property takes a Definition to return a Binding.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 11:33:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10781381#M22200</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-11-25T11:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Document ParameterBindings Definition is shared parameter and get GUID?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10781539#M22201</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public Function Obj_211125a(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result

        Dim app = commandData.Application
        Dim uidoc = commandData.Application.ActiveUIDocument
        Dim IntDoc = uidoc.Document

        Dim PB As BindingMap = IntDoc.ParameterBindings

        Dim PBM_FwdIt As DefinitionBindingMapIterator = PB.ForwardIterator

        PBM_FwdIt.Reset()
        While PBM_FwdIt.MoveNext = True
            Dim IDef As InternalDefinition = PBM_FwdIt.Key
            Dim Ty As String = ""
            If PBM_FwdIt.Current.GetType = GetType(InstanceBinding) Then
                Ty = "(Instance)"
            ElseIf PBM_FwdIt.Current.GetType = GetType(TypeBinding) Then
                Ty = "(Type)"
            End If

            Debug.WriteLine(IDef.Name &amp;amp; " " &amp;amp; IDef.GetTypeId.TypeId &amp;amp; " " &amp;amp; Ty)

        End While

        Return Result.Succeeded


    End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample output for project parameter:&lt;BR /&gt;&lt;FONT color="#800080"&gt;rpt autodesk.parameter.aec.revit.project:610094-1.0.0 (Instance)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample output for shared parameter:&lt;BR /&gt;&lt;FONT color="#800080"&gt;ProfileAngle autodesk.parameter.aec.revit.external.-1:e544d5d1a0cb490bb276d191cd8b1456-1.0.0 (Type)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can be seen from above you can get the Guid of the shared parameter or the ElementId (presumed) of the non-shared project parameter using the above method. The Guid is not in a convenient form but you can get it. Not sure if there is an easier way because the SharedParameterElement class is not just for those bound in the project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although you can't cast an InternalDefinition to an ExternalDefinition you can feed an ExternalDefinition into&amp;nbsp;&lt;SPAN&gt;BindingMap.Item to get the binding (which is more common).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 13:00:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10781539#M22201</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-11-25T13:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Document ParameterBindings Definition is shared parameter and get GUID?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10783558#M22202</link>
      <description>&lt;P&gt;I am sorry, I can't find the GetTypeId&amp;nbsp;&lt;SPAN&gt;method on InternalDefinitions class.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can you explain in more detail to define the&amp;nbsp;external parameter in BindingMap Class?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2021.1/1f5f93dd-0ddc-c7d6-9ac1-332f0f14a5ae.htm" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://www.revitapidocs.com/2021.1/1f5f93dd-0ddc-c7d6-9ac1-332f0f14a5ae.htm&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 12:03:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10783558#M22202</guid>
      <dc:creator>s04049</dc:creator>
      <dc:date>2021-11-26T12:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Document ParameterBindings Definition is shared parameter and get GUID?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10783615#M22203</link>
      <description>&lt;P&gt;Sorry didn't see you were limited to 2021, it was probably introduced in 2022.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a better alternative for both anyway:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public Function Obj_211126a(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result

        Dim app = commandData.Application
        Dim uidoc = commandData.Application.ActiveUIDocument
        Dim IntDoc = uidoc.Document

        Dim PB As BindingMap = IntDoc.ParameterBindings

        Dim PBM_FwdIt As DefinitionBindingMapIterator = PB.ForwardIterator

        PBM_FwdIt.Reset()
        While PBM_FwdIt.MoveNext = True
            Dim IDef As InternalDefinition = PBM_FwdIt.Key
            Dim Ty As String = ""
            If PBM_FwdIt.Current.GetType = GetType(InstanceBinding) Then
                Ty = "(Instance)"
            ElseIf PBM_FwdIt.Current.GetType = GetType(TypeBinding) Then
                Ty = "(Type)"
            End If

            Dim IdStr As String = ""
            Dim El As Element = IntDoc.GetElement(IDef.Id)
            If El.GetType = GetType(SharedParameterElement) Then
                Dim SPE As SharedParameterElement = El
                IdStr = SPE.GuidValue.ToString
            ElseIf El.GetType = GetType(ParameterElement) Then
                IdStr = CStr(IDef.Id.IntegerValue)
            End If

            Debug.WriteLine(IDef.Name &amp;amp; " " &amp;amp; IdStr &amp;amp; " " &amp;amp; Ty)

        End While

        Return Result.Succeeded


    End Function&lt;/LI-CODE&gt;&lt;P&gt;Sample output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rpt 610094 (Instance)&lt;/P&gt;&lt;P&gt;ProfileAngle e544d5d1-a0cb-490b-b276-d191cd8b1456 (Type)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 12:31:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-define-document-parameterbindings-definition-is-shared/m-p/10783615#M22203</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-11-26T12:31:36Z</dc:date>
    </item>
  </channel>
</rss>

