明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 949|回复: 4

[提问] 如何获取直线与CIRCLE,LWPOLYLINE的交点

[复制链接]
发表于 2022-9-30 08:35:25 | 显示全部楼层 |阅读模式
(setq ss (ssget "f" (list t1 t2) '((0 . "CIRCLE,LWPOLYLINE")))

请问,如何获取直线(t1-t2)与CIRCLE,LWPOLYLINE的交点
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2022-9-30 08:55:52 | 显示全部楼层
用这个函数

Gets the points where one object intersects another object in the drawing.

Signature

VBA : RetVal = object.IntersectWith(IntersectObject, ExtendOption)

VL : RetVal = (vla-IntersectWith object IntersectObject, ExtendOption)

(vla-IntersectWith obj1 obj2 acExtendBoth)

Object : All Drawing Objects (Except Pviewport and PolygonMesh)
The object or objects this method applies to.

IntersectObject : Object, input-only;
The object can be one of All Drawing Objects.


ExtendOption : AcExtendOption enum; input-only
This option specifies if one or the other, both, or none of the entities are to be extended in order to attempt an intersection.


acExtendNone
Does not extend either object.

acExtendThisEntity
Extends the base object.

acExtendOtherEntity
Extends the object passed as an argument.

acExtendBoth
Extends both objects.




RetVal : Variant (array of doubles)
The array of points where one object intersects another object in the drawing.

Remarks

If the two objects do not intersect, no data is returned. You can request the point of intersection that would occur if one or both of the objects were extended to meet the other.

Example :


(defun c:al-intersectwith ()

(vl-load-com)

(setq util (vla-get-utility
                   (vla-get-activedocument
                        (vlax-get-acad-object))))
                        
(vla-getentity util 'obj1 'ip "\nSelect First Object: ")

(vla-getentity util 'obj2 'ip "\nSelect Second Object: ")

(setq int (vla-IntersectWith obj1 obj2 acExtendBoth))

(princ int)

(princ)

);defun




   

发表于 2022-9-30 08:56:54 | 显示全部楼层
发表于 2022-9-30 20:28:54 | 显示全部楼层
循环求交点不就行了
发表于 2022-10-1 01:00:41 | 显示全部楼层
(mapcar 'cadr (cdddr(car(ssnamex ss)))) 这个结果不准 精度不足 是函数的问题 不可避免
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-15 22:22 , Processed in 0.134408 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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