acheok24 Posted May 21, 2015 Posted May 21, 2015 Hello everyone, This is my first post on here so please forgive my ignorance if this is posted somewhere else. I am trying to create a lisp that will draw a polyline around a set of polylines, essentially connecting all start points and all endpoints. I just started writing lisps last week so I'm pretty new to this stuff, but the way I'm thinking about doing this is selecting all the polylines, filter out closed polylines that could be in the set, run a while loop to create a list of start points and end points, use repeat to draw a line from start point 1 to start point 2 to start point 3 etc. and then doing the same with the endpoints, and finally join all these lines into one polyline. Let me know what you all think. Thanks in advance. Quote
CafeJr Posted May 21, 2015 Posted May 21, 2015 Hello acheok24... Try it... http://www.cadtutor.net/forum/showthread.php?82351-Linking-end-point-lines-creating-a-contour. Post #7. Thanks Tharwat to!... Quote
acheok24 Posted May 21, 2015 Author Posted May 21, 2015 Thanks for the quick reply CafeJr. I followed your link and found this code that written by alanjt. I edited it and it almost works correctly now. I've attached two images: 1) showing what the code does 2) what I need it to do. Thanks for your help. (defun c:SPLC (/ ss lst) ;; Spline Connect ;; Alan J. Thompson, 05.15.10 ;; Edited by acheok24, 05.21.15 (vl-load-com) (if (setq ss (ssget)) (progn (vl-cmdf "pline") (foreach p (vl-sort ((lambda (i) (while (setq e (ssname ss (setq i (1+ i)))) (setq lst (cons (car (vl-sort (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e)) (function (lambda (a b) (> (cadr a) (cadr b)))) ) ) lst ) ) ) ) -1 ) (function (lambda (a b) ( ) (vl-cmdf "_non" (trans p 0 1)) ) (vl-cmdf "" "" "") ) ) (princ) ) Quote
CafeJr Posted May 21, 2015 Posted May 21, 2015 Acheok24... Maybe it can help you, I can't see the original image of you previous post, are there many lines crossing the drawing?!... That other post #7 I guess you can use, but selecting part of your drawing, limiting the link of end points... Try this other: http://www.lee-mac.com/outlineobjects.html Quote
acheok24 Posted May 21, 2015 Author Posted May 21, 2015 The lines crossing the drawing are created when I run the above referenced code. It seems the code is only drawing lines to connect the start points of each polyline and are connecting them in a random order. Thanks for the link. It is the correct idea that I'm looking for, but it unfortunately will not create a boundary around the extents of polylines. Thank you for your help CafeJr. Quote
BIGAL Posted May 22, 2015 Posted May 22, 2015 Dig a bit deeper here there was another solution put forward a while back for this subject finding outer bounds of plines. Quote
Cad64 Posted May 22, 2015 Posted May 22, 2015 I followed your link and found this code that written by alanjt. I edited it and it almost works correctly now. Welcome to the forum acheok24. Please take a moment and read the Code Posting Guidelines: http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines Quote
CafeJr Posted May 22, 2015 Posted May 22, 2015 The lines crossing the drawing are created when I run the above referenced code. It seems the code is only drawing lines to connect the start points of each polyline and are connecting them in a random order. Thanks for the link. It is the correct idea that I'm looking for, but it unfortunately will not create a boundary around the extents of polylines. Thank you for your help CafeJr. Could you attach your example drawing here (in dwg file)!?... As I told you, it occurs because you do the command and select all the drawing (I guess), if you do it in parts (I don't know how many drawings or times do you need to do it), but you will creating small linkages of end points, and at the end of it you can join these lines to make a final Pline as you need. Quote
acheok24 Posted May 26, 2015 Author Posted May 26, 2015 Here is a drawing and the lisp I used. I spent some time digging, but I could not find anything like what I need already posted. Thanks again for the help. Let me know if you have any questions. SPLC.LSP cadtutor_example.dwg Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.