Author Topic: Join Lines to Polylines  (Read 9304 times)

0 Members and 1 Guest are viewing this topic.

POCKETS

  • Guest
Join Lines to Polylines
« on: August 20, 2009, 05:27:00 PM »
The included list joins lines to polylines.
Since I am forced to use R2008 it doesn't work.  It worked great in R2002 but as I said not now.  :x

;;;;8:18 AM 05/09/2008 theexchange
;;The user selects a line, arc or polyline and then several lines, arcs or polylines and then the function joins all that touch into one polyline.
(defun c:JP (/ EntType SS)
  (princ "\nSelect lines, arcs or polylines to be joined into a polyline.")
  (if (setq SS (ssget))
    (progn
      (setq EntType (cdr (assoc 0 (entget (ssname SS 0)))))
      (if (or (= EntType "LINE")(= EntType "ARC"))
        (command ".PEDIT" SS "Y" "J" SS "" "X")
      )
      (if (or (= EntType "POLYLINE")(= EntType "LWPOLYLINE"))
        (command ".PEDIT" SS "J" SS "" "X")
      )
    )
    (princ "\nNo lines, arcs or polylines selected.")
  )
  (princ)
)

Lee Mac

  • Seagull
  • Posts: 12285
  • London, England
Re: Join Lines to Polylines
« Reply #1 on: August 20, 2009, 05:44:10 PM »
Perhaps:

Code: [Select]
(defun c:jp (/ ope ss)
  (setq ope (getvar "PEDITACCEPT"))
  (if (setq ss (ssget '((0 . "ARC,*POLYLINE,LINE"))))
    (progn
      (setvar "PEDITACCEPT" 1)
      (command "_.pedit" "_M" ss "" "_J" "" "")))
  (setvar "PEDITACCEPT" ope)
  (princ))

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Join Lines to Polylines
« Reply #2 on: August 20, 2009, 10:10:00 PM »
Code: [Select]
(defun c:JP (/ ss)
  (and (setq ss (ssget ":L" '((0 . "ARC,*POLYLINE,LINE"))))
       (if (zerop (getvar "peditaccept"))
         (command "_.pedit" "_m" ss "" "_y" "_j" "" "")
         (command "_.pedit" "_m" ss "" "_j" "" "")
       ) ;_ if
  ) ;_ and
  (princ)
) ;_ defun

don't have to change any variables & objects on locked layers are ignored.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12285
  • London, England
Re: Join Lines to Polylines
« Reply #3 on: August 21, 2009, 06:47:24 AM »
Much better  :wink:

Chris

  • Swamp Rat
  • Posts: 544
Re: Join Lines to Polylines
« Reply #4 on: August 21, 2009, 07:52:49 AM »
Code: [Select]
(defun c:JP (/ ss)
  (and (setq ss (ssget ":L" '((0 . "ARC,*POLYLINE,LINE"))))
       (if (zerop (getvar "peditaccept"))
         (command "_.pedit" "_m" ss "" "_y" "_j" "" "")
         (command "_.pedit" "_m" ss "" "_j" "" "")
       ) ;_ if
  ) ;_ and
  (princ)
) ;_ defun

don't have to change any variables & objects on locked layers are ignored.
please forgive my ignorance, but what is the : in front of the L for?  and wouldn't it work better if selection method wasn't specified?
Christopher T. Cowgill, P.E.
AEC Collection 2018 (C3D)
Win 10

Lee Mac

  • Seagull
  • Posts: 12285
  • London, England
Re: Join Lines to Polylines
« Reply #5 on: August 21, 2009, 07:56:43 AM »
:L means ignore objects on locked layers  :-)

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Join Lines to Polylines
« Reply #6 on: August 21, 2009, 08:37:37 AM »
selection method? are you talking about the filter in ssget?

Code: [Select]
(defun c:JP (/ ss)
  (and (setq ss (ssget ":L" '((0 . "ARC,*POLYLINE,LINE"))))
       (if (zerop (getvar "peditaccept"))
         (command "_.pedit" "_m" ss "" "_y" "_j" "" "")
         (command "_.pedit" "_m" ss "" "_j" "" "")
       ) ;_ if
  ) ;_ and
  (princ)
) ;_ defun

don't have to change any variables & objects on locked layers are ignored.
please forgive my ignorance, but what is the : in front of the L for?  and wouldn't it work better if selection method wasn't specified?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10369
Re: Join Lines to Polylines
« Reply #7 on: August 22, 2009, 03:55:11 PM »
It appears that Chris mistook the :L for Last selection method when in fact it is as Lee said "Reject Locked Layers".
Nice one Alan.
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Join Lines to Polylines
« Reply #8 on: August 22, 2009, 03:57:49 PM »
It appears that Chris mistook the :L for Last selection method when in fact it is as Lee said "Reject Locked Layers".
Nice one Alan.

Thanks Alan.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Chris

  • Swamp Rat
  • Posts: 544
Re: Join Lines to Polylines
« Reply #9 on: August 24, 2009, 07:51:34 AM »
It appears that Chris mistook the :L for Last selection method when in fact it is as Lee said "Reject Locked Layers".
Nice one Alan.

I get it, it's one of those undocumented things. (or if it is documented, could someone please point it out?)
Christopher T. Cowgill, P.E.
AEC Collection 2018 (C3D)
Win 10

Lee Mac

  • Seagull
  • Posts: 12285
  • London, England
Re: Join Lines to Polylines
« Reply #10 on: August 24, 2009, 07:58:03 AM »
Check out Page 8 of this from AU - quite interesting. :-)

« Last Edit: August 24, 2009, 08:13:25 AM by Lee Mac »

Krushert

  • Seagull
  • Posts: 13577
  • FREE BEER Tomorrow!!
Re: Join Lines to Polylines
« Reply #11 on: August 24, 2009, 08:11:14 AM »
Check out Page 8 of this from AU - quite interesting:


Thanks
I + XI = X is true ...
... if you change your perspective.

POCKETS

  • Guest
Re: Join Lines to Polylines
« Reply #12 on: August 24, 2009, 08:14:57 AM »
My thanks to one and all
Pockets

Lee Mac

  • Seagull
  • Posts: 12285
  • London, England
Re: Join Lines to Polylines
« Reply #13 on: August 24, 2009, 08:16:42 AM »
Check out Page 8 of this from AU - quite interesting:


Thanks

My thanks to one and all
Pockets

Not a problem guys, you're welcome   8-)

alanjt

  • Needs a day job
  • Posts: 5327
  • Standby for witty remark...
Re: Join Lines to Polylines
« Reply #14 on: August 24, 2009, 08:55:02 AM »
here's some of them i had in a text file
Quote
    *  (ssget "_:S") - selecting a single object
    * (ssget "_:E") - selecting all objects crossing the selection box (can be also combined to e.g. (ssget "_:E:S")
    * (ssget "_:N") - selecting objects including nested/child objects - e.g. with block references
    * (ssget "_:D") - duplicate objects counted separately (2x selected object = 2 selections)
    * (ssget "_:L") - stops users from selecting objects on locked layers
    * (ssget "_:P") - rejects selection of viewports
    * (ssget "+.") - allows window selection even in the single selection mode - (ssget "+.:E:S") (may not work in localized versions)




Civil 3D 2019 ~ Windohz 7 64bit
Dropbox