ucs관련 블럭리습
컨텐츠 정보
- 268 조회
- 1 댓글
- 0 추천
- 0 비추천
- 목록
본문
ucs값이 들어가있는 도면에 블럭을 좌표값에 맞게 넣으려고 리습을 짰는데 먹히지가 않아요;;;왕초보라 이것저것 짜집기해서 한번만봐주세요
(defun c:bbre()
(GRAPHSCR)
(setq ata (getvar "attdia"))
(setq cdo (getvar "cmdecho"))
(setvar "attdia" 0)
(setvar "cmdecho" 0)
(command "layer" "m" "remark" "")
(command "layer" "s" "remark" "")
(if (/= (setq s1 (ssget "x" (list (cons 0 "INSERT")(cons 2 "BO")))) nil)
(setq es (ssname s1 0))
);exit if
(command "UCS" "E" s1)
(search)
(command "insert" "REMARK0″ "s" sc pt1 "0″ "" "" )
);exit if
);exit defun
(defun search()
(if (/= (setq s1 (ssget "x" (list (cons 0 "INSERT")(cons 2 "BO")))) nil)
(progn (setq es (ssname s1 0))
(setq eg (entget es))
(setq sx (cadr (assoc 10 eg))) ;INTSERT POINT X
(setq sy (caddr (assoc 10 eg))) ;INTSERT POINT Y
(setq sc (cdr (assoc 41 eg))) ;SCALE FACTOR
(setq ang1 (cdr (assoc 50 eg))) ;block rotated radian angle
(setq ang2 (/ (* ang1 180) pi)) ;;block rotation value
(setq pt1 (strcat (rtos sx 2 3) "," (rtos sy 2 3)))
(setq dx (- (* (* 200 sc) (cos ang1))
(* (* 100 sc) (sin ang1))
)
dy (+ (* (* 200 sc) (sin ang1))
(* (* 100 sc) (cos ang1))
)
)
(setq pt2 (strcat (rtos (+ sx dx) 2 3)
","
(rtos (+ sy dy) 2 3)
)
)
(setq scale (strcat "1:" (rtos (* sc 2) 2 0)));scale value
);exit progn
);exit if
);exit defun