gbhsu 发表于 2012-2-18 20:35:03

帮你顶一下,问题太沉了!
请教风之影吧,他肯定会!

gbhsu 发表于 2012-2-18 20:45:30

gbhsu 发表于 2012-2-18 20:35 static/image/common/back.gif
帮你顶一下,问题太沉了!
请教风之影吧,他肯定会!

可能是你现在也是黑老大了,没人敢教你哦

flytoday 发表于 2012-2-18 22:05:48

大师们是不是都忙啊………顶起来………

hao3ren 发表于 2012-2-19 15:59:41

以前看到过一个求枝状路径相关的程序,发给你看看

hao3ren 发表于 2012-2-19 16:00:12

(defun search:pathSearch
       (startPoint path tobesearch / line entity otherPoint found)
(setq found nil)
(foreach line      tobesearch
    (if      line
      (progn
      (setq entity (entget line))
      (if
          (search:point-eq startPoint (assoc 10 entity))
         (progn
             (setq otherPoint (assoc 11 entity))
             (setq path (append path (list otherPoint)))
             (search:pathSearch
               otherPoint
               path
               (subst nil line tobesearch)
             )
             (setq found t)
         )
      )
      (if
          (search:point-eq startPoint (assoc 11 entity))
         (progn
             (setq otherPoint (assoc 10 entity))
             (setq path (append path (list otherPoint)))
             (search:pathSearch
               otherPoint
               path
               (subst nil line tobesearch)
             )
             (setq found t)
         )
      )
      )
    )
    )
    (if      (not found)
      (search:printPath path)
    )
)




(defun search:point-eq (apoint bpoint / val)
    (if (and
      (= (cadr apoint) (cadr bpoint))
      (= (caddr apoint) (caddr bpoint))
      (= (cadddr apoint) (cadddr bpoint))
      )
    (setq val T)
    (setq val NIL)
)
)

(defun search:printPath (path / prev point leng)
(setq prev nil leng 0.0)
(princ "\n 路径是")
(foreach point path
    (princ "\t")
    (princ (cdr point))
    (if prev
      (setq leng (+ leng (distance (cdr prev) (cdr point))))
      )
    (setq prev point))
(princ "\n 总长度是")
(princ leng)
)

(defun c:pathSearch (/ point lines all)
(setq point (cons 10 (getpoint "\n选择起点")))
(princ "\n 选择所有路径直线")
(setq all (ssget))
(setq len (sslength all))
(setq cur 0)
(while (> (- len cur) 0)
    (setq name (ssname all cur))
    (setq cur (+ 1 cur))
    (if      (= (cdr (assoc 0 (entget name))) "LINE")
      (setq lines (append (list name) lines))
    )
)
(search:pathSearch point '() lines )
(princ)
)

yjr111 发表于 2012-2-20 16:32:26

自己再顶一下

yjr111 发表于 2012-2-21 18:04:55

顶到G版和highflybird出手!

flytoday 发表于 2012-2-21 22:09:03

明总请给长期对明经做出贡献的热心朋友解决问题…严哥在这论坛算是很热心的呢…经常帮人解决问题…奉献源码……请明总给解决下

flytoday 发表于 2012-2-22 15:37:25

声援下严哥。严哥好人啊。。请版主费心了。。请明总支持下。

Gu_xl 发表于 2012-2-22 16:58:25

先发个演示图和编译的程序,程序仅对Line有效!


调用命令:GetPath
页: 1 [2] 3 4 5 6 7
查看完整版本: G版和HIGHFLYBIRD及高人请进!如何能求出所有的路径呢?