Format coodinate values per the Drawing Units precision sett
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Format coodinate values per the Drawing Units precision sett

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Eugene
Guest





Posted: Tue Dec 07, 2004 12:17 am    Post subject: Format coodinate values per the Drawing Units precision sett Reply with quote

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

Back to top
Jorge Jimenez
Guest





Posted: Tue Dec 07, 2004 12:25 am    Post subject: Re: Format coodinate values per the Drawing Units precision Reply with quote

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


"Eugene" <eburgy@entranco.com> wrote in message news:41b4af7c$1_2@newsprd01...
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
Back to top
Eugene
Guest





Posted: Tue Dec 07, 2004 12:55 am    Post subject: Re: Format coodinate values per the Drawing Units precision Reply with quote

Worked great, thanks!
-Eugene
"Jorge Jimenez" <unknown@nospam.com> wrote in message news:41b4b218$1_2@newsprd01...
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


"Eugene" <eburgy@entranco.com> wrote in message news:41b4af7c$1_2@newsprd01...
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

Back to top
Tony Tanzillo
Guest





Posted: Tue Dec 07, 2004 3:53 am    Post subject: Re: Format coodinate values per the Drawing Units precision Reply with quote

Use -1 for the units and precision, and it will use
the current values of LUNITS and LUPREC.
--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com

"Eugene" <eburgy@entranco.com> wrote in message news:41b4af7c$1_2@newsprd01...
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?
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB