-Tên lệnh O2.
Bạn copy nội dung và tạo file lisp hay tải file về cũng được!
(Defun c:o2 ()
(vl-load-com)
(command "undo" "be")
(if (= droff nil)
(setq droff1 2.00)
(setq droff1 droff)
)
(setq
droff (GETREAL (strcat "\nNhap do rong offset: <" (rtos droff1 2 2) ">"))
)
(if (= droff nil)
(setq droff droff1)
)
(setq SS (ssget (list (cons 0 "ellipse,lwpolyline,spline,line,circle"))))
(setq i 0)
(setq N (sslength ss))
(while (< i N)
(setq TEXTENT (ssname SS i))
(setq luubatdiem (getvar "osmode"))
(setvar "osmode" 0)
(setq diemchuan (vlax-curve-getPointAtDist TEXTENT 0))
(setq diemdinhhuong (vlax-curve-getPointAtDist TEXTENT 0.01))
(setq goc (angle diemchuan diemdinhhuong))
(setq diembentrai (polar diemchuan (- goc (/ pi 2)) droff))
(setq diembenphai (polar diemchuan (+ goc (/ pi 2)) droff))
(command ".offset" droff textent diembentrai textent diembenphai "")
(setq i (1+ i))
(setvar "osmode" luubatdiem)
)
(command "undo" "end")
(princ)
)