Jhun Gonzalo Posted April 29, 2009 Share Posted April 29, 2009 hi, please can u help me regarding with my MEP coordination section drawings im using Autocad 2009 i need a lsp route that will automatically provide an annotation with a level, kindly see attached image below: and also i attached of my annotation.lsp could up please fix it up because when i use it to as UCS model drawing it will rotate the icon on X and Y coordinate i like to make it use also on UCS arrangement. PLEASE HELP... (defun c:vl (/ p1 sub sub2) (setq osm(getvar "osmode")) (setq cla(getvar "clayer")) (command "ucs" "w") (command "attdia" "1") (command "osmode" "0") (command "layer" "n" "0-callout" "") (command "clayer" "0-Callout") (setq atd(getvar "attdia")) (setq bs " ") (setq def "t") (while def (command "attdia" 0) (if (= p1 nil) (command "insert" "AS-LVTX" pause "" "" "" bs bs bs "")) (if (/= p1 nil) (command "insert" "AS-LVTX" p1 "" "" "" bs bs bs "")) (command "attdia" atd) ;;; (setq abc "t") (while abc ;;; (setq ent (entlast)) (setq p1 (cdr (assoc 10 (entget ent)))) (setq p1x (car p1)) (setq p1y (cadr p1)) ;;; (initget 8 "u d s") (setq obj (getkword "Up/Down/Space?")) ; (if (= obj "s") (setq sub2 (getdist "set new distance:")) (setq sub sub2)) (if (= sub2 nil) (setq sub 6)) ; (if (= obj "u") (progn (setq p1y1 (+ p1y sub)) (setq p1 (list p1x p1y1)) (setq u1 (assoc 10 (entget ent))) (setq u2 (cons (car u1) (list p1x p1y1))) (setq u3 (subst u2 u1 (entget ent))) (entmod u3)) (if (= obj nil) (setq abc nil))) (if (= obj "d") (progn (setq p1y1 (- p1y sub)) (setq p1 (list p1x p1y1)) (setq u1 (assoc 10 (entget ent))) (setq u2 (cons (car u1) (list p1x p1y1))) (setq u3 (subst u2 u1 (entget ent))) (entmod u3)) (if (= obj nil) (setq abc nil)))) (if (or (/= obj "u") (/= obj "d")) (setq p2 (getpoint "pick target:" p1))) (if (= p2 nil) (setq def nil)) (command "erase" ent "") ;;; ;;; (setq pp1x (cdr p1)) (setq p1x (car p1)) (if (< (car p1) (car p2)) (progn (if (< (cadr p1) (cadr p2)) (setq p3d (- (cadr p1) (cadr p2)))) (if (< (cadr p2) (cadr p1)) (setq p3d (- (cadr p2) (cadr p1)))) (if (< (cadr p2) (cadr p1)) (progn (setq pp3x (- (* 1 p1x) 17)) (setq pp3 (list pp3x p1y 00)) (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr -60)) (* p3d 1.1547))) (command "leader" p2 p3 pp3 "a" "" "b" "AS-LVTX" p1 "" "" ""))) (if (< (cadr p1) (cadr p2)) (progn (setq pp3x (- (* 1 p1x) 17)) (setq pp3 (list pp3x p1y 00)) (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr 60)) (* p3d 1.1547))) (command "leader" p2 p3 pp3 "a" "" "b" "AS-LVTX" p1 "" "" ""))))) (if (< (car p2) (car p1)) (progn (if (< (cadr p1) (cadr p2)) (setq p3d (- (cadr p1) (cadr p2)))) (if (< (cadr p2) (cadr p1)) (setq p3d (- (cadr p2) (cadr p1)))) (if (< (cadr p2) (cadr p1)) (progn (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr -120)) (* p3d 1.1547))) (command "leader" p2 p3 p1 "a" "" "b" "AS-LVTX" p1 "" "" ""))) (if (< (cadr p1) (cadr p2)) (progn (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr 120)) (* p3d 1.1547))) (command "leader" p2 p3 p1 "a" "" "b" "AS-LVTX" p1 "" "" ""))))) (setq vs2 (* 2 (getvar "useri3"))) (command "insert" "LD-CRPT" p2 vs2 vs2 "")) (command "osmode" osm) (command "clayer" cla) (princ)) BR Jhun sample1.pdf Quote Link to comment Share on other sites More sharing options...
Jhun Gonzalo Posted May 2, 2009 Author Share Posted May 2, 2009 Hi for additional information on what Lisp route that i need just please find attached PDF files i have Lisp routine which draws a leader at 60; 120; 240; 320 degree angles so you don't have to eyeball ;(setq vs2(* 2 (getvar "useri1"))) (defun dtr (a) (* pi (/ a 180.0)) ) (defun rtd (a) (/ (* a 180.0) pi) ) (defun c:leang (/ p1 sub sub2) (setq osm(getvar "osmode")) (setq cla(getvar "clayer")) (command "ucs" "w") (command "attdia" "1") (command "osmode" "0") (command "layer" "n" "0-callout" "") (command "clayer" "0-Callout") (setq atd(getvar "attdia")) (setq bs " ") (setq def "t") (while def (command "attdia" 0) (if (= p1 nil) (command "insert" "AS-LVTX" pause "" "" "" bs bs bs "")) (if (/= p1 nil) (command "insert" "AS-LVTX" p1 "" "" "" bs bs bs "")) (command "attdia" atd) ;;; (setq abc "t") (while abc ;;; (setq ent (entlast)) (setq p1 (cdr (assoc 10 (entget ent)))) (setq p1x (car p1)) (setq p1y (cadr p1)) ;;; (initget 8 "u d s") (setq obj (getkword "Up/Down/Space?")) ; (if (= obj "s") (setq sub2 (getdist "set new distance:")) (setq sub sub2)) (if (= sub2 nil) (setq sub 6)) ; (if (= obj "u") (progn (setq p1y1 (+ p1y sub)) (setq p1 (list p1x p1y1)) (setq u1 (assoc 10 (entget ent))) (setq u2 (cons (car u1) (list p1x p1y1))) (setq u3 (subst u2 u1 (entget ent))) (entmod u3)) (if (= obj nil) (setq abc nil))) (if (= obj "d") (progn (setq p1y1 (- p1y sub)) (setq p1 (list p1x p1y1)) (setq u1 (assoc 10 (entget ent))) (setq u2 (cons (car u1) (list p1x p1y1))) (setq u3 (subst u2 u1 (entget ent))) (entmod u3)) (if (= obj nil) (setq abc nil)))) (if (or (/= obj "u") (/= obj "d")) (setq p2 (getpoint "pick target:" p1))) (if (= p2 nil) (setq def nil)) (command "erase" ent "") ;;; ;;; (setq pp1x (cdr p1)) (setq p1x (car p1)) (if (< (car p1) (car p2)) (progn (if (< (cadr p1) (cadr p2)) (setq p3d (- (cadr p1) (cadr p2)))) (if (< (cadr p2) (cadr p1)) (setq p3d (- (cadr p2) (cadr p1)))) (if (< (cadr p2) (cadr p1)) (progn (setq pp3x (- (* 1 p1x) 17)) (setq pp3 (list pp3x p1y 00)) (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr -60)) (* p3d 1.1547))) (command "leader" p2 p3 pp3 "a" "" "b" "AS-LVTX" p1 "" "" ""))) (if (< (cadr p1) (cadr p2)) (progn (setq pp3x (- (* 1 p1x) 17)) (setq pp3 (list pp3x p1y 00)) (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr 60)) (* p3d 1.1547))) (command "leader" p2 p3 pp3 "a" "" "b" "AS-LVTX" p1 "" "" ""))))) (if (< (car p2) (car p1)) (progn (if (< (cadr p1) (cadr p2)) (setq p3d (- (cadr p1) (cadr p2)))) (if (< (cadr p2) (cadr p1)) (setq p3d (- (cadr p2) (cadr p1)))) (if (< (cadr p2) (cadr p1)) (progn (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr -120)) (* p3d 1.1547))) (command "leader" p2 p3 p1 "a" "" "b" "AS-LVTX" p1 "" "" ""))) (if (< (cadr p1) (cadr p2)) (progn (command "dimstyle" "r" "non") (setq p3 (polar p2 (+ 0.0 (dtr 120)) (* p3d 1.1547))) (command "leader" p2 p3 p1 "a" "" "b" "AS-LVTX" p1 "" "" ""))))) (setq vs2 (* 2 (getvar "useri3"))) (command "insert" "LD-CRPT" p2 vs2 vs2 "")) (command "osmode" osm) (command "clayer" cla) (princ)) -only i want to remodified it because when i use on a model drawing that rotates the UCS view the leader will rotate also acording to X /Y axis direction, how can i re-aligned it that not affecting the on UCS orientations. -and also i need the Text leader that automatical creating the level by picking the ground level to bottom of duct / pipe services level. its like a dimension only it will create the dimension on the text leader. if ever please help me to make it this route so that it will be easier to me to make callout levels on coordination drawings, thanks and regards JG leang.zip SAMPLE2.pdf 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.