캐드 분류
리습 문법이 잘 못됐다고 나오는데 한번봐주실수있나요 ㅠㅠ
컨텐츠 정보
- 636 조회
- 0 추천
- 0 비추천
-
목록
본문
사용하려고하는데 문법오류가 뜨는데 해결해주실수있나요 ㅠㅠ
;; ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
;; Fire-alarm 면적 및 필요감지기 수량 체크
(defun c:fa ( / a i s cl txt_bsz txt_bsc txt_sz OBJ oa unit p1 p2 pnt1 cdec btype spec height stru bname sname err area blkname pnt2 dist)
(vl-load-com)
(defun BK_Roundto ( n p ) (/ (fix (+ (* n (setq p (expt 10. p))) (if (minusp n) -0.5 0.5))) p))
(defun BK_roundup1 ( y )
(if (equal 0.0 (rem y 1) 1e-8)
(atoi (rtos y 2 0))
(* 1 (fix (1+ (/ y 1))))
)
)
(setq cl (getvar "clayer"))
(setq cdsep (getvar "dimdsep"))
(setq cdec (getvar "dimdec"))
(setq txt_bsz 1.5)
(setq txt_bsc (getreal "Scale을 입력 :"))
(if (= txt_bsc nil) (setq txt_bsc (getvar "ltscale")))
(setq txt_sz (* txt_bsz txt_bsc))
(setq dist (* txt_bsc 10))
(setvar "dimscale" (getvar "ltscale"))
(setvar "dimdsep" ".")
(setvar "dimdec" 2)
(setq btype (getreal " 감지기 종류를 선택하세요. 1) 차동식 2) 정온식 3) 보상식 4) 연기식 (Default : 차동식) : ")) ;; 조건 1 : 차동식, 정온식, 보상식, 연기식
(if (= btype nil) (setq btype 1))
(setq spec (getreal " 종별 구분을 선택하세요. 1) 1종 2) 2종 3) 3종(연기식만 해당됨) 4) 특종(정온식만 해당됨) (Default : 2종) : ")) ;; 조건 2 : 1종, 2종, 3종,특종
(if (= spec nil) (setq spec 2))
(if (and (/= btype 4) (= spec 3) ) (setq err "n3종은 연기식만 가능합니다" "n3종은 연기식만 가능합니다" "n3종은 연기식만 가능합니다"))
(if (and (/= btype 2) (= spec 4) ) (setq err "n특종은 정온식만 가능합니다" "n특종은 정온식만 가능합니다" "n특종은 정온식만 가능합니다"))
(setq height (getreal " 설치높이를 선택하세요. 1) 4m 미만 2) 4m~8m미만 3) 4m~20m미만(연기식만 해당됨) (Default : 4m 미만) : ")) ;; 조건 3 : 4m 이하 or 4m ~ 8m미만 or 4m ~ 20m미만
(if (= height nil) (setq height 1))
(if (and (= btype 2) (= spec 2) (= height 2)) (setq err "n정온식 2종은 4~8m미만에 설치 불가합니다" "n정온식 2종은 4~8m미만에 설치 불가합니다" "n정온식 2종은 4~8m미만에 설치 불가합니다"))
(if (and (= btype 4) (= spec 3) (= height 3)) (setq err "n4~20m미만 조건은 연기식 1,2종만 해당됩니다" "n4~20m미만 조건은 연기식 1,2종만 해당됩니다" "n4~20m미만 조건은 연기식 1,2종만 해당됩니다"))
(if (and (= btype 4) (= height 2)) (setq err "n4~8m미만 조건은 연기식에 해당되지 않습니다" "n4~8m미만 조건은 연기식에 해당되지 않습니다" "n4~8m미만 조건은 연기식에 해당되지 않습니다"))
(if (and (/= btype 4) (= height 3)) (setq err "n4~20m미만 조건은 연기식만 해당됩니다" "n4~20m미만 조건은 연기식만 해당됩니다" "n4~20m미만 조건은 연기식만 해당됩니다"))
(setq stru (getreal " 설치장소 구조를 선택하세요. 1) 내화구조 2) 기타구조 (Default : 기타구조) : ")) ;; 조건 4 : 내화구조, 기타구조
(if (= stru nil) (setq stru 2))
(cond ((or (= btype 1) (= btype nil)) (setq bname "차동식"))
((= btype 2) (setq bname "정온식"))
((= btype 3) (setq bname "보상식"))
((= btype 4) (setq bname "연기식"))
)
(cond ((= spec 1) (setq sname "1종"))
((or (= spec 2) (= spec nil)) (setq sname "2종"))
((= spec 3) (setq sname "3종"))
((= spec 4) (setq sname "특종"))
)
(cond ((or (= btype 1) (= btype nil)) (setq blkname "F1″))
((= btype 2) (setq blkname "F2″))
((= btype 4) (setq blkname "F3″))
)
;; 차동식/보상식 1종 : 90 50 45 30
;; 차동식/보상식 2종 : 70 40 35 25
;; 정온식 특종 : 70 40 35 25
;; 정온식 1종 : 60 30 30 15
;; 정온식 2종 : 20 15
;; 연기식 1종/2종 : 150 75
;; 연기식 3종 : 50
(cond ;; 차동식/보상식 1종
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 1) (= stru 1)) (setq area 90))
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 1) (= stru 2)) (setq area 50))
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 2) (= stru 1)) (setq area 45))
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 2) (= stru 2)) (setq area 30))
;; 차동식/보상식 2종
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 1) (= stru 1)) (setq area 70))
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 1) (= stru 2)) (setq area 40))
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 2) (= stru 1)) (setq area 35))
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 2) (= stru 2)) (setq area 25))
;; 정온식 1종
((and (= btype 2) (= spec 1) (= height 1) (= stru 1)) (setq area 60))
((and (= btype 2) (= spec 1) (= height 1) (= stru 2)) (setq area 30))
((and (= btype 2) (= spec 1) (= height 2) (= stru 1)) (setq area 30))
((and (= btype 2) (= spec 1) (= height 2) (= stru 2)) (setq area 15))
;; 정온식 2종
((and (= btype 2) (= spec 2) (= height 1) (= stru 1)) (setq area 20))
((and (= btype 2) (= spec 2) (= height 1) (= stru 2)) (setq area 15))
((and (= btype 2) (= spec 2) (= height 2) (or (= stru 1) (= stru 2))) (princ err))
;; 정온식 특종
((and (= btype 2) (= spec 4) (= height 1) (= stru 1)) (setq area 70))
((and (= btype 2) (= spec 4) (= height 1) (= stru 2)) (setq area 40))
((and (= btype 2) (= spec 4) (= height 2) (= stru 1)) (setq area 35))
((and (= btype 2) (= spec 4) (= height 2) (= stru 2)) (setq area 25))
;; 연기식 1종 및 2종
((and (= btype 4) (or (= spec 1) (= spec 2)) (= height 1) (or (= stru 1) (= stru 2))) (setq area 150))
((and (= btype 4) (or (= spec 1) (= spec 2)) (= height 3) (or (= stru 1) (= stru 2))) (setq area 75))
;; 연기식 3종
((and (= btype 4) (= spec 3) (= height 1) (or (= stru 1) (= stru 2))) (setq area 50))
)
(setq s (ssget '( (0 . "CIRCLE,ELLIPSE,*POLYLINE,SPLINE")
(-4 . " (-4 . " (0 . "POLYLINE") (-4 . "&") (70 . 80)
(-4 . "AND>")
(-4 . "NOT>")
)
)
);setq
(command "clayer" "defpoints")
(command "la" "c" "11″ "" "")
(repeat
(setq cnt (sslength s))
(setq obj (vlax-ename->vla-object (ssname s (setq cnt (1- cnt)))))
(setq i (sslength s))
(setq a (vlax-curve-getarea obj))
(setq oa (rtos a 0))
(setq unit "㎡")
;(setq base "기준면적 : ")
;(setq sep " / ")
;(setq inst " 개 설치")
(vla-getboundingbox OBJ 'P1 'P2)
(setq P1 (vlax-safearray->list P1))
(setq P2 (vlax-safearray->list P2))
(setq pnt1 (list (+ (car p1) (/ (- (car p2) (car p1)) 2)) (+ (cadr p1) (/ (- (cadr p2) (cadr p1)) 2))))
(setq pnt2 (list (+ (car p1) (/ (- (car p2) (car p1)) 2)) (+ (+ (cadr p1) (/ (- (cadr p2) (cadr p1)) 2)) dist )))
;; 자동으로 블럭 삽입하려면 이곳에 해당 명령줄 추가
(COMMAND "INSERT" blkname pnt2 txt_bsc txt_bsc "0″)
(COMMAND "TEXT" "M" pnt2 txt_sz "" (rtos (bk_roundup1 (/ (atof oa) 1000000 area)) 2 0)) ;;심벌 중앙에 "TS" 리습을 위한 숫자 기입
(command "MTEXT" p1 "J" "MC" "h" txt_sz "s" "standard" p2 (strcat "면적 : " (rtos (/ (atof oa) 1000000) 2 2) unit
"n" "기준면적 : " (rtos area 2 0) unit " / 최소 " (rtos (bk_roundup1 (/ (atof oa) 1000000 area)) 2 0) " 개 설치"
"n" "(" bname " " sname ")" ) "")
(command "dimlinear" (list (car p1) (cadr p2)) (list (car p2) (cadr p2)) "h" "@0,0,0″) ;; 가로
(command "dimlinear" p1 (list (car p1) (cadr p2)) "v" "@0,0,0″) ;; 세로
);repeat
(command "clayer" cl)
(command "dimdsep" cdsep)
(command "dimdec" cdec)
(princ)
);defun
(vl-load-com) (princ)
;; Fire-alarm 면적 및 필요감지기 수량 체크
(defun c:fa ( / a i s cl txt_bsz txt_bsc txt_sz OBJ oa unit p1 p2 pnt1 cdec btype spec height stru bname sname err area blkname pnt2 dist)
(vl-load-com)
(defun BK_Roundto ( n p ) (/ (fix (+ (* n (setq p (expt 10. p))) (if (minusp n) -0.5 0.5))) p))
(defun BK_roundup1 ( y )
(if (equal 0.0 (rem y 1) 1e-8)
(atoi (rtos y 2 0))
(* 1 (fix (1+ (/ y 1))))
)
)
(setq cl (getvar "clayer"))
(setq cdsep (getvar "dimdsep"))
(setq cdec (getvar "dimdec"))
(setq txt_bsz 1.5)
(setq txt_bsc (getreal "Scale을 입력 :"))
(if (= txt_bsc nil) (setq txt_bsc (getvar "ltscale")))
(setq txt_sz (* txt_bsz txt_bsc))
(setq dist (* txt_bsc 10))
(setvar "dimscale" (getvar "ltscale"))
(setvar "dimdsep" ".")
(setvar "dimdec" 2)
(setq btype (getreal " 감지기 종류를 선택하세요. 1) 차동식 2) 정온식 3) 보상식 4) 연기식 (Default : 차동식) : ")) ;; 조건 1 : 차동식, 정온식, 보상식, 연기식
(if (= btype nil) (setq btype 1))
(setq spec (getreal " 종별 구분을 선택하세요. 1) 1종 2) 2종 3) 3종(연기식만 해당됨) 4) 특종(정온식만 해당됨) (Default : 2종) : ")) ;; 조건 2 : 1종, 2종, 3종,특종
(if (= spec nil) (setq spec 2))
(if (and (/= btype 4) (= spec 3) ) (setq err "n3종은 연기식만 가능합니다" "n3종은 연기식만 가능합니다" "n3종은 연기식만 가능합니다"))
(if (and (/= btype 2) (= spec 4) ) (setq err "n특종은 정온식만 가능합니다" "n특종은 정온식만 가능합니다" "n특종은 정온식만 가능합니다"))
(setq height (getreal " 설치높이를 선택하세요. 1) 4m 미만 2) 4m~8m미만 3) 4m~20m미만(연기식만 해당됨) (Default : 4m 미만) : ")) ;; 조건 3 : 4m 이하 or 4m ~ 8m미만 or 4m ~ 20m미만
(if (= height nil) (setq height 1))
(if (and (= btype 2) (= spec 2) (= height 2)) (setq err "n정온식 2종은 4~8m미만에 설치 불가합니다" "n정온식 2종은 4~8m미만에 설치 불가합니다" "n정온식 2종은 4~8m미만에 설치 불가합니다"))
(if (and (= btype 4) (= spec 3) (= height 3)) (setq err "n4~20m미만 조건은 연기식 1,2종만 해당됩니다" "n4~20m미만 조건은 연기식 1,2종만 해당됩니다" "n4~20m미만 조건은 연기식 1,2종만 해당됩니다"))
(if (and (= btype 4) (= height 2)) (setq err "n4~8m미만 조건은 연기식에 해당되지 않습니다" "n4~8m미만 조건은 연기식에 해당되지 않습니다" "n4~8m미만 조건은 연기식에 해당되지 않습니다"))
(if (and (/= btype 4) (= height 3)) (setq err "n4~20m미만 조건은 연기식만 해당됩니다" "n4~20m미만 조건은 연기식만 해당됩니다" "n4~20m미만 조건은 연기식만 해당됩니다"))
(setq stru (getreal " 설치장소 구조를 선택하세요. 1) 내화구조 2) 기타구조 (Default : 기타구조) : ")) ;; 조건 4 : 내화구조, 기타구조
(if (= stru nil) (setq stru 2))
(cond ((or (= btype 1) (= btype nil)) (setq bname "차동식"))
((= btype 2) (setq bname "정온식"))
((= btype 3) (setq bname "보상식"))
((= btype 4) (setq bname "연기식"))
)
(cond ((= spec 1) (setq sname "1종"))
((or (= spec 2) (= spec nil)) (setq sname "2종"))
((= spec 3) (setq sname "3종"))
((= spec 4) (setq sname "특종"))
)
(cond ((or (= btype 1) (= btype nil)) (setq blkname "F1″))
((= btype 2) (setq blkname "F2″))
((= btype 4) (setq blkname "F3″))
)
;; 차동식/보상식 1종 : 90 50 45 30
;; 차동식/보상식 2종 : 70 40 35 25
;; 정온식 특종 : 70 40 35 25
;; 정온식 1종 : 60 30 30 15
;; 정온식 2종 : 20 15
;; 연기식 1종/2종 : 150 75
;; 연기식 3종 : 50
(cond ;; 차동식/보상식 1종
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 1) (= stru 1)) (setq area 90))
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 1) (= stru 2)) (setq area 50))
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 2) (= stru 1)) (setq area 45))
((and (or (= btype 1) (= btype 3)) (= spec 1) (= height 2) (= stru 2)) (setq area 30))
;; 차동식/보상식 2종
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 1) (= stru 1)) (setq area 70))
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 1) (= stru 2)) (setq area 40))
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 2) (= stru 1)) (setq area 35))
((and (or (= btype 1) (= btype 3)) (= spec 2) (= height 2) (= stru 2)) (setq area 25))
;; 정온식 1종
((and (= btype 2) (= spec 1) (= height 1) (= stru 1)) (setq area 60))
((and (= btype 2) (= spec 1) (= height 1) (= stru 2)) (setq area 30))
((and (= btype 2) (= spec 1) (= height 2) (= stru 1)) (setq area 30))
((and (= btype 2) (= spec 1) (= height 2) (= stru 2)) (setq area 15))
;; 정온식 2종
((and (= btype 2) (= spec 2) (= height 1) (= stru 1)) (setq area 20))
((and (= btype 2) (= spec 2) (= height 1) (= stru 2)) (setq area 15))
((and (= btype 2) (= spec 2) (= height 2) (or (= stru 1) (= stru 2))) (princ err))
;; 정온식 특종
((and (= btype 2) (= spec 4) (= height 1) (= stru 1)) (setq area 70))
((and (= btype 2) (= spec 4) (= height 1) (= stru 2)) (setq area 40))
((and (= btype 2) (= spec 4) (= height 2) (= stru 1)) (setq area 35))
((and (= btype 2) (= spec 4) (= height 2) (= stru 2)) (setq area 25))
;; 연기식 1종 및 2종
((and (= btype 4) (or (= spec 1) (= spec 2)) (= height 1) (or (= stru 1) (= stru 2))) (setq area 150))
((and (= btype 4) (or (= spec 1) (= spec 2)) (= height 3) (or (= stru 1) (= stru 2))) (setq area 75))
;; 연기식 3종
((and (= btype 4) (= spec 3) (= height 1) (or (= stru 1) (= stru 2))) (setq area 50))
)
(setq s (ssget '( (0 . "CIRCLE,ELLIPSE,*POLYLINE,SPLINE")
(-4 . " (-4 . " (0 . "POLYLINE") (-4 . "&") (70 . 80)
(-4 . "AND>")
(-4 . "NOT>")
)
)
);setq
(command "clayer" "defpoints")
(command "la" "c" "11″ "" "")
(repeat
(setq cnt (sslength s))
(setq obj (vlax-ename->vla-object (ssname s (setq cnt (1- cnt)))))
(setq i (sslength s))
(setq a (vlax-curve-getarea obj))
(setq oa (rtos a 0))
(setq unit "㎡")
;(setq base "기준면적 : ")
;(setq sep " / ")
;(setq inst " 개 설치")
(vla-getboundingbox OBJ 'P1 'P2)
(setq P1 (vlax-safearray->list P1))
(setq P2 (vlax-safearray->list P2))
(setq pnt1 (list (+ (car p1) (/ (- (car p2) (car p1)) 2)) (+ (cadr p1) (/ (- (cadr p2) (cadr p1)) 2))))
(setq pnt2 (list (+ (car p1) (/ (- (car p2) (car p1)) 2)) (+ (+ (cadr p1) (/ (- (cadr p2) (cadr p1)) 2)) dist )))
;; 자동으로 블럭 삽입하려면 이곳에 해당 명령줄 추가
(COMMAND "INSERT" blkname pnt2 txt_bsc txt_bsc "0″)
(COMMAND "TEXT" "M" pnt2 txt_sz "" (rtos (bk_roundup1 (/ (atof oa) 1000000 area)) 2 0)) ;;심벌 중앙에 "TS" 리습을 위한 숫자 기입
(command "MTEXT" p1 "J" "MC" "h" txt_sz "s" "standard" p2 (strcat "면적 : " (rtos (/ (atof oa) 1000000) 2 2) unit
"n" "기준면적 : " (rtos area 2 0) unit " / 최소 " (rtos (bk_roundup1 (/ (atof oa) 1000000 area)) 2 0) " 개 설치"
"n" "(" bname " " sname ")" ) "")
(command "dimlinear" (list (car p1) (cadr p2)) (list (car p2) (cadr p2)) "h" "@0,0,0″) ;; 가로
(command "dimlinear" p1 (list (car p1) (cadr p2)) "v" "@0,0,0″) ;; 세로
);repeat
(command "clayer" cl)
(command "dimdsep" cdsep)
(command "dimdec" cdec)
(princ)
);defun
(vl-load-com) (princ)
수정후 보내주시면 감사하겠습니다 ㅠㅠ
관련자료
댓글 0
/ 1 페이지
등록된 댓글이 없습니다.