nalsur8 Posted April 12, 2011 Share Posted April 12, 2011 (edited) this coding only can select line not polyline how to change the code, so user can select line and polyline to add dimension/leader TQ (defun C:DCH(/ CL CHAM DL PT1 PT2 ANG ANG1 DIST PT3 PT4 DIST1 T1 H1 V1) (defun *error* (msg) (setq *error* nil) (princ)) (setq old10 (getvar "ucsorg")) (command "_ucs" "w") (command "_ucsicon" "or") (setvar "CMDECHO" 0) (setq CL(getvar "CLAYER") CHAM(entget(car(entsel "\nSelect Chamfer to Dimension: "))) PT1(cdr(assoc 10 CHAM)) PT2(cdr(assoc 11 CHAM)) ANG(angle PT1 PT2) ANG1(angtos ANG 0 0) DIST(distance PT1 PT2)) (cond ((or(= ANG1 "45")(= ANG1 "135")(= ANG1 "225")(= ANG1 "315")) (setq PT3(polar PT1 ANG (/ DIST 2.0)) PT4(getpoint "\nNote Location: ") DIST1(rtos(* DIST(abs(cos ANG))) 2 2) T1(strcat "C"DIST1)) (command "leader" pt3 pt4 "" "" "" T1 "") ) ((or(and(> ANG1 "0")(< ANG1 "45")) (and(> ANG1 "45")(< ANG1 "135")) (and(> ANG1 "135")(< ANG1 "225")) (and(> ANG1 "225")(< ANG1 "315")) (and(> ANG1 "315")(< ANG1 "360"))) (setq H1(getpoint "\nHorizontal Dimension Line Location: ") V1(getpoint "\nVertical Dimension Line Location: ")) (command "layer" "s" DL "" "dim" "horizontal" PT1 PT2 H1 "" "vertical" PT1 PT2 V1 "" nil) ) ) (command "layer" "s" CL "") ) Edited April 13, 2011 by nalsur8 Quote Link to comment Share on other sites More sharing options...
SunnyTurtle Posted April 12, 2011 Share Posted April 12, 2011 Hi i new to lisp so i don't understand completly what you are trying to do but can't you use the chamfer command that is build into utocad that allows you to chamfer Polylines Heres a small lisp for using that feature ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun PLC() (setq ply (entsel "\nSelect Polyline you wish to Chamfer: ")) (setq disa (getreal "\nEnter distance from corner to chamfer: ")) (setq anga 45) (command "chamfer" "angle" disa 315) (command "chamfer" "polyline" ply) );end defun PLC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 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.