Yes, it is possible to rename an annonymous block from *U17 to MTM_17 (for
example). But when you list the available blocks in a drawing using commands
like BLOCK or INSERT, MTM_17 will not be listed as it is an annonymous block
(but it exists). Just by changing an annonymous block's name will not make
it a named block. The group code 70 decides if this block is annonymous or
not, and this group code cannot be edited.
For example, create an annonymous block "*T" using any_blk function and then
execute the ren_blk function to rename it to "TESTBLOCK"
(defun c:any_blk ()
(vl-load-com)
(setq a_app (VLAX-GET-ACAD-OBJECT)
a_doc (vla-get-ActiveDocument a_app)
a_blks (vla-get-blocks a_doc)
blk (vla-add a_blks (vlax-3d-point '(0 0 0)) "*T")
)
(vla-addcircle blk (vlax-3d-point '(0 0 0)) 3)
)
(defun c:ren_blk ()
(vl-load-com)
(setq a_app (VLAX-GET-ACAD-OBJECT)
a_doc (vla-get-ActiveDocument a_app)
a_blks (vla-get-blocks a_doc)
blk (vla-item a_blks "*T1")
)
(vla-put-name blk "TESTBLOCK")
)
Now invoke command INSERT and you will find that TESTBLOCK is not listed,
but you are allowed to type the blockname and then to insert it.
The block TESTBLOCK is not listed as it is an annonymous block.
As a workaround, I would suggest you to make a copy of the annonymous block
instead of renaming it, as shown in the following sample code:
(defun c:cop_blk ()
(vl-load-com)
(setq a_app (VLAX-GET-ACAD-OBJECT)
a_doc (vla-get-ActiveDocument a_app)
a_blks (vla-get-blocks a_doc)
i 0
blk (vla-item a_blks "*T1")
inspt (vla-get-origin blk)
cnt (- (vla-get-count blk) 1)
newfil (vlax-make-safearray vlax-vbobject (cons 0 cnt))
)
(vlax-for ent blk
(vlax-safearray-put-element newfil i ent)
(setq i (1+ i))
)
(setq newblk (vla-add a_blks inspt "TESTBLOCK"))
(vla-copyobjects a_doc newfil newblk nil)
)
--
Madhanagopal
AutoCAD & MCAD Product Support, INDIA
WW Support & Services, Autodesk
Discussion Q&A: http://www.autodesk.com/discussion
"Juan Carlos Velez" wrote in message
news:f053069.-1@WebX.maYIadrTaRb...
> I have any blocks *u318 how I renme those blokcs
>
>