Author Topic: Set Angle Direction  (Read 232 times)

0 Members and 1 Guest are viewing this topic.


  • Newt
  • Posts: 28
Set Angle Direction
« on: February 07, 2019, 02:35:54 AM »

I want to set the angles to the north and clockwise to get the azimuths.
How do I do this in my application by code?
I do not want to do this in the AutoCAD environment, through the menus and windows of units and direction .
Normally when using :
Code: [Select]
double teta=myLine.Angle;
the angle of the line is obtained from the east and counterclockwise direction.


  • Bull Frog
  • Posts: 270
Re: Set Angle Direction
« Reply #1 on: February 07, 2019, 10:21:17 AM »
I assume that you want the angle base and angle direction to be North and Clockwise, which may or may not be the same as AutoCAD is set up in its current session, WHEN your code runs. AFTER your code runs, you want AutoCAD keeps its original angle base and direction. Not surprising at all, you use system variable "ANGBASE" and "ANGDIR" to do it.

You would have code like

Dim aBase As Double
Dim aDir As Integer

''Save variables' current value

'' Set variables as needed
ThisDrawing.SetSysVariable("ANGBASE", 3.1415926/2)
ThisDrawing.SetSysVariable("ANGDIR", 1)

On Error Resume Next


If err.Number<>0 Then
  '' handle possible error
End If

'' Restore the variables back to their original value
ThisDrawing.SetSysVariable("ANGBASE", aBase)
ThisDrawing.SetSysVariable("ANGDIR", aDir)

Private Sub DoWork()
  '' Do whatever
End Sub


  • Newt
  • Posts: 28
Re: Set Angle Direction
« Reply #2 on: February 07, 2019, 12:24:34 PM »
Dear n.yuan

Thank you for your advice .
It was very elaborate and perfect .