단일선택리습을 다중선택으로 바꾸는 방법
컨텐츠 정보
- 102 조회
- 1 댓글
- 0 추천
- 0 비추천
- 목록
본문
(defun c:ahl (/ p1 p2 p3 p4 a10 a1 a2 s1 s2 lin pickpt linname lindata ang1)
(setq cosmode (getvar “OSMODE”))
(setvar “OSMODE” 0)
(setq lin (entsel “nPick a line: “)
pickpt (cadr lin)
linname (car lin)
lindata (entget linname)
p1 (cdr (assoc 10 lindata))
p2 (cdr (assoc 11 lindata))
p11 (cdr (assoc 10 lindata))
p12 (cdr (assoc 11 lindata))
)
(if ( (distance p11 pickpt) (distance pickpt p12))
(setq p13 p11
p11 p12
p12 p13
)
)
(setq ang (angle p1 p2)
ang1 (* (/ ang pi) 180)
a10 (* (/ 10.0 180) pi)
a1 (+ (- ang a10) pi)
a2 (+ (+ ang a10) pi)
)
(setq 1ang (angle p11 p12)
1ang1 (* (/ 1ang pi) 180)
1a10 (* (/ 10.0 180) pi)
1a1 (+ (- 1ang 1a10) pi)
1a2 (+ (+ 1ang 1a10) pi)
)
(if (= (getvar “USERR1”) 0.0)
(setvar “USERR1” 3.0)
)
(setq s1 (getvar “USERR1”))
(setq mess (strcat “nArrow Size = “))
(setq s2 (getreal mess))
(if (= s2 nil)
(setq s2 s1)
(setvar “USERR1” S2)
)
(setq p3 (polar p2 a1 s2)
p4 (polar p2 a2 s2)
)
(setq p13 (polar p12 1a1 s2)
p14 (polar p12 1a2 s2)
)
(command “SOLID” p2 p3 p4 p3 “”)
(command “SOLID” p12 p13 p14 p13 “”)
(setvar “OSMODE” cosmode)
(princ)
)
선 양끝에 화살표를 그려주는 리습입니다만
한번에 1개씩만 선택이됩니다. 이걸 한번에 여러개 선택해서 바꾸고 싶은데 어떻게 수정해야하나요?
lisp
관련자료
dhL님의 댓글
(defun c:ahl (/ p1 p2 p3 p4 a10 a1 a2 s1 s2 lin pickpt linname lindata ang1) (setq cosmode (getvar “OSMODE”)) (setvar “OSMODE” 0)
(setq ss (ssget ‘((0 . “LINE”)))) (if (/= ss nil) (progn
(if (= (getvar “USERR1”) 0.0) (setvar “USERR1” 3.0)) (setq s1 (getvar “USERR1”)) (setq mess (strcat “nArrow Size = “)) (setq s2 (getreal mess)) (if (= s2 nil) (setq s2 s1) (setvar “USERR1” S2))
(repeat (setq n (sslength ss)) (setq ent (ssname ss (setq n (1- n)))) (setq lindata (entget ent)) (setq p1 (cdr (assoc 10 lindata))) (setq p2 (cdr (assoc 11 lindata))) (setq ang (angle p1 p2) ang1 (* (/ ang pi) 180) a10 (* (/ 10.0 180) pi) a1 (+ (- ang a10) pi) a2 (+ (+ ang a10) pi) ) (setq 1ang (angle p2 p1) 1ang1 (* (/ 1ang pi) 180) 1a10 (* (/ 10.0 180) pi) 1a1 (+ (- 1ang 1a10) pi) 1a2 (+ (+ 1ang 1a10) pi) )
(setq p3 (polar p2 a1 s2) p4 (polar p2 a2 s2) ) (setq p13 (polar p1 1a1 s2) p14 (polar p1 1a2 s2) ) (command “SOLID” p2 p3 p4 p3 “”) (command “SOLID” p1 p13 p14 p13 “”) ) ) ) (setvar “OSMODE” cosmode) (princ) )