(defun uni (txt)
(entmake (list (cons 0 “TEXT”)
(cons 1 “-“)
(cons 6 (cdr (assoc 6 ent)))
(cons 7 (getvar “textstyle”))
(cons 10 (list (+ (nth 1 (assoc 10 ent)) 344) (nth 2 (assoc 10 ent))))
(cons 11 (list (+ (nth 1 (assoc 11 ent)) 355) (nth 2 (assoc 11 ent))))
(cons 40 (cdr (assoc 40 ent)))
(cons 41 (cdr (assoc 41 ent)))
(cons 62 (cdr (assoc 62 ent)))
(cons 72 2)
(cons 73 2)))
)
캐드에 입력하고
커맨드창에
(uni unit) 이렇게 입력하니까 리습은 되는데
(uni 다음에 어떠한 문자가 들어가도 다 실행되던데 정확어떤 문자가 들어가야 하나요?
캐드를 완전히 껐다가 이 리습만 로드 하고 실행해도 실행 된다면 님이 모르는 다른 리습이 로드 돼있는겁니다 실행이 되지 않아야 정상입니다
윽…어떤 방식으로 수정하면 좋을지 봐주 실 수 있으신가요??
(defun c:wgt (/ text len r ent txt)
(setvar “cmdecho” 0)
(setq text (ssget “w” ‘(3788 3075) ‘(3860 2246) ‘((-4 . “<or”)(0 . “TEXT”)(0 . “MTEXT”)(-4 . “or>”))))
(setq len (sslength text) r 1)
(repeat len
(setq ent (entget (ssname text (1- r))))
(setq txt (cdr (assoc 1 ent)))
(if (> (atof txt) 1)
(uni unit))
(tot total)
(setq r (1+ r))
)
(setvar “cmdecho” 1)
(princ)
)
(defun uni (txt)
(entmake (list (cons 0 “TEXT”)
(cons 1 “-“)
(cons 6 (cdr (assoc 6 ent)))
(cons 7 (getvar “textstyle”))
(cons 10 (list (+ (nth 1 (assoc 10 ent)) 344) (nth 2 (assoc 10 ent))))
(cons 11 (list (+ (nth 1 (assoc 11 ent)) 355) (nth 2 (assoc 11 ent))))
(cons 40 (cdr (assoc 40 ent)))
(cons 41 (cdr (assoc 41 ent)))
(cons 62 (cdr (assoc 62 ent)))
(cons 72 2)
(cons 73 2)))
)
(defun tot (txt)
(entmake (list (cons 0 “TEXT”)
(cons 1 “-“)
(cons 6 (cdr (assoc 6 ent)))
(cons 7 (getvar “textstyle”))
(cons 10 (list (+ (nth 1 (assoc 10 ent)) 344) (nth 2 (assoc 10 ent))))
(cons 11 (list (+ (nth 1 (assoc 11 ent)) 500) (nth 2 (assoc 11 ent))))
(cons 40 (cdr (assoc 40 ent)))
(cons 41 (cdr (assoc 41 ent)))
(cons 62 (cdr (assoc 62 ent)))
(cons 72 2)
(cons 73 2)))
)
단순히 좌표만따서 좌표내의 텍스트가 1일 경우와 2이상 경우만 나눠서
“-“라는 텍스트만 생성하는 리습입니다..
(setq a 5)
(setq b 3)
(setq d (test_call a b )) ;d는 광역변수. a b는 매개변수.
)
(setq c(* a d))
)
댓글로 달았다가 게시글이 지저분해져서 파일로 올립니다 ^^ ;;
감사합니다 참고하겠습니다!!
감사합니다..!근데 다운이 안되네요ㅠㅠㅠ
파일내용까지 확인했습니다..! 친절한 설명까지 감사합니다!!