Help with ssget inside block editor

Help with ssget inside block editor

msarqui
Collaborator Collaborator
2,158 Views
11 Replies
Message 1 of 12

Help with ssget inside block editor

msarqui
Collaborator
Collaborator

Hi guys,

 

I have this ssget that works pretty good for me but now I want to filter only objects that are in the block editor. So, how can I add a filter for that without changing the existing structure of this ssget? (getvar "ctab")?

 

Better yet... Because I am using this with dynamic blocks with visibilitys, is it possible to filter only objects that are visible? I mean, do not include the ones that have been hide by the "bhide" command?

 

(setq sel (ssget "_X" '(
 (-4 . "<OR")
  (0 . "WIPEOUT")
  (0 . "INSERT")
   (-4 . "<AND")
    (0 . "HATCH")(2 . "ANSI31")(62 . 2)
   (-4 . "AND>")
 (-4 . "OR>")
)))

Thanks!

 

0 Likes
Accepted solutions (1)
2,159 Views
11 Replies
Replies (11)
Message 2 of 12

msarqui
Collaborator
Collaborator

I found a solution for the not visible objects.

(repeat
	(setq i (sslength sel))											;To convert each objetc in the selection set to vl-object
	(setq ename (ssname sel (setq i (1- i))))	
	(setq vlobj (vlax-ename->vla-object ename))	
	(if (= :vlax-false (vla-get-visible vlobj))
		(ssdel ename sel)											;Remove the objects that had been hide in "(command "-bvhide" selh "" "")"
	);if
);repeat

Need only the filter for objects that are only in the block editor.

 

0 Likes
Message 3 of 12

DannyNL
Advisor
Advisor

Use A for all objects instead of X for the entire database.

 

(setq sel (ssget "_A" '(
 (-4 . "<OR")
  (0 . "WIPEOUT")
  (0 . "INSERT")
   (-4 . "<AND")
    (0 . "HATCH")(2 . "ANSI31")(62 . 2)
   (-4 . "AND>")
 (-4 . "OR>")
)))
0 Likes
Message 4 of 12

msarqui
Collaborator
Collaborator
Sorry Danny.
This will still select the objects that are outside the block editor.
0 Likes
Message 5 of 12

cadffm
Consultant
Consultant

msarqui schrieb:
Sorry Danny.
This will still select the objects that are outside the block editor.

You can not Filter objects outside the current Block(outside of BEDIT), NO!

So your problem isn´t exist, but why you are thinking it is existing? No idea why you think that.

Or I am wrong?

 

For the wanted selectionset it is need to define clear filter that present exactly what you want,

 but you are currently unable to technically handle this issue to describe completely and correctly
that makes it a bit difficult for the helpers;)

 

Inside the BEDIT, at this Moments you want to create a selectionset:

a) Objects on Layers that are OFF

b) Objects on Layers that are FREEZE

c) Objects which are not visible (not Layervisibility)

and

d) Objects which are not visible because the current visibleState is hideing the object.

d) how to handle nested Objects (if there is a nested Block inside our current)

 

The d) is to much for this Thread.

 

The answer for [ c) hidden.. ] visible Objects is DXF60=0 (= visible), so attach this as filter to your ssget filterlist  (60 . 0)


( and once again I allow myself to say at the point: I can not imagine that this "INSIDE BEDIT" thing is a really good way, but we still do not know the actual data and tasks )

 

 

Sebastian

0 Likes
Message 6 of 12

cadffm
Consultant
Consultant

(60 . 0) = VISIBLY can only work if you set BVMODE to 0, because by Value 1 all Objecs are "visible" 😉

Sebastian

Message 7 of 12

msarqui
Collaborator
Collaborator

Sebastian,

 

My goal was to filter visible objects inside BEDIT.

 

I dug I little bit and I finally found the answer.

 

