- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Anonymous wrote:
....
1. Copied one of the anonymous blocks to 0,0,0
2. Exploded
3. Re-create the block with new name and basepoint of 0,0
... it does replace all of the selected anonymous blocks with the newly created block, but it puts them all exactly on top of one another.
....
[By the way, there's no need to move one to 0,0 and then use 0,0 as the insertion base point in defining a new Block. You can specify an insertion base point for a Block at any location [presumably a logical place in relation to the drawn elements], regardless of where it is in relation to the drawing origin.]
Since, as pointed out, those are not just differently-named versions of the same Block definition, but rather each has its insertion base point in a different relationship to its drawn content, and all have their insertion points at the same place, then yes, replacing them with BRS will put the new Blocks all at the same place.
Here's a way to do it, particular to your situation: Copy one of the Blocks somewhere, Explode it, and define it as a new Block [here with the name "TEST" but edit for whatever name suits you], with its insertion base point defined at the Mid-of-2 point between the extreme corners [i.e. in the middle of the extents of the pieces]. Then use this:
(defun C:TEST (/ ss n blk) ; edit command name
(setq ss (ssget '((0 . "INSERT") (2 . "`**")))); only anonymous Blocks
(repeat (setq n (sslength ss))
(setq blk (ssname ss (setq n (1- n))))
(vla-getboundingbox (vlax-ename->vla-object blk) 'minpt 'maxpt)
(command "_.insert" "test" "_none" ; EDIT name
(mapcar '/ ; find midpoint between corners of its bounding box
(mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt))
'(2 2 2)
); mapcar
"" "" ""
"_.erase" blk ""
); command
); repeat
); defun
(vl-load-com)
That's in simplest terms, without all the usual enhancements, but those can be added easily enough.
I tried it successfully in a limited area of your sample drawing.