aaryan 发表于 2022-7-6 07:03:34

vlax-curve-getDistAtPoint retu

Hi All,
 
Please Help me understand why am I getting "vlax-curve-getDistAtPoint" results as nil.
 

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

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

Tharwat 发表于 2022-7-6 07:13:46

Put the osmode system variable to zero and try again

aaryan 发表于 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

Pietari 发表于 2022-7-6 07:23:39

What is it that you want for result? I mean what should the program do?

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

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

MSasu 发表于 2022-7-6 07:36:58

One difference is that the fitted item is no longer LWPOLYLINE type and become POLYLINE (old type).

GP_ 发表于 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

aaryan 发表于 2022-7-6 07:45:32

 
So I should use (ssget "_:E:S") with filter for LWpolyline.
Thanks it solved the problem.
 
Regards
页: [1] 2
查看完整版本: vlax-curve-getDistAtPoint retu