면적리습 사용중 오스넵 초기화
컨텐츠 정보
- 229 조회
- 4 댓글
- 0 추천
- 0 비추천
-
목록
본문
캐드 파워를 쓰다가 일반캐드로 갈아타고 리습을 깔아서 사용중인데요
면적표 리습을 사용하고 나면 오스넵이 초기화 되버립니다ㅠㅠ
한두번은 그냥 사용했는데 너무 불편해서… 수정할 방법이 있을까요??
(defun c:ab ()
(setvar "osmode" 0)
(prompt "n select polyline in ones:?")
(setq ss (ssget) sl (sslength ss) arn (+ 3 sl)
sc (getint "n your drawing scale?:")
p1 (getpoint "n pick place of box?:")
an1 (/ pi 2) an2 pi an3 (* pi 1.5)
ts1 (* 3 sc) ra (* 2.8 sc)
sv1 (* 7.8 sc) sv (+ (* sv1 sl) sv1 ) sv3 (+ sv sv1 sv1)
sh1 (* 12 sc) sh2 (* 55 sc) sh3 (* 30 sc) sv0 (* sv1 sl)
t0 "1층 면 적 산 출 표" t1 "구분" t2 "산 출 근 거" t3 "면 적(M2)" t4 "합 계"
t5 "CAD계산에 의함" t6 "굴림"
p2 (polar p1 0 sh1) p3 (polar p2 0 sh2) p4 (polar p3 0 sh3)
p5 (polar p2 an1 sv) p6 (polar p3 an1 sv)
p7 (polar p1 an1 sv3) p8 (polar p4 an1 sv3)
p12 (polar p1 0 (/ sh1 2))
p120 (polar p12 an1 (/ sv1 2)) p12 (polar p120 an1 sv0)
p12t (polar p12 an1 sv1)
p23 (polar p3 an2 sv1) p230 (polar p23 an1 (/ sv1 2)) p23 (polar p230 an1 sv0)
p23t (polar p2 0 (/ sh2 2)) p23t (polar p23t an1 (/ sv1 2))
p23t (polar p23t an1 sv) p23tt (polar p23t an1 sv1)
p34 (polar p4 an2 sv1) p340 (polar p34 an1 (/ sv1 2)) p34 (polar p340 an1 sv0)
p34t (polar p3 0 (/ sh3 2)) p34t (polar p34t an1 (/ sv1 2))
p34t (polar p34t an1 sv) sn 0 n 1
);;setq
(command "layer" "m" "etc" "c" 6 "" "" "line" p1 p4 "" "chprop" "l" "" "c" 161 ""
"array" "l" "" "r" arn "" sv1 "" "chprop" "l" "p" "" "c" 141 ""
"line" p2 p5 "" "chprop" "l" "" "c" 161 ""
"line" p3 p6 "" "chprop" "l" "" "c" 161 ""
"line" p7 p8 "" "chprop" "l" "" "c" 141 ""
"layer" "m" "tex" "c" 3 "" ""
"text" "j" "mc" p120 ts1 "" t4 "text" "j" "mc" p12t ts1 "" t1
"text" "j" "mc" p23t ts1 "" t2 "text" "j" "mc" p34t ts1 "" t3
"text" "j" "mc" p23tt ts1 "" t0)
(repeat sl
(setq e0 (ssname ss sn)
e1 (entget e0) )
(setq VtxList '())
(cond
((= "LWPOLYLINE" (CDR (ASSOC 0 e1)))
(foreach x e1
(if (= (car x) 10)
(setq VtxList (append VtxList (list (cdr x)))))))
((= "POLYLINE" (CDR (ASSOC 0 e1)))
(SETQ AA (ENTGET(ENTNEXT (CDR (ASSOC -1 e1)))))
(WHILE (/= "SEQEND" (CDR (ASSOC 0 AA)))
(setq VtxList (append VtxList (list (cdr (ASSOC 10 AA)))))
(SETQ AA (ENTGET(ENTNEXT (CDR (ASSOC -1 AA))))))))
(setq ip1 (car vtxlist) ip2 (cadr vtxlist) ip3 (caddr vtxlist) ip4 (cadddr vtxlist)
ip1x (car ip1) ip1y (cadr ip1) ip3x (car ip3) ip3y (cadr ip3)
ip5x (/ (+ ip1x ip3x) 2) ip5y (/ (+ ip1y ip3y) 2) ip5 (list ip5x ip5y)
ip2x (car ip2) ip2y (cadr ip2) ip4x (car ip4) ip4y (cadr ip4)
ip6x (/ (+ ip2x ip4x) 2) ip6y (/ (+ ip2y ip4y) 2) ip6 (list ip6x ip6y) )
(setq ip1x (car ip1) ip2x (car ip2) ip2y (car (cdr ip2)) ip3y (car (cdr ip3))
d1 (abs (/ (- ip2x ip1x) 1000.0)) d2 (abs (/ (- ip3y ip2y) 1000.0)) sum (* d1 d2)
d1 (rtos d1 2 2) d2 (rtos d2 2 2) sum (rtos sum 2 2)
total (strcat d1 "X" d2 "=" sum) );;setq
(command "area" "e" e0)
(setq ar1 (/ (/ (getvar "area") 1.0e+02) 10000))
(setq ar1 (rtos ar1 2 2))
(if (= sum ar1)
(command "circle" p12 ra "text" "j" "mc" p12 "" "" n
"circle" ip5 ra "text" "j" "mc" ip5 "" "" n
"text" "j" "mr" p23 "" "" total
"text" "j" "mr" p34 "" "" sum )
(command "circle" p12 ra "text" "j" "mc" p12 "" "" n
"circle" ip5 ra "text" "j" "mc" ip5 "" "" n
"text" "j" "mr" p23 "" "" t5
"text" "j" "mr" p34 "" "" ar1 )
);;if
(setq n (+ n 1) sn (+ sn 1) svv sv1 p12 (polar p12 an3 svv)
p23 (polar p23 an3 svv) p34 (polar p34 an3 svv) svv (+ sv1 svv))
);;repeat
(setq p33 (polar p6 0 sh3))
(ssum p3 p33 p34)
(prin1)
);;defun
(defun ssum (p3 p33 p34)
(setq ss (ssget "w" p3 p33)
ls (sslength ss)
n 0
sum 0
);;setq
(repeat ls
(if (= "TEXT" (cdr (assoc 0 (entget (ssname ss n)))))
(progn
(setq n1 (read (cdr (assoc 1 (entget (ssname ss n)))))
sum (+ n1 sum)
n (1+ n)
);;setq
);;progn
);;if
);;repeat
(setq sum (rtos sum 2 2))
(command "text" "j" "mr" p34 ts1 "" sum)
);;defun
(defun c:ab1 ()
(prompt "nPolygon을 선택하시오->")
(setq n 2)
(while (<= 1 n)
(setq en (car (entsel) ) )
(if (eq (cdr (assoc 0 (entget en))) "LWPOLYLINE")
(progn
(command "area" "e" en)
(setq ar1 (/ (/ (getvar "area") 1.0e+02) 10000))
(prin1 ar1)
(setq ar1 (rtos ar1 2 2))
(setq p1 (getpoint "n pick point:?" ))
(command "text" "j" "mc" p1 "" "" ar1)
);;progn
);;if
);;while
(prin1)
)
관련자료
아린2님의 댓글
(defun c:ab () (setq osm (getvar "osmode")) ; 오스냅 저장 지점 (setvar "osmode" 0) (prompt "n select polyline in ones:?") (setq ss (ssget) sl (sslength ss) arn (+ 3 sl) sc (getint "n your drawing scale?:") p1 (getpoint "n pick place of box?:") an1 (/ pi 2) an2 pi an3 (* pi 1.5) ts1 (* 3 sc) ra (* 2.8 sc) sv1 (* 7.8 sc) sv (+ (* sv1 sl) sv1 ) sv3 (+ sv sv1 sv1) sh1 (* 12 sc) sh2 (* 55 sc) sh3 (* 30 sc) sv0 (* sv1 sl) t0 "1층 면 적 산 출 표" t1 "구분" t2 "산 출 근 거" t3 "면 적(M2)" t4 "합 계" t5 "CAD계산에 의함" t6 "굴림" p2 (polar p1 0 sh1) p3 (polar p2 0 sh2) p4 (polar p3 0 sh3) p5 (polar p2 an1 sv) p6 (polar p3 an1 sv) p7 (polar p1 an1 sv3) p8 (polar p4 an1 sv3) p12 (polar p1 0 (/ sh1 2)) p120 (polar p12 an1 (/ sv1 2)) p12 (polar p120 an1 sv0) p12t (polar p12 an1 sv1) p23 (polar p3 an2 sv1) p230 (polar p23 an1 (/ sv1 2)) p23 (polar p230 an1 sv0) p23t (polar p2 0 (/ sh2 2)) p23t (polar p23t an1 (/ sv1 2)) p23t (polar p23t an1 sv) p23tt (polar p23t an1 sv1) p34 (polar p4 an2 sv1) p340 (polar p34 an1 (/ sv1 2)) p34 (polar p340 an1 sv0) p34t (polar p3 0 (/ sh3 2)) p34t (polar p34t an1 (/ sv1 2)) p34t (polar p34t an1 sv) sn 0 n 1 );;setq (command "layer" "m" "etc" "c" 6 "" "" "line" p1 p4 "" "chprop" "l" "" "c" 161 "" "array" "l" "" "r" arn "" sv1 "chprop" "l" "p" "" "c" 141 "" "line" p2 p5 "" "chprop" "l" "" "c" 161 "" "line" p3 p6 "" "chprop" "l" "" "c" 161 "" "line" p7 p8 "" "chprop" "l" "" "c" 141 "" "layer" "m" "tex" "c" 3 "" "" "text" "j" "mc" p120 ts1 "" t4 "text" "j" "mc" p12t ts1 "" t1 "text" "j" "mc" p23t ts1 "" t2 "text" "j" "mc" p34t ts1 "" t3 "text" "j" "mc" p23tt ts1 "" t0) (repeat sl (setq e0 (ssname ss sn) e1 (entget e0) ) (setq VtxList '()) (cond ((= "LWPOLYLINE" (CDR (ASSOC 0 e1))) (foreach x e1 (if (= (car x) 10) (setq VtxList (append VtxList (list (cdr x))))))) ((= "POLYLINE" (CDR (ASSOC 0 e1))) (SETQ AA (ENTGET(ENTNEXT (CDR (ASSOC -1 e1))))) (WHILE (/= "SEQEND" (CDR (ASSOC 0 AA))) (setq VtxList (append VtxList (list (cdr (ASSOC 10 AA))))) (SETQ AA (ENTGET(ENTNEXT (CDR (ASSOC -1 AA)))))))) (setq ip1 (car vtxlist) ip2 (cadr vtxlist) ip3 (caddr vtxlist) ip4 (cadddr vtxlist) ip1x (car ip1) ip1y (cadr ip1) ip3x (car ip3) ip3y (cadr ip3) ip5x (/ (+ ip1x ip3x) 2) ip5y (/ (+ ip1y ip3y) 2) ip5 (list ip5x ip5y) ip2x (car ip2) ip2y (cadr ip2) ip4x (car ip4) ip4y (cadr ip4) ip6x (/ (+ ip2x ip4x) 2) ip6y (/ (+ ip2y ip4y) 2) ip6 (list ip6x ip6y) ) (setq ip1x (car ip1) ip2x (car ip2) ip2y (car (cdr ip2)) ip3y (car (cdr ip3)) d1 (abs (/ (- ip2x ip1x) 1000.0)) d2 (abs (/ (- ip3y ip2y) 1000.0)) sum (* d1 d2) d1 (rtos d1 2 2) d2 (rtos d2 2 2) sum (rtos sum 2 2) total (strcat d1 "X" d2 "=" sum) );;setq (command "area" "e" e0) (setq ar1 (/ (/ (getvar "area") 1.0e+02) 10000)) (setq ar1 (rtos ar1 2 4)) (if (= sum ar1) (command "circle" p12 ra "text" "j" "mc" p12 "" "" n "circle" ip5 ra "text" "j" "mc" ip5 "" "" n "text" "j" "mr" p23 "" "" total "text" "j" "mr" p34 "" "" sum ) (command "circle" p12 ra "text" "j" "mc" p12 "" "" n "circle" ip5 ra "text" "j" "mc" ip5 "" "" n "text" "j" "mr" p23 "" "" t5 "text" "j" "mr" p34 "" "" ar1 ) );;if (setq n (+ n 1) sn (+ sn 1) svv sv1 p12 (polar p12 an3 svv) p23 (polar p23 an3 svv) p34 (polar p34 an3 svv) svv (+ sv1 svv)) );;repeat (setq p33 (polar p6 0 sh3)) (ssum p3 p33 p34) (setvar "osmode" osm) ; 오스냅 원래대로 (저장했던 지점) (prin1) );;defun
(defun ssum (p3 p33 p34) (setq ss (ssget "w" p3 p33) ls (sslength ss) n 0 sum 0 );;setq (repeat ls (if (= "TEXT" (cdr (assoc 0 (entget (ssname ss n))))) (progn (setq n1 (read (cdr (assoc 1 (entget (ssname ss n))))) sum (+ n1 sum) n (1+ n) );;setq );;progn );;if );;repeat (setq sum (rtos sum 2 4)) (command "text" "j" "mr" p34 ts1 "" sum) );;defun
(defun c:ab1 () (prompt "nPolygon을 선택하시오->") (setq n 2) (while (<= 1 n) (setq en (car (entsel) ) ) (if (eq (cdr (assoc 0 (entget en))) "LWPOLYLINE") (progn (command "area" "e" en) (setq ar1 (/ (/ (getvar "area") 1.0e+02) 10000)) (prin1 ar1) (setq ar1 (rtos (- (ar1) 0.00005) 2 4)) (setq p1 (getpoint "n pick point:?" )) (command "text" "j" "mc" p1 "" "" ar1) );;progn );;if );;while (prin1) )
짱짱 멋져요
여길 고치면 +_+ 산식이 소수점 세자리까지 나올줄 알았는데 cad 산식에 의함으로 나와요 ;;ㅋㅋ 산식이 소수점 세째짜리 나오게 가르쳐주세요 (^^)(__) 아 그리구 산출근거란에 A×B=C 이거를 A×B 이렇게 고치고 싶습니다 +ㅁ+/
상큼메론90님의 댓글
질문이 면적표 리습을 사용하고 나면 오스넵이 초기화 되버립니다ㅠㅠ
(defun c:ab () (setq osm (getvar "osmode")) ; 오스냅 저장 지점 (setvar "osmode" 0) (prompt "n select polyline in ones:?") (setq ss (ssget) sl (sslength ss) arn (+ 3 sl) sc (getint "n your drawing scale?:") p1 (getpoint "n pick place of box?:") an1 (/ pi 2) an2 pi an3 (* pi 1.5) ts1 (* 3 sc) ra (* 2.8 sc) sv1 (* 7.8 sc) sv (+ (* sv1 sl) sv1 ) sv3 (+ sv sv1 sv1) sh1 (* 12 sc) sh2 (* 55 sc) sh3 (* 30 sc) sv0 (* sv1 sl) t0 "1층 면 적 산 출 표" t1 "구분" t2 "산 출 근 거" t3 "면 적(M2)" t4 "합 계" t5 "CAD계산에 의함" t6 "굴림" p2 (polar p1 0 sh1) p3 (polar p2 0 sh2) p4 (polar p3 0 sh3) p5 (polar p2 an1 sv) p6 (polar p3 an1 sv) p7 (polar p1 an1 sv3) p8 (polar p4 an1 sv3) p12 (polar p1 0 (/ sh1 2)) p120 (polar p12 an1 (/ sv1 2)) p12 (polar p120 an1 sv0) p12t (polar p12 an1 sv1) p23 (polar p3 an2 sv1) p230 (polar p23 an1 (/ sv1 2)) p23 (polar p230 an1 sv0) p23t (polar p2 0 (/ sh2 2)) p23t (polar p23t an1 (/ sv1 2)) p23t (polar p23t an1 sv) p23tt (polar p23t an1 sv1) p34 (polar p4 an2 sv1) p340 (polar p34 an1 (/ sv1 2)) p34 (polar p340 an1 sv0) p34t (polar p3 0 (/ sh3 2)) p34t (polar p34t an1 (/ sv1 2)) p34t (polar p34t an1 sv) sn 0 n 1 );;setq (command "layer" "m" "etc" "c" 6 "" "" "line" p1 p4 "" "chprop" "l" "" "c" 161 "" "array" "l" "" "r" arn "" sv1 "chprop" "l" "p" "" "c" 141 "" "line" p2 p5 "" "chprop" "l" "" "c" 161 "" "line" p3 p6 "" "chprop" "l" "" "c" 161 "" "line" p7 p8 "" "chprop" "l" "" "c" 141 "" "layer" "m" "tex" "c" 3 "" "" "text" "j" "mc" p120 ts1 "" t4 "text" "j" "mc" p12t ts1 "" t1 "text" "j" "mc" p23t ts1 "" t2 "text" "j" "mc" p34t ts1 "" t3 "text" "j" "mc" p23tt ts1 "" t0) (repeat sl (setq e0 (ssname ss sn) e1 (entget e0) ) (setq VtxList '()) (cond ((= "LWPOLYLINE" (CDR (ASSOC 0 e1))) (foreach x e1 (if (= (car x) 10) (setq VtxList (append VtxList (list (cdr x))))))) ((= "POLYLINE" (CDR (ASSOC 0 e1))) (SETQ AA (ENTGET(ENTNEXT (CDR (ASSOC -1 e1))))) (WHILE (/= "SEQEND" (CDR (ASSOC 0 AA))) (setq VtxList (append VtxList (list (cdr (ASSOC 10 AA))))) (SETQ AA (ENTGET(ENTNEXT (CDR (ASSOC -1 AA)))))))) (setq ip1 (car vtxlist) ip2 (cadr vtxlist) ip3 (caddr vtxlist) ip4 (cadddr vtxlist) ip1x (car ip1) ip1y (cadr ip1) ip3x (car ip3) ip3y (cadr ip3) ip5x (/ (+ ip1x ip3x) 2) ip5y (/ (+ ip1y ip3y) 2) ip5 (list ip5x ip5y) ip2x (car ip2) ip2y (cadr ip2) ip4x (car ip4) ip4y (cadr ip4) ip6x (/ (+ ip2x ip4x) 2) ip6y (/ (+ ip2y ip4y) 2) ip6 (list ip6x ip6y) ) (setq ip1x (car ip1) ip2x (car ip2) ip2y (car (cdr ip2)) ip3y (car (cdr ip3)) d1 (abs (/ (- ip2x ip1x) 1000.0)) d2 (abs (/ (- ip3y ip2y) 1000.0)) sum (* d1 d2) d1 (rtos d1 2 2) d2 (rtos d2 2 2) sum (rtos sum 2 2) total (strcat d1 "X" d2 "=" sum) );;setq (command "area" "e" e0) (setq ar1 (/ (/ (getvar "area") 1.0e+02) 10000)) (setq ar1 (rtos ar1 2 2)) (if (= sum ar1) (command "circle" p12 ra "text" "j" "mc" p12 "" "" n "circle" ip5 ra "text" "j" "mc" ip5 "" "" n "text" "j" "mr" p23 "" "" total "text" "j" "mr" p34 "" "" sum ) (command "circle" p12 ra "text" "j" "mc" p12 "" "" n "circle" ip5 ra "text" "j" "mc" ip5 "" "" n "text" "j" "mr" p23 "" "" t5 "text" "j" "mr" p34 "" "" ar1 ) );;if (setq n (+ n 1) sn (+ sn 1) svv sv1 p12 (polar p12 an3 svv) p23 (polar p23 an3 svv) p34 (polar p34 an3 svv) svv (+ sv1 svv)) );;repeat (setq p33 (polar p6 0 sh3)) (ssum p3 p33 p34) (setvar "osmode" osm) ; 오스냅 원래대로 (저장했던 지점) (prin1) );;defun
(defun ssum (p3 p33 p34) (setq ss (ssget "w" p3 p33) ls (sslength ss) n 0 sum 0 );;setq (repeat ls (if (= "TEXT" (cdr (assoc 0 (entget (ssname ss n))))) (progn (setq n1 (read (cdr (assoc 1 (entget (ssname ss n))))) sum (+ n1 sum) n (1+ n) );;setq );;progn );;if );;repeat (setq sum (rtos sum 2 2)) (command "text" "j" "mr" p34 ts1 "" sum) );;defun
(defun c:ab1 () (prompt "nPolygon을 선택하시오->") (setq n 2) (while (<= 1 n) (setq en (car (entsel) ) ) (if (eq (cdr (assoc 0 (entget en))) "LWPOLYLINE") (progn (command "area" "e" en) (setq ar1 (/ (/ (getvar "area") 1.0e+02) 10000)) (prin1 ar1) (setq ar1 (rtos ar1 2 2)) (setq p1 (getpoint "n pick point:?" )) (command "text" "j" "mc" p1 "" "" ar1) );;progn );;if );;while (prin1) )
; "array" "l" "" "r" arn "" sv1 <— 이부분에서 "" 하나가 에러나서 지웠어요..
;;