lusj
发表于 2003-7-28 11:29:00
谢谢,我刚学VL,有许多东西还不懂,你能告诉我"vla-intersectwith ax_ent_1 ax_ent_2 acextendnone"这句应怎样理解,为什么我在VL函数表中查不到?
meflying
发表于 2003-7-28 11:45:00
你搜索intersectwith,这是VBA的用法,
至于VL的用法可以参考帮助中开发人员手册中的使用ActiveX
lusj
发表于 2003-7-28 12:06:00
谢谢
amos_lg
发表于 2003-8-7 12:44:00
有一个命令, 好象是“intersectionwith”也可求交点,不过限于二维spline线
BDYCAD
发表于 2003-9-7 14:18:00
有沒有可以求出其它圖元的交點的呢?如求出ARC和LINE的交點或ELLIPSE和CIRCLE的交點的程序.如果沒有,我覺得這個程序要升級到如上面所說的才很棒.希望這個見議值得各位專家們和版主和大家去深入研究.
daren326
发表于 2003-9-11 09:25:00
请问mccad
如果是在延长线上的交点又怎么求呢
meflying
发表于 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))
aeo000000
发表于 2003-10-12 16:36:00
贴一个吧,选中线得所有交点:
(defun get_all_inters_in_SS (SS /
SSL ;length of SS
PTS ;returning list
aObj1 ;Object 1
aObj2 ;Object 2
N1;Loop counter
N2;Loop counter
iPts ;intersects
)
(setq N1 0 ;index for outer loop
SSL (sslength SS))
; Outer loop, first through second to last
(while (< N1 (1- SSL))
; Get object 1, convert to VLA object type
(setq aObj1 (ssname SS N1)
aObj1 (vlax-ename->vla-object aObj1)
N2 (1+ N1)) ;index for inner loop
; Inner loop, go through remaining objects
(while (< N2 SSL)
; Get object 2, convert to VLA object
(setq aObj2 (ssname SS N2)
aObj2 (vlax-ename->vla-object aObj2)
; Find intersections of Objects
iPts (vla-intersectwith aObj1
aObj2 0)
; variant result
iPts (vlax-variant-value iPts))
; Variant array has values?
(if (> (vlax-safearray-get-u-bound iPts 1)
0)
(progn ;array holds values, convert it
(setq iPts ;to a list.
(vlax-safearray->list iPts))
;Loop through list constructing points
(while (> (length iPts) 0)
(setq Pts (cons (list (car iPts)
(cadr iPts)
(caddr iPts))
Pts)
iPts (cdddr iPts)))))
(setq N2 (1+ N2))) ;inner loop end
(setq N1 (1+ N1))) ;outer loop end
Pts) ;return list of points found
;;----------------------------------------------- END LISTING 1
;;
;; Remaining lines of code for download version, used to demonstrate and test the utility in Listing 1.
;;
;; Process - Create drawing with intersecting lines and lwpolylines.
;; Load function set
;; Run command function INTLINES
;; Intersections are marked with POINT objects on current layer
;;
(defun C:INTLINES ()
(prompt "\nINTLINES running to demonstrate GET_ALL_INTERS_IN_SS function.")
(setq SS1 (get_all_lines_as_SS)
PTS (get_all_inters_in_ss SS1)
)
(foreach PT PTS ;;Loop through list of points
(command "_POINT" PT)) ;;Create point object
(setvar "PDMODE" 34) ;;display points so you can see them
(command "_REGEN")
)
;;
;;-----------------------------------------------
;;Get all lines and lwpolyline objects in the
;;drawing and return as a selection set.
;;
(defun get_all_Lines_as_SS ()
(ssget "X" '((0 . "LINE,LWPOLYLINE"))))
;;
wb0815
发表于 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