AutoLISP: Connect Endpoints To Make PolyLine

I found this today and thought That I’d share it here because it is really cool.

If you need to make a POLYLINE of objects that continuously touch at their endpoints, this ones for you.

Here’s how:

  • EJA <enter> to start – (Entity Join All)
  • Select one object in the chain – can be a Line, Arc or Polyline.

That’s it.  The routine will check to see if the endpoints touch and if they do, it will join them for you.

The original post can be [found here] on the second page. It is also called PEJA.lsp

;Entity Join All
;Joins lines, arcs & Polylines at their endpoints automatically.
; All you have to do is select one object
; by Kent Cooper @ Autodesk forums
(defun C:EJA (/ peac cmde); = Polyline Edit: Join All
(setq peac (getvar ‘peditaccept))
(setvar ‘peditaccept 1)
(setq cmde (getvar ‘cmdecho))
(setvar ‘cmdecho 0)
(command“_.pedit” pause “_join”“_all”“”“”)
(setvar ‘peditaccept peac)
(setvar ‘cmdecho cmde)
(princ)
)

Advertisement

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, Modifying, TIPS. Bookmark the permalink.

8 Responses to AutoLISP: Connect Endpoints To Make PolyLine

  1. Julio says:

    Fantastic, a very quick and easy way to make polylines, congratulations

  2. Pingback: Auto Load Your Lisp Files (& others) | AutoCAD Tips

  3. Dale says:

    I am a complete AutoCAD rookie. My AutoCAD 2011 does not understand EJA . Any idea what I may be doing wrong?

  4. Kent Cooper says:

    Updated & improved version [PolylineJoin.lsp] available at this thread:
    http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Lines-to-pline-in-one-step/m-p/3533752/highlight/true#M305394
    where any further updates/enhancements/improvements will probably be posted, in case they don’t also show up here.

    • AutoCAD Tips says:

      Good point Kent. For some routines that I have featured from a long time ago I did not include the link because I didn’t even think of the possibility or need to update the routines. I have since started to include the links as a commented section within the code. I will start to make an additional link within the post as well. I have wondered if should even include posting the code in my posts or simply having a direct link. Being that people are copying the code form here and then asking me to to update the code because of an issue I think that for now on I will leave out the code and give the link. That way you (the author) are aware of any issues.
      Thanks for all that you do Kent
      ~Greg

  5. a.yuksel says:

    Hello sir,
    You’ve written a code that join them all. What if we want to joint some of them that we assigned names to them by setq entlast?
    How can we do that? For example; I just want to join line7, arc1, line8, arc2 ?
    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s