<?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 Get value of user parameters at drawing level in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/get-value-of-user-parameters-at-drawing-level/m-p/13284113#M113</link>
    <description>&lt;P&gt;I am trying to access the values of user parameters using VBA. I can access the values of dimensionnal constraints but can't access user parameters.&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-inline" image-alt="InfoLEC_0-1737992298478.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1459481i5A61F0EC188F3A9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="InfoLEC_0-1737992298478.png" alt="InfoLEC_0-1737992298478.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub get_value_of_dimension_parameter()
    'prints out the value of a dimensional constraint parameter in a message box
    
    Dim drawing As AcadDocument
    Dim ParamName As String
    Dim MdlSpc As AcadModelSpace
    Dim obj As Variant
    Dim ConstrName As String
    Dim ConstrValue As Variant
    
    ParamName = "d1"
    
    Set drawing = ThisDrawing
    Set MdlSpc = drawing.ModelSpace
    
    'loop through each object (item) of the ModelSpace
    For Each obj In MdlSpc
        'check if object type is a dimension
        If Left(obj.ObjectName, 4) = "AcDb" And Right(obj.ObjectName, 9) = "Dimension" Then
            'get name and value of active dimension
            ConstrName = obj.DimConstrName
            ConstrValue = obj.DimConstrValue
            'check if we have found the rigth dimension
            If ConstrName = ParamName Then
                MsgBox ConstrValue, vbOKOnly, ConstrName
            End If
        End If
    Next
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jan 2025 16:00:21 GMT</pubDate>
    <dc:creator>InfoLEC</dc:creator>
    <dc:date>2025-01-27T16:00:21Z</dc:date>
    <item>
      <title>Get value of user parameters at drawing level</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-value-of-user-parameters-at-drawing-level/m-p/13284113#M113</link>
      <description>&lt;P&gt;I am trying to access the values of user parameters using VBA. I can access the values of dimensionnal constraints but can't access user parameters.&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-inline" image-alt="InfoLEC_0-1737992298478.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1459481i5A61F0EC188F3A9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="InfoLEC_0-1737992298478.png" alt="InfoLEC_0-1737992298478.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub get_value_of_dimension_parameter()
    'prints out the value of a dimensional constraint parameter in a message box
    
    Dim drawing As AcadDocument
    Dim ParamName As String
    Dim MdlSpc As AcadModelSpace
    Dim obj As Variant
    Dim ConstrName As String
    Dim ConstrValue As Variant
    
    ParamName = "d1"
    
    Set drawing = ThisDrawing
    Set MdlSpc = drawing.ModelSpace
    
    'loop through each object (item) of the ModelSpace
    For Each obj In MdlSpc
        'check if object type is a dimension
        If Left(obj.ObjectName, 4) = "AcDb" And Right(obj.ObjectName, 9) = "Dimension" Then
            'get name and value of active dimension
            ConstrName = obj.DimConstrName
            ConstrValue = obj.DimConstrValue
            'check if we have found the rigth dimension
            If ConstrName = ParamName Then
                MsgBox ConstrValue, vbOKOnly, ConstrName
            End If
        End If
    Next
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 16:00:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-value-of-user-parameters-at-drawing-level/m-p/13284113#M113</guid>
      <dc:creator>InfoLEC</dc:creator>
      <dc:date>2025-01-27T16:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of user parameters at drawing level</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-value-of-user-parameters-at-drawing-level/m-p/13295726#M114</link>
      <description>&lt;P&gt;I wanted to answer this question, because it has been asked before, but without an resolution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I couldn't find much information on it so I asked Lee Ambrosius. Below is what he had to say. Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1706559"&gt;@ambrosl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-olk-copy-source="MessageBody"&gt;There is some basic documentation in the &lt;A href="https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-BD833D49-DD90-4815-B576-8E7B5831A5BC" target="_blank" rel="noopener"&gt;ObjectARX Developer’s Guide&lt;/A&gt;.&amp;nbsp;It explains the dictionary and how it has a pointer to the actual AcDbAssocNetwork object.&amp;nbsp; The objects are spread across several places though in the drawing itself. (The user variable is stored in a dictionary of this network.)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-olk-copy-source="MessageBody"&gt;What you are trying to do isn’t possible with VBA directly as there are no classes exposed at that level.&amp;nbsp; Now you could export the drawing to DXF and parse it for the information you are looking for which could take time based on the size of the drawing file.&lt;BR /&gt;&lt;BR /&gt;You can use AutoLISP to pull the data, write it to a file or dictionary and then read that with VBA to get the current values.&amp;nbsp; Modifying the data would be the reverse, basically push it back to a data file or dictionary that AutoLISP would process.&amp;nbsp; The data isn’t easy to work with though as you will see in the example below it is nested pretty deep but here is some basic code that will locate the dimension and user defined parameter variables and their values.&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;Managed .NET is the best language to use for this.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Below is a sample lisp of how to do this.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(setq assocNetDict (assoc 350 (entget (namedobjdict))))
(setq assocNet
       (entget
                (cdr
                   (assoc
                     330
                     (reverse
                       (entget
                                (cdr
                                   (assoc 350
                                                  (entget
                                                    (cdr assocNetDict)
                                                  )
                                   )
                                )
                       )
                     )
                   )
                )
       )
)
(setq lookUpItems nil)
(foreach item assocNet
  (if (= (car item) 100)
    (if (= (cdr item) "AcDbAssocNetwork")
      (setq lookUpItems T)
    )
  )
  (if (and (= (car item) 360)(= lookUpItems T))
    (progn
      (princ (entget (cdr item)))
    )
  )
) 

