Author Topic: Add a Line using Surveyor units  (Read 1238 times)

0 Members and 1 Guest are viewing this topic.

dull_blades

  • Guest
Add a Line using Surveyor units
« on: June 21, 2011, 01:06:27 PM »
Hi All,
 
Can someone get me started on adding a line to the database using surveyors units (preferably in VB).
 
Command: line
Specify first point: 0,0
Specify next point or [Undo]: @104.88'<N57d59'45"W
 
I know how to add normal Point3D line:
 
Code: [Select]
Dim acLine As Line = New Line(New Point3d(5, 5, 0), New Point3d(12, 3, 0))
But not sure how add an angled line.
 
 
Thanks!

fixo

  • Guest
Re: Add a Line using Surveyor units
« Reply #1 on: June 22, 2011, 06:45:27 PM »
I'm not a math so use it just as idea
 
Code: [Select]
  Public Function StringToRad(ByVal ang As String) As Double
        Dim parts() As String = ang.Split("d"c, "'"c)
        Dim grad As Double
        Dim min As Double
        Dim sec As Double
        If (parts(0).Trim() = "00") Then
            grad = 0.0
        ElseIf (parts(0).Trim()(0) = "0") Then
            grad = Double.Parse(parts(0)(1))
        Else
            grad = Double.Parse(parts(0))
        End If
        If (parts(1).Trim() = "00") Then
            min = 0.0
        ElseIf (parts(1).Trim()(0) = "0") Then
            min = Double.Parse(parts(1)(1)) / 60.0
        Else
            min = Double.Parse(parts(1)) / 60.0
        End If
        If (parts(2).Trim() = "00") Then
            sec = 0.0
        ElseIf (parts(2).Trim()(0) = "0") Then
            sec = Double.Parse(parts(2)(1)) / 3600.0
        Else
            sec = Double.Parse(parts(2)) / 3600.0
        End If
        Return Math.PI * (grad + min + sec) / 180.0
    End Function
'usage
MsgBox(StringToRad("57d59'45"))
the use PolarPoint function, try search for this forum