Display full version of the post: Getpolar function

lucasugar
22.02.2016, 20:36
Hello to everybody,I'd like to create a lisp function which waits for the user to specify a point which lies on a straight line passing through a specified point and inclined of a specified angle. It's not difficult to code but the function must show a rubber-line which moves only along the specified angle.I already coded such a function. Here it is:(defun getpolar (pt ang msg / r)  (vl-cmdf "_line" pt (strcat "<" (angtos ang (getvar "AUNITS"))))  (prompt msg)  (command pause)  (command)  (setq r (getvar "LASTPOINT"))  (entdel (entlast))  (polarp pt ang (* (distance r pt) (cos (- (angle pt r) ang)))))Try it like this:(getpolar '(0 0 0) 30 "Specifiy end point: ")But I want the function not to create a line entity and then delete it.Is there a simpler way?For example, if from command-line I enter:(getpoint '(0 0 0) "Specifiy end point: ")and then:<45a rubber-line which moves only along an angle of 45° appears.But how do I put it in a lisp function?Thanks to all.