2007에서 다정다감을 쓰려고보니
” Error: AutoCAD 변수 설정이 거부됨: “CECOLOR” “red””
요렇게 에러가 떠버립니다.
컬러함수 red를 숫자 1로 바꾸어주면 되는데요…
리습 내의 모든 컬러함수를 서치해서 숫자로 바꿔주려니 red~white까지
해야하는 번거로움도 있고 컬러명이 숫자로 되어있을경우 주석을 달아주
지 않으면 나중에 리습 분석시 번거로음이 생길것 같아..(헥헥~~=3)
setq 변수를 이용하여 red는 1이고 yellow는 2라고 한방에 처리해줄려고
했는뎅… 컬러명은 변수로 이용할수가 없는가봅니다.(휴~~ㅜㅜ)
컬러명이 들어가 있는 리습은 그대로 두고 다른 변수를 추가해서 쓸수있는 방법은 없는지 궁금합니다.
*********************************************************
(defun C:LEAD(/
ds p1 p2 ang w4 ys tp tbox tl p3 ;지역변수 정의
)
(defun SETERR(s)
(if (/= s “Function cancelled”)
(princ (strcat “nError: ” s))
); of If
(setq *error* oer seterr nil)
(princ)
); of SETERR
(setq oer *error* *error* seterr)
(push-env) ;환경변수 대피
(setq ds (getvar “DIMSCALE”) ;스케일 값
th (getvar “DIMTXT”))
(setq p1 (getpoint “nFirst point: “)) ;첫째점
(setq p2 (getpoint p1 “nSecond point: “)) ;두째점
(setq ang (angle p1 p2) ;두점이 이루는 각
w4 (which4 ang)) ;몇사분면인가?
(if (or (= w4 1) (= w4 4)) ;1,4분면일경우
(setq ys (* 1 ds)) ;y-scale = 1
(setq ys (* -1 ds)) ;y-scale = -1
) ;of if
(command “INSERT” (strcat (prefix) “blocks/arw1”) p1 ds ys (rtod ang))
(setvar “CECOLOR” “RED”) ;색을 빨강으로
(command “LINE” p1 p2 “”) ;leader line
(setvar “CECOLOR” “WHITE”) ;색을 흰색으로
(if (or (= w4 1) (= w4 4))
(progn ; 1, 4사분면일 때 왼쪽에서 오른쪽으로
(setq tp (list (+ (car p2) (* ds th)) (+ (cadr p2) (* ds 1.25)) 0.0))
(command “DTEXT” tp (* ds th) “0.0”)
) ;of progn
(progn ; 2 ,3사분면일 때 오른쪽에서 왼쪽으로
(setq tp (list (- (car p2) (* ds th)) (+ (cadr p2) (* ds 1.25)) 0.0))
;(command “DTEXT” “R” tp (* ds th) “0.0” /) ; text 입력대기
(command “DTEXT” “R” tp (* ds th) “0.0”) ; text입력대
) ;progn
) ;of if
*********************************************************
요 리습을 예제로 한번 알려주세요~~~