乐筑天下

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

[编程交流] vlax-curve-getDistAtPoint retu

[复制链接]

43

主题

136

帖子

92

银币

后起之秀

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

铜币
217
发表于 2022-7-6 07:03:34 | 显示全部楼层 |阅读模式
Hi All,
 
Please Help me understand why am I getting "vlax-curve-getDistAtPoint" results as nil.
 
  1. (setq a (car (entsel "\nSelect Line:")))(setq b (getpoint "\nPick  Point"))(setq b (vlax-curve-getDistAtPoint a (vlax-curve-getClosestPointTo a b)))
 
Attached is the drawing in which I am getting an error Please refer.
 
Thanks in advance
Aaryan
 
0011.dwg
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 07:11:25 | 显示全部楼层
That trouble-maker entity is a fitted polyline, so I suspect that this is the reason that prevents your code to work as expected.
After decurved it (command PEDIT --> Decurve) it return the required value.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 07:13:46 | 显示全部楼层
Put the osmode system variable to zero and try again
回复

使用道具 举报

43

主题

136

帖子

92

银币

后起之秀

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

铜币
217
发表于 2022-7-6 07:17:39 | 显示全部楼层
@Mircea
Thanks Mircea You are right.
How can I make sure through lisp that a selected line is Decurved.
 
@Tharwat
I tried but still getting an error but thanks for your help.
 
Regards
Aaryan
回复

使用道具 举报

7

主题

50

帖子

45

银币

初来乍到

Rank: 1

铜币
39
发表于 2022-7-6 07:23:39 | 显示全部楼层
What is it that you want for result? I mean what should the program do?
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 07:26:06 | 显示全部楼层
I believe @Aaryan's code is self-explanatory; after selecting a curve and a point, the point will be projected on the said curve and the distance between the start point of the curve and that projection will be calculated.
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 07:30:13 | 显示全部楼层
I believe @Aaryan's code is self-explanatory; after selecting a curve and a point, the point will be projected on the said curve and the distance between the start point of the curve and that projection will be calculated. So, the above code excerpt should return a real number.
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-6 07:36:58 | 显示全部楼层
One difference is that the fitted item is no longer LWPOLYLINE type and become POLYLINE (old type).
回复

使用道具 举报

GP_

8

主题

248

帖子

245

银币

初来乍到

Rank: 1

铜币
42
发表于 2022-7-6 07:40:01 | 显示全部楼层
The objects are too distant from the UCS origin, try place them in the vicinity of 0,0,0
回复

使用道具 举报

43

主题

136

帖子

92

银币

后起之秀

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

铜币
217
发表于 2022-7-6 07:45:32 | 显示全部楼层
 
So I should use (ssget "_:E:S") with filter for LWpolyline.
Thanks it solved the problem.
 
Regards
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 09:56 , Processed in 0.391328 second(s), 72 queries .

© 2020-2025 乐筑天下

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