turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Close

AutoCAD Land Desktop

- Autodesk Community
- >
- Additional Products
- >
- AutoCAD Land Desktop
- >
- Convert Radians to Bearing?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

879 Views, 13 Replies

03-19-2002 06:10 AM

Using VBA in LDT3, what is the best way to convert the angle of a line from

Radians to either an Azimuth or Bearing?

TIA, Gene

Radians to either an Azimuth or Bearing?

TIA, Gene

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-19-2002 07:09 AM in reply to:
*Redmon, Gene

Off the top of my head you multiply by 180/pi to get the azimuth from

radians.

Depending on what format you want the output to be in you may need to use:

angletoreal and angletostring for conversion.

If you let me know the desired output I'll send you better instructions.

Bud Miller

www.BudCAD.com

Legal Descriptions. Parcel Reports.

Point Group Automation. Layer Reports.

"Gene Redmon" wrote in message

news:F087EEE7445DE8F25ACFB6497919BC43@in.WebX.maYIadrTaRb...

> Using VBA in LDT3, what is the best way to convert the angle of a line

from

> Radians to either an Azimuth or Bearing?

>

> TIA, Gene

>

>

radians.

Depending on what format you want the output to be in you may need to use:

angletoreal and angletostring for conversion.

If you let me know the desired output I'll send you better instructions.

Bud Miller

www.BudCAD.com

Legal Descriptions. Parcel Reports.

Point Group Automation. Layer Reports.

"Gene Redmon"

news:F087EEE7445DE8F25ACFB6497919BC43@in.WebX.maYI

> Using VBA in LDT3, what is the best way to convert the angle of a line

from

> Radians to either an Azimuth or Bearing?

>

> TIA, Gene

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-19-2002 09:28 AM in reply to:
*Redmon, Gene

Thanks for the assistance Bud. I'm trying to format the angle in:

DegreesMinutesSeconds for the Azimuth and Bearings both. If I'm not

mistaking

your suggestion will give me the Azimuth in decimal degrees and I'll need to

convert

that to DDMMSS?

Gene

"Bud Miller" wrote in message

news:3124F28BC0D2BFBAA6B97BD62DFCB768@in.WebX.maYIadrTaRb...

> Off the top of my head you multiply by 180/pi to get the azimuth from

> radians.

>

> Depending on what format you want the output to be in you may need to use:

>

> angletoreal and angletostring for conversion.

>

> If you let me know the desired output I'll send you better instructions.

>

> Bud Miller

> www.BudCAD.com

> Legal Descriptions. Parcel Reports.

> Point Group Automation. Layer Reports.

>

> "Gene Redmon" wrote in message

> news:F087EEE7445DE8F25ACFB6497919BC43@in.WebX.maYIadrTaRb...

> > Using VBA in LDT3, what is the best way to convert the angle of a line

> from

> > Radians to either an Azimuth or Bearing?

> >

> > TIA, Gene

> >

> >

>

>

DegreesMinutesSeconds for the Azimuth and Bearings both. If I'm not

mistaking

your suggestion will give me the Azimuth in decimal degrees and I'll need to

convert

that to DDMMSS?

Gene

"Bud Miller"

news:3124F28BC0D2BFBAA6B97BD62DFCB768@in.WebX.maYI

> Off the top of my head you multiply by 180/pi to get the azimuth from

> radians.

>

> Depending on what format you want the output to be in you may need to use:

>

> angletoreal and angletostring for conversion.

>

> If you let me know the desired output I'll send you better instructions.

>

> Bud Miller

> www.BudCAD.com

> Legal Descriptions. Parcel Reports.

> Point Group Automation. Layer Reports.

>

> "Gene Redmon"

> news:F087EEE7445DE8F25ACFB6497919BC43@in.WebX.maYI

> > Using VBA in LDT3, what is the best way to convert the angle of a line

> from

> > Radians to either an Azimuth or Bearing?

> >

> > TIA, Gene

> >

> >

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-19-2002 09:28 PM in reply to:
*Redmon, Gene

I just stumbled on an almost undocumented "AngleToString" method. I don't know VBA but it's used on the Aecc.Application.ActiveDocument.Utility object...

Sub Example_Utility()

' This example returns the AngleToString value for 0.785398 radians using

' the active document.

Dim doc As AeccDocumen

tSet doc = AeccApplication.ActiveDocument

MsgBox "The setting for AngleToString is " & doc.Utility.AngleToString(0.785398, acDegrees, 4) _

, vbInformation, "Utility Example"

End Sub

Using Visual Lisp, you can see that the acDegree parameter is actual a format designation, and the last paramter is precision....

Command: (setq |aeccapp (vl-catch-all-apply 'vla-getinterfaceobject (list

*acad* "aecc.application")))

#

Command: (setq |aeccdoc (vlax-get |aeccapp "ActiveDocument"))

#

Command: (setq |aeccutil (vlax-get |aeccdoc "Utility"))

#

Command: (vla-angletostring |aeccutil 0.5 0 2)

"28.65"

Command: (vla-angletostring |aeccutil 0.5 0 4)

"28.6479"

Command: (vla-angletostring |aeccutil 0.5 1 4)

"28d38'52\""

Command: (vla-angletostring |aeccutil 0.5 2 4)

"31.8310g"

Command: (vla-angletostring |aeccutil 0.5 3 4)

"0.5000r"

Command: (vla-angletostring |aeccutil 0.5 4 4)

"N 61d21'8\" E"

--

John Uhden, Cadlantic/formerly CADvantage

[ mailto:juhden@cadlantic.com ]

