(defun c:test(/ os st textp one tow three four)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setvar "cmdecho" 1)
(setq st(ssget '((0 . "TEXT"))))
(command "ucs" "ob"(SSNAME ST 0) )
(SETQ TEXTP (textbox (ENTGET (SSNAME ST 0))))
(setq one (car textp) tow (cadr textp))
(setq three (polar one 0 (car tow)))
(setq four (polar one (/ pi 2.0) (cadr tow)))
(command "trim" "all" "" "f"one three tow four """")
(command "ucs" "")
(setvar "osmode" os) (setvar "cmdecho" 1)
(princ))
再完善點. 我認為這樣就比較好了.
(defun c:test (/ os st i textp one tow three four)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setvar "cmdecho" 1)
(setq st (ssget '((0 . "TEXT"))))
(setq i 0)
(repeat (sslength st)
(command "ucs" "ob" (SSNAME ST i))
(SETQ textp (textbox (ENTGET (SSNAME ST 0))))
(setq one (car textp)
tow (cadr textp)
)
(setq three (polar one 0 (car tow)))
(setq four (polar one (/ pi 2.0) (cadr tow)))
(command "trim" "all" "" "f" one three tow four "" "")
(command ".erase" "f" one tow"" "r"(SSNAME ST i) "")
(command ".erase" "f" three four """r" (SSNAME ST i)"")
(command "ucs" "")
(setq i (1+ i))
)
(setvar "osmode" os)
(setvar "cmdecho" 1)
(princ)
)
刚刚改好的,看看这个怎么样。
谁能改一下,让它能剪切标注文本上的线。
(defun c:testtrim (/ os st i textp one two three four)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setvar "cmdecho" 1)
(setq st (ssget '((0 . "TEXT"))))
(setq i 0)
(repeat (sslength st)
(vl-cmdf "ucs" "ob" (ssname st i))
(SETQ textp (textbox (ENTGET (SSNAME ST 0))))
(setq one (car textp)
two (cadr textp)
)
(setq three (polar one 0 (car two)))
(setq four (polar one (/ pi 2.0) (cadr two)))
(command "trim" "" "f" one three "" ""
"trim" "" "f" two four "" ""
"trim" "" "f" one four "" ""
"trim" "" "f" two three "" "")
(command ".erase" "cp" one three two four "" "r" (SSNAME ST i) "")
(command "ucs" "")
(setq i (1+ i))
);end repeat