Author Topic: Seeing info of selection sets  (Read 6197 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Seeing info of selection sets
« on: February 19, 2010, 01:18:59 PM »
Alright, this is a stupid question but for the life of me I can't remember how to view the info after making a selection set.
So I have the following code:

Code: [Select]
(setq dwgblocks (ssget "X" '((2 . "*"))))
because I'm simply trying to select all the blocks in a drawing so I can explode them all.

But I know this is selecting everything including the stuff in paperspace, and I only want the stuff in modelspace.
So, first off, how can I view this information from the selection set ??
Secondly, does anyone have an idea for how I can select just the blocks in modelspace ??

Thanks in advance.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Seeing info of selection sets
« Reply #1 on: February 19, 2010, 01:27:09 PM »
ssnamex will list the selection set properties.  Read help for all the information.

To get certain entities, use there dxf codes.  For blocks, inserts, use dxf code 0 and insert.

To get items in a certain tab, use code 410 and that spaces name.

Hope that helps.

ps... code 2 gets names of entities, that have names.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Seeing info of selection sets
« Reply #2 on: February 19, 2010, 01:56:49 PM »
There is a lot of information here on
Explode Blocks
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seeing info of selection sets
« Reply #3 on: February 19, 2010, 04:29:39 PM »
...
ps... code 2 gets names of entities, that have names.
T,
I was to the understanding I could use ... '((2 . "*")) to get blocks and just use the wildcard to select all the blocks in the drawing.  I know it made a selection set for me, but I couldn't for the life of me figure out how to read it.  :D
But if this is not the case, how would you suggest selecting all the blocks in a drawing in model space only to be exploded ??
I'm converting a boat load of drawings from Microstation to CAD so I need to change ALL the attributes, text styles, colors, layers, etc.   We're spending hours on something that should take a mere minutes.
By the way T, it's good to see you again, I've been out of the loop for the past year.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Seeing info of selection sets
« Reply #4 on: February 19, 2010, 04:32:28 PM »
Select All Blocks (Inserts):

Code: [Select]
(ssget "_X" '((0 . "INSERT")))

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seeing info of selection sets
« Reply #5 on: February 19, 2010, 05:08:26 PM »
Select All Blocks (Inserts):

Code: [Select]
(ssget "_X" '((0 . "INSERT")))
OK, it selects some objects, I still do not know what it is putting in the selection set though.
When I run the command to explode the blocks, I get the following error:
Quote
Command: (command ".explode" blocks "")
.explode
Select object:
The object is not in current space.

The object is not in current space.

The object is not in current space.

The object is not in current space.

The object is not in current space.

The object is not in current space.

The object is not in current space.

The object is not in current space.

The object is not in current space.

The object is not in current space.
Now, I have one block in Paper space (a title block), the rest are in model space.  These in model space are the ones I want to explode.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Seeing info of selection sets
« Reply #6 on: February 19, 2010, 05:33:05 PM »
Current Layout:

Code: [Select]
(ssget "_X" (list (cons 0 "INSERT")
                  (cons 410 (getvar 'CTAB))))

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Seeing info of selection sets
« Reply #7 on: February 19, 2010, 05:45:59 PM »
How are you defining 'blocks
in this  (command ".explode" blocks "")



See if this helps ;
Code: [Select]
(setq SelectedBlocks(ssget "_X" '((0 . "INSERT") )))
(kdub:ss->entlist SelectedBlocks)


(setq SelectedBlocksInCurrentSpace (ssget "_X"
                                        (list (cons 0 "INSERT")
                                              (cons 410 (getvar 'CTAB))
                                        )
                                 )
)
(kdub:ss->entlist SelectedBlocksInCurrentSpace)

Code: [Select]
(foreach ent (kdub:ss->entlist SelectedBlocksInCurrentSpace)
         (command ".explode" ent )
)

Code: [Select]
(defun kdub:ss->entlist (ss / i returnval)
  (if (and ss (< 0 (sslength ss)))
    (progn (setq i 0)
           (repeat (sslength ss)
             (setq returnval (cons (ssname ss i) returnval)
                   i         (1+ i)
             )
           )
    )
  )
  (if returnval
    (reverse returnval)
    nil
  )
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seeing info of selection sets
« Reply #8 on: February 19, 2010, 05:59:15 PM »
Kerry,
my definition is simply:
Code: [Select]
(setq blocks (ssget "_X" '((0 . "INSERT"))))So, let me throw in the  (list (cons ...  )) and I'll let you know.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Seeing info of selection sets
« Reply #9 on: February 19, 2010, 06:58:55 PM »
There is no need to explode each entity by itself, so I would use the code Lee posted, and pass that selection set to the explode command, and then keep going until there is no blocks left.

Good to see you too Hangman.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Seeing info of selection sets
« Reply #10 on: February 19, 2010, 07:07:26 PM »
There is no need to explode each entity by itself, so I would use the code Lee posted, and pass that selection set to the explode command, and then keep going until there is no blocks left.

Good to see you too Hangman.

I couldn't get that to work Tim. Only exploded the first item in the selection set ... or that seemed to be the case.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Seeing info of selection sets
« Reply #11 on: February 19, 2010, 07:12:36 PM »
Set QAFLAGS to 1 perhaps?

< Note:- this should only be changed within the routine, and then reset when the routine completes >
« Last Edit: February 19, 2010, 08:14:34 PM by Lee Mac »

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seeing info of selection sets
« Reply #12 on: February 19, 2010, 07:15:36 PM »
There is no need to explode each entity by itself, so I would use the code Lee posted, and pass that selection set to the explode command, and then keep going until there is no blocks left.

Good to see you too Hangman.

I couldn't get that to work Tim. Only exploded the first item in the selection set ... or that seemed to be the case.

I couldn't get it to work either.  It asks for the name of the block to be exploded.  I'm assuming it's because the list is created but I'm not sure.
Question along these lines then:   Can I filter the selection to only blocks with text in them ??  And would that look something like this ??
Code: [Select]
(setq dwgblocks (ssget "_X" '((0 . "INSERT")(0 . "MText,Text")))) Thanks guys.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seeing info of selection sets
« Reply #13 on: February 19, 2010, 07:17:20 PM »
Set QAFLAGS to 1 perhaps?

What is QAFLAGS ??  I can't find it in the system variables or the in help file for that matter.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seeing info of selection sets
« Reply #14 on: February 19, 2010, 07:23:17 PM »
Well, whatever QAFLAGS is, it didn't do the trick.
I received a return value of:  0   Nothing exploded, no other prompt.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Seeing info of selection sets
« Reply #15 on: February 19, 2010, 07:28:06 PM »

QAFLAGS is undocumented. It's been in AutoCAD since R11.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Seeing info of selection sets
« Reply #16 on: February 19, 2010, 07:45:32 PM »
QAFLAGS normally affects whether selection sets can be exploded.  :-)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Seeing info of selection sets
« Reply #17 on: February 19, 2010, 08:53:11 PM »
Maybe:
Code: [Select]
(defun c:test (/ usrexplmode ent ss)
  (if (setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 410 (getvar 'CTAB)))))
    (progn
      (setq usrexplmode (getvar "explmode"))
      (setvar "explmode" 1)
      (mapcar '(lambda(x)(command "._explode" x)) (mapcar 'cadr (ssnamex ss)))
      (setvar "explmode" usrexplmode)
    )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Seeing info of selection sets
« Reply #18 on: February 19, 2010, 08:59:33 PM »
Another one to try.
Code: [Select]
(defun c:test (/ ss)
  (if (setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 410 (getvar 'CTAB)))))
    (progn
      (initcommandversion 2)
      (command "._explode" "P" "")
    )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Seeing info of selection sets
« Reply #19 on: February 19, 2010, 09:08:06 PM »
Last one:
Code: [Select]
(defun C:test (/ ss flag)
  (if (setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 410 (getvar 'CTAB)))))
    (progn
      (setq flag (getvar "qaflags"))
      (setvar "qaflags" 5)
      (command "explode" ss "")
      (setvar "qaflags" flag)
    )
  )
  (princ)
)

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

myloveflyer

  • Newt
  • Posts: 152
Re: Seeing info of selection sets
« Reply #20 on: February 19, 2010, 09:17:58 PM »
CAB,NICE
HAPPY NEW YEAR!
Never give up !

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Seeing info of selection sets
« Reply #21 on: February 19, 2010, 09:28:22 PM »

yep, that last one should do nicely Alan

Should ignore locked layers too, yes ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Seeing info of selection sets
« Reply #22 on: February 19, 2010, 10:04:36 PM »
Wow.  Learned something new.  I could have sworn that I used a selection set with the explode command before.  Guess I remembered wrong.  Good to know.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Seeing info of selection sets
« Reply #23 on: February 19, 2010, 11:13:39 PM »

yep, that last one should do nicely Alan

Should ignore locked layers too, yes ?


Thanks all,

It honered locked layers in ACAD2000.
I could not test the middle one because initcommandversion is not recognized in ACAD 2000.
No more time tonight..
ZZZZZZZZZZZZZZZzzzzzz........
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seeing info of selection sets
« Reply #24 on: February 21, 2010, 11:12:25 AM »
Thanks all,

It honered locked layers in ACAD2000.
I could not test the middle one because initcommandversion is not recognized in ACAD 2000.
No more time tonight..
ZZZZZZZZZZZZZZZzzzzzz........
I think the correct phrase would be something to the effect of:
Quote
No more time tonight..
LiZZZZPPLiZZZZPPLiZZZZZZZzzzzzzppp........
  :)
Nicely done.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~