Jocker_Boy 发表于 2022-7-5 16:18:25

Select pline, get lenght, then

Hi,
 
I want to select one pline, obtain the lenght then use this dimension to offset other pline.
 
Cheers,
 
Gonçalo

alanjt 发表于 2022-7-5 16:27:44

(vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent))
The above code will return the total length of a line/curve/pline.
From there, you just plug in the value to the Offset command and go.

1958 发表于 2022-7-5 16:37:44

Find the length of the object can be so:

(vla-get-length (vlax-ename->vla-object ent))

BIGAL 发表于 2022-7-5 16:50:50

My normal one
 

(vla-get-length (vlax-ename->vla-object (car (entsel "pick object" ))))

Jocker_Boy 发表于 2022-7-5 16:54:12

 
Many thanks. It's perferct!!!

Tharwat 发表于 2022-7-5 17:06:01

 
Not yet so.
Try to select any object that doesn't have any length property or just pin a point on the screen to find out the outcome of the codes.
 
Furthermore its not necessarily / recommended at all to convert any object to vla-object unless you are in need of that conversion and have no solution with AutoLISP vanilla ( DXF ).

BIGAL 发表于 2022-7-5 17:12:28

Tharwat you are correct sometimes you need to pick an object then check what it is and is that property then available and I think it was to do with this exact request for length. It was just a simple example where it was expected the user would pick a suitable object.

Tharwat 发表于 2022-7-5 17:24:38

 
Agreed, but I just wanted to pay OP's attention to such important issues.
页: [1]
查看完整版本: Select pline, get lenght, then