Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp for selecting all on layer 5

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
6271 Views, 6 Replies

Lisp for selecting all on layer 5

Can someone let me know what a lisp routine would look like for selecting all items on layer 5. 

Thanks.

6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Just a hint always search this NG for suggestions before posting.  One way

 

(setq ss (ssget "x" (list (cons 8 "5"))))

Will give you a selection set of all objects on layer 5

 

(command "erase" ss "")

will erase all on layer 5

 

Southie

Message 3 of 7
Kent1Cooper
in reply to: Anonymous

Or, since there's nothing to be evaluated [no variable names or calculations] in the (ssget) filter, you can use the shorter "quoted-list" version:

 

(ssget "X" '((8 . "5")))

Kent Cooper, AIA
Message 4 of 7
braudpat
in reply to: Kent1Cooper

 

Hello

 

If I remember well, this kind of ssget will select any entities on Layer "5"

in ANY space (Model + Layouts) ?

 

Bye, Pat

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 5 of 7
Kent1Cooper
in reply to: braudpat


@braudpat wrote:

.... 

If I remember well, this kind of ssget will select any entities on Layer "5"

in ANY space (Model + Layouts) ?

....


That is correct.  Any things that are not in the current space cannot then be operated on by editing commands in (command) functions that ask for object selection, because those will "see" only things in the current space, but they can be operated on in other ways.

Kent Cooper, AIA
Message 6 of 7
Maltezc
in reply to: Anonymous

hi all, I know this thread is old but i'm having an issue with my lisping code and if anyone can help me, that would be great. 

 

i'm trying to select and change all hatches AR-SAND on layer a-ceil-grid and then only change the scale. The issue is that if I have multiple hatches on this layer and this type, it will only work on the very first one i put in the file, 

 

is there a way to select all?

 

here is my code: 

 

(defun C:Hatch_Edit_A-CEIL-GRID (/ ss old_CMDECHO)
(setq old_CMDECHO (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
;;(setq ss (ssget "X" '((2 . "AR-SAND"))))
(setq ss (ssget "X" '((2 . "AR-SAND")(8 . "a-ceil-grid"))))
(command "-hatchedit" ss "p" "AR-SAND" "10" "")
(Setvar "CMDECHO" old_CMDECHO)
(princ)
)

 

all help is appreciated !

Message 7 of 7
Kent1Cooper
in reply to: Maltezc


@Maltezc wrote:

.... 

i'm trying to select and change all hatches AR-SAND on layer a-ceil-grid and then only change the scale. The issue is that if I have multiple hatches on this layer and this type, it will only work on the very first one i put in the file, 

 

is there a way to select all?

....

(command "-hatchedit" ....


The Hatchedit command won't work on more than one at a time [which you can tell by trying it manually], but it can be done by stepping through the selection set and having it change one at a time.  But I would suggest you start a new thread [after first Searching for whether this has come up before], to make it easier for someone else who has the same problem to find whatever solution you may get -- this is not really a select-all-on-a-Layer problem to go with this thread's Subject, but a Hatch-editing problem.  [EDIT -- And now I see that you have ....]

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost