text를 1:1로 copy 하여 복사하는 리습입니다.
sort 가 잘 되지않아서 여러서적과 site 를 돌아다녀 보아도 해결이 잘안되고
있어 도움을 부탁 드립니다.
그룹으로 선택한 ss1,ss2 를 xy 좌표 순서대로 정렬하는 방법을 부탁드립니다.
(defun c:cht (/ text n ss1 ss2 ea i s1 s2 ent1 ent2 text1 text2)
(Princ “1번째 선택그룹을 선택해주십시오.”)
(setq ss1 (ssget ‘((0 . “text”))))
(vl-sort-i ‘(ss1)
(function (lambda (e1 e2)
(< nth 10 (cdr e1)
nth 10 (cdr e2)
)
)
)
)
(Princ “2번째 선택그룹을 선택해주십시오.”)
(setq ss2 (ssget ‘((0 . “text”))))
(vl-sort-i ‘(ss2)
(function (lambda (e1 e2)
(< nth 10 (cdr e1)
nth 10 (cdr e2)
)
)
)
)
(setq ea (sslength ss1))
(command “undo” “g”)
(setq i 0)
(repeat ea
(setq s1 (ssname SS1 i)
s2 (ssname SS2 i)
ent1 (entget s1)
ent2 (entget s2)
text (cdr (assoc 1 ent1))
ent2 (subst (cons 1 text) (assoc 1 ent2) ent2)
ent2 (entmod ent2)
i (1+ i)
)
)
(command “undo” “e”)
(princ)
)