((-1 . &amp;lt;Entity name: 220986f46d0&amp;gt;) (0 . ACDBASSOCVARIABLE) (5 . 275) (102 . {ACAD_REACTORS) (330 . &amp;lt;Entity name: 220986f46e0&amp;gt;) (102 . }) (330 . &amp;lt;Entity name: 220986f4670&amp;gt;) (100 . AcDbAssocAction) (90 . 2) (90 . 0) (330 . &amp;lt;Entity name: 220986f4670&amp;gt;) (360 . &amp;lt;Entity name: 0&amp;gt;) (90 . 1) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (100 . AcDbAssocVariable) (90 . 2) (1 . d1) (1 . 13.2902766714) (1 . AcDbCalc:1.0) (1 . ) (40 . 13.2903) (290 . 0) (290 . 0) (90 . 0)) 

((-1 . &amp;lt;Entity name: 220986f4710&amp;gt;) (0 . ACDBASSOC2DCONSTRAINTGROUP) (330 . &amp;lt;Entity name: 220986f4670&amp;gt;) (5 . 279) (100 . AcDbAssocAction) (90 . 2) (90 . 0) (330 . &amp;lt;Entity name: 220986f4670&amp;gt;) (360 . &amp;lt;Entity name: 0&amp;gt;) (90 . 2) (90 . 3) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (90 . 2) (70 . 0) (10 0.0 0.0 0.0) (10 1.0 0.0 0.0) (10 0.0 1.0 0.0) (360 . &amp;lt;Entity name: 0&amp;gt;) (90 . 3) (360 . &amp;lt;Entity name: 220986f4720&amp;gt;) (360 . &amp;lt;Entity name: 220986f46f0&amp;gt;) (360 . &amp;lt;Entity name: 220986f46e0&amp;gt;) (90 . 6) (90 . 0) (90 . 0) (290 . 0) (90 . 6) (1 . AcConstrainedBoundedLine) (90 . 1) (1 . AcConstrainedImplicitPoint) (90 . 2) (1 . AcPointCurveConstraint) (90 . 3) (1 . AcConstrainedImplicitPoint) (90 . 4) (1 . AcPointCurveConstraint) (90 . 5) (1 . AcDistanceConstraint) (90 . 6) (90 . 1) (90 . 2) (90 . 3) (90 . 5) (70 . 1) (330 . &amp;lt;Entity name: 220986f4720&amp;gt;) (90 . 0) (10 18.511 8.74125 0.0) (10 0.833581 0.552398 0.0) (290 . 0) (10 18.511 8.74125 0.0) (11 29.5895 16.0828 0.0) (90 . 2) (90 . 2) (90 . 3) (90 . 6) (70 . 1) (330 . &amp;lt;Entity name: 0&amp;gt;) (90 . 0) (280 . 0) (90 . -1) (90 . 1) (90 . 3) (90 . 2) (90 . 2) (90 . 1) (70 . 0) (90 . 0) (290 . 1) (290 . 1) (90 . 4) (90 . 2) (90 . 5) (90 . 6) (70 . 1) (330 . &amp;lt;Entity name: 0&amp;gt;) (90 . 0) (280 . 1) (90 . -1) (90 . 1) (90 . 5) (90 . 2) (90 . 4) (90 . 1) (70 . 0) (90 . 0) (290 . 1) (290 . 1) (90 . 6) (90 . 2) (90 . 2) (90 . 4) (70 . 0) (90 . 0) (290 . 0) (290 . 1) (340 . &amp;lt;Entity name: 220986f46e0&amp;gt;) (340 . &amp;lt;Entity name: 220986f46f0&amp;gt;) (280 . 0))
 

((-1 . &amp;lt;Entity name: 220986f4730&amp;gt;) (0 . ACDBASSOCVARIABLE) (330 . &amp;lt;Entity name: 220986f4670&amp;gt;) (5 . 27B) (100 . AcDbAssocAction) (90 . 2) (90 . 0) (330 . &amp;lt;Entity name: 220986f4670&amp;gt;) (360 . &amp;lt;Entity name: 0&amp;gt;) (90 . 3) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (90 . 0) (100 . AcDbAssocVariable) (90 . 2) (1 . U1) (1 . 2.5) (1 . AcDbCalc:1.0) (1 . ) (40 . 2.5) (290 . 0) (290 . 0) (90 . 0))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2025 22:31:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-value-of-user-parameters-at-drawing-level/m-p/13295726#M114</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2025-02-02T22:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get value of user parameters at drawing level</title>
      <link>https://forums.autodesk.com/t5/vba-forum/get-value-of-user-parameters-at-drawing-level/m-p/13298982#M115</link>
      <description>&lt;P&gt;Thanks for your help, I suspected it was not possible in VBA but I had no proof. I'll try to understand your Lisp solution in a future project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. InfoLec and jm.surprenant is the same person. I had to use a collegue's account because mine was broken. It has since been fixed.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 14:00:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/get-value-of-user-parameters-at-drawing-level/m-p/13298982#M115</guid>
      <dc:creator>jm.surprenant5D582</dc:creator>
      <dc:date>2025-02-04T14:00:50Z</dc:date>
    </item>
  </channel>
</rss>

