AutoCAD 2010/2011/2012

AutoCAD 2010/2011/2012

Reply
Contributor
artisteroi
Posts: 25
Registered: ‎11-12-2008
Message 11 of 18 (13,540 Views)

Re: How to join more than one line using single command?

08-03-2010 01:51 PM in reply to: JamaL9722060

 PE Enter

 M Enter(for multiple)

select all your lines you want to join Enter

convert to polylines Enter (defaults to yes)

J Enter (for join)

fuzz distance? Enter (defaults to zero)

Enter (closes command)

all lines are now joined. Provided the lines had touching ends that is.

Valued Contributor
brooky
Posts: 84
Registered: ‎04-14-2010
Message 12 of 18 (13,534 Views)

Re: How to join more than one line using single command?

08-03-2010 01:57 PM in reply to: artisteroi

Hmmmm, and this is faster than join?

(somewhat tongue in cheek) It's amazing what "progarammers" do to save one key sytoke or one pick.

Yes, guilty myself upon reflection.

Valued Mentor
stevenelliott3894
Posts: 474
Registered: ‎06-14-2010
Message 13 of 18 (13,496 Views)

Re: How to join more than one line using single command?

08-04-2010 01:23 PM in reply to: JamaL9722060

The fastest way (by far) I have found is to edit your double click function for Line entities.

 

In the CUI under Double Click Actions, select the action for Line.

Under Macro (on the right) enter:  ^C^CPEDIT;J;

 

You should also set the PEDITACCEPT variable to 1.

 

Then you just have to double click a line to turn it into a polyline and leave you in Join mode where you can window (or select) your other lines to join. Enter (right click) when done and you are good to go.

 

NO KEYPRESSES AT ALL!

 

Steven Elliott

When I was a little bitty boy, my grandmother bought me a cute little toy. Silver bells hangin' on a string... she told me it was my ding-a-ling-a-ling!
Contributor
artisteroi
Posts: 25
Registered: ‎11-12-2008
Message 14 of 18 (13,473 Views)

Re: How to join more than one line using single command?

08-05-2010 06:18 AM in reply to: artisteroi

That method is best However I will edit your macro just a bit.

you wrote ^C^CPEDIT;J;

try this instead ^C^CPEDIT;Y;J;

so just double click any line then window the ones to join

hit enter twice to finish the command.

Valued Mentor
stevenelliott3894
Posts: 474
Registered: ‎06-14-2010
Message 15 of 18 (13,470 Views)

Re: How to join more than one line using single command?

08-05-2010 06:23 AM in reply to: artisteroi

I don't need the extra 'Y' in my macro because I like to have the PEDITACCEPT variable set to 1. Yours is a great modification for those who may not want to change their PEDITACCEPT variable.

 

Steven Elliott

When I was a little bitty boy, my grandmother bought me a cute little toy. Silver bells hangin' on a string... she told me it was my ding-a-ling-a-ling!
Mentor
stevev0983
Posts: 203
Registered: ‎11-05-2005
Message 16 of 18 (13,458 Views)

Re: How to join more than one line using single command?

08-05-2010 08:50 AM in reply to: JamaL9722060

Try this:

 

1) create a new lisp routine called pjoin.lsp

2) Paste this into it:

 

(defun C:JP (/ EHCO PT1 PTLL PTUR ENT LAYR OC ETYPE ENT2 ENT3)
  (setq ECHO (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (setvar "peditaccept" 0)
  (setq PTLL  (getvar "vsmin")
        PTUR  (getvar "vsmax"))
  (setq ENT   (entsel "Select object to become polyline:")
        LAYR  (cdr (assoc 8 (entget (car ENT))))
        ETYPE (cdr (assoc 0 (entget (car ENT))))
  )
  (command "_layer" "_s" LAYR "_off" "*" "" "")
  (setq PT1 (cadr ENT))
  (if (or (= ETYPE "LWPOLYLINE") (= ETYPE "POLYLINE"))
      (progn
         (setq OC (cdr (assoc 70 (entget (car ENT)))))
         (if (= OC 0)
             (progn
                (command "_PEDIT" PT1 "_J" "_C" PTLL PTUR "" "")
                (command "_Select" PT1 "")
                (setq ENT2 (ssget PT1)
                      ENT2 (entget (ssname ENT2 0))
                      OC   (cdr (assoc 70 ENT2))
                )
             )
         )

      )
      (progn
         (command "_PEDIT" PT1 "_y" "_J" "_C" PTLL PTUR "" "")
         (setq ENT3 (entget (entlast))
               OC   (cdr (assoc 70 ENT3))
         )
      )
  )
  (command "_Layer" "a" "r" "temp" "" "")
  (setvar "cmdecho" ECHO)
  (setvar "peditaccept" 1)
  (if (= OC 1)
      (prompt "\nPolyline is closed\n")
      (prompt "\nPolyline is open...find break and try again\n")
  )
  (prin1)
)

 

3) End AutoCAD, open your acaddoc.lsp file, and paste this in it:   (LOAD "pjoin.LSP")

 

4) Start ACAD back up and you're good to go. Simply type pj and select any items you want. You can even use window or crossing. As long at the lines touch correctly, they will become a joined polyline.

Distinguished Contributor
barry2104
Posts: 114
Registered: ‎04-18-2011
Message 17 of 18 (13,116 Views)

Re: How to join more than one line using single command?

04-18-2011 06:50 AM in reply to: stevev0983

thanks for the lsp cad peeps - i will be using this one all the time from now on

 

can anyone tell me how to create an ICON so that i can click to start the command (instead of typing PLJOIN or equivalent)?

I'd like to add this icon to my quick access toolbar (cad 2011)

Valued Mentor
stevenelliott3894
Posts: 474
Registered: ‎06-14-2010
Message 18 of 18 (13,110 Views)

Re: How to join more than one line using single command?

04-18-2011 06:56 AM in reply to: barry2104

Ummm.. have you tried looking in the help documantation under CUI?

 

Steven Elliott

When I was a little bitty boy, my grandmother bought me a cute little toy. Silver bells hangin' on a string... she told me it was my ding-a-ling-a-ling!
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.