hdlyt11 发表于 2011-1-5 10:54:38

怎样实现双线填充?

选取图中两道直线,获取两道直线的四个端点,然后以四个端点组成的四边形用实体填充,实体图层hatch,请各位高手帮忙把这段源码写一下,多谢了,呵呵

Q_Q 发表于 2017-8-23 11:12:15

有没有填充是间断的,比如填充5mm一段,在空一段5mm,在填充5mm一段

305341043 发表于 2017-11-30 10:03:48

这功能CAD自带的呀,有两种方式呀,
填加拾取点与拾取对象

806331126 发表于 2017-8-28 15:13:25

谢谢分享这么好的东西

crazylsp 发表于 2011-1-5 11:55:13

本帖最后由 crazylsp 于 2011-4-21 09:40 编辑

))))))))))))))))))))))))))))))))))))))

hdlyt11 发表于 2011-1-5 17:23:58

这个程序选择两条直线,实现不了在两条直线间填充为solid

Gu_xl 发表于 2011-1-5 17:58:54


(defun c:tt(/ en1 en2 ss p1 p2 p3 p4)
(setq en1 (car(entsel "\n第一条直线:"))
        en2 (car(entsel "\n第二条直线:"))
        )
(setq ss (ssadd))
(ssadd en1 ss)
(ssadd en2 ss)
(setq p1 (cdr (assoc 10 (setq enl( entget en1))))
        p2 (cdr (assoc 11 enl))
        p3 (cdr (assoc 10 (setq enl( entget en2))))
        p4 (cdr (assoc 11 enl))
        )
(if (inters p1 p4 p2 p3)
    (progn
      (command "line" p1 p3 "")
      (ssadd (entlast) ss)
      (command "line" p2 p4 "")
      (ssadd (entlast) ss)
      (command "hatch" "solid" "s" ss "")
      )
    (progn
      (command "line" p1 p4 "")
      (ssadd (entlast) ss)
      (command "line" p2 p3 "")
      (ssadd (entlast) ss)
      (command "hatch" "solid" "s" ss "")
      )
    )

)

ZZXXQQ 发表于 2011-1-5 21:27:31

本帖最后由 ZZXXQQ 于 2011-1-5 21:40 编辑

简化了一下。

;两直线间填充 明经 ZZXXQQ 2011.1.5
(defun c:tt (/ s1 s2 en1 en2 p1 p2 p3 p4)
(setvar "CMDECHO" 0)
(if (and (setq s1 (entsel "\n第一条直线:"))
       (setq s2 (entsel "\n第二条直线:"))
       (setq en1 (entget(car s1)))
       (setq en2 (entget(car s2)))
       (= (cdr(assoc 0 en1)) "LINE")
       (= (cdr(assoc 0 en2)) "LINE")) (progn
(setq p1 (cdr (assoc 10 en1))
      p2 (cdr (assoc 11 enl))
      p3 (cdr (assoc 10 en2))
      p4 (cdr (assoc 11 en2)))
(if (inters p1 p4 p2 p3)
   (command ".SOLID" p1 p3 p2 p4 "")
   (command ".SOLID" p1 p4 p2 p3 "")
)
))
(setvar "CMDECHO" 1)
(princ)
)

hdlyt11 发表于 2011-1-6 17:53:18

呵呵,多谢,有这个就可以了

hdlyt11 发表于 2011-1-6 17:55:03

明总的提示:错误 : 参数类型错误: 二维/三维点: nil

hdlyt11 发表于 2011-1-6 18:05:49

(defun c:tt (/ s1 s2 en1 en2 p1 p2 p3 p4)
(setvar "CMDECHO" 0)
(if (and (setq s1 (entsel "\n第一条直线:"))
       (setq s2 (entsel "\n第二条直线:"))
       (setq en1 (entget(car s1)))
       (setq en2 (entget(car s2)))
       (= (cdr(assoc 0 en1)) "LINE")
       (= (cdr(assoc 0 en2)) "LINE")) (progn
(setq p1 (cdr (assoc 10 en1))
      p2 (cdr (assoc 11 enl))
      p3 (cdr (assoc 10 en2))
      p4 (cdr (assoc 11 en2)))
(if (inters p1 p4 p2 p3)
   (command ".SOLID" p1 p3 p2 p4 "")
   (command ".SOLID" p1 p4 p2 p3 "")
)
))
(setvar "CMDECHO" 1)
(princ)
)
;以上才是我真正想得到的结果

hdlyt11 发表于 2011-1-6 20:15:18

还有就是希望是框选而不是点选,另外连接两条直线的直线要删掉,这样才算完美。

yunfengning 发表于 2011-5-23 01:08:35

不知为何,cad2004用不了。
页: [1] 2
查看完整版本: 怎样实现双线填充?