jpaulsen
2008-11-10, 06:33 PM
I work with LDT and LDT inserts a block named ACADD_ZZ in paper space to keep track of which project the drawing is associated with. Sometimes that block ends up on a locked layer which causes LDT to display errors.
My goal is to change the ADCADD_ZZ block to layer 0.
I just spent the last 1.5 hours reading the Help and forums and haven't gotten very far. I'm taking baby steps but this is what I have:
(defun c:test ()
; (setq ss1 (ssget "x" '((2 . "addcad_zz"))))
; (setq en (ssname ss1 0))
(setq en (entnext))
(setq ed (entget en)) ; Sets ed to the entity data for entity name en.
(setq ed
(subst (cons 8 "0")
(assoc 8 ed) ; Changes the layer group in ed.
ed ; to layer 0.
)
)
(entmod ed) ; Modifies entity en's layer in the drawing.
)
I got this directly from the help. It works but only on the first object in the drawing (entnext). I tried adding lines 2 and 3 and commenting line 4 but that doesn't work. I get the following error:
; error: bad argument type: lselsetp nil
How do I select the ADCADD_ZZ block and change it's layer?
Will it be possible to change the layer of the block while the block is on a locked layer or will I need to unlock the layer first?
If I need to unlock the layer how do I retrieve the layer the block is on?
The last road block I see is not knowing which layout the block was inserted on.
Will I be able to change the block's layer if the layout that contains the block is not current?
If not, how do I figure out which layout contains the block?
Thanks for any help.
My goal is to change the ADCADD_ZZ block to layer 0.
I just spent the last 1.5 hours reading the Help and forums and haven't gotten very far. I'm taking baby steps but this is what I have:
(defun c:test ()
; (setq ss1 (ssget "x" '((2 . "addcad_zz"))))
; (setq en (ssname ss1 0))
(setq en (entnext))
(setq ed (entget en)) ; Sets ed to the entity data for entity name en.
(setq ed
(subst (cons 8 "0")
(assoc 8 ed) ; Changes the layer group in ed.
ed ; to layer 0.
)
)
(entmod ed) ; Modifies entity en's layer in the drawing.
)
I got this directly from the help. It works but only on the first object in the drawing (entnext). I tried adding lines 2 and 3 and commenting line 4 but that doesn't work. I get the following error:
; error: bad argument type: lselsetp nil
How do I select the ADCADD_ZZ block and change it's layer?
Will it be possible to change the layer of the block while the block is on a locked layer or will I need to unlock the layer first?
If I need to unlock the layer how do I retrieve the layer the block is on?
The last road block I see is not knowing which layout the block was inserted on.
Will I be able to change the block's layer if the layout that contains the block is not current?
If not, how do I figure out which layout contains the block?
Thanks for any help.