ChirilaDan Posted February 10, 2010 Share Posted February 10, 2010 Hi, i'm working in autocad 2005 for civil engeneering project, and i'm in need of an lisp routine ,(similar to "dist" command,) in wich to be displayed the horizontal angle (from direction North, clockwise) , vertical angle, slope distance, horizontal distance, delta x, y, z betwen 2 points or 1 control point and multiple points . if possible to be displayed separated just by commas so that i can paste them into excel sorry for my englsh Thank's Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 10, 2010 Share Posted February 10, 2010 This might get you halfway there: http://www.cadtutor.net/forum/showthread.php?t=42128 Quote Link to comment Share on other sites More sharing options...
guitarguy1685 Posted February 11, 2010 Share Posted February 11, 2010 you are so prolific among this forum Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 11, 2010 Share Posted February 11, 2010 you are so prolific among this forum Thanks GuitarGuy, but I do spend too much time on here... Quote Link to comment Share on other sites More sharing options...
ReMark Posted February 11, 2010 Share Posted February 11, 2010 The Germans had their Enigma coding machine. CADTutor has a coding machine too. His name is Lee Mac. Quote Link to comment Share on other sites More sharing options...
ChirilaDan Posted February 11, 2010 Author Share Posted February 11, 2010 Thanks Lee Mac it's just what i need but the only deference is that i need the angles units to be displayed in "grads" . Can you help me with this one, i don't have any knowledge in lisp routine language. Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted February 11, 2010 Share Posted February 11, 2010 Never mind, Rads are not GRADS. Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted February 11, 2010 Share Posted February 11, 2010 I'm not good at LISP, but the changes you need for Grads are not complex. I've taken the liberty of modifying Alans program. You will need to edit the LSP file with a text editor and make the following changes highlighted in RED. (defun c:D (/) (c:DistanceInquiry)) (defun c:DistanceInquiry (/ *error* AT:FlatDist AT:Arrow AT:Midpoint AT:PointSameXY AT:DrawX _GetPoint AT:Entsel #PromptString #OldOsnapz #Luprec #Lunits #Measure #Arch _RToS #Point1 #Point2 #Bear #Rad [color=Red]#Grad[/color] #Angle #Dist #Elev #Slope ) ;; points picked, calculation time (setq #Point1 (trans #Point1 1 0) #Point2 (trans #Point2 1 0) #Bear (angtos (angle #Point1 #Point2) 4 4 ) ;_ angtos #Angle (angtos (angle #Point1 #Point2) 1 4) #Rad (angle #Point1 #Point2) [color=Red]#Grad (/ #Rad (/ 3.14159 200))[/color] #Dist (* #Arch (AT:FlatDist #Point1 #Point2)) I Wikipediad the conversion formula for radians to gradians, check it for accuracy. (the code above means: grad = rad / (pi / 200) ) (setq #PromptString (strcat #PromptString "\nRad: " (vl-princ-to-string #Rad) [color=Red] ", Grad: " (vl-princ-to-string #Grad) [/color] ", Azimuth: " #Angle ", Bear: " #Bear ", Dist: " (_RToS #Dist) please check some known angles before you trust this, as I had never used Gradians prior to this. Hope this helps. Glen Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 11, 2010 Share Posted February 11, 2010 Glen, Just use angtos to convert it directly into a string Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 11, 2010 Share Posted February 11, 2010 This should be all you need to add: (setq #PromptString (strcat #PromptString "\nRad: " (vl-princ-to-string #Rad) ", Azimuth: " #Angle ", Bear: " #Bear [color=Red][b] ", Grad: " (angtos #Rad 2 4)[/b][/color] ", Dist: " (_RToS #Dist) ) ;_ strcat ) ;_ setq Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted February 11, 2010 Share Posted February 11, 2010 Lee, At first I was like : Then I looked up angtos :facepalm and then I was like: Thanks for the lesson. So the only update that you need to make to the code would be this: (setq #PromptString (strcat #PromptString "\nRad: " (vl-princ-to-string #Rad) [color=Red] ", Grad: " (angtos #Rad 2 3) [/color] ", Azimuth: " #Angle ", Bear: " #Bear ", Dist: " (_RToS #Dist) ) ;_ strcat which returns and prints out your angle in Gradians to 3 significant digits. if you need more, increase the 3 to what you want. Glen Which, naturally you beat me to!! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 11, 2010 Share Posted February 11, 2010 At first I was like : Then I looked up angtos :facepalm and then I was like: Thanks for the lesson. Don't worry, I've been there Quote Link to comment Share on other sites More sharing options...
ChirilaDan Posted February 11, 2010 Author Share Posted February 11, 2010 I'd replace that . Thanks i'm almost there, can you tell me what code to write to to tell the program when making a subtraction like this : (- (caddr #Point2) (caddr #Point1) ) if the resulting number is negative then make a subtraction like this (- (caddr #Point1) (caddr #Point2) ) so the number is always positive so that later on i can calculate the angle of a slope using formula (atan slope 100) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 11, 2010 Share Posted February 11, 2010 i'm almost there, can you tell me what code to write to to tell the program when making a subtraction like this : (- (caddr #Point2) (caddr #Point1) ) if the resulting number is negative then make a subtraction like this (- (caddr #Point1) (caddr #Point2) ) so the number is always positive so that later on i can calculate the angle of a slope Why not use: (abs (- (caddr #Point1) (caddr #Point2))) Quote Link to comment Share on other sites More sharing options...
ChirilaDan Posted February 11, 2010 Author Share Posted February 11, 2010 Thanks all. I've manage to modify this lisp to my needs. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 11, 2010 Share Posted February 11, 2010 Thanks all. I've manage to modify this lisp to my needs. Happy to help Dan Quote Link to comment Share on other sites More sharing options...
alanjt Posted February 11, 2010 Share Posted February 11, 2010 Glad you got the issue resolved. Sorry I wasn't around to lend a hand. Quote Link to comment Share on other sites More sharing options...
allanbsteven Posted January 23, 2015 Share Posted January 23, 2015 Happy to help Dan How could one change this to have it "alert"? Show up as a separate box? Thanks Allan 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.