[ http://www.cadlantic.com ]

2 Village Road

Sea Girt, NJ 08750

Tel. 732-974-1711

"Gene Redmon" wrote in message news:F087EEE7445DE8F25ACFB6497919BC43@in.WebX.maYIadrTaRb...

> Using VBA in LDT3, what is the best way to convert the angle of a line from

> Radians to either an Azimuth or Bearing?

>

> TIA, Gene

>

>

Sub Example_Utility()

' This example returns the AngleToString value for 0.785398 radians using

' the active document.

Dim doc As AeccDocumen

tSet doc = AeccApplication.ActiveDocument

MsgBox "The setting for AngleToString is " & doc.Utility.AngleToString(0.785398, acDegrees, 4) _

, vbInformation, "Utility Example"

End Sub

Using Visual Lisp, you can see that the acDegree parameter is actual a format designation, and the last paramter is precision....

Command: (setq |aeccapp (vl-catch-all-apply 'vla-getinterfaceobject (list

*acad* "aecc.application")))

#

Command: (setq |aeccdoc (vlax-get |aeccapp "ActiveDocument"))

#

Command: (setq |aeccutil (vlax-get |aeccdoc "Utility"))

#

Command: (vla-angletostring |aeccutil 0.5 0 2)

"28.65"

Command: (vla-angletostring |aeccutil 0.5 0 4)

"28.6479"

Command: (vla-angletostring |aeccutil 0.5 1 4)

"28d38'52\""

Command: (vla-angletostring |aeccutil 0.5 2 4)

"31.8310g"

Command: (vla-angletostring |aeccutil 0.5 3 4)

"0.5000r"

Command: (vla-angletostring |aeccutil 0.5 4 4)

"N 61d21'8\" E"

--

John Uhden, Cadlantic/formerly CADvantage

[ mailto:juhden@cadlantic.com ]

[ http://www.cadlantic.com ]

2 Village Road

Sea Girt, NJ 08750

Tel. 732-974-1711

"Gene Redmon"

> Using VBA in LDT3, what is the best way to convert the angle of a line from

> Radians to either an Azimuth or Bearing?

>

> TIA, Gene

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-19-2002 10:09 PM in reply to:
*Redmon, Gene

It's also fairly straight forward if you want to calc it yourself if you

need more control over the string formating. Once you get the decimal degree

value, to get the degree portion of the DMS value you convert the direction

to an integer. This will truncate the numbers to the right of the decimal

point. You then subtract the Deg value from the decimal degree value then

multiple by 60 you get the decimal minutes. then repeat the procedure for

the seconds.

In this example, the original decDeg is a double, the Deg and Min variables

are integers and the Sec variable is a double to carry the seconds

precision.

deg = Int(decDeg)

decDeg= (decDeg- Int(decDeg)) * 60

min = Int(decDeg)

decDeg= (decDeg- Int(decDeg)) * 60

sec = RoundVal(decDeg, 0))

' check for values rounded to 60

If sec >= 60 Then

sec = sec - 60

min = min + 1

End If

If min >= 60 Then

min = min - 60

deg = deg + 1

End If

' format the strings

sDeg = CStr(deg)

If sDeg = "0" Then sDeg = "00" & sDeg

sMin = CStr(min)

If Len(sMin) = 1 Then sMin = "0" & sMin

sSec = CStr(sec)

If Len(sSec) = 1 Then sSec = "0" & sSec

sDMS= sDeg & "-" & sMin & "-" & sSec

This gives the azimuth. If you want bearings you first need to get the

correct quadrant and angle.

Glen

"John Uhden" wrote in message

news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYIadrTaRb...

> I just stumbled on an almost undocumented "AngleToString" method. I don't

know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

object...

>

>

need more control over the string formating. Once you get the decimal degree

value, to get the degree portion of the DMS value you convert the direction

to an integer. This will truncate the numbers to the right of the decimal

point. You then subtract the Deg value from the decimal degree value then

multiple by 60 you get the decimal minutes. then repeat the procedure for

the seconds.

In this example, the original decDeg is a double, the Deg and Min variables

are integers and the Sec variable is a double to carry the seconds

precision.

deg = Int(decDeg)

decDeg= (decDeg- Int(decDeg)) * 60

min = Int(decDeg)

decDeg= (decDeg- Int(decDeg)) * 60

sec = RoundVal(decDeg, 0))

' check for values rounded to 60

If sec >= 60 Then

sec = sec - 60

min = min + 1

End If

If min >= 60 Then

min = min - 60

deg = deg + 1

End If

' format the strings

sDeg = CStr(deg)

If sDeg = "0" Then sDeg = "00" & sDeg

sMin = CStr(min)

If Len(sMin) = 1 Then sMin = "0" & sMin

sSec = CStr(sec)

If Len(sSec) = 1 Then sSec = "0" & sSec

sDMS= sDeg & "-" & sMin & "-" & sSec

This gives the azimuth. If you want bearings you first need to get the

correct quadrant and angle.

Glen

"John Uhden"

news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYI

> I just stumbled on an almost undocumented "AngleToString" method. I don't

know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

object...

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-19-2002 10:42 PM in reply to:
*Redmon, Gene

Thanks, Glen. We probably all knew that, but my concern was that his interpretation of the angle was w/r/t the drawing's North rotation. I beleive the AngleToString method incorporates that.

So when is Pipeworks going to let me enter inverts in the tabular editor without recalculating the whole d____d run? Did you realize that this June we're coming up on the 10th anniversary of its failure to work correctly?

--

John Uhden, Cadlantic/formerly CADvantage

[ mailto:juhden@cadlantic.com ]

[ http://www.cadlantic.com ]

2 Village Road

Sea Girt, NJ 08750

Tel. 732-974-1711

"Glen Albert" wrote in message news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYIadrTaRb...

> It's also fairly straight forward if you want to calc it yourself if you

> need more control over the string formating. Once you get the decimal degree

> value, to get the degree portion of the DMS value you convert the direction

> to an integer. This will truncate the numbers to the right of the decimal

> point. You then subtract the Deg value from the decimal degree value then

> multiple by 60 you get the decimal minutes. then repeat the procedure for

> the seconds.

>

> In this example, the original decDeg is a double, the Deg and Min variables

> are integers and the Sec variable is a double to carry the seconds

> precision.

>

> deg = Int(decDeg)

>

> decDeg= (decDeg- Int(decDeg)) * 60

> min = Int(decDeg)

>

> decDeg= (decDeg- Int(decDeg)) * 60

> sec = RoundVal(decDeg, 0))

