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

Select all blocks in paperspace

9 REPLIES 9
Reply
Message 1 of 10
embolisim
1815 Views, 9 Replies

Select all blocks in paperspace

Hi, this is probably a newbie question sorry, I dont do much lisping.
I want to select all blocks in paperspace for the purpose of deleting it. The file is a revit export and I know very well that the only block is the title block.

This selects all paperspace objects successfully;

(setq sstb (ssget "x" '(67 .1)(command "select" sstb)))

but when I try to filter out everything that is not a block like this;

(setq sstb (ssget "x" '(67 .1)(0 . "BLOCK")(command "select" sstb)))

my selection set is empty.

Any help much appreciated.
Thanks....
9 REPLIES 9
Message 2 of 10
embolisim
in reply to: embolisim

just ignore me I was talking gibberish... none of that worked anyway, but this does.

(setq sstb (ssget "X" (list (cons 0 "INSERT")(cons 67 1))))

(setq ssreminder "\ntake meds before posting on forums")
Message 3 of 10

Any advice for how to use that string for this noob ? I need to select only paperspace objects (indeed blocks) too. How do i use that string to select them ?

Deniz
Message 4 of 10


@limezestpizzawithextracheese wrote:

Any advice for how to use that string for this noob ? I need to select only paperspace objects (indeed blocks) too. How do i use that string to select them ?


Deniz,

the group code 67 it's a flag, if it's 1 indicates that the entity is in paper space, if zero or absent indicates that the entity is in model space.

 

So from the code string

(setq sstb ;; sets to the sstb variable re resulting selection set
(ssget "X" ;; search the entire drawing database
(list ;; filter list
(cons 0 "INSERT") ;; must be an INSERT entity
(cons 67 1) ;; must be in paper space
) ;; end the filter list
) ;; end the ssget function
) ;; end the setq function

 

You can also use

(setq sstb (ssget "X" (list (cons 0 "INSERT") (cons 410 "~Model") )))

the group code 410 is the Layout name, and with a tilde preceding the name, means except that name, will accept as valid layaut name all except "Model"

 

Hope that helps
Henrique

EESignature

Message 5 of 10

Henrique, 

 

Can you pls tell me how can i use that code string ? ( I remember that when i asked this question i found the answer but now i forgot 😄

 

Thnx

 

I already copied and pasted that to command bar but it does not select the blocks in the paperspace ? 

 

PS: ( I'm seeking for the answer because, all i want to do is to change the titleblock attributes whenever it is necessary. So Right now i finished my dynamic block but, it seems that i can't select all the title blocks i have pasted to each layout ? 

Deniz
Message 6 of 10

Hi Deniz,

with

(setq ss (ssget "_X" '((0 . "INSERT") (410 . "~Model") (66 . 1))))

you should ceate a selection set with all blocks with attributes in all layouts, except in model space, and set the 'ss' variable with it.

 

Henrique

 

EESignature

Message 7 of 10

Nope, It seems that it does not work for me. I attached the file. What i need to do is to make an attout and attin for those titleblocks, in my layouts. 

 

Hope i could define enough. 

 

I pasted that code in the command bar but again did not worked. Here is a screenshot. 

Deniz
Message 8 of 10

Deniz,

 

at the moment I don't have AutoCAD with me, but try

(if (setq ss (ssget "_X" '((0 . "INSERT") (410 . "~Model") (66 . 1))))(sssetfirst nil ss))

 

Henrique

EESignature

Message 9 of 10

It works like a charm. I still did not tested extensively but, i can say that it works with the test file i sent to you. Thanks a lot.

Cheers
Deniz
Message 10 of 10

You're welcome, Deniz
Glad I could help

Henrique

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost