Here is a handy routine that will let you quickly create a block of selected objects – it will even automatically name the block for you.
Here’s how:
- QB <enter> to start (Quick Block)
- Select the objects that you want the block to be made of <enter>
- Specify an Insertion point
- The routine will automatically give the block a generic name “MyBlock” followed by a number. Each time you use the routine to create a quick block, the number will increase incrementally (ex. MyBlock1, MyBlock2, MyBlock3…)
- Note – Use on blocks that do not have attributes – use on geometry only
~enjoy
; Quick Block ; Creates a block instantly out of the objects that you select ; Found at http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Quick-block/td-p/3454228 (defun c:QB (/ selectionset insertionpoint number Blockname) ;;; Tharwat 11. May. 2012 ;; (if (and (setq selectionset (ssget "_:L")) (setq insertionpoint (getpoint "\n Specify insertion point :")) ) (progn (setq number 1 Blockname (strcat "MyBlock" (itoa number)) ) (while (tblsearch "BLOCK" Blockname) (setq Blockname (strcat "MyBlock" (itoa (setq number (1+ number)))) ) ) (command "_.-Block" Blockname insertionpoint selectionset "") (command "_.-insert" Blockname insertionpoint "" "" "") ) (princ) ) (princ) )
Thanks!!
Very useful, I had to make 50 blocks and this saved my life ;-)
You may use a couple of commands to make it, such as ctrl+x after that ctrl+shift+v. I will get a new block
Unable to load in Autocad2014
i just tested it in both 2014 & 2015 and it is working. I think that the issue that you are experiencing is the new “SECURELOAD” feature.
Type SECURELOAD in the command line and hit enter. Then set it to 0 (zero)
Then you should be able to load these easily.
~Greg
That was it! thanks a lot Greg
Thanks for the great tip. I’m wondering how I would modify this to automatically get all the objects on the current layer, create the block using the current layer name with a 0,0,0 base point and then insert the block at its original position. Thanks in advance!
Thanks, it’s very help full. before i use this lisp, i got confused use CTRL+SHIFT+C then CTRL+SHIFT+V and cause of that my block got a random name. it’s hard to find if we have more than 20 block with a typical design.
Thanks for advice
Cherchez comment dire point d l’intersection de deux lignes dans AutoCAD LISP
hi i need this lisp which automatically sets insertion point to 0,0,0
i want to just select and enter and then have a random named block with just one clik
hi thanks for sharing what about if attributes are there.?
Hi there,
is it possible instead of autonaming the block, to select a mtext or txt for the block name? it would be very helpful…
thanks for the lisp
Hi,
Is it possible to get the name for the block from a mtext? That would be a perfecr lisp for me?
Thanks…
Really appreciate that
This is great!
I was having trouble with the block command because I was using a list of entities instead of a selection set.
Thanks Greg!!