+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Forum Newbie
    Computer Details
    MrCocopuffz's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL Precision 7720
    Discipline
    Construction
    MrCocopuffz's Discipline Details
    Occupation
    BIM Engineer
    Discipline
    Construction
    Using
    Civil 3D 2017
    Join Date
    Mar 2018
    Posts
    8

    Default Join lines on same layer

    Registered forum members do not see this ad.

    Hello everyone. I'm trying to put together a lisp to be able to select a line, which will cause all the lines on that layer to be selected, then using the join command will make any lines connected at the endpoints to become a poly lines. I'm using some code from other lisps and trying to make this work. If I enter each line in on the command line it seems to work but when I use the new command "JLL" nothing really happens. It goes through the process of selecting everything but does not join.

    Code:
    (defun C:JLL ()
    	(setq targetEnt (car (entsel "\nSelect object on layer to select: ")))
    	(setq targetLayer (assoc 8 (entget targetEnt)))
    	(sssetfirst nil (ssget "_X" (list targetLayer)))
    	(command "join" "")
    	(princ)
    )

  2. #2
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,543

    Default

    In AutoCAD, try running it with QAFLAGS = 1

    Interestingly, it works fine in BricsCAD with QAFLAGS = 0 (the default)
    R.K. McSwain
    CAD Panacea | twitter

  3. #3
    Forum Newbie
    Computer Details
    MrCocopuffz's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL Precision 7720
    Discipline
    Construction
    MrCocopuffz's Discipline Details
    Occupation
    BIM Engineer
    Discipline
    Construction
    Using
    Civil 3D 2017
    Join Date
    Mar 2018
    Posts
    8

    Default

    It works!!! Thank you so much.

  4. #4
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 10
    Computer:
    HP Z240
    CPU:
    i7-7700k @ 4.20GHz
    RAM:
    64GB
    Graphics:
    Nvidia Quadro P1000
    Primary Storage:
    0.5TB SSD
    Secondary Storage:
    1TB SATA
    Monitor:
    Vizio 40"
    Discipline
    Civil
    Using
    Civil 3D 2019
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    4,543

    Default

    I would suggest setting that sysvar in the routine, and returning it to a value of 0 when you're done.
    QAFLAGS at a non-zero value can cause other oddities
    R.K. McSwain
    CAD Panacea | twitter

  5. #5
    Forum Newbie
    Computer Details
    MrCocopuffz's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL Precision 7720
    Discipline
    Construction
    MrCocopuffz's Discipline Details
    Occupation
    BIM Engineer
    Discipline
    Construction
    Using
    Civil 3D 2017
    Join Date
    Mar 2018
    Posts
    8

    Default

    Good to know, thanks for the help.

  6. #6
    Forum Newbie
    Computer Details
    MrCocopuffz's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL Precision 7720
    Discipline
    Construction
    MrCocopuffz's Discipline Details
    Occupation
    BIM Engineer
    Discipline
    Construction
    Using
    Civil 3D 2017
    Join Date
    Mar 2018
    Posts
    8

    Default

    Would I place (setvar "qaflags" 1) right above the (command "join" "") or under (defun C:JLL ()? Or does it matter?

  7. #7
    Forum Newbie
    Computer Details
    MrCocopuffz's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL Precision 7720
    Discipline
    Construction
    MrCocopuffz's Discipline Details
    Occupation
    BIM Engineer
    Discipline
    Construction
    Using
    Civil 3D 2017
    Join Date
    Mar 2018
    Posts
    8

    Default

    So I'm watching the text window as it executes and it looks like this:

    Command: jll
    Select object on layer to select: join 1340 found

    5 objects converted to 1 polyline, 1333 objects discarded from the operation
    Command: JLL
    Unknown command "JLL". Press F1 for help.


    Why is it giving me an additionall "JLL" and "Unknown command" at the end?

  8. #8
    Super Member
    Computer Details
    tombu's Computer Details
    Operating System:
    Windows 7 64-bit
    Computer:
    Dell
    Discipline
    Civil
    tombu's Discipline Details
    Occupation
    Design Analyst
    Discipline
    Civil
    Details
    Small Street & Stormwater projects. Traffic Calming and other issues.
    Using
    Civil 3D 2018
    Join Date
    Dec 2010
    Location
    Tallahassee, FL USA
    Posts
    810

    Default

    This works using initcommandversion without qaflags:
    Code:
    (defun C:JLL ()
    	(setq targetEnt (car (entsel "\nSelect object on layer to select: ")))
    	(setq targetLayer (assoc 8 (entget targetEnt)))
    	(sssetfirst nil (ssget "_X" (list targetLayer)))
    	(initcommandversion 2)
    	(command-s "join" "")
    	(princ)
    )
    Layer 0 for ByBlock Block entities, everything else ByLayer. So many issues can be solved with good templates.

  9. #9
    Forum Newbie
    Computer Details
    MrCocopuffz's Computer Details
    Operating System:
    Windows 10
    Computer:
    DELL Precision 7720
    Discipline
    Construction
    MrCocopuffz's Discipline Details
    Occupation
    BIM Engineer
    Discipline
    Construction
    Using
    Civil 3D 2017
    Join Date
    Mar 2018
    Posts
    8

    Default

    Quote Originally Posted by tombu View Post
    This works using initcommandversion without qaflags:
    Code:
    (defun C:JLL ()
    	(setq targetEnt (car (entsel "\nSelect object on layer to select: ")))
    	(setq targetLayer (assoc 8 (entget targetEnt)))
    	(sssetfirst nil (ssget "_X" (list targetLayer)))
    	(initcommandversion 2)
    	(command-s "join" "")
    	(princ)
    )
    For some reason, this version doesn't work for me. It asks for the selection but then nothing after.

  10. #10
    Super Member
    Computer Details
    tombu's Computer Details
    Operating System:
    Windows 7 64-bit
    Computer:
    Dell
    Discipline
    Civil
    tombu's Discipline Details
    Occupation
    Design Analyst
    Discipline
    Civil
    Details
    Small Street & Stormwater projects. Traffic Calming and other issues.
    Using
    Civil 3D 2018
    Join Date
    Dec 2010
    Location
    Tallahassee, FL USA
    Posts
    810

    Default

    Registered forum members do not see this ad.

    Odd, for me the Command or Text window displays:
    Command: JLL

    Select object on layer to select: join 3 found

    3 objects converted to 1 polyline
    Command:

    after selecting one line it joined it with 2 other lines that shared endpoints.

    What did your Command or Text window display after you selected a line?
    Layer 0 for ByBlock Block entities, everything else ByLayer. So many issues can be solved with good templates.

Similar Threads

  1. How can I Join lines
    By akis123321 in forum AutoCAD General
    Replies: 10
    Last Post: 27th Feb 2015, 01:58 pm
  2. how to join these 5 lines/arcs?
    By Marvin7 in forum AutoCAD General
    Replies: 13
    Last Post: 22nd Jul 2013, 08:27 pm
  3. Using Polyedit to join lines
    By manchest in forum AutoCAD General
    Replies: 4
    Last Post: 11th Oct 2010, 07:53 am
  4. How to join lines on different UCS planes
    By dreamer in forum AutoCAD 3D Modelling & Rendering
    Replies: 5
    Last Post: 3rd Jul 2010, 07:35 pm
  5. join lines
    By azman modular in forum AutoCAD General
    Replies: 25
    Last Post: 26th Mar 2009, 03:36 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts