리습을 실행하면
두개의 블럭이 삽입이 되면서 1번 그림과 같이 회전하는 방향에 맞게 꼬리쪽블록이 생성되야하는데
1번 그림

2번 그림
2번 그림처럼 앞쪽의 블록은 회전하여 삽입이 잘되는데 꼬리쪽블록은 무조건 고정이 되어서
삽입이 됩니다.
리습의 전문은 아래와 같습니다.
어느부분에서 문제가 있는걸까요? 조언 부탁드립니다.
(defun c:hw (/ current_dimscale insert_point insert_path1 insert_path2 rotate_entity read_hw_string hw_string text_point
dir_point)
(Setq current_dimscale (getvar “dimscale”))
(prompt “n ** << 삽입점을 선택하면 단면표시을 자동으로 작도하는 명령어 입니다 >> **” )
(while
(Setq insert_point (getpoint “n종료(Enter)/삽입점을 찍으세요.”) )
(Setq insert_path1 (strcat “IAD\hw1.dwg”))
(Setq insert_path2 (strcat “IAD\hw2.dwg”))
(Setq rotate_entity (ssadd))
(if (= (tblsearch “block” “hw1”) nil)
(progn
(command “-insert” insert_path1 insert_point current_dimscale current_dimscale “1” “0”)
(ssadd (entlast) rotate_entity)
(entmod (subst (cons 8 oc_layer_7)(assoc 8 (entget (entlast))) (entget (entlast))))
)
(progn
(entmake (list (cons 0 “insert”)
(cons 2 “hw1”);블록명
(cons 8 “ch”);레이어
(cons 10 insert_point)
(cons 41 current_dimscale);X scale factor
(cons 42 current_dimscale);Y scale factor
(cons 43 1);Z scale factor
)
)
(ssadd (entlast) rotate_entity)
)
);end if
(Setq block_hw1 (entlast))
(Setq read_hw_string (getcfg “hw1”))
(if (= read_hw_string1 nil)
(Setq read_hw_string1 “C”)
);end if
(Setq hw_string1 (getstring (strcat “n단면 문자1를 입력하세요.<” read_hw_string1 “>:”)))
(if (or (= hw_string1 nil) (= hw_string1 “”))
(Setq hw_string1 read_hw_string1)
);end if
(Setq text_point (polar insert_point (dtr 90) (* current_dimscale 3)))
(f:make_text text_point text_point (* current_dimscale 3)
256 1 2 “te” “romans” hw_string1 0 0.8);mc
(ssadd (entlast) rotate_entity)
(Setq read_hw_string2 (getcfg “hw2”))
(if (= read_hw_string2 nil)
(Setq read_hw_string2 “1”)
);end if
(Setq hw_string2 (getstring (strcat “n단면 문자2를 입력하세요.<” read_hw_string2 “>:”)))
(if (or (= hw_string2 nil) (= hw_string2 “”))
(Setq hw_string2 read_hw_string2)
);end if
(Setq text_point (polar insert_point (dtr 270) (* current_dimscale 3)))
(f:make_text text_point text_point (* current_dimscale 3)
256 1 2 “te” “romans” hw_string2 0 0.8);mc
(ssadd (entlast) rotate_entity)
(princ “n단면 기호 방향에 점을 찍으세오.”)
(command “rotate” rotate_entity “” insert_point pause)
(Setq insert_point2 (getvar ‘lastpoint))
(Setq insert_angle (angle insert_point insert_point2))
(if (/= (cdr (assoc 50 (entget block_hw1))) insert_angle)
(progn
(Setq insert_agnle (cdr (assoc 50 (entget block_hw1))))
(cond
((or (= insert_agnle 0)(= insert_agnle pi))
(Setq insert_point2 (list (nth 0 insert_point2)(nth 1 insert_point)))
)
((or (= insert_agnle (dtr 90))(= insert_agnle (* 2 pi)))
(Setq insert_point2 (list (nth 0 insert_point)(nth 1 insert_point2)))
)
);end cond
)
);end if
(if (= (tblsearch “block” “hw2”) nil)
(progn
(command “-insert” insert_path2 insert_point2 current_dimscale current_dimscale “1” (rtd (angle insert_point insert_point2)))
(entmod (subst (cons 8 “ch”)(assoc 8 (entget (entlast)))(entget (entlast))))
)
(progn
(entmake (list (cons 0 “insert”)
(cons 2 “hw2”);블록명
(cons 8 “ch”);레이어
(cons 10 insert_point2)
(cons 41 current_dimscale);X scale factor
(cons 42 current_dimscale);Y scale factor
(cons 43 1);Z scale factor
(cons 50 (angle insert_point insert_point2));rotation angle
)
)
)
);end if
(setcfg “hw1” hw_string1)
(setcfg “hw2” hw_string2)
)
(prin1)
)