(setq sel (ssget "_X" '(
 (-4 . "<OR")
  (-4 . "<AND") (0 . "WIPEOUT") (67 . 0) (60 . 0) (-4 . "AND>")
  (-4 . "<AND") (0 . "INSERT") (67 . 0) (60 . 0) (-4 . "AND>")
  (-4 . "<AND") (0 . "HATCH") (2 . "ANSI31") (62 . 2) (67 . 0) (60 . 0) (-4 . "AND>")
 (-4 . "OR>")
)))

67 code will filter current space. And you show me 60 code to filter visible elements.

Now its working perfect for me.

Thanks for your help.

0 Likes
Message 8 of 12

cadffm
Consultant
Consultant
You should write more exactly, only the phras "visible objects" are hard to understand if we have
Layer off/on
Layer thaw/freeze
And objectd which temporary invisible by command are possible too, if you use in the active Bedit-session.

It is like to google for the keyword "help" , good results impossible.

DXF 67 is only a flag, Modeltab current or not?
Current Layout/space is DXF 410

But why? Please answer my question why you think you can select objects outside BEDIT and now "outside current space".
Which Version you are using (command _vernum)?
PLEASE show me an example that I can understand your posts about "outside BEDIT" and "current spaces" (dwg&screenshot/screencast).

If objects on off and freezed Layers are ok for you and you think about BVMODE=0

(setq sel (ssget "_X" (list '(60 . 0)'(-4 . "<OR") '(0 . "WIPEOUT,INSERT") '(-4 . "<AND") '(0 . "HATCH") '(2 . "ANSI31") '(62 . 2)'(-4 . "AND>")  '(-4 . "OR>") )))

Sebastian

0 Likes
Message 9 of 12

cadffm
Consultant
Consultant
Accepted solution


You do not need to answer, I finally discovered/understand it.

Just to make it easier for some readers as for me:

Within BEDIT, ssget A and X..ignores normal modelspace-objects*, but notic objects in paperspace (Layouts) !
If you want to select all Objects inside the BEdit you can set the SSGET filter to modelspace (67.0)


*if you edit the hole modelspace as block, all modelspace objects are inside the bedit, but if you edit a (real)
internal Blockdefinition the Block is temporary your modelspace and all usual modelspace objects are "away".

(setq sel (ssget "_X" '((60 . 0)(67 . 0) ; Visible-Flag and filter only (current) modelspace objects
                        (-4 . "<OR")
                              (0 . "WIPEOUT,INSERT")
                              (-4 . "<AND") (0 . "HATCH") (2 . "ANSI31") (62 . 2) (-4 . "AND>")
                        (-4 . "OR>")
                       )
)         )




Please excuse my confusion and I'm happy to have learned something again.

Sebastian

Message 10 of 12

DannyNL
Advisor
Advisor

Good to know, thanks!

I didn't check (SSGET "_A" ....) with paperspace objects but only modelspace objects. So learned something new as well Smiley Happy

0 Likes
Message 11 of 12

cadffm
Consultant
Consultant

DannyNL schrieb:

I didn't check (SSGET "_A" ....) with paperspace objects but only modelspace objects.


This was not clear to me, but there had to be a reason why msarqui (in my view) got mixed up.
Then I tested at some point as it is with the paperspace.
So: The BEdit environment is temporarily a modelspace, but the paper area exists in the moment "as usual"

Me too, and statements like "67 code will filter current space." had confused me additional.
Because 67=0 isn't filter the current Space, it filter the modelspace.
(But inside the BEdit you are alltime "in modelspace", so 67=0 is the current space if Blockeditor=1)

Thanks to msarqui for this discussion, not only did you have some of it, Kudos4u
Usually you do not work with Lisp inside the blockeditor (very special thing),
but for people who work with scripts (*. scr) this could also be of interest if you use the objectselection method ALL.

 

Sebastian

0 Likes
Message 12 of 12

msarqui
Collaborator
Collaborator

This is better yet than mine.
Thanks Sebatian!

0 Likes