+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Aug 2015
    Posts
    25

    Default Selecting layers by its name

    Registered forum members do not see this ad.

    Hi,

    I'm searching a lisp that selecting layers by them name. As an example I give some names:

    AAA_BBB_xxx
    AAA_BBB_xxy
    AAA_BBB_xyz

    I need to select all layers that names start as AAA_BBB. The third part of name is changing. In this case I'd like to select only this layers that name has AAA_BBB. How can I do this?

    Thank you for any suggestions in advance.
    Jakub

  2. #2
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,085

    Default

    Try.

    Code:
    (setq sel (ssget "_:L" '((8 . "AAA_BBB*"))))

  3. #3
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    Do you need a lisp ?

    FILTER, select object, edit layer name, AAA_BBB* selects all layers that start with AAA_BBB
    A man who never made mistakes never made anything

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    Registered forum members do not see this ad.

    2nd suggestion pick object then "how many characters to match" for above its 7 then substr and use Tharwats suggestion.

    Code:
    ; bit rough but for testing
    (setq obj (vlax-ename->vla-object (car (entsel))))
    (setq lay (vla-get-layer obj) )
    (alert (strcat "You have picked layer " lay "Enter number of characters next step"))
    (setq num ("Enter number of characters"))
    (setq str (strcat (substr lay 1 num) "*" ))
    (setq sel (ssget "_:L" (list (cons 8 str))))
    A man who never made mistakes never made anything

Similar Threads

  1. no dotting of locked layers while selecting?
    By rock1 in forum AutoCAD General
    Replies: 12
    Last Post: 10th Aug 2015, 03:47 am
  2. Selecting Individual Layers Within XRefs
    By SJC2014 in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 16th May 2014, 03:41 pm
  3. Viewing/Selecting Layers
    By jwfilion in forum AutoCAD Beginners' Area
    Replies: 8
    Last Post: 7th Dec 2010, 09:22 pm
  4. Shortcut for selecting layers
    By krimer in forum AutoCAD Drawing Management & Output
    Replies: 10
    Last Post: 14th Aug 2007, 06:24 pm
  5. Selecting layers per viewport
    By matramurena in forum AutoCAD Drawing Management & Output
    Replies: 7
    Last Post: 25th May 2007, 11:57 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