>

> ' check for values rounded to 60

> If sec >= 60 Then

> sec = sec - 60

> min = min + 1

> End If

> If min >= 60 Then

> min = min - 60

> deg = deg + 1

> End If

>

> ' format the strings

> sDeg = CStr(deg)

> If sDeg = "0" Then sDeg = "00" & sDeg

> sMin = CStr(min)

> If Len(sMin) = 1 Then sMin = "0" & sMin

> sSec = CStr(sec)

> If Len(sSec) = 1 Then sSec = "0" & sSec

>

> sDMS= sDeg & "-" & sMin & "-" & sSec

>

> This gives the azimuth. If you want bearings you first need to get the

> correct quadrant and angle.

>

> Glen

>

> "John Uhden" wrote in message

> news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYIadrTaRb...

> > I just stumbled on an almost undocumented "AngleToString" method. I don't

> know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> object...

> >

> >

>

>

So when is Pipeworks going to let me enter inverts in the tabular editor without recalculating the whole d____d run? Did you realize that this June we're coming up on the 10th anniversary of its failure to work correctly?

--

John Uhden, Cadlantic/formerly CADvantage

[ mailto:juhden@cadlantic.com ]

[ http://www.cadlantic.com ]

2 Village Road

Sea Girt, NJ 08750

Tel. 732-974-1711

"Glen Albert"

> It's also fairly straight forward if you want to calc it yourself if you

> need more control over the string formating. Once you get the decimal degree

> value, to get the degree portion of the DMS value you convert the direction

> to an integer. This will truncate the numbers to the right of the decimal

> point. You then subtract the Deg value from the decimal degree value then

> multiple by 60 you get the decimal minutes. then repeat the procedure for

> the seconds.

>

> In this example, the original decDeg is a double, the Deg and Min variables

> are integers and the Sec variable is a double to carry the seconds

> precision.

>

> deg = Int(decDeg)

>

> decDeg= (decDeg- Int(decDeg)) * 60

> min = Int(decDeg)

>

> decDeg= (decDeg- Int(decDeg)) * 60

> sec = RoundVal(decDeg, 0))

>

> ' check for values rounded to 60

> If sec >= 60 Then

> sec = sec - 60

> min = min + 1

> End If

> If min >= 60 Then

> min = min - 60

> deg = deg + 1

> End If

>

> ' format the strings

> sDeg = CStr(deg)

> If sDeg = "0" Then sDeg = "00" & sDeg

> sMin = CStr(min)

> If Len(sMin) = 1 Then sMin = "0" & sMin

> sSec = CStr(sec)

> If Len(sSec) = 1 Then sSec = "0" & sSec

>

> sDMS= sDeg & "-" & sMin & "-" & sSec

>

> This gives the azimuth. If you want bearings you first need to get the

> correct quadrant and angle.

>

> Glen

>

> "John Uhden"

> news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYI

> > I just stumbled on an almost undocumented "AngleToString" method. I don't

> know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> object...

> >

> >

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-19-2002 11:23 PM in reply to:
*Redmon, Gene

This will work with a north rotation of 0 (north straight up).

To use it with NR you'll need to get the angle by converting the XY of the

start and end points to North/East.

unit = acDegreeMinuteSeconds

bearinquest = ent.Angle * (180 / pi)

select case bearinquest

case < 90

bearinquest = Abs(90 - bearinquest)

'similar statements to correct the angle for each quadrant

end select

bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

'convert to min etc

--

Bud Miller

www.BudCAD.com

Try the only Legal Writer that reads parcels directly!

"John Uhden" wrote in message

news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYIadrTaRb...

> Thanks, Glen. We probably all knew that, but my concern was that his

interpretation of the angle was w/r/t the drawing's North rotation. I

beleive the AngleToString method incorporates that.

>

> So when is Pipeworks going to let me enter inverts in the tabular editor

without recalculating the whole d____d run? Did you realize that this June

we're coming up on the 10th anniversary of its failure to work correctly?

>

> --

> John Uhden, Cadlantic/formerly CADvantage

> [ mailto:juhden@cadlantic.com ]

> [ http://www.cadlantic.com ]

> 2 Village Road

> Sea Girt, NJ 08750

> Tel. 732-974-1711

>

>

> "Glen Albert" wrote in message

news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYIadrTaRb...

> > It's also fairly straight forward if you want to calc it yourself if you

> > need more control over the string formating. Once you get the decimal

degree

> > value, to get the degree portion of the DMS value you convert the

direction

> > to an integer. This will truncate the numbers to the right of the

decimal

> > point. You then subtract the Deg value from the decimal degree value

then

> > multiple by 60 you get the decimal minutes. then repeat the procedure

for

> > the seconds.

> >

> > In this example, the original decDeg is a double, the Deg and Min

variables

> > are integers and the Sec variable is a double to carry the seconds

> > precision.

> >

> > deg = Int(decDeg)

> >

> > decDeg= (decDeg- Int(decDeg)) * 60

> > min = Int(decDeg)

> >

> > decDeg= (decDeg- Int(decDeg)) * 60

> > sec = RoundVal(decDeg, 0))

> >

> > ' check for values rounded to 60

> > If sec >= 60 Then

> > sec = sec - 60

> > min = min + 1

> > End If

> > If min >= 60 Then

> > min = min - 60

> > deg = deg + 1

> > End If

> >

> > ' format the strings

> > sDeg = CStr(deg)

> > If sDeg = "0" Then sDeg = "00" & sDeg

> > sMin = CStr(min)

> > If Len(sMin) = 1 Then sMin = "0" & sMin

> > sSec = CStr(sec)

> > If Len(sSec) = 1 Then sSec = "0" & sSec

> >

> > sDMS= sDeg & "-" & sMin & "-" & sSec

