bah026 Posted June 24, 2020 Posted June 24, 2020 Hello, I need to generate a close polylines from the end/beginning points of a line , which mean, after I'm having all lines in the drawing I need to run some loop that find the vertex of those lines and to generate a poly from those vertexes, The vertex point I already able to find by autolist code, so I only need to generate the polyline. in the attached files I have example of the beforeDocument2.pdf and after that result I need to get Quote
ronjonp Posted June 24, 2020 Posted June 24, 2020 (edited) Look into the boundary command. example.dwg Edited June 24, 2020 by ronjonp 1 Quote
BIGAL Posted June 25, 2020 Posted June 25, 2020 (edited) Bpoly with OOPS no need for code. Look at cyan line. Edited June 25, 2020 by BIGAL Quote
bah026 Posted June 28, 2020 Author Posted June 28, 2020 Thanks for the answers, The Bpoly don't do it's work, even a simples lines, it couldn't recognize the 4 closed poly, only the 2 outers (yellow and green) Quote
bah026 Posted June 28, 2020 Author Posted June 28, 2020 The option of using enclosed_polyline.lsp is not working either, it's don't create a closed poly, worst result then bpoly, it even didin't recognized the yellow poly Quote
Stefan BMR Posted June 28, 2020 Posted June 28, 2020 4 hours ago, bah026 said: The option of using enclosed_polyline.lsp is not working either, it's don't create a closed poly, worst result then bpoly, it even didin't recognized the yellow poly Enclosed_polylines is about finding EACH closed area in a selection. If it's not what you are looking for, then you should explain better. I'd really like to see each of the 2 samples you already posted, but with both "before" and "after" situation. And, most important, how do you see them the same? For me, looks like 2 different tasks. 1 Quote
BIGAL Posted June 29, 2020 Posted June 29, 2020 Agree with Stefan your 1st example was random lines not overlapping objects. If I remember correct there is an answer using region for simple overlapping objects. This is not a new request and has been solved previously its a case of finding that solution. Google is your friend. A quick and dirty, draw say a circle or pline around outside of objects, then BOUNDARY with island detect on Pline option, pick point inside circle see image two plines are made. Very limited testing. Quote
bah026 Posted June 29, 2020 Author Posted June 29, 2020 Hi Stefan, see attached drawing befor and after runnung the enclosed_polyline.lsp Maybe I didin't express myself, but I'm looking to get all the closed polylines contain the vertex point of the lines, in this example Drawing11.dwg Drawing11-after.dwg Quote
Stefan BMR Posted June 29, 2020 Posted June 29, 2020 Isn't PEDIT good for this? Sorry, I fail to understand. Maybe somebody else will do. Good luck!! Quote
Roy_043 Posted June 29, 2020 Posted June 29, 2020 On 6/28/2020 at 12:03 PM, bah026 said: Thanks for the answers, The Bpoly don't do it's work, even a simples lines, it couldn't recognize the 4 closed poly, only the 2 outers (yellow and green) I would say that 6 different polylines can be derived from those lines. Quote
marko_ribar Posted June 29, 2020 Posted June 29, 2020 (edited) I counted 8 different polylines... Edited June 29, 2020 by marko_ribar Quote
BIGAL Posted June 30, 2020 Posted June 30, 2020 (edited) Very confusing what is required ? DWG 11 erase the two lines inside box PE Y join pick all lines top right oops put 2 lines back now = what was posted DWG 11 after NO CODE. Just like my 1st post. Edited June 30, 2020 by BIGAL Quote
bah026 Posted July 1, 2020 Author Posted July 1, 2020 Bigal, It's just an example I need to run a script on complicated drawing with thousands of lines. Quote
BIGAL Posted July 2, 2020 Posted July 2, 2020 Post a simple real example dwg with before and after very obvious. Then we will have a better idea of what you want. Quote
bah026 Posted July 2, 2020 Author Posted July 2, 2020 Bigal, It's just an example I need to run a script on complicated drawing with thousands of lines. See attached example the "before" is an example drawing with 17 lines The "after" is a drawing contains 7 polylines (with small space between them and with colors so you'll be able to see them all) that created manually, but in order to work on a large drawing I need to have some script that scans all the lines, find the vertex of the lines and generate all the polylines from the created vertex, I hope I explain myself clear example-after.dwg example-before.dwg Quote
eldon Posted July 2, 2020 Posted July 2, 2020 I am not sure whether the goal posts are shifting. With your first example, I used PEDIT with the multiple option and formed two separate polylines. With your second example, the boundary command would do what you want. So now you want a magician to write an omnipotent app to do what you want in different situations!! Quote
bah026 Posted July 2, 2020 Author Posted July 2, 2020 So using PEDIT wan't give you all the polylines that I have in "example-after" Quote
eldon Posted July 2, 2020 Posted July 2, 2020 I got one polyline using all the lines in the second example. Quote
marko_ribar Posted July 2, 2020 Posted July 2, 2020 Use REGION command and select all lines... Then use this routine on selection of all regions previously created : (defun c:regs2lws ( / pea ss i reg n k m p z f ) (vl-load-com) (setq pea (getvar 'peditaccept)) (setvar 'peditaccept 1) (prompt "\nSelect REGIONS convertable to lwpolylines (lines+arcs) to convert them to LWPOLYLINES...") (while (null (setq ss (ssget "_:L" '((0 . "REGION"))))) (prompt "\nEmpty sel. set... Try selecting again...") ) (setq k 0 m 0 sss (ssadd)) (repeat (setq i (sslength ss)) (setq reg (ssname ss (setq i (1- i)))) (setq n (vlax-safearray->list (vlax-variant-value (vla-get-normal (vlax-ename->vla-object reg))))) (vl-cmdf "_.UCS" "_W") (vl-cmdf "_.EXPLODE" reg) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (if (vl-every '(lambda ( x ) (or (eq (cdr (assoc 0 (entget x))) "LINE") (eq (cdr (assoc 0 (entget x))) "ARC"))) (vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssget "_P")))) ) (progn (setq m (1+ m) z t) (setq p (vlax-curve-getstartpoint (entlast))) (vl-cmdf "_.UCS" "_M" p) (vl-cmdf "_.UCS" "_ZA" "" n) (vl-cmdf "_.PEDIT" "_M" (ssget "_P") "" "_J") (while (> (getvar 'cmdactive) 0) (vl-cmdf "")) (ssadd (entlast) sss) (vl-cmdf "_.UCS" "_P") (vl-cmdf "_.UCS" "_P") ) (progn (setq k (1+ k) f t) (vl-cmdf "_.UNDO" "1") ) ) (vl-cmdf "_.UCS" "_P") ) (if z (progn (prompt "\nThere were : ") (princ m) (prompt " REGIONS - that were converted to LWPOLYLINES"))) (if f (progn (prompt "\nThere were : ") (princ k) (prompt " REGIONS - that were impossible to be converted to LWPOLYLINES"))) (if z (progn (prompt "\nSelection set is stored in variable : \"sss\"...") (sssetfirst nil sss) ) ) (setvar 'peditaccept pea) (princ) ) Regards, M.R. 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.