Lee Mac 发表于 2022-7-6 13:28:48

多亏了你,我逐渐对Visual LISP有了更多的了解。
 
我更喜欢的方法仍然是常见的LISP和DXF表,但一旦我对VL有信心,我相信事情会更容易操作。
 
再次感谢您的耐心和解释,非常感谢。
 
干杯
 

CAB 发表于 2022-7-6 13:33:56

任何时候李。

George Duls 发表于 2022-7-6 13:35:46

谢谢,我不知道(vla intersectwith)
 
我不在VL,但我觉得我应该试试。
(这让我像阿尔一样困惑
过去和现在)
 
问候语。
 
附笔
我知道我会再次困惑自己
有了这个VL,ActiveX(我对此一无所知)
variant、ACExtendNone、数据转换等。
我在这里什么都不知道,但我会学习的。
TNX公司

Lee Mac 发表于 2022-7-6 13:38:23

没问题,乔治,
 
很高兴我们能帮上点忙-我自己还在学习VL
 
干杯
 

Lee Mac 发表于 2022-7-6 13:41:45

基于Carl的链接,我重写了交叉口LISP:
 

(defun ssInter (ss / i y Ent1 Ent2 iArr iLst)
(setq i (sslength ss))
(while (not (minusp (setq y (1- i) i (1- i))))
   (setq Ent1 (vlax-ename->vla-object (ssname ss i)))
   (while (not (minusp (setq y (1- y))))
   (setq Ent2 (vlax-ename->vla-object (ssname ss y))
       iArr (vlax-variant-value
         (vla-IntersectWith Ent1 Ent2 acExtendNone)))
   (if (> (vlax-safearray-get-u-bound iArr 1) 0)
   (progn
   (setq iLst (vlax-safearray->list iArr))
   (while (not (zerop (length iLst)))
       (setq ptLst (cons (list (car iLst) (cadr iLst) (caddr iLst)) ptLst)
         iLst (cdddr iLst))))))))

(defun c:test (/ ptLst)
(vl-load-com)
(ssInter (ssget))
(alert (vl-princ-to-string ptLst))
(princ))


 
(*配有测试程序*)

Lee Mac 发表于 2022-7-6 13:46:37

另一种方式:
 

(defun ssInter (ss / vLst i j obj1 obj2 iArr iLst)
(setq vLst (mapcar 'vlax-ename->vla-object
            (vl-remove-if 'listp
            (mapcar 'cadr (ssnamex ss))))
   i (length vLst))
(while (not (minusp (setq j (1- i) i (1- i))))
   (setq obj1 (nth i vLst))
   (while (not (minusp (setq j (1- j))))
   (setq obj2 (nth j vLst)
       iArr (vlax-variant-value
         (vla-IntersectWith obj1 obj2 acExtendNone)))      
   (if (> (vlax-safearray-get-u-bound iArr 1) 0)
   (progn
   (setq iLst (vlax-safearray->list iArr))
   (while (not (zerop (length iLst)))
       (setq ptLst (cons (list (car iLst) (cadr iLst) (caddr iLst)) ptLst)
         iLst (cdddr iLst))))))))


(defun c:test (/ ptLst)
(vl-load-com)
(ssInter (ssget))
(alert (vl-princ-to-string ptLst))
(princ))

Hudson 发表于 2022-7-6 13:50:44

我只是想说,这条线索被证明是非常有益的。
 
很棒的论坛!

Lee Mac 发表于 2022-7-6 13:55:40

这条线好像是很久以前的事了!
 
很高兴你能从中得到一些东西
页: 1 [2]
查看完整版本: 线弧交点?