明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: lusj

[求助]请问如何求出两条多义线的交点?

  [复制链接]
 楼主| 发表于 2003-7-28 11:29:00 | 显示全部楼层
谢谢,我刚学VL,有许多东西还不懂,你能告诉我"vla-intersectwith ax_ent_1 ax_ent_2 acextendnone"这句应怎样理解,为什么我在VL函数表中查不到?
发表于 2003-7-28 11:45:00 | 显示全部楼层
你搜索intersectwith,这是VBA的用法,
至于VL的用法可以参考帮助中开发人员手册中的使用ActiveX
 楼主| 发表于 2003-7-28 12:06:00 | 显示全部楼层
谢谢
发表于 2003-8-7 12:44:00 | 显示全部楼层
有一个命令, 好象是“intersectionwith”也可求交点,不过限于二维spline线
发表于 2003-9-7 14:18:00 | 显示全部楼层
有沒有可以求出其它圖元的交點的呢?如求出ARC和LINE的交點或ELLIPSE和CIRCLE的交點的程序.如果沒有,我覺得這個程序要升級到如上面所說的才很棒.希望這個見議值得各位專家們和版主和大家去深入研究.
发表于 2003-9-11 09:25:00 | 显示全部楼层
请问mccad
     如果是在延长线上的交点又怎么求呢
发表于 2003-9-11 09:36:00 | 显示全部楼层
(setq intpoints (vla-intersectwith ax_ent_1 ax_ent_2 acextendnone))
此句改为如下即可:
(setq intpoints (vla-intersectwith ax_ent_1 ax_ent_2 acextendboth))
发表于 2003-10-12 16:36:00 | 显示全部楼层
贴一个吧,选中线得所有交点:

  1. (defun get_all_inters_in_SS (SS /
  2.                              SSL ;length of SS
  3.                              PTS ;returning list
  4.                              aObj1 ;Object 1
  5.                              aObj2 ;Object 2
  6.                              N1  ;Loop counter
  7.                              N2  ;Loop counter
  8.                              iPts ;intersects
  9.                              )
  10.   (setq N1 0 ;index for outer loop
  11.         SSL (sslength SS))
  12.   ; Outer loop, first through second to last
  13.   (while (< N1 (1- SSL))
  14.     ; Get object 1, convert to VLA object type
  15.     (setq aObj1 (ssname SS N1)
  16.           aObj1 (vlax-ename->vla-object aObj1)
  17.           N2 (1+ N1)) ;index for inner loop
  18.     ; Inner loop, go through remaining objects
  19.     (while (< N2 SSL)
  20.       ; Get object 2, convert to VLA object
  21.       (setq aObj2 (ssname SS N2)
  22.             aObj2 (vlax-ename->vla-object aObj2)
  23.             ; Find intersections of Objects
  24.             iPts (vla-intersectwith aObj1
  25.                    aObj2 0)
  26.             ; variant result
  27.             iPts (vlax-variant-value iPts))
  28.       ; Variant array has values?
  29.       (if (> (vlax-safearray-get-u-bound iPts 1)
  30.              0)
  31.         (progn ;array holds values, convert it
  32.           (setq iPts ;to a list.
  33.                  (vlax-safearray->list iPts))
  34.           ;Loop through list constructing points
  35.           (while (> (length iPts) 0)
  36.             (setq Pts (cons (list (car iPts)
  37.                                   (cadr iPts)
  38.                                   (caddr iPts))
  39.                             Pts)
  40.                   iPts (cdddr iPts)))))
  41.       (setq N2 (1+ N2))) ;inner loop end
  42.     (setq N1 (1+ N1))) ;outer loop end
  43.   Pts) ;return list of points found
  44. ;;-----------------------------------------------   END LISTING 1
  45. ;;
  46. ;; Remaining lines of code for download version, used to demonstrate and test the utility in Listing 1.
  47. ;;
  48. ;; Process - Create drawing with intersecting lines and lwpolylines.
  49. ;;           Load function set
  50. ;;           Run command function INTLINES
  51. ;;           Intersections are marked with POINT objects on current layer
  52. ;;
  53. (defun C:INTLINES ()
  54.   (prompt "\nINTLINES running to demonstrate GET_ALL_INTERS_IN_SS function.")
  55.   (setq SS1 (get_all_lines_as_SS)
  56.         PTS (get_all_inters_in_ss SS1)
  57.         )
  58.   (foreach PT PTS ;;Loop through list of points
  59.     (command "_POINT" PT)) ;;Create point object
  60.   (setvar "PDMODE" 34) ;;display points so you can see them
  61.   (command "_REGEN")
  62. )
  63. ;;
  64. ;;-----------------------------------------------
  65. ;;  Get all lines and lwpolyline objects in the
  66. ;;  drawing and return as a selection set.
  67. ;;
  68. (defun get_all_Lines_as_SS ()
  69.   (ssget "X" '((0 . "LINE,LWPOLYLINE"))))
  70. ;;
发表于 2003-11-11 11:34:00 | 显示全部楼层
真是高手
发表于 2003-11-19 17:09:00 | 显示全部楼层
這個程序用了N年,在CADENCE網站來的,但CADENCE網站已被cadalyst合併了
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=2521
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-2-23 17:34 , Processed in 0.164342 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表