> >

> > This gives the azimuth. If you want bearings you first need to get the

> > correct quadrant and angle.

> >

> > Glen

> >

> > "John Uhden" wrote in message

> > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYIadrTaRb...

> > > I just stumbled on an almost undocumented "AngleToString" method. I

don't

> > know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> > object...

> > >

> > >

> >

> >

To use it with NR you'll need to get the angle by converting the XY of the

start and end points to North/East.

unit = acDegreeMinuteSeconds

bearinquest = ent.Angle * (180 / pi)

select case bearinquest

case < 90

bearinquest = Abs(90 - bearinquest)

'similar statements to correct the angle for each quadrant

end select

bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

'convert to min etc

--

Bud Miller

www.BudCAD.com

Try the only Legal Writer that reads parcels directly!

"John Uhden"

news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYI

> Thanks, Glen. We probably all knew that, but my concern was that his

interpretation of the angle was w/r/t the drawing's North rotation. I

beleive the AngleToString method incorporates that.

>

> So when is Pipeworks going to let me enter inverts in the tabular editor

without recalculating the whole d____d run? Did you realize that this June

we're coming up on the 10th anniversary of its failure to work correctly?

>

> --

> John Uhden, Cadlantic/formerly CADvantage

> [ mailto:juhden@cadlantic.com ]

> [ http://www.cadlantic.com ]

> 2 Village Road

> Sea Girt, NJ 08750

> Tel. 732-974-1711

>

>

> "Glen Albert"

news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYI

> > It's also fairly straight forward if you want to calc it yourself if you

> > need more control over the string formating. Once you get the decimal

degree

> > value, to get the degree portion of the DMS value you convert the

direction

> > to an integer. This will truncate the numbers to the right of the

decimal

> > point. You then subtract the Deg value from the decimal degree value

then

> > multiple by 60 you get the decimal minutes. then repeat the procedure

for

> > the seconds.

> >

> > In this example, the original decDeg is a double, the Deg and Min

variables

> > are integers and the Sec variable is a double to carry the seconds

> > precision.

> >

> > deg = Int(decDeg)

> >

> > decDeg= (decDeg- Int(decDeg)) * 60

> > min = Int(decDeg)

> >

> > decDeg= (decDeg- Int(decDeg)) * 60

> > sec = RoundVal(decDeg, 0))

> >

> > ' check for values rounded to 60

> > If sec >= 60 Then

> > sec = sec - 60

> > min = min + 1

> > End If

> > If min >= 60 Then

> > min = min - 60

> > deg = deg + 1

> > End If

> >

> > ' format the strings

> > sDeg = CStr(deg)

> > If sDeg = "0" Then sDeg = "00" & sDeg

> > sMin = CStr(min)

> > If Len(sMin) = 1 Then sMin = "0" & sMin

> > sSec = CStr(sec)

> > If Len(sSec) = 1 Then sSec = "0" & sSec

> >

> > sDMS= sDeg & "-" & sMin & "-" & sSec

> >

> > This gives the azimuth. If you want bearings you first need to get the

> > correct quadrant and angle.

> >

> > Glen

> >

> > "John Uhden"

> > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYI

> > > I just stumbled on an almost undocumented "AngleToString" method. I

don't

> > know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> > object...

> > >

> > >

> >

> >

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-19-2002 11:30 PM in reply to:
*Redmon, Gene

Well, whadoyaknow. Seems like a pretty useless function relative to the Utility object. Thanks for the info, Bud.

BTW, do you have any documentation on the dxf values in the "AEC_VARS_DWG_SETUP" dictionary?

--

John Uhden, Cadlantic/formerly CADvantage

[ mailto:juhden@cadlantic.com ]

