(defun Pline_Point (object / objlist count point return wonso)
;;피라인의 정점을 리스트로 리턴
(setq return nil) ;포인트 리스트를 기억할 변수 초기화
(setq objlist (entget object)) ;엔티티 정보를 추출
(if (= (cdr (assoc 0 objlist)) “LWPOLYLINE”) ;폴리라인인지 확인
(progn
(setq count 0) ;엔티티 리스트 카운터 초기화
(setq wonso (nth count objlist)) ; 리스트의 원소를 하나씩 추출
(while (/= wonso nil) ;리스트 끝까지 뺑뺑이
(if (= (car wonso) 10) ;원소가 10번인지(10번-> 버택좌표)
(setq return (append return (list (cdr wonso))))
;포인트를 리스트 형태로 연결 저장합니다.
);if
(setq count (1+ count)) ;카운트 증가
(setq wonso (nth count objlist)) ;다음 원소 추출
);while
);progn
);if
return ; 포인트 리스트를 리턴함.
) ;Pline_Point
(defun c:pc ( / p_list pline c_point01 c_point02 c_point03 cir_ent cir_point pol_cen01 pol_cen02 pol_cen03 pol_cen04 pol_cen)
(setq pline (car (entsel))) ;폴리라인 선택
(setq p_list (Pline_Point pline));함수 호출
(setq c_point01 (nth 0 p_list))
(setq c_point02 (nth 1 p_list))
(setq c_point03 (nth 2 p_list))
(command “circle” “3P” c_point01 c_point02 c_point03)
(setq cir_ent (entlast))
(setq cir_point (entget cir_ent))
(command “erase” cir_ent “”)
(setq pol_cen (cdr (assoc 10 cir_point)))
(setq pol_cen01 (list (- (car pol_cen) 10.0) (cadr pol_cen)))
(setq pol_cen02 (list (+ (car pol_cen) 10.0) (cadr pol_cen)))
(setq pol_cen03 (list (car pol_cen) (+ (cadr pol_cen) 10.0)))
(setq pol_cen04 (list (car pol_cen) (- (cadr pol_cen) 10.0)))
(command “line” pol_cen01 pol_cen02 “”)
(command “line” pol_cen03 pol_cen04 “”)
(princ “nDream Makers Zone”)
(princ “n”)
(princ pol_cen)
(princ)
)
(princ “nLoad……….”)
(princ)
;;========================================================================
폴리박스의 센타점을 추출해 주는 리습입니다….
위의 리습은 하나의 폴리박스만 선택이 가능합니다…
그런데 이리습을 가지고 여러개의 폴리박스을 선택하여
각각의 폴리박스 센타점 추출이 가능할까요?
다중객체 선택의 ssget만 바꾸면 되는가여…
저의 짧은 생각에는 추출함수에서도 바꿔주어야 될것도 같구…
그리고
(setq c_point01 (nth 0 p_list))
(setq c_point02 (nth 1 p_list))
(setq c_point03 (nth 2 p_list))
이 부분에서 다른값을 주어야 할것 같은데….
아닌가여?? 아직 많이 서툴러서….
자문을 구하고자 합니다…
부탁드립니다.. 검토해 주시고 많은 의견 부탁드립니다…