乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: MarcoW

[编程交流] 关于“GetClosestPo”的问题

[复制链接]

32

主题

430

帖子

423

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
150
发表于 2022-7-6 12:26:51 | 显示全部楼层
 
不-只是偶尔在论坛上看电视-23:25在这里
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:27:34 | 显示全部楼层
李,
 
我试过了,但我认为这幅画里真的有上千个物体,它仍然有效。
 
如果对象位于外部参照中,需要如何处理?
在我的第一篇文章中:
 
  1. (entmake (list (cons 0 "LINE")
  2.               (cons 10 p1)
  3.               (cons 11 p2)))
  4. (setq line (entlast))

 
变成:
  1. obj (car (entsel))

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

使用道具 举报

32

主题

430

帖子

423

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
150
发表于 2022-7-6 12:30:47 | 显示全部楼层
vlax curve getClosestPointto仅适用于曲线对象,因此必须将外部参照子图元添加到选择集。
 
如果你允许用户选择一个对象,这会容易得多。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:35:33 | 显示全部楼层
是的,我知道,但这就是重点,我不想手动选择对象。我将尝试选取一个点,然后创建一种“边界”。或限制,如果你喜欢。。。
 
只有在这些限制范围内的对象才会参与。
 
感谢Tnx帮助我。
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
295
发表于 2022-7-6 12:37:22 | 显示全部楼层
 
李,
 
我试图找到一个lisp,其中“外部参照子实体”被放置在选择集中。没有找到任何我可以使用或探索的内容。
 
我确实在互联网上的某个地方从CAB找到了这个代码:
(起初代码有效,现在我不知道我做错了什么,我不工作)
 
  1. obj (car (nentsel))

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

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:42:34 | 显示全部楼层
红色部分仅打印选择集中的实体名称,与选择过程无关。
 
实际选择过程仅使用交叉选择集,不会获得外部参照子图元,而只会获得外部参照本身。
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
295
发表于 2022-7-6 12:46:53 | 显示全部楼层
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
295
发表于 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)
 
  1. (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 ([color=royalblue]get_lines[/color] r pk lyr))[color=red]      (mapcar '(lambda (x) (print x))             (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))     )[/color]      (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.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 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.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-6 02:32 , Processed in 0.400416 second(s), 68 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表