Jump to content

Recommended Posts

Posted

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!

pline.jpg

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • lutcus

    5

  • ReMark

    4

  • alanjt

    3

  • lpseifert

    2

Top Posters In This Topic

Posted Images

Posted

Lines can't be exploded although plines can. However, lines can be "joined" to plines using the Pedit command and vice-versa.

Posted

I know this cmd, but it's to long action.. i need select all lines and type the lisp..just two steps..

Posted

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?

Posted

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 :)

Posted

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?

Posted

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)
)

Posted

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)
)

Posted

Demesne and lpseifert , thank you both.. it's work!!:D

Posted

In the picture, all you need to do is Fillet, then the line and the polyline will be joined as one polyline.

Posted
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!!

Posted

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. :D

 

This forum is making it too easy to use AutoCAD with Lisps instead of the inbuilt commands :cry:

Posted
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. :D

 

This forum is making it too easy to use AutoCAD with Lisps instead of the inbuilt commands :cry:

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]:

Posted

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.

Posted

Oh yeah, FYI: you cannot join lines that are not collinear.

Posted

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!

Posted
Oh yeah, FYI: you cannot join lines that are not collinear.

 

Huh?

 

....

Guest balajibth84
Posted

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??

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...