lutcus Posted September 30, 2010 Posted September 30, 2010 Hi, i found this lisp in this amazing forum:JOIN-LINES-J.LSP I need to complete this lisp, because this lisp does'nt join the line with pline and so I must to explode all plines to lines and after this i can to use this lisp, so i need to add this "explode" action in this lisp. PLEASE HELP! Quote
ReMark Posted September 30, 2010 Posted September 30, 2010 Lines can't be exploded although plines can. However, lines can be "joined" to plines using the Pedit command and vice-versa. Quote
lutcus Posted September 30, 2010 Author Posted September 30, 2010 I know this cmd, but it's to long action.. i need select all lines and type the lisp..just two steps.. Quote
ReMark Posted September 30, 2010 Posted September 30, 2010 If lines can be joined to polylines and polylines joined to lines using Pedit then what is the need to Explode anything unless there are blocks invloved? Quote
lutcus Posted September 30, 2010 Author Posted September 30, 2010 look at the pic.. i have line ant pline.. and I need to have one pline (wtihout using pedit cmd. it's too long to "play" for me)..i want to select all lines (lines and plines together. i dont care) type the lisp command and finish it. just two steps way to do it.. I added the lisp.. and this do this but just with lines..if i want to use added lisp (try it) i must have all lines.. so i must explode plines to lines and then i can to use this lisp ant join all lines to ONE pline..i thint it's more clear now.. and i'm sorry about my english Quote
ReMark Posted September 30, 2010 Posted September 30, 2010 I'm having monitor problems so the image you posted was unreadable to me. If what you are saying is true then I imagine that the original lisp routine used the "fillet" command to make the lines meet up before they were changed to plines and joined. Is that right? Quote
lpseifert Posted September 30, 2010 Posted September 30, 2010 No need to explode anything. If the endpoints are within 0.01 units apart this will join them (defun c:pj () (setq pa (getvar "peditaccept")) (setvar "peditaccept" 1) (setq ssj (ssget )) (command "pedit" "m" ssj "" "j" "0.01" "") (setvar "peditaccept" pa) (princ) ) Quote
Demesne Posted September 30, 2010 Posted September 30, 2010 This code will join selected lines to create one pline. However, it will not work with 3D POLYS. (defun c:jn () (setvar "cmdecho" 0) (setq lines (ssget (list (cons 0 "LINE,ARC,LWPOLYLINE,POLYLINE")))) ;POLYLINE added 300910 - will crash with 3D POLYLINES (if lines (progn (while (> (sslength lines) 0) (if (= (cdr (assoc 0 (entget (ssname lines 0)))) "LWPOLYLINE") (progn (command "pedit" (ssname lines 0) "j" lines "" "X") (ssdel (ssname lines 0) lines) ) (command "pedit" (ssname lines 0) "y" "j" lines "" "X") ) (setq lines2 (ssadd)) (setq cnt 0 len (sslength lines)) (while (< cnt len) (if (entget (ssname lines cnt)) (setq lines2 (ssadd (ssname lines cnt) lines2)) ) (setq cnt (1+ cnt)) ) (setq lines lines2) ) (princ "\n......Tada!!") ) (princ "\n....Doh!!") ) (setvar "cmdecho" 1) (princ) ) Quote
lutcus Posted September 30, 2010 Author Posted September 30, 2010 Demesne and lpseifert , thank you both.. it's work!! Quote
eldon Posted September 30, 2010 Posted September 30, 2010 In the picture, all you need to do is Fillet, then the line and the polyline will be joined as one polyline. Quote
lutcus Posted September 30, 2010 Author Posted September 30, 2010 In the picture, all you need to do is Fillet, then the line and the polyline will be joined as one polyline. Fillet is not quick way. pedit too.. especially you have a lot of lines and plines to join. and the scripts I get is the best way. and its more than i expected. just select all and type lisp cmd! just two steps! there are no better cmd in default autocad.. or i don't know... so... thanks for all again!! Quote
eldon Posted September 30, 2010 Posted September 30, 2010 I expect ordinary mortals without Lisp would have used the Pedit with Multiple option, and Join with a Fuzz distance, and managed to join everything in one go. This forum is making it too easy to use AutoCAD with Lisps instead of the inbuilt commands Quote
alanjt Posted September 30, 2010 Posted September 30, 2010 I expect ordinary mortals without Lisp would have used the Pedit with Multiple option, and Join with a Fuzz distance, and managed to join everything in one go. This forum is making it too easy to use AutoCAD with Lisps instead of the inbuilt commands I totally agree. There's nothing wrong with a little macro, but one should first learn to use and proficiently understand AutoCAD, as is. PEdit>Multiple... Command: pe PEDIT Select polyline or [Multiple]: m Select objects: Specify opposite corner: 3 found Select objects: Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Undo]: j Join Type = Extend Enter fuzz distance or [Jointype] <0.0000>: 2 segments added to polyline Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Undo]: Quote
Lee Mac Posted September 30, 2010 Posted September 30, 2010 Here's a rather over-elaborate code that I use - it annoys me having to select 'Multiple'... (defun c:pj ( / *error* vl ov ss ) (defun *error* ( msg ) (and ov (mapcar 'setvar vl ov)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")) ) (princ) ) (setq vl '("CMDECHO" "PEDITACCEPT") ov (mapcar 'getvar vl)) (mapcar 'setvar vl '(0 1)) (if (setq ss (ssget "_:L" '((0 . "LINE,ARC,LWPOLYLINE")))) (command "_.pedit" "_M" ss "" "_J" "" "") ) (mapcar 'setvar vl ov) (princ) ) But I agree that you should learn the program before looking to customise. Quote
alanjt Posted September 30, 2010 Posted September 30, 2010 Oh yeah, FYI: you cannot join lines that are not collinear. Quote
ReMark Posted September 30, 2010 Posted September 30, 2010 Better hope the electricity keeps flowing for a long time to come. I can imagine some of these users trying to hand draft a drawing with a pencil, a straightedge and a couple of triangles. There ain't no lisp in board drafting unless you talk funny! Quote
Lee Mac Posted September 30, 2010 Posted September 30, 2010 Oh yeah, FYI: you cannot join lines that are not collinear. Huh? .... Quote
alanjt Posted September 30, 2010 Posted September 30, 2010 I think he means coplanar Oops, thank you. Quote
Guest balajibth84 Posted October 7, 2010 Posted October 7, 2010 I have used this mentioned both lisp..But after join all vertex is maintaining now...Suppose i am join 3 lines means i want only 2 endpoint and one midpoint vertex only....Remaining vertex i want to delete..Hw to do this through lisp?? 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.