hao3ren 发表于 2012-7-6 17:55:08

(defun c:jd()
(setq pt1 (getpoint "\n指定第1点:"))
(setq pt2 (getpoint pt1 "\n指定第2点:"))
(setq pt3 (getpoint "\n指定第3点:"))
(grdraw Pt1 pt2 1)
(command "line" pt1 pt2 "")
(setq tg (entLast))
(command "trim" tg "" "f" pt1 pt3 pt2 "" "")
(entdel tg)
)

半听可乐 发表于 2012-7-7 00:08:23

hao3ren 发表于 2012-7-6 17:55 static/image/common/back.gif
(defun c:jd()
(setq pt1 (getpoint "\n指定第1点:"))
(setq pt2 (getpoint pt1 "\n指定第2点:"))


非常感谢!但还有bug:当截断多条线时有些线截断不了,还没找到规律性~~望好人继续完善

1993063 发表于 2012-7-7 01:18:40

本帖最后由 1993063 于 2012-7-6 07:21 编辑

(defun c:QTR ( / a ang ce cm ent obj op p1 p2 p3 p4 p5 sset)
(defun *error* (msg)
    (setvar "osmode" a)
    (command "undo" "e")
    (setvar "CMDECHO" CM)
    (setvar "CECOLOR" CE)
    (if (and
          msg
          (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,*EXIT*,"))
      )
      (princ)
    )
)
(setq a (getvar "osmode"))
(setq CM (getvar "CMDECHO"))
(setq CE (getvar "CECOLOR"))
(setvar "CMDECHO" 0)
(SETVAR "CECOLOR" "1")
(command "undo" "be")
(cond
    ((vl-cmdf "_.line" (setq p1 (getpoint "\n指定第一点: "))
            (setq p2 (getpoint p1 "\n指定第二点: "))
            ""
   )
      (setq ent (entlast))
      (setq p3 (getpoint "\n点击修剪边: "))
      (setq obj (vlax-ename->vla-object ent))
      (setq op (vlax-curve-getclosestpointto obj p3))
      (setq ang (angle op p3))
      (setq p4 (polar p1 ang 1))
      (setq p5 (polar p2 ang 1))
      (setq sset (ssget "_f" (list p1 p2)))
      (command "_.trim" sset "" "f" p4 p5 "" "")
      (command "_.erase" ent "")
    )
)
(setvar "osmode" a)
(setvar "CMDECHO" CM)
(setvar "CECOLOR" CE)
(command "undo" "e")
(princ)
)

半听可乐 发表于 2012-7-7 12:10:43

Gu_xl 发表于 2012-7-7 00:54 static/image/common/back.gif


G版出马,什么都是浮云,哈哈,对我来说功能非常完美了,谢谢!

半听可乐 发表于 2012-7-7 19:57:02

Gu_xl 发表于 2012-7-6 15:57 static/image/common/back.gif


奇怪,我的回复怎么看不见~~这么好的程序,我得再三感谢G版了,非常完美,感谢感谢!

longer1000 发表于 2012-7-9 08:54:03

G版出手,非常感谢

longer1000 发表于 2012-7-9 09:22:48

Gu_xl 发表于 2012-7-6 15:57 static/image/common/back.gif


测试在确定第二点时,不能捕捉。

yjr111 发表于 2012-7-9 09:25:28

Gu_xl 发表于 2012-7-6 15:57 static/image/common/back.gif


G版出手,不同凡响,顶!

小心 发表于 2012-7-10 07:55:42

学学,看看,长见识

kexiya123 发表于 2012-7-10 10:05:04

G大侠的程序不错,只是捕捉第二点时最好还是有交点、垂足、最近点之类的带选择性更好。你的F8,F3选择不太适用。
页: 1 [2] 3 4 5
查看完整版本: 5币求画线截断直线程序,要源码