홀 좌표 리습
컨텐츠 정보
- 397 조회
- 5 댓글
- 0 추천
- 0 비추천
-
목록
본문
가공 업체에서 일을하게되었는데 홀 좌표뽑는 리습을 사용하고있는데요
이리습
(defun dtr (a) (* a (/ pi 180)))
(defun c:XYT (/ sca a n index th no noo sp lsp lep 1p 2p 3p 4p 5p 6p
org xorg yorg lp ep aa spt cp x y rr ss xsp ysp rsp)
(defun *error* (msg)(princ "error: ")(princ msg) (setvar "osmode" cur-osmode) (setvar "orthomode" ortho_mode)(princ))
; (setq sca 1)
(setq cur-osmode (getvar "osmode"))
(setq ortho_mode (getvar "orthomode"))
(setq dlf (getvar "dimlfac") dsc (getvar "dimscale") dtxt (getvar "dimtxt") txth (* dsc dtxt))
(setq sca (getreal "n>>Input Scale. < 1 >: "))
(if (= sca nil)(setq sca 1))
(princ "n>>원이나 Arc를 선택하시오.:")
(setvar "orthomode" 1)
(setvar "cmdecho" 0)
(setvar "osmode" 32)
;|
0 ………..없음 none
1 ………..끝점 end
2 ………..준간점 mid
4 ………..중심점 cen
8 ………..노드 node
16 ……….사분점 qua
32 ……….교차점 int
64 ……….삽입점 ins
128 ………수직점 per
256 ………접점 tan
512 ………근처점 nea
1024 ……..신속 -두개이상의 점중가가장 가까운점
2048 ……..가상 교차점
|;
(setq a (ssget)
org (getpoint "n>> 원점.: ")
xorg (polar org 0 100) ;(getpoint org "n>>Positive X-axis direction.: ")
yorg (polar org (/ pi 2) 100) ;(getpoint org "n>>Positive Y-axis direction.: ")
n (sslength a)
index 0 th (rtos txth) no 1
noo (getstring "n>>머리첨자. < h >: ")
non (getint "n>> 시작번호. < 1 >: ")
p-p (getint "n>> 소수이하 자릿수. < 1 >: ")
sp (getpoint "n>>표 그리기 시작점.: ")
lsp (polar sp (dtr 180) (* dsc 5))
lsp (polar lsp (dtr 90) (* dsc 4))
lep (polar lsp 0 (* dsc 75))
1p (polar lsp 0 (* dsc 15))
2p (polar lsp 0 (* dsc 35))
3p (polar lsp 0 (* dsc 55))
lp lsp ep lep
xp "Y" ;(getstring "n>>Want head line ? :")
)
(setvar "osmode" 0)
; (if (= xp "")(setq xp "Y"))
(if (= noo "")(setq noo "h"))
(if (= non nil)(setq non 1))
(if (= p-p nil)(setq p-p 1))
(if (or (= xp "")(= (strcase xp) "Y"))
(progn
(command "color" "w")
(command "text" sp txth 0 "No X Y Dia.")
(command "color" "bylayer")
)
)
(setq th txth)
(repeat n
(setq aa (entget (ssname a index)))
(if (or (= (cdr (assoc 0 aa)) "arc") (= (cdr (assoc 0 aa)) "CIRCLE"))
; (if (= (cdr (assoc 0 aa)) "CIRCLE")
(progn
(command "ucs" "3″ org xorg yorg)
(setq cp (cdr (assoc 10 aa))
x (rtos (/ (car (trans cp 0 1)) sca) 2 p-p)
y (rtos (/ (cadr (trans cp 0 1)) sca) 2 p-p)
rr (cdr (assoc 40 aa))
rr (/ (* rr 2) sca)
)
(command "ucs" "P")
(setq spt (polar (trans cp 0 1) (dtr 45) (+ (/ rr 2) 1.0))
lsp (polar lsp (dtr 270) (* dsc 5))
lep (polar lep (dtr 270) (* dsc 5))
rr (strcat "%%c" (rtos rr 2 p-p))
)
(setq ss (strcat noo (itoa non)))
(command "line" lsp lep "")
(command "color" "w")
(command "text" spt th 0 ss)
(setq sp (polar sp (dtr 270) (* dsc 5)))
(command "text" sp th 0 ss)
(setq xsp (polar sp 0 (* dsc 23))
ysp (polar sp 0 (* dsc 43))
rsp (polar sp 0 (* dsc 63))
)
; (point-place x)
(command "text" "r" xsp th 0 x)
; (point-place y)
(command "text" "r" ysp th 0 y)
(command "text" "r" rsp th 0 rr)
(command "color" "bylayer")
(setq non (+ non 1))
)
)
(setq index (+ index 1))
)
(setq lsp (polar lsp (dtr 270) (* dsc 5))
lep (polar lep (dtr 270) (* dsc 5))
4p (polar lsp 0 (* dsc 15))
5p (polar lsp 0 (* dsc 35))
6p (polar lsp 0 (* dsc 55))
)
(command "line" lp lsp lep ep lp "")(command "line" 1p 4p "")
(command "line" 2p 5p "")(command "line" 3p 6p "")
(setvar "osmode" cur-osmode)
(setvar "orthomode" ortho_mode)(princ)
); end of defun
아크 인식 삭제와 크기별 최단거리로 좌표를 뽑을 수 있게 수정을 하고싶은데 어떻게 해야할까요??