Format coodinate values per the Drawing Units precision setting

Discussion in 'AutoCAD' started by Eugene, Dec 6, 2004.

  1. Eugene

    Eugene Guest

    I'm populating a txtbox with the coordinates of a selected point. What is the easiest way to format the number value per the Drawing Units setting?
    Here is my code:

    Private Sub tbCoords_Click()
    Dim Pnt As Variant
    Dim sPntX As String
    Dim sPntY As String
    Me.hide
    Pnt = ThisDrawing.Utility.GetPoint(, "Select A Point")
    sPntX = Pnt(0)
    sPntY = Pnt(1)
    tbMtxt.Text = "N = " & sPntY & " , " & "E = " & sPntX
    Me.Show
    End Sub

    Best Regards,
    Eugene
     
    Eugene, Dec 6, 2004
    #1
  2. unit=ThisDrawing.GetVariable("LUNITS")
    precision=ThisDrawing.GetVariable("LUPREC")

    sPntX= ThisDrawing.Utility.RealToString(Pnt(0), unit, precision)
    sPntY= ThisDrawing.Utility.RealToString(Pnt(1), unit, precision)


    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    I'm populating a txtbox with the coordinates of a selected point. What is the easiest way to format the number value per the Drawing Units setting?
    Here is my code:

    Private Sub tbCoords_Click()
    Dim Pnt As Variant
    Dim sPntX As String
    Dim sPntY As String
    Me.hide
    Pnt = ThisDrawing.Utility.GetPoint(, "Select A Point")
    sPntX = Pnt(0)
    sPntY = Pnt(1)
    tbMtxt.Text = "N = " & sPntY & " , " & "E = " & sPntX
    Me.Show
    End Sub

    Best Regards,
    Eugene
     
    Jorge Jimenez, Dec 6, 2004
    #2
  3. Eugene

    Eugene Guest

    Worked great, thanks!
    -Eugene
    unit=ThisDrawing.GetVariable("LUNITS")
    precision=ThisDrawing.GetVariable("LUPREC")

    sPntX= ThisDrawing.Utility.RealToString(Pnt(0), unit, precision)
    sPntY= ThisDrawing.Utility.RealToString(Pnt(1), unit, precision)


    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


    I'm populating a txtbox with the coordinates of a selected point. What is the easiest way to format the number value per the Drawing Units setting?
    Here is my code:

    Private Sub tbCoords_Click()
    Dim Pnt As Variant
    Dim sPntX As String
    Dim sPntY As String
    Me.hide
    Pnt = ThisDrawing.Utility.GetPoint(, "Select A Point")
    sPntX = Pnt(0)
    sPntY = Pnt(1)
    tbMtxt.Text = "N = " & sPntY & " , " & "E = " & sPntX
    Me.Show
    End Sub

    Best Regards,
    Eugene
     
    Eugene, Dec 6, 2004
    #3
  4. Use -1 for the units and precision, and it will use
    the current values of LUNITS and LUPREC.


    I'm populating a txtbox with the coordinates of a selected point. What is the easiest way to format the number value per
    the Drawing Units setting?
     
    Tony Tanzillo, Dec 6, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.