Hi guys,
If I have BLOCKA on a layer (or specifically layer 0), how do you copy blockA onto every layers? I'm sure there are 5 ways of doing this. Thanks in advance! 🙂
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@kameron1967 wrote:Hi guys,
If I have BLOCKA on a layer (or specifically layer 0), how do you copy blockA onto every layers? I'm sure there are 5 ways of doing this. Thanks in advance! 🙂
And what of the location? on the same spot? one on top of the other?
Sample
(defun c:CB2Layer ( / blk clay e lay a) (if (setq blk (ssget "_:S:E:L" '((0 . "INSERT")))) (progn (setq clay (cdr (assoc 8 (entget (setq e (ssname blk 0))))) e (vlax-ename->vla-object e) ) (while (setq a (tblnext "Layer" (null a))) (if (not (member (setq lay (Cdr (assoc 2 a))) (list clay "Defpoints")));<-- exclusion list (vla-put-layer (vla-copy e) lay) ) ) )(princ "\nNo Block selected:") )(princ) ) (vl-load-com)
I tested it and it worked, pbejse! I found a way to specify the block name, without it asking, so thanks again. Your expertise is much appreciated! 🙂
@kameron1967 wrote:I tested it and it worked, pbejse!
Glad you it sorted, Happy to help.
Cheers kameron1967
@kameron1967 wrote:
Pbejse – if I wanted to explode these blocks and have the broken entities reside on whatever layer(s) they’ve been copied to, how do I do that?
Yes, it can be done. But what of the block? is there no need to keep the "copied" block?
@kameron1967 wrote:
The block will simply be exploded and only the remaining content is kept on their respective layers. Assume that the entire content in that block is on layer 0. Once it's copied to other layers, it will simply be bursted versus exploded, so that the contents within those copied blocks remain on their respective layers. Hope that makes sense. Thanks again, Pbejse. 🙂
I see, for a while there, i thought the reason for the burst is because the block has attributes. if thats not the case we can make do without using burst. or is there attributes on some of your blocks? i remember you are targeting a specific block correct?
@kameron1967 wrote:
There are no attributes on this block. It is, however, a 3D solid object which has been put into BLOCKX.DWG. Not sure if that would affect your routine or not..
Try this
(defun c:CB2LayerX (/ blk clay e lay a ExColl) (if (setq blk (ssget "_:S:E:L" '((0 . "INSERT")))) (progn (setq clay (cdr (assoc 8 (entget (setq e (ssname blk 0))))) e (vlax-ename->vla-object e) ) (while (setq a (tblnext "Layer" (null a))) (if (not (member (setq lay (Cdr (assoc 2 a))) (list clay "Defpoints")));<-- exclusion list (progn (setq ExColl (vlax-invoke e 'Explode)) (mapcar '(lambda (j) (Vla-put-layer j lay)) ExColl)) ) ) ) (princ "\nNo Block selected:") ) (princ) ) (vl-load-com)
command: CB2LAYERX
@kameron1967 wrote:
You've got it, Pbejse! That worked without any glitches. Thanks for the awesome support - you rock! 🙂
Excellent,
Glad to be of service 🙂