乐筑天下

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

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

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:50:20 | 显示全部楼层
 
Object Snap does not affect vlax-curve-* functions
 
 
This is not the cause since the code is successful when tested with an LWPolyline in the vicinity of the existing Polyline.
 
@aaryan: You can convert the Polyline to an LWPolyline using the CONVERTPOLY command.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-6 07:53:26 | 显示全部楼层
 
Correct , but with Autocad 2013 it behaves with a bug most of the time and specially with the scale command .
 
I tried it with Autocad 2010 and nothing 's wrong with the code .
回复

使用道具 举报

GP_

8

主题

248

帖子

245

银币

初来乍到

Rank: 1

铜币
42
发表于 2022-7-6 07:55:25 | 显示全部楼层
 
With LWPOLYLINE always works, but not with POLYLINE.
Try it the attached dwg with the objects moved near the UCS origin.
 
 
 
This solves all problems.
Or PLINETYPE = 2
 
 
回复

使用道具 举报

1

主题

475

帖子

481

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 08:01:03 | 显示全部楼层
 
Aaryan,
maybe not a very clean way to solve the problem but the "vlax-curve-getClosestPointTo" function sometimes does not work well, when the object is not orthogonal,
so the way I got to get around this situation is to calculate twice the closest point on the curve, so the second point is on the curve and therefore already calculates the distance on the curve without error,
 
  1. (setq a (car (entsel "\nSelect Line:")))(setq b (getpoint "\nPick  Point"))(setq c (vlax-curve-getDistAtPoint a (vlax-curve-getClosestPointTo a (vlax-curve-getClosestPointTo a b T) T)))
 
test your code by rotating your line to the vertcal and to the horizontal, and see that the
"vlax-curve-getClosestPointTo" function works well if the object is orthogonal.
 
hope that helps
 
Henrique
回复

使用道具 举报

43

主题

136

帖子

92

银币

后起之秀

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

铜币
217
发表于 2022-7-6 08:04:20 | 显示全部楼层
Sorry for being late But Thanks to ALL of YOU..
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 10:45 , Processed in 0.703606 second(s), 60 queries .

© 2020-2025 乐筑天下

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