[ http://www.cadlantic.com ]

2 Village Road

Sea Girt, NJ 08750

Tel. 732-974-1711

"Bud" wrote in message news:CCFAF8FF20879105FFED13D7A4864586@in.WebX.maYIadrTaRb...

> This will work with a north rotation of 0 (north straight up).

> To use it with NR you'll need to get the angle by converting the XY of the

> start and end points to North/East.

>

> unit = acDegreeMinuteSeconds

> bearinquest = ent.Angle * (180 / pi)

>

> select case bearinquest

> case < 90

> bearinquest = Abs(90 - bearinquest)

>

> 'similar statements to correct the angle for each quadrant

>

> end select

>

> bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

> converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

> 'convert to min etc

>

> --

> Bud Miller

> www.BudCAD.com

> Try the only Legal Writer that reads parcels directly!

>

> "John Uhden" wrote in message

> news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYIadrTaRb...

> > Thanks, Glen. We probably all knew that, but my concern was that his

> interpretation of the angle was w/r/t the drawing's North rotation. I

> beleive the AngleToString method incorporates that.

> >

> > So when is Pipeworks going to let me enter inverts in the tabular editor

> without recalculating the whole d____d run? Did you realize that this June

> we're coming up on the 10th anniversary of its failure to work correctly?

> >

> > --

> > John Uhden, Cadlantic/formerly CADvantage

> > [ mailto:juhden@cadlantic.com ]

> > [ http://www.cadlantic.com ]

> > 2 Village Road

> > Sea Girt, NJ 08750

> > Tel. 732-974-1711

> >

> >

> > "Glen Albert" wrote in message

> news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYIadrTaRb...

> > > It's also fairly straight forward if you want to calc it yourself if you

> > > need more control over the string formating. Once you get the decimal

> degree

> > > value, to get the degree portion of the DMS value you convert the

> direction

> > > to an integer. This will truncate the numbers to the right of the

> decimal

> > > point. You then subtract the Deg value from the decimal degree value

> then

> > > multiple by 60 you get the decimal minutes. then repeat the procedure

> for

> > > the seconds.

> > >

> > > In this example, the original decDeg is a double, the Deg and Min

> variables

> > > are integers and the Sec variable is a double to carry the seconds

> > > precision.

> > >

> > > deg = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > min = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > sec = RoundVal(decDeg, 0))

> > >

> > > ' check for values rounded to 60

> > > If sec >= 60 Then

> > > sec = sec - 60

> > > min = min + 1

> > > End If

> > > If min >= 60 Then

> > > min = min - 60

> > > deg = deg + 1

> > > End If

> > >

> > > ' format the strings

> > > sDeg = CStr(deg)

> > > If sDeg = "0" Then sDeg = "00" & sDeg

> > > sMin = CStr(min)

> > > If Len(sMin) = 1 Then sMin = "0" & sMin

> > > sSec = CStr(sec)

> > > If Len(sSec) = 1 Then sSec = "0" & sSec

> > >

> > > sDMS= sDeg & "-" & sMin & "-" & sSec

> > >

> > > This gives the azimuth. If you want bearings you first need to get the

> > > correct quadrant and angle.

> > >

> > > Glen

> > >

> > > "John Uhden" wrote in message

> > > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYIadrTaRb...

> > > > I just stumbled on an almost undocumented "AngleToString" method. I

> don't

> > > know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> > > object...

> > > >

> > > >

> > >

> > >

>

>

BTW, do you have any documentation on the dxf values in the "AEC_VARS_DWG_SETUP" dictionary?

--

John Uhden, Cadlantic/formerly CADvantage

[ mailto:juhden@cadlantic.com ]

[ http://www.cadlantic.com ]

2 Village Road

Sea Girt, NJ 08750

Tel. 732-974-1711

"Bud"

> This will work with a north rotation of 0 (north straight up).

> To use it with NR you'll need to get the angle by converting the XY of the

> start and end points to North/East.

>

> unit = acDegreeMinuteSeconds

> bearinquest = ent.Angle * (180 / pi)

>

> select case bearinquest

> case < 90

> bearinquest = Abs(90 - bearinquest)

>

> 'similar statements to correct the angle for each quadrant

>

> end select

>

> bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

> converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

> 'convert to min etc

>

> --

> Bud Miller

> www.BudCAD.com

> Try the only Legal Writer that reads parcels directly!

>

> "John Uhden"

> news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYI

> > Thanks, Glen. We probably all knew that, but my concern was that his

> interpretation of the angle was w/r/t the drawing's North rotation. I

> beleive the AngleToString method incorporates that.

> >

> > So when is Pipeworks going to let me enter inverts in the tabular editor

> without recalculating the whole d____d run? Did you realize that this June

> we're coming up on the 10th anniversary of its failure to work correctly?

> >

> > --

> > John Uhden, Cadlantic/formerly CADvantage

> > [ mailto:juhden@cadlantic.com ]

> > [ http://www.cadlantic.com ]

> > 2 Village Road

> > Sea Girt, NJ 08750

> > Tel. 732-974-1711

> >

> >

> > "Glen Albert"

> news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYI

> > > It's also fairly straight forward if you want to calc it yourself if you

> > > need more control over the string formating. Once you get the decimal

> degree

> > > value, to get the degree portion of the DMS value you convert the

> direction

> > > to an integer. This will truncate the numbers to the right of the

> decimal

> > > point. You then subtract the Deg value from the decimal degree value

> then

> > > multiple by 60 you get the decimal minutes. then repeat the procedure

> for

> > > the seconds.

> > >

> > > In this example, the original decDeg is a double, the Deg and Min

> variables

> > > are integers and the Sec variable is a double to carry the seconds

> > > precision.

> > >

> > > deg = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > min = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > sec = RoundVal(decDeg, 0))

> > >

> > > ' check for values rounded to 60

> > > If sec >= 60 Then

> > > sec = sec - 60

> > > min = min + 1

> > > End If

> > > If min >= 60 Then

> > > min = min - 60

> > > deg = deg + 1

> > > End If

> > >

> > > ' format the strings

> > > sDeg = CStr(deg)

> > > If sDeg = "0" Then sDeg = "00" & sDeg

> > > sMin = CStr(min)

> > > If Len(sMin) = 1 Then sMin = "0" & sMin

> > > sSec = CStr(sec)

> > > If Len(sSec) = 1 Then sSec = "0" & sSec

> > >

> > > sDMS= sDeg & "-" & sMin & "-" & sSec

> > >

> > > This gives the azimuth. If you want bearings you first need to get the

> > > correct quadrant and angle.

> > >

> > > Glen

> > >

> > > "John Uhden"

> > > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYI

> > > > I just stumbled on an almost undocumented "AngleToString" method. I

> don't

> > > know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> > > object...

> > > >

> > > >

> > >

> > >

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-20-2002 12:39 AM in reply to:
*Redmon, Gene

This will get you the bearing (without a direction) from a selected line

when the drawing is north rotated:

(To get the direction you'd need to add a case statement that checks the N/E

of the start and endpoints relative to each other.)

Dim util As AeccUtility

Set util = AeccApplication.ActiveDocument.Utility

Dim var1 As Variant

Dim var2 As Variant

ptXY = ent.StartPoint

ptXY2 = ent.EndPoint

' Convert point to Easting, Northing

var1 = util.XyToEastNorth(ptXY)

var2 = util.XyToEastNorth(ptXY2)

opp = Abs(var1(0) - var2(0))

adj = Abs(var1(1) - var2(1))

dratio = opp / adj

newbearing = Atn(dratio) 'inverse tangent

Bud Miller

www.BudCAD.com

Try the only Legal Writer that reads parcels directly!

"Bud" wrote in message

news:CCFAF8FF20879105FFED13D7A4864586@in.WebX.maYIadrTaRb...

> This will work with a north rotation of 0 (north straight up).

> To use it with NR you'll need to get the angle by converting the XY of the

> start and end points to North/East.

>

> unit = acDegreeMinuteSeconds

> bearinquest = ent.Angle * (180 / pi)

>

> select case bearinquest

> case < 90

> bearinquest = Abs(90 - bearinquest)

>

> 'similar statements to correct the angle for each quadrant

>

> end select

>

> bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

> converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

> 'convert to min etc

>

> --

> Bud Miller

> www.BudCAD.com

> Try the only Legal Writer that reads parcels directly!

>

> "John Uhden" wrote in message

> news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYIadrTaRb...

> > Thanks, Glen. We probably all knew that, but my concern was that his

> interpretation of the angle was w/r/t the drawing's North rotation. I

> beleive the AngleToString method incorporates that.

> >

> > So when is Pipeworks going to let me enter inverts in the tabular editor

> without recalculating the whole d____d run? Did you realize that this

June

> we're coming up on the 10th anniversary of its failure to work correctly?

> >

> > --

> > John Uhden, Cadlantic/formerly CADvantage

> > [ mailto:juhden@cadlantic.com ]

> > [ http://www.cadlantic.com ]

> > 2 Village Road

> > Sea Girt, NJ 08750

> > Tel. 732-974-1711

> >

> >

> > "Glen Albert" wrote in message

> news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYIadrTaRb...

> > > It's also fairly straight forward if you want to calc it yourself if

you

> > > need more control over the string formating. Once you get the decimal

> degree

> > > value, to get the degree portion of the DMS value you convert the

> direction

> > > to an integer. This will truncate the numbers to the right of the

> decimal

> > > point. You then subtract the Deg value from the decimal degree value

> then

> > > multiple by 60 you get the decimal minutes. then repeat the procedure

> for

> > > the seconds.

> > >

> > > In this example, the original decDeg is a double, the Deg and Min

> variables

> > > are integers and the Sec variable is a double to carry the seconds

> > > precision.

> > >

> > > deg = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > min = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > sec = RoundVal(decDeg, 0))

> > >

> > > ' check for values rounded to 60

> > > If sec >= 60 Then

> > > sec = sec - 60

> > > min = min + 1

> > > End If

> > > If min >= 60 Then

> > > min = min - 60

> > > deg = deg + 1

> > > End If

> > >

> > > ' format the strings

> > > sDeg = CStr(deg)

> > > If sDeg = "0" Then sDeg = "00" & sDeg

> > > sMin = CStr(min)

> > > If Len(sMin) = 1 Then sMin = "0" & sMin

> > > sSec = CStr(sec)

> > > If Len(sSec) = 1 Then sSec = "0" & sSec

> > >

> > > sDMS= sDeg & "-" & sMin & "-" & sSec

> > >

> > > This gives the azimuth. If you want bearings you first need to get the

> > > correct quadrant and angle.

> > >

> > > Glen

> > >

> > > "John Uhden" wrote in message

> > > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYIadrTaRb...

> > > > I just stumbled on an almost undocumented "AngleToString" method. I

> don't

> > > know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> > > object...

> > > >

> > > >

> > >

> > >

>

>

when the drawing is north rotated:

(To get the direction you'd need to add a case statement that checks the N/E

of the start and endpoints relative to each other.)

Dim util As AeccUtility

Set util = AeccApplication.ActiveDocument.Utility

Dim var1 As Variant

Dim var2 As Variant

ptXY = ent.StartPoint

ptXY2 = ent.EndPoint

' Convert point to Easting, Northing

var1 = util.XyToEastNorth(ptXY)

var2 = util.XyToEastNorth(ptXY2)

opp = Abs(var1(0) - var2(0))

adj = Abs(var1(1) - var2(1))

dratio = opp / adj

newbearing = Atn(dratio) 'inverse tangent

Bud Miller

www.BudCAD.com

Try the only Legal Writer that reads parcels directly!

"Bud"

news:CCFAF8FF20879105FFED13D7A4864586@in.WebX.maYI

> This will work with a north rotation of 0 (north straight up).

> To use it with NR you'll need to get the angle by converting the XY of the

> start and end points to North/East.

>

> unit = acDegreeMinuteSeconds

> bearinquest = ent.Angle * (180 / pi)

>

> select case bearinquest

> case < 90

> bearinquest = Abs(90 - bearinquest)

>

> 'similar statements to correct the angle for each quadrant

>

> end select

>

> bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

> converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

> 'convert to min etc

>

> --

> Bud Miller

> www.BudCAD.com

> Try the only Legal Writer that reads parcels directly!

>

> "John Uhden"

> news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYI

> > Thanks, Glen. We probably all knew that, but my concern was that his

> interpretation of the angle was w/r/t the drawing's North rotation. I

> beleive the AngleToString method incorporates that.

> >

> > So when is Pipeworks going to let me enter inverts in the tabular editor

> without recalculating the whole d____d run? Did you realize that this

June

> we're coming up on the 10th anniversary of its failure to work correctly?

> >

> > --

> > John Uhden, Cadlantic/formerly CADvantage

> > [ mailto:juhden@cadlantic.com ]

> > [ http://www.cadlantic.com ]

> > 2 Village Road

> > Sea Girt, NJ 08750

> > Tel. 732-974-1711

> >

> >

> > "Glen Albert"

> news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYI

> > > It's also fairly straight forward if you want to calc it yourself if

you

> > > need more control over the string formating. Once you get the decimal

> degree

> > > value, to get the degree portion of the DMS value you convert the

> direction

> > > to an integer. This will truncate the numbers to the right of the

> decimal

> > > point. You then subtract the Deg value from the decimal degree value

> then

> > > multiple by 60 you get the decimal minutes. then repeat the procedure

> for

> > > the seconds.

> > >

> > > In this example, the original decDeg is a double, the Deg and Min

> variables

> > > are integers and the Sec variable is a double to carry the seconds

> > > precision.

> > >

> > > deg = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > min = Int(decDeg)

> > >

> > > decDeg= (decDeg- Int(decDeg)) * 60

> > > sec = RoundVal(decDeg, 0))

> > >

> > > ' check for values rounded to 60

> > > If sec >= 60 Then

> > > sec = sec - 60

> > > min = min + 1

> > > End If

> > > If min >= 60 Then

> > > min = min - 60

> > > deg = deg + 1

> > > End If

> > >

> > > ' format the strings

> > > sDeg = CStr(deg)

> > > If sDeg = "0" Then sDeg = "00" & sDeg

> > > sMin = CStr(min)

> > > If Len(sMin) = 1 Then sMin = "0" & sMin

> > > sSec = CStr(sec)

> > > If Len(sSec) = 1 Then sSec = "0" & sSec

> > >

> > > sDMS= sDeg & "-" & sMin & "-" & sSec

> > >

> > > This gives the azimuth. If you want bearings you first need to get the

> > > correct quadrant and angle.

> > >

> > > Glen

> > >

> > > "John Uhden"

> > > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYI

> > > > I just stumbled on an almost undocumented "AngleToString" method. I

> don't

> > > know VBA but it's used on the Aecc.Application.ActiveDocument.Utility

> > > object...

> > > >

> > > >

> > >

> > >

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-20-2002 12:44 AM in reply to:
*Redmon, Gene

Thanks to everyone that responded. You all provided many solutions that

product

great results.

One other thing I'm stuggling with is, once I get these string values I'm

writing them to a text file.

Of course, since they are Strings they are entered into the text file with

quotes around them. "String"

Is there anyway to prevent the quotes from being placed in the text file?

Gene

"Bud" wrote in message

news:2EC6ED4834D30BBB422B56C4EFE37668@in.WebX.maYIadrTaRb...

> This will get you the bearing (without a direction) from a selected line

> when the drawing is north rotated:

> (To get the direction you'd need to add a case statement that checks the

N/E

> of the start and endpoints relative to each other.)

>

> Dim util As AeccUtility

> Set util = AeccApplication.ActiveDocument.Utility

>

> Dim var1 As Variant

> Dim var2 As Variant

>

> ptXY = ent.StartPoint

> ptXY2 = ent.EndPoint

>

> ' Convert point to Easting, Northing

> var1 = util.XyToEastNorth(ptXY)

> var2 = util.XyToEastNorth(ptXY2)

>

> opp = Abs(var1(0) - var2(0))

> adj = Abs(var1(1) - var2(1))

> dratio = opp / adj

> newbearing = Atn(dratio) 'inverse tangent

>

> Bud Miller

> www.BudCAD.com

> Try the only Legal Writer that reads parcels directly!

>

>

> "Bud" wrote in message

> news:CCFAF8FF20879105FFED13D7A4864586@in.WebX.maYIadrTaRb...

> > This will work with a north rotation of 0 (north straight up).

> > To use it with NR you'll need to get the angle by converting the XY of

the

> > start and end points to North/East.

> >

> > unit = acDegreeMinuteSeconds

> > bearinquest = ent.Angle * (180 / pi)

> >

> > select case bearinquest

> > case < 90

> > bearinquest = Abs(90 - bearinquest)

> >

> > 'similar statements to correct the angle for each quadrant

> >

> > end select

> >

> > bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

> > converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

> > 'convert to min etc

> >

> > --

> > Bud Miller

> > www.BudCAD.com

> > Try the only Legal Writer that reads parcels directly!

> >

> > "John Uhden" wrote in message

> > news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYIadrTaRb...

> > > Thanks, Glen. We probably all knew that, but my concern was that his

> > interpretation of the angle was w/r/t the drawing's North rotation. I

> > beleive the AngleToString method incorporates that.

> > >

> > > So when is Pipeworks going to let me enter inverts in the tabular

editor

> > without recalculating the whole d____d run? Did you realize that this

> June

> > we're coming up on the 10th anniversary of its failure to work

correctly?

> > >

> > > --

> > > John Uhden, Cadlantic/formerly CADvantage

> > > [ mailto:juhden@cadlantic.com ]

> > > [ http://www.cadlantic.com ]

> > > 2 Village Road

> > > Sea Girt, NJ 08750

> > > Tel. 732-974-1711

> > >

> > >

> > > "Glen Albert" wrote in message

> > news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYIadrTaRb...

> > > > It's also fairly straight forward if you want to calc it yourself if

> you

> > > > need more control over the string formating. Once you get the

decimal

> > degree

> > > > value, to get the degree portion of the DMS value you convert the

> > direction

> > > > to an integer. This will truncate the numbers to the right of the

> > decimal

> > > > point. You then subtract the Deg value from the decimal degree value

> > then

> > > > multiple by 60 you get the decimal minutes. then repeat the

procedure

> > for

> > > > the seconds.

> > > >

> > > > In this example, the original decDeg is a double, the Deg and Min

> > variables

> > > > are integers and the Sec variable is a double to carry the seconds

> > > > precision.

> > > >

> > > > deg = Int(decDeg)

> > > >

> > > > decDeg= (decDeg- Int(decDeg)) * 60

> > > > min = Int(decDeg)

> > > >

> > > > decDeg= (decDeg- Int(decDeg)) * 60

> > > > sec = RoundVal(decDeg, 0))

> > > >

> > > > ' check for values rounded to 60

> > > > If sec >= 60 Then

> > > > sec = sec - 60

> > > > min = min + 1

> > > > End If

> > > > If min >= 60 Then

> > > > min = min - 60

> > > > deg = deg + 1

> > > > End If

> > > >

> > > > ' format the strings

> > > > sDeg = CStr(deg)

> > > > If sDeg = "0" Then sDeg = "00" & sDeg

> > > > sMin = CStr(min)

> > > > If Len(sMin) = 1 Then sMin = "0" & sMin

> > > > sSec = CStr(sec)

> > > > If Len(sSec) = 1 Then sSec = "0" & sSec

> > > >

> > > > sDMS= sDeg & "-" & sMin & "-" & sSec

> > > >

> > > > This gives the azimuth. If you want bearings you first need to get

the

> > > > correct quadrant and angle.

> > > >

> > > > Glen

> > > >

> > > > "John Uhden" wrote in message

> > > > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYIadrTaRb...

> > > > > I just stumbled on an almost undocumented "AngleToString" method.

I

> > don't

> > > > know VBA but it's used on the

Aecc.Application.ActiveDocument.Utility

> > > > object...

> > > > >

> > > > >

> > > >

> > > >

> >

> >

>

>

product

great results.

One other thing I'm stuggling with is, once I get these string values I'm

writing them to a text file.

Of course, since they are Strings they are entered into the text file with

quotes around them. "String"

Is there anyway to prevent the quotes from being placed in the text file?

Gene

"Bud"

news:2EC6ED4834D30BBB422B56C4EFE37668@in.WebX.maYI

> This will get you the bearing (without a direction) from a selected line

> when the drawing is north rotated:

> (To get the direction you'd need to add a case statement that checks the

N/E

> of the start and endpoints relative to each other.)

>

> Dim util As AeccUtility

> Set util = AeccApplication.ActiveDocument.Utility

>

> Dim var1 As Variant

> Dim var2 As Variant

>

> ptXY = ent.StartPoint

> ptXY2 = ent.EndPoint

>

> ' Convert point to Easting, Northing

> var1 = util.XyToEastNorth(ptXY)

> var2 = util.XyToEastNorth(ptXY2)

>

> opp = Abs(var1(0) - var2(0))

> adj = Abs(var1(1) - var2(1))

> dratio = opp / adj

> newbearing = Atn(dratio) 'inverse tangent

>

> Bud Miller

> www.BudCAD.com

> Try the only Legal Writer that reads parcels directly!

>

>

> "Bud"

> news:CCFAF8FF20879105FFED13D7A4864586@in.WebX.maYI

> > This will work with a north rotation of 0 (north straight up).

> > To use it with NR you'll need to get the angle by converting the XY of

the

> > start and end points to North/East.

> >

> > unit = acDegreeMinuteSeconds

> > bearinquest = ent.Angle * (180 / pi)

> >

> > select case bearinquest

> > case < 90

> > bearinquest = Abs(90 - bearinquest)

> >

> > 'similar statements to correct the angle for each quadrant

> >

> > end select

> >

> > bearinquest = ActiveDocument.Utility.AngleToReal(bearinquest, acDegrees)

> > converted = ActiveDocument.Utility.AngleToString(bearinquest, unit, 4)

> > 'convert to min etc

> >

> > --

> > Bud Miller

> > www.BudCAD.com

> > Try the only Legal Writer that reads parcels directly!

> >

> > "John Uhden"

> > news:810419FD7A252ED6108C2D18CFF0EFA6@in.WebX.maYI

> > > Thanks, Glen. We probably all knew that, but my concern was that his

> > interpretation of the angle was w/r/t the drawing's North rotation. I

> > beleive the AngleToString method incorporates that.

> > >

> > > So when is Pipeworks going to let me enter inverts in the tabular

editor

> > without recalculating the whole d____d run? Did you realize that this

> June

> > we're coming up on the 10th anniversary of its failure to work

correctly?

> > >

> > > --

> > > John Uhden, Cadlantic/formerly CADvantage

> > > [ mailto:juhden@cadlantic.com ]

> > > [ http://www.cadlantic.com ]

> > > 2 Village Road

> > > Sea Girt, NJ 08750

> > > Tel. 732-974-1711

> > >

> > >

> > > "Glen Albert"

> > news:679F3F890E14A4020B7D36618D84409E@in.WebX.maYI

> > > > It's also fairly straight forward if you want to calc it yourself if

> you

> > > > need more control over the string formating. Once you get the

decimal

> > degree

> > > > value, to get the degree portion of the DMS value you convert the

> > direction

> > > > to an integer. This will truncate the numbers to the right of the

> > decimal

> > > > point. You then subtract the Deg value from the decimal degree value

> > then

> > > > multiple by 60 you get the decimal minutes. then repeat the

procedure

> > for

> > > > the seconds.

> > > >

> > > > In this example, the original decDeg is a double, the Deg and Min

> > variables

> > > > are integers and the Sec variable is a double to carry the seconds

> > > > precision.

> > > >

> > > > deg = Int(decDeg)

> > > >

> > > > decDeg= (decDeg- Int(decDeg)) * 60

> > > > min = Int(decDeg)

> > > >

> > > > decDeg= (decDeg- Int(decDeg)) * 60

> > > > sec = RoundVal(decDeg, 0))

> > > >

> > > > ' check for values rounded to 60

> > > > If sec >= 60 Then

> > > > sec = sec - 60

> > > > min = min + 1

> > > > End If

> > > > If min >= 60 Then

> > > > min = min - 60

> > > > deg = deg + 1

> > > > End If

> > > >

> > > > ' format the strings

> > > > sDeg = CStr(deg)

> > > > If sDeg = "0" Then sDeg = "00" & sDeg

> > > > sMin = CStr(min)

> > > > If Len(sMin) = 1 Then sMin = "0" & sMin

> > > > sSec = CStr(sec)

> > > > If Len(sSec) = 1 Then sSec = "0" & sSec

> > > >

> > > > sDMS= sDeg & "-" & sMin & "-" & sSec

> > > >

> > > > This gives the azimuth. If you want bearings you first need to get

the

> > > > correct quadrant and angle.

> > > >

> > > > Glen

> > > >

> > > > "John Uhden"

> > > > news:6CCA4AD1BA04E7219FC98360C26B9C2B@in.WebX.maYI

> > > > > I just stumbled on an almost undocumented "AngleToString" method.

I

> > don't

> > > > know VBA but it's used on the

Aecc.Application.ActiveDocument.Utility

> > > > object...

> > > > >

> > > > >

> > > >

> > > >

> >

> >

>

>

Search This Board

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.

- Privacy | Legal Notices & Trademarks | Report Noncompliance | Site map | © Copyright 2014 Autodesk Inc. All rights reserved

Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Please see the Autodesk Creative Commons FAQ for more information.