+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
  1. #1
    Forum Newbie Vittorio's Avatar
    Computer Details
    Vittorio's Computer Details
    Operating System:
    Windows 7 Pro 64-bit SP1
    Motherboard:
    MSI MS-7502
    CPU:
    Intel Core 2 Quad Q6600 @ 2.40GHz
    RAM:
    8.00GB GEiL Dual-Channel DDR2 @ 332MHz (5-5-5-15)
    Graphics:
    896MB NVIDIA GeForce GTX 260 (EVGA)
    Primary Storage:
    Samsung SSD 850 EVO 250GB
    Secondary Storage:
    Western Digital WDC WD10EADS 1000GB
    Monitor:
    iiyama ProLite XB2374HDS
    Discipline
    Surveying
    Vittorio's Discipline Details
    Occupation
    geodesist
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Mar 2018
    Location
    Germany
    Posts
    8

    Default LISP - select objects of specific type

    Registered forum members do not see this ad.

    Hello Everybody, this is my first post and I'd like to know a little bit more about the ssget command.

    I already searched the world wide web for various search keywords, but couldn't find references / lists, especially of the Associative codes and object types.

    I also read a lot of articles about that command, but most of them use these Associative codes:
    http://www.lee-mac.com/ssget.html
    https://knowledge.autodesk.com/searc...3B2C3-htm.html
    http://www.afralisp.net/autolisp/tut...ction-sets.php
    They

    Since I am a total newbie with AutoLISP please explain things easily.

    What I would like to do in the first place is selecting objects via LISP, since there seems to be no command line version of SELECT, QSELECT etc.

    and therefore I need:
    • a list of "names" of object types that exist in AutoLISP (eg. TEXT, LINE, etc)
    • all neccessary parameters for the ssget function


    Let's say I want to select a table in a drawing, how can this be done?
    What if there are more than one tables?

    Many thanks in advance

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,572

    Default

    Welcome to CADTutor Vittorio.

    If you have already studied the documentation for the ssget function as found on my site, or in the Autodesk documentation, then you should already be familiar with the parameters which may be supplied to the function: the mode string argument to determine the type of selection, the point & point list arguments when specifying a selection window/polygon, and the filter list argument to filter the properties of objects which may be selected.

    Since your question is predominantly asking about the filter list argument and the various entity types which may be filtered, I would first suggest that you refer to a DXF Reference.

    To understand the entity types available, refer to the ENTITIES section of the reference.

    For example, for a Table, the DXF reference shows that the entity type (DXF group 0) is "ACAD_TABLE". Therefore, to obtain a selection of all tables in the drawing, you might use:
    Code:
    (ssget "_X" '((0 . "ACAD_TABLE")))
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  3. #3
    Forum Newbie Vittorio's Avatar
    Computer Details
    Vittorio's Computer Details
    Operating System:
    Windows 7 Pro 64-bit SP1
    Motherboard:
    MSI MS-7502
    CPU:
    Intel Core 2 Quad Q6600 @ 2.40GHz
    RAM:
    8.00GB GEiL Dual-Channel DDR2 @ 332MHz (5-5-5-15)
    Graphics:
    896MB NVIDIA GeForce GTX 260 (EVGA)
    Primary Storage:
    Samsung SSD 850 EVO 250GB
    Secondary Storage:
    Western Digital WDC WD10EADS 1000GB
    Monitor:
    iiyama ProLite XB2374HDS
    Discipline
    Surveying
    Vittorio's Discipline Details
    Occupation
    geodesist
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Mar 2018
    Location
    Germany
    Posts
    8

    Default

    Quote Originally Posted by Lee Mac View Post
    For example, for a Table, the DXF reference shows that the entity type (DXF group 0) is "ACAD_TABLE".
    Therefore, to obtain a selection of all tables in the drawing, you might use:
    Code:
    (ssget "_X" '((0 . "ACAD_TABLE")))
    I did, but nothing happened. Here's a copy of the ACAD Text Window:
    Code:
    Command: APPLOAD
    selectTable.lsp successfully loaded.
    
    Command: SELECTTABLE
    <Selection set: 18867>
    
    Command: SELECTTABLE
    <Selection set: 1888d>
    
    Command: SELECTTABLE
    <Selection set: 1888f>
    
    Command: (ssget "_X" '((0 . "ACAD_TABLE")))
    <Selection set: 188ca>
    
    Command: SELECTTABLE
    <Selection set: 188d4>
    here is the LISP selectTable.lsp
    Code:
    (defun c:selectTable nil
      (vl-load-com)
    (ssget "_X" '((0 . "ACAD_TABLE")))
    )
    As I already said, I'm a total noob in AutoLISP.



    Quote Originally Posted by Lee Mac View Post
    Since your question is predominantly asking about the filter list argument and the various entity types which may be filtered, I would first suggest that you refer to a DXF Reference.

    To understand the entity types available, refer to the ENTITIES section of the reference.
    So here is what I am understanding:

    The ssget syntax as described on your site or at Autodesk Help:
    (ssget [mode-string] [pt1 [pt2]] [pt-list] [filter-list])

    ssget - required
    [mode-string] - "_X" (Extended Search - Entire Drawing Database)
    [pt1 [pt2]] - "" (Point 1, Point 2, ...) => empty: no points selected
    [pt-list] - "" (Point List) => empty: no point list
    [filter-list] - here we go... I just don't get this part

    • Why is the whole thing eclosed in double parentheses?
    • Why is there an apostroph before the first parenthesis?
    • Why is there a dot between the group code and the entity name?
    • What exactly does the "0" stand for? Group Code? There are many 0s in the reference.
    • Is the "0" bound to the entity name? If so, why is there no "0" or entity name for the LINE object?

    Here is a part of the Reference:
    Table group codes:
    Group code / Description
    0 / Entity name (ACAD_TABLE)

    Line group codes:
    Group code / Description
    100 / Subclass marker (AcDbLine)

  4. #4
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,600

    Default

    A couple more hints you can filter more than one type of entity in one go

    Code:
    (ssget "_X" '((0 . "Line,Lwpolyline"))) finds lines and poly lines
     
    (ssget "_X" '((0 . "Text,Mtext")))  finds text and mtext
    (ssget "_X" '((0 . "*Text")))  finds text and mtext
     
    (ssget "_X" '((0 . "Insert"))) one that is not obvious this finds blocks.
     
    (ssget "_X" '((0 . "*Text")(8 . "123")))  finds text on layer 123
    A man who never made mistakes never made anything

  5. #5
    Forum Newbie Vittorio's Avatar
    Computer Details
    Vittorio's Computer Details
    Operating System:
    Windows 7 Pro 64-bit SP1
    Motherboard:
    MSI MS-7502
    CPU:
    Intel Core 2 Quad Q6600 @ 2.40GHz
    RAM:
    8.00GB GEiL Dual-Channel DDR2 @ 332MHz (5-5-5-15)
    Graphics:
    896MB NVIDIA GeForce GTX 260 (EVGA)
    Primary Storage:
    Samsung SSD 850 EVO 250GB
    Secondary Storage:
    Western Digital WDC WD10EADS 1000GB
    Monitor:
    iiyama ProLite XB2374HDS
    Discipline
    Surveying
    Vittorio's Discipline Details
    Occupation
    geodesist
    Discipline
    Surveying
    Using
    AutoCAD 2018
    Join Date
    Mar 2018
    Location
    Germany
    Posts
    8

    Default

    I tried and pasted the code into command line, but all that AutoCAD tells me is: "<Selection set: XY>" with XY being an incremented number / letter

    There is nothing selected after applying (ssget "_X" '((0 . "Line,Lwpolyline"))) for example...

    How can I actually select objects in AutoLISP?

  6. #6
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,600

    Default

    At its most simplest (setq SS (ssget)) you then have a selection set of objects. Note the SS this the variable name that is holding our selection of objects. All the above are examples of ssget but we all forgot to save the selection to a variable. In saying that there are situations where you dont need to assign to a variable. Like move copy erase etc.
    A man who never made mistakes never made anything

  7. #7
    Senior Member
    Discipline
    Civil
    Aftertouch's Discipline Details
    Discipline
    Civil
    Details
    Engineer
    Using
    AutoCAD 2017
    Join Date
    Jul 2016
    Location
    Netherlands
    Posts
    295

    Default

    If i understand the question...

    SSGET create a selection SET

    If you want to actualy SELECT them.. your looking for the sssetfirst function.

    Have a look at this:
    https://knowledge.autodesk.com/searc...0D2D8-htm.html

  8. #8
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,600

    Default

    Again you need to explain what is it your trying to do, ignore the ssget for the moment do you want to pick objects and do something with them ? Explain what it is you want to do.

    Code:
    an example 
    (command "Erase" (ssget "X" '((8 . "0"))) "") erase objects on layer "0"
    Code:
    (setq ss (ssget "X" '((0 . "TEXT")))) 
    (repeat (setq x (sslength ss))
    (setq obj (ssname ss x))
    ... do stuff here like
    .... get insertion point
    (setq x (+ x 1))
    )
    Last edited by BIGAL; 8th Mar 2018 at 02:48 am.
    A man who never made mistakes never made anything

  9. #9
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    1,013

    Default

    maybe OP just want to use the select command in combo with ssget?


    Code:
     (command "select" ss)

    But I agree he has to give more info in what he is trying to do...


    gr. Rlx

  10. #10
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    859

    Default

    Registered forum members do not see this ad.

    You might also study THIS.

Similar Threads

  1. Lisp needed for Move objects with specific distance
    By dreams in forum AutoLISP, Visual LISP & DCL
    Replies: 20
    Last Post: 4th Feb 2017, 02:39 pm
  2. Lisp to select all objects on specified layers
    By PianoMan in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 30th Jan 2016, 12:41 am
  3. Lisp to select and hatch objects
    By pixel8er in forum AutoLISP, Visual LISP & DCL
    Replies: 26
    Last Post: 4th Aug 2011, 05:09 pm
  4. how to select all visible objects by lisp ?
    By ahyin in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 3rd Aug 2010, 07:42 am
  5. how to filter select objects by 2 type of layer in single set
    By muthu123 in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 16th Dec 2009, 01:23 pm

Tags for this Thread

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