;;只列出點表
;;展開的計算就交給你(LJCGQ)
;|
指令: TTT
選閉合曲線:
中心點:
半徑: 50
等分角度: 1
|;
(defun C:TTT
(/ HOLDOSMODE HOLDECHO PT PT1 PT2 OBJ CPT RAD ANG PT_LIST N AA)
(setq OBJ (vlax-ename->vla-object (car (entsel "\n選閉合曲線: "))))
(setq CPT (trans (getpoint "\n中心點: ") 1 0))
(setq RAD (getdist "\n半徑: ")
N 0
)
(while (progn
(initget 7)
(setq ANG (getreal "\n等分角度: "))
(/= 0 (rem 360 ANG))
)
)
(setq HOLDECHO (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.ucs" "")
(setq HOLDOSMODE (getvar "osmode"))
(setvar "osmode" 0)
(setq SS (ssadd))
(while (> 360 (* N ANG))
(setq PT1 (polar CPT (/ (* (* N ANG) pi) 180) RAD))
(setq PT2 (list (car PT1) (cadr PT1) 1))
(command "_.line" PT1 PT2 "")
(ssadd (entlast) SS)
(setq PT (vlax-safearray->list
(vlax-variant-value
(vla-intersectwith
OBJ
(vlax-ename->vla-object (entlast))
acextendotherentity
)
)
)
)
(setq PT_LIST (cons PT PT_LIST))
(setq N (1+ N))
)
(command "_.erase" SS "")
;;測試
(setq AA (reverse PT_LIST))
(command "3dpoly" (nth 0 AA))
(apply 'command (cdr AA))
(command "c")
;;
(command "_.ucs" "p")
(setvar "osmode" HOLDOSMODE)
(setvar "cmdecho" HOLDECHO)
)
|