Position 3D polylines on points

Position 3D polylines on points

carlos_m_gil_p
Advocate Advocate
2,054 Views
15 Replies
Message 1 of 16

Position 3D polylines on points

carlos_m_gil_p
Advocate
Advocate

Hello boys how are you.

Again I am here, to request your help.

It will be that they can help me with a lisp that allows to move the vertices of a 3dpoly towards some points.

I will attach a dwg so you can understand me.

Excuse my English, I only speak Spanish.
And this is from a translator.
As always, a thousand thanks to all.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Accepted solutions (1)
2,055 Views
15 Replies
Replies (15)
Message 2 of 16

dlanorh
Advisor
Advisor
Is the maximum distance in your drawing a slope distance or a horizontal distance?
Is it the distance from the point to the line or the point to the nearest vertex?

I am not one of the robots you're looking for

0 Likes
Message 3 of 16

carlos_m_gil_p
Advocate
Advocate

 

Hi @dlanorh how are you.
Thanks for your help.

 

Is the maximum distance in your drawing a slope distance or a horizontal distance?

 

          To have a radio range, we will work with the horizontal distance.

 

Is it the distance from the point to the line or the point to the nearest vertex?

 

         Is it the distance from the point to the nearest vertex.

 

Thanks a lot.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 4 of 16

dlanorh
Advisor
Advisor
I'll take a look tomorrow if i've got time. I have an inkling of solution, but I'm too tired to think straight at the moment.

I am not one of the robots you're looking for

0 Likes
Message 5 of 16

dlanorh
Advisor
Advisor

@carlos_m_gil_p 

Please find attached initial lisp. This is lightly tested on your example drawing. It will only work with open 3Dpolylines.

Any problems let me know.

I am not one of the robots you're looking for

Message 6 of 16

carlos_m_gil_p
Advocate
Advocate

 

Hello @dlanorh , thank you very much for your help.

 

I attached a dwg so you can see the tests I did.

 

Look at it and let me know.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 7 of 16

dlanorh
Advisor
Advisor
Accepted solution

There were a number of problems here.

 

The first was "psuedo" closed polylines (a non closed polyline where the end point and start point are the same)

I have tested for these and converted them into closed polylines. The same is true where the polyline is open but the distance between the start point and end point is less than the max_distance. It was undesirable to test points against multiple vertices as this started producing self crossing polylines.

 

The second was good old autocads way of doing math, and the rounding errors it produces. even though some points were exactly on the max dist, they still had to go through the same calculations which produced infinitely small rounding error. This has been solved by testing equality using a fuzz factor set at 1.0e-4 ( 0.1 of a mm if working in metres)

 

The attached now seems to work much better, although I found an incorrect magenta polyline. Please see attached drawing.

 

I am not one of the robots you're looking for

Message 8 of 16

carlos_m_gil_p
Advocate
Advocate

Hi how are you.
Thank you for the correction.
Today I do the tests and anything I tell you.
Thank you.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 9 of 16

carlos_m_gil_p
Advocate
Advocate

Hello @dlanorh , how have you been?
It works very well with the tests I have done.
Thanks a lot for helping me.
Greetings.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 10 of 16

dlanorh
Advisor
Advisor

Please try the attached. It has been altered slightly to take account of an unforseen scenario.

 

 

I am not one of the robots you're looking for

Message 11 of 16

carlos_m_gil_p
Advocate
Advocate

Hi @dlanorh .
I did some tests.
The fuzz factor I think is a lot.

The same thing happened in the previous file and I did not realize it.

I enclose a dwg so you can see what happens.
When I do the test at 0.25 draw where it should not be.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 12 of 16

dlanorh
Advisor
Advisor
Is this using PolyVertices or PolyVertices2?

I am not one of the robots you're looking for

0 Likes
Message 13 of 16

carlos_m_gil_p
Advocate
Advocate

i am using PolyVertices2


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 14 of 16

dlanorh
Advisor
Advisor

OK. Found the problem. Try the attached.

 

I am not one of the robots you're looking for

Message 15 of 16

dlanorh
Advisor
Advisor

Refined version of above. Always selects the closest point if multiple points available for a vertex.

 

 

I am not one of the robots you're looking for

Message 16 of 16

carlos_m_gil_p
Advocate
Advocate

Hi @dlanorh 
How are you.
It works perfect.
I am very grateful for your help.
Thanks a lot for everything.

Greetings.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes