Message 1 of 11
Select Block by name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to create a command where I can select a block by name. Now I have seen where lisps where I run the command and have to type in the block name. I want the command and select it without user input.
This will be a small part of a larger lisp. The end goal for me is to create a lisp that updates the client existing border to their new one.
Here is one I found that I have to type in the block name:
(defun c:fbx ( / blockname sset); filter all blocks of same name with one click
(SETVAR "CMDECHO" 1)
(while
(not
(tblsearch "block"
(setq blockname
(getstring t "\nEnter Block Name: ")
)
)
)
(prompt "\nNo such Block name defined in this drawing. Try again:")
); while
(if
(setq sset
(ssget "x"
(list
(cons 2 blockname)
)
)
)
(progn ; then
(sssetfirst sset sset)
(princ
(strcat "\nSelected "
(itoa
(sslength sset)
) " instances of block \"" blockname "\"."
)
)
); progn
(prompt "\nNo insertions of that Block in this drawing."); else
); if
(SETVAR "CMDECHO" 1)
(princ)
)
I Have Shortened it to this:
(defun c:fbx ( / blockname sset); filter all blocks of same name with one click
(SETVAR "CMDECHO" 1)
(tblsearch "block"
(setq blockname
(getstring t "\nEnter Block Name: ")
)
)
(SETVAR "CMDECHO" 1)
(princ)
)
adding the block name to select the block is where I'm having trouble. I'm still at novice. Any explanation will help
Best