title: CATIA VBA Measure a user selected line(s)/spline
body: <p>I am trying to get the length of user selected lines/splines</p>
  
  <p>This is the code I'm using to have users select their lines:</p>
  
  <pre><code>Dim USel As Selection
  Dim USelLB
  Dim InputObject(0)
  
  InputObject(0) = "AnyObject"
  Set USel = CATIA.ActiveDocument.Selection
  Set USelLB = USel
  
  USel.Clear
  USelLB.Clear
  
  Linestomeasure = USelLB.SelectElement3(InputObject, "Select objects to list names", True, CATMultiSelTriggWhenUserValidatesSelection, False)
  </code></pre>
  
  <p><code>Linestomeasure</code> is a <code>public</code> variable, in the mainsub i've been trying to measure <code>Linestomeasure</code> using the following code:</p>
  
  <pre><code>Dim pd1 As PartDocument
  Dim a As Object
  Dim c As Reference
  
  a = TrimLines.Item(1)
  c = pd1.Part.CreateReferenceFromObject(a)
  
  Dim Mea1 As Measurable
  Dim TheSPAWorkbench As SPAWorkbench
  Set TheSPAWorkbench = pd1.GetWorkbench("SPAWorkbench")
  Set Mea1 = TheSPAWorkbench.GetMeasurable(c)
  </code></pre>
  
  <p>But when I run the code <code>a = trimLines.Item(1)</code> gets highlighted in the debugger with the error message "Object Required".</p>
  
  <p>Does anyone have an idea on how I can change my code so that I can get the length of the line as a variable that I can work with ? Or just a different way to go about what I'm trying to do?</p>