Block selection (with window method)

Block selection (with window method)

k005
Advisor Advisor
1,269 Views
18 Replies
Message 1 of 19

Block selection (with window method)

k005
Advisor
Advisor

 

Hello everyone

 

How can we make a selection in the Window by entering the layer names of the blocks?

 

sample:

 

BLOCK REFERENCE
--------------------------------
Beam ... (layer)
Colon...(layer)
Panel...(layer)

 

1- First of all, region selection. ( ssget window )
2- I will enter these names at the beginning with getstring t.
or let me select one by one with the mouse.. (Beam-Column-Panel....+ )


Thanks in advance to the helper.

0 Likes
Accepted solutions (2)
1,270 Views
18 Replies
Replies (18)
Message 2 of 19

ВeekeeCZ
Consultant
Consultant

You still don't know anything? Gees. 

0 Likes
Message 3 of 19

k005
Advisor
Advisor

I didn't have a study like learning lisp. Isn't this already clear?

0 Likes
Message 4 of 19

ВeekeeCZ
Consultant
Consultant

That's just a silly excuse. It's hard to imagine someone here who studied a field that included learning of LISP. My guess would be - no one. Some may have some programming basics, but that's about it. Anyway, LISP is designed so that its basics are really simple and can be mastered by anyone educatable.

But as it seems, you only studied how to abuse people. That's clear to me but might not to you.

0 Likes
Message 5 of 19

k005
Advisor
Advisor

why would it be stupid?

 

So I have to learn lisp to ask questions in this forum?

 

* Also in my opinion do not abuse people. There are applications for those who want to help...

you cannot help. no problem.

0 Likes
Message 6 of 19

ВeekeeCZ
Consultant
Consultant

You're abusing goodwill. 

And use the right words. You are not asking questions, you're asking people to WRITE THE CODE FOR YOU.

Message 7 of 19

k005
Advisor
Advisor

I am using the right words.

 

Yes, I'm asking questions to help them. If this is not suitable for you, you will not write an answer.

 

Why did you drag this subject so long?

0 Likes
Message 8 of 19

k005
Advisor
Advisor

 

* Question is up to date...

0 Likes
Message 9 of 19

Sea-Haven
Mentor
Mentor

You can select blocks by name "Beam,Column,Slab" then look at each item in ssget and delete those with wrong layer matching block name. Or you need to build a big filter using the "(-4" in the filter code including, and's, or's very complicated so no answer from me. 

0 Likes
Message 10 of 19

Kent1Cooper
Consultant
Consultant
Accepted solution

To find Blocks named "1" on Layer "1" and Blocks named "2" on Layer "2" and Blocks named "3" on Layer "3": 

(setq YourVariableName
  (ssget "_X"
    '(
      (-4 . "<OR")
        (-4 . "<AND") (2 . "1") (8 . "1") (-4 . "AND>")
        (-4 . "<AND") (2 . "2") (8 . "2") (-4 . "AND>")
        (-4 . "<AND") (2 . "3") (8 . "3") (-4 . "AND>")
      (-4 . "OR>")
    )
  )
)

Help is not very helpful in helping you find information about these, but you can read about "Logical Grouping of Selection Filter Tests>here<.

Kent Cooper, AIA
Message 11 of 19

k005
Advisor
Advisor

The next step is to take the layer name of the object selected with the mouse and add it to the code.

Thank you so much. @Kent1Cooper 

(Defun C:bsec()
(setq pn1 (getpoint "\nÜst köşe?"))
(setq pn2 (getcorner pn1 "\nAlt köşe?"))
(setq bloklar
 ; (ssget "_X"
(ssget "W" pn1 pn2
    '(
      (-4 . "<OR")
        (-4 . "<AND") (8 . "Kolon") (-4 . "AND>")
        (-4 . "<AND") (8 . "Kiriş") (-4 . "AND>")
        (-4 . "<AND") (8 . "Panel") (-4 . "AND>")
      (-4 . "OR>")
    )
  )
)
(sssetfirst bloklar))
0 Likes
Message 12 of 19

Kent1Cooper
Consultant
Consultant

Your AND wrappers with only one entry between them are kind of pointless, are they not?  Did you mean to include another entry, whether with a specific Block name as in my previous suggestion, or just to limit it to Blocks?

 

...
        (-4 . "<AND") (0 . "INSERT") (8 . "Kolon") (-4 . "AND>")
        (-4 . "<AND") (0 . "INSERT") (8 . "Kiriş") (-4 . "AND>")
        (-4 . "<AND") (0 . "INSERT") (8 . "Panel") (-4 . "AND>")
....

 

Even that -- finding all Blocks on those Layers without limiting to certain Block names -- could be done without the AND wrappers:

 

(ssget "W" pn1 pn2 '((0 . "INSERT") (8 . "Kolon,Kiriş,Panel")))

 

As you have it, the same could be done with just this:

 

(ssget "W" pn1 pn2 '((8 . "Kolon,Kiriş,Panel")))

 

Kent Cooper, AIA
Message 13 of 19

k005
Advisor
Advisor

Yes, there may be other layers besides these three layers. Or it can be only 1 layer.

 

For now, I want to collect 5 layers in 5 different variables for noses.

 

so I will create a loop and get the layer names or names... with the mouse.

 

When I exit the loop, the layer to be selected will take a null value.

 

my variables.

 

layer1
layer2
layer3
layer4
layer5

is in the form.

 

Column, beam, panel was an example.

 

layer1=column
layer2=beam
layer3=panel
layer4=""
layer5=""

 

I want to do something like this...

 

* should not click on an empty spot and exit the command.

0 Likes
Message 14 of 19

Sea-Haven
Mentor
Mentor

You can select select select getting layer names, and joins as a string "layer1,layer2,layer3" note the "," between.

 

(ssget "W" pn1 pn2 (list (cons 8 str)))
0 Likes
Message 15 of 19

k005
Advisor
Advisor

OK.

 

But ; The str variable must come from a loop. and by selecting it with the mouse...

because the number of layers to be selected is not clear... It can be 1, 5, 7...

 

0 Likes
Message 16 of 19

Sea-Haven
Mentor
Mentor

That is what I said pick pick pick as many as required and make the layer list for the ssget filter.

 

(setq lay (cdr (assoc 8 (entget (car (entsel "pick object ")))))) then strcat together.

0 Likes
Message 17 of 19

k005
Advisor
Advisor
(setq str (cdr (assoc 8 (entget (car (entsel "Obje seç"))))))

 

I added the code. But it only selects 1 object.

 

How do I make multiple selection?

 

and when you click on the space, the command exits. should not come out.

 

Thank you.

0 Likes
Message 18 of 19

Sea-Haven
Mentor
Mentor
Accepted solution

You skipped over the (setq lay (strcat lay "," newlay) )

(setq lay (cdr (assoc 8 (entget (car (entsel "\nPick object for layer"))))))

(while(setq ent (entsel "\nPick object for layer"))
(setq lay (strcat lay "," (cdr (assoc 8 (entget (car ent))))))
)

 

 

 

Message 19 of 19

k005
Advisor
Advisor

@Sea-Haven 

 

Thank you.

0 Likes