PDA

View Full Version : block selection


rstiles
2008-02-21, 05:54 PM
how would you select a specific block by name in the begining of a command?

i tried using "Filter" and i cant get it right.

rkmcswain
2008-02-21, 07:50 PM
Not sure what you want, but here is a shot....


;;; Select the block named "GGG" from the block table:
(tblsearch "BLOCK" "GGG")

;;; Select all the blocks named "GGG" from the drawing
(ssget "_X" '((0 . "INSERT")(2 . "GGG")))

;;; Prompt the user to make a selection, but only include blocks named "GGG"
(ssget '((0 . "INSERT")(2 . "GGG")))

.T.
2008-02-21, 07:54 PM
how would you select a specific block by name in the begining of a command?

i tried using "Filter" and i cant get it right.

ssget is one way:

(ssget '((0 . "INSERT")(2 . "block name here")))

;Lets the user select but only selects blocks with that name

(ssget "x" '((0 . "INSERT")(2 . "block name here")))

;Selects all blocks with that name

There are a lot more ways to filter with ssget. Have a look in the Developer's Guide.

abdulhuck
2008-02-26, 02:56 PM
how would you select a specific block by name in the begining of a command?

i tried using "Filter" and i cant get it right.

Hi,

If I need to use Lisp, then "ssget" function is the answer, as explained in earlier posts. If you just want to issue a command (erase/copy/move etc) on selected blocks, then "Qselect" or "Filter" commands are handy. I have attached a snapshot of filter dialog sequence. I will briefly explain the steps:


Command: move
Select objects: 'filter


1. Choose block name from the list.
2. Click on the select button and choose the block name you want.
3. Click add to list button.
4. Click apply.


Applying filter to selection.
>>Select objects: all 1 found
>>Select objects: <enter>
Exiting filtered selection.
Resuming MOVE command.
Select objects: 1 found
Select objects: <enter>
Specify base point or displacement: 0,0
Specify second point of displacement or <use first point as displacement>: 0,841


As you posted in Lisp forum, here is a quick command if you would prefer to type the block name on command prompt.


(defun c:SBL (/ blkName selSet ans)
(setq blkName (getstring "\nEnter block name to select: "))
(initget "Yes No")
(setq ans (getkword "\nDo you want to select all the blocks in the dwg? [Yes/No]<Yes>: "))
(if (/= ans "No")
(setq selSet (ssget "_x" (list (cons 0 "INSERT")(cons 2 blkName))))
(setq selSet (ssget (list (cons 0 "INSERT")(cons 2 blkName))))
)
selSet
)


You can use SBL as a transparent command for any select object prompt.

Regards
AH