Jump to content

Creating Line at an angle


priyanka_mehta

Recommended Posts

Hi all,

 

My code is almost done but i am stuck at the end. I am supposed to show directions and have been provided with the value of u and v.

Using atan(v/u) i get the value of theta.

 

But the problem that i guess is that by default the unit is set to East anticlockwise. So if i have to plot 83° it appears like 7°. Because it shows 0 in the East.If i change units to north clockwise, it doesn't makes a difference only if i plot in manually but no difference if i try to plot it via VBA.

 

Is there a way or some setting so that I can make 0° North clockwise as default

 

Please find the attached image.

 

Thanks a lot

Priyanka

directions.png

Link to comment
Share on other sites

Is there a way or some setting so that I can make 0° North clockwise as default

I think that the system variables ANGBASE (set to 90) and ANGDIR (set to 1) are what you are looking for. Please don't forget that those are saved in drawing.

 

Regards,

Link to comment
Share on other sites

It didn't help :(. I tried making angbase 0 but its still the same.

Sorry I forgot to paste the code in my previous thread. Is there something wrong with the code ?!

 


Dim Line As AcadLine
Dim r As Double
Dim theta As Double

Pnt = ThisDrawing.Utility.GetPoint(, "select point")
InsertionPoint(0) = Pnt(0)
InsertionPoint(1) = Pnt(1)
InsertionPoint(2) = 0



r = 2        'Suppose r = 2 and theta = 0 radians
theta = 0

  polarpnt = ThisDrawing.Utility.PolarPoint(InsertionPoint, theta, r)
  
  Set Line = ThisDrawing.ModelSpace.AddLine(InsertionPoint, polarpnt)
  
Dim pText As AcadText
   degree = (theta * 180) / 3.14
  Set pText = ThisDrawing.ModelSpace.AddText(degree, (Line.EndPoint), 0.3)

Link to comment
Share on other sites

Since you want North to be the 0 angle should set ANGBASE to 90, not to 0. I think the below example is what you need to use:

 

ThisDrawing.SetVariable "ANGBASE", 90
ThisDrawing.SetVariable "ANGDIR", 1

 

PS. Please take care that there is a separate sub-forum for VBA/.Net solutions.

 

Regards,

Link to comment
Share on other sites

Still no luck.. It is still creating line at 90° north when theta = 0 even after including the above code. Do i still need to add more lines of code to it.

When i manually change the drawing unit angles and manually create a line with command like @10

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...