• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

trace a polyline from ordered points

  • Thread starter Thread starter luc@85
  • Start date Start date

luc@85

Guest
Hello everyone I am new to the forum, I would have this:
I have a set of x and y coordinate points defined as lists as in the example:
a(6,9) b(5,4) c(3,7) d(4,3) etc.
Is it possible to draw a polyline that joins the points taking into account the coordinate x growing? in the example the polylinea would have as an initial point c, then d b and a
thanks in advance to anyone who wants to answer
 
if you have them in excel, order the list according to x growing, export to csv .
edit the csv file and start the _pline command to the coordinates writings, and save it all in a text file with the scr extension.
by autocad give the script command and select your .scr file
 
Thanks for the answer, I know this procedure.
the situation however is a little more complex, and wanting to be synthetic in the question perhaps I did not explain well.
I have created a lisp in which I draw the coordinates of some points, and after manipulating them with various mathematical operations within the lisp I get the list of points of the initial question. I wanted to know if it was possible to order them directly in the lisp, without having to export them to csv, order them in excel, and draw them polylinea by script or another lisp. the problem is that I have to repeat this several times and the process would be a little too slender. .
Thanks again
 
to avoid hurting you see if during manipulation you can trace your data to a variable with separate values, for example:
(((a) 6 9)(b) 5 4)(c) 3 7)(d) 4 3)

if you call poplar such variable you can order the list as follows:
(vl-sort pippo (function (lambda (j1 j2) (< (cadr j1)))

that returns:
((c) 3 7)(d) 4 3)(b) 5 4)(a) 6 9)
 
Dearest gp thank you for the answer and the suggestion works hereme!!!
However, I would like to take advantage of your patience and availability to submit another brief question.
I attach these two lisp plus an example dwg file.
the file "grip" works perfectly, but it has the defect that is limited to a prefixed number of points as you can see opening the lisp, and therefore it is not the maximum. the file "cooled" does not have the limit of the number of preset points, but I have problems in the generation of the list of points, in the sense that with a list like that the formula you suggested does not work. .
would you have some valuable suggestions?
Thanks again
 

Attachments

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top