Lee Mac 发表于 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.

Tharwat 发表于 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_ 发表于 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
 
 

hmsilva 发表于 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,
 

(setq a (car (entsel "\nSelect Line:")))(setq b (getpoint "\nPickPoint"))(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

aaryan 发表于 2022-7-6 08:04:20

Sorry for being late But Thanks to ALL of YOU..
页: 1 [2]
查看完整版本: vlax-curve-getDistAtPoint retu