priyanka_mehta Posted July 9, 2010 Share Posted July 9, 2010 Hi all, I need to create a line with specific length and angle using VBA. I am using Utility.PolarPoint method for the same but i need to set 0° North clockwise for my angles. It is not following the drawing units if i change them manually. It is by default using East Anticlockwise (3' 0 Clock position). Is there a way to set the drawing unit to north clockwise so that when i create a line at an angle of 0° through VBA it should appear like ↑ and not like → Please help !!! I have tried this solution that i received by posting the thread at incorrect sub forum but it didnt help http://www.cadtutor.net/forum/showthread.php?p=340889#post340889 Thanks and Regards, Priyanka Quote Link to comment Share on other sites More sharing options...
SEANT Posted July 9, 2010 Share Posted July 9, 2010 Modifying ANGBASE/ANGDIR may not apply at the level which VBA operates. It isn’t too hard to do that mathematically, however. AngBase.zip Quote Link to comment Share on other sites More sharing options...
Joro-- Posted July 9, 2010 Share Posted July 9, 2010 As far as I understand you need something like this: Function drawLineNorth(basePt As Variant, lineLen As Double, angDeg As Double) As AcadLine Dim angRad As Double angRad = ThisDrawing.Utility.AngleToReal(angDeg + 90, acDegrees) Dim line As AcadLine Dim pt1(2) As Double pt1(0) = 0 pt1(1) = 0 pt1(2) = 0 Dim pt2(2) As Double pt2(0) = lineLen pt2(1) = 0 pt2(2) = 0 Set line = ThisDrawing.ModelSpace.AddLine(pt1, pt2) line.Move pt1, basePt line.Rotate basePt, angRad line.Update Set drawLineNorth = line End Function Sub TryLineNorth() Dim L As AcadLine Dim basePt(2) As Double basePt(0) = 1 basePt(1) = 1 basePt(2) = 0 Set L = drawLineNorth(basePt, 3, 45) L.Update End Sub is that OK for you? Quote Link to comment Share on other sites More sharing options...
priyanka_mehta Posted July 12, 2010 Author Share Posted July 12, 2010 Thanks Joro. But I took Seant's suggestion and I mathematically rotated by using (theta*(-1)+ PI/2) where PI = Atn(1)*4. So it takes a 90 degree rotation which is the difference between arithmetic and geographic coordinates and autocad by default takes arithmetic coordinate system where as i wanted it in latter. Thanks a lot !!! Regards, Priyanka Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.