devitg 发表于 2022-7-6 12:26:51

 
不-只是偶尔在论坛上看电视-23:25在这里

Lee Mac 发表于 2022-7-6 12:27:34

李,
 
我试过了,但我认为这幅画里真的有上千个物体,它仍然有效。
 
如果对象位于外部参照中,需要如何处理?
在我的第一篇文章中:
 

(entmake (list (cons 0 "LINE")
            (cons 10 p1)
            (cons 11 p2)))
(setq line (entlast))

 
变成:

obj (car (entsel))

 
.. 是可能的,但您的代码是以不同的方式生成的。。你不用“entsel”这个词。。。

devitg 发表于 2022-7-6 12:30:47

vlax curve getClosestPointto仅适用于曲线对象,因此必须将外部参照子图元添加到选择集。
 
如果你允许用户选择一个对象,这会容易得多。

Lee Mac 发表于 2022-7-6 12:35:33

是的,我知道,但这就是重点,我不想手动选择对象。我将尝试选取一个点,然后创建一种“边界”。或限制,如果你喜欢。。。
 
只有在这些限制范围内的对象才会参与。
 
感谢Tnx帮助我。

MarcoW 发表于 2022-7-6 12:37:22

 
李,
 
我试图找到一个lisp,其中“外部参照子实体”被放置在选择集中。没有找到任何我可以使用或探索的内容。
 
我确实在互联网上的某个地方从CAB找到了这个代码:
(起初代码有效,现在我不知道我做错了什么,我不工作)
 

obj (car (nentsel))

 
据我所知,该程序的返回/结果是最接近给定点的实体名称(在外部参照中)。我看到在ssget部分中使用了一个交叉。
 
蓝色部分正在执行子函数,所以在这一点上我得到了它。
然后是红色部分,我无法解释。
 
不知怎的,我被一切困住了。你能再帮我一次吗?
我将再次尝试指定我的需求:
 
1、提示用户输入(getpoint)
2.获取“任何东西”上的最近点-->也可以外部参照
更好的说法是:它将99%是外部参照中的某物(直线/圆等)。
可能1%不在外部参照中。。。因此“任何事”。
 
从那里我将再次尝试我自己的方式。
 
CAB的代码不是必须使用的,但我想在这个代码中是有用的部分,红色部分。

Lee Mac 发表于 2022-7-6 12:42:34

红色部分仅打印选择集中的实体名称,与选择过程无关。
 
实际选择过程仅使用交叉选择集,不会获得外部参照子图元,而只会获得外部参照本身。

MarcoW 发表于 2022-7-6 12:46:53

MarcoW 发表于 2022-7-6 12:49:29

 
Lee,
 
I have tried to find a lisp in wich "xref sub entities" are put so the selection set. Did not find anything I can use or explore, .
 
I did find this code, from CAB, somewhere on the internet:
(At first the code worked, I don't know what I am doing wrong with that now, I dont work)
 

(defun c:test (/ pk r lyr) (if (and (setq pk (getpoint "\nPick point to get lines."))          (setq r (getdist pk "\nEnter search distance."))          (setq lyr (getstring t "\nEnter layer name."))   )   (if (setq ss (get_lines r pk lyr))      (mapcar '(lambda (x) (print x))             (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))   )      (prompt "\nNothing found.")   ) ) (princ));;get lines crossing a rectangle 2*rad with pt as the center;;only on layer specified(defun get_lines (rad pt lay / ll ur) (setq ll (list (- (car pt) rad) (- (cadr pt) rad))       ur (list (+ (car pt) rad) (+ (cadr pt) rad)) ) (ssget "_C" ur ll ; look at the entire drawing, no user input      ;; filter to follow      (list          '(0 . "LINE") ; get only lines          (cons 8 lay) ; layer name          (cons 410 (getvar "ctab")) ; current space only      ) ))
 
As far as I know the return / result of this program is the entities name (in xref) that is closest to the point given. I see that there is a crossing used in the ssget part.
 
The blue part is executing the sub-function, so till that point I get it.
Then the red part, that I can't explain.
 
Somehow I am stuck, with everything. Can you help me out again?
I will again try to specify my needs:
 
1. Prompt for user input (getpoint)
2. Get nearest point on "anything" --> also XREF
Better to say: it will 99% be something (line / circle etc.) in an Xref.
Maybe 1% is not in an Xref... therefore "anything".
 
From there I will try my own way again.
 
The code from CAB is not what must be used but I guess that in this code is a usefull part, the red part.

Lee Mac 发表于 2022-7-6 12:51:49

The red part just prints the entity names in the selection set, it is nothing to do with the selection process.
 
The actual selection process just uses a crossing selection set, and will not get Xref sub-entities, but just the xRef itself.
页: 1 [2]
查看完整版本: 关于“GetClosestPo”的问题