anindya Posted October 10, 2014 Share Posted October 10, 2014 I need to draw a line in any direction say clock wise or anti clock wise with respect to a base line with a definite angle value in degree minute and second with a fixed length in meter.is it possible by any lisp which will just ask me the angle value (degree minute and second),,,,,the direction(clockwise or anti clockwise) and the length in meter,and will draw the angle after selecting the base line?????? I am attaching a sample for observation NEED HELP 55.dwg Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 10, 2014 Share Posted October 10, 2014 (edited) Here, try this... (defun c:angfromlin (/ angb angd li loop stp enp lia nas nar d ch san) (setq angb (getvar 'angbase)) (setq angd (getvar 'angdir)) (setvar 'angbase 0.0) (setvar 'angdir 0) (while (or (null li) loop) (setq li (car (entsel "\nPick reference line..."))) (if (null li) (prompt "\nMissed... Try picking again...") ) (if li (if (not (eq (cdr (assoc 0 (entget li))) "LINE")) (progn (prompt "\nPicked wrong entity type... Please choose 2D line... Try picking again..." ) (setq loop t) ) (progn (setq stp (cdr (assoc 10 (entget li)))) (setq enp (cdr (assoc 11 (entget li)))) (if (or (not (equal (last stp) 0.0 1e-6)) (not (equal (last enp) 0.0 1e-6)) ) (progn (prompt "\nLine is 3D line... Please choose 2D line... Try picking again..." ) (setq loop t) ) (setq loop nil) ) ) ) ) ) (setq lia (angle stp enp)) (setq nas (getstring "\nPlease specify new angle measured from reference picked line in form [XdX'X.X\"] where X is number : " ) ) (setq nar (angtof nas 1)) (initget 7) (setq d (getdist "\nPick or specify length of new line : ")) (initget 1 "CW CCW") (setq ch (getkword "\nChoose side for new line [CW/CCW] : ")) (if (eq ch "CCW") (progn (setq san (+ lia nar)) (entmake (list '(0 . "LINE") (cons 10 stp) (cons 11 (polar stp san d)) ) ) ) (progn (setq san (- lia nar)) (entmake (list '(0 . "LINE") (cons 10 stp) (cons 11 (polar stp san d)) ) ) ) ) (setvar 'angbase angb) (setvar 'angdir angd) (princ) ) M.R. Edited October 10, 2014 by marko_ribar localized variable "san" I missed Quote Link to comment Share on other sites More sharing options...
anindya Posted October 10, 2014 Author Share Posted October 10, 2014 great job sir......it is working Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 10, 2014 Share Posted October 10, 2014 You're welcome, anindya... I forgot to localize one variable, now fixed... Marko R. Quote Link to comment Share on other sites More sharing options...
highflybird Posted October 10, 2014 Share Posted October 10, 2014 Here, try this... M.R. Hi marko ,Your ability to fully can make it dynamic Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 10, 2014 Share Posted October 10, 2014 Please note that third-party programs are not actually required to complete this task, as shown by the following demo: If you align your UCS to the line in question, zero degrees will be parallel to the line, with positive angles measured counter-clockwise, and negative angles clockwise. Lee Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 10, 2014 Share Posted October 10, 2014 What ab older versions of AutoCAD ? Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 10, 2014 Share Posted October 10, 2014 Oh, I know... @500.0 Regards, thanks anyway... Quote Link to comment Share on other sites More sharing options...
highflybird Posted October 10, 2014 Share Posted October 10, 2014 Oh, I know... @500.0 Regards, thanks anyway... But , I didn't see lee Enter "@ " Must rotating ucs , Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 10, 2014 Share Posted October 10, 2014 But , I didn't see lee Enter "@ " This is only required in older versions of CAD in which Dynamic Input is not available (or for command-line input). Rotating the UCS is only two clicks... 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.