Code Red > AutoLISP (Vanilla / Visual)

change nested block colour

(1/1)

hudster:
Can anyone help me with this.

I'm trying to write a cleanup routine for use by non cad literate people.
I need a lisp routine that will change all all entities to colour 8 for use within xrefs, including nested blocks.

Does anyone have anything whivh will do this?

Cheers in advance for any help.

daron:
Look into nentsel. Also, you might try (car (nentsel)) and converting it to an object i.e. (vlax-ename->vla-object x) you won't have to decipher the dxf color. Just true color. Also, this topic seems more appropriate in the lisp forums, soooo....

Jürg Menzi:
May this one helps (doesn't work with attributes in Xrefs):
--- Code: ---(defun MeChgBlkEntCol ( / AcaDoc BlkCol)
 (setq AcaDoc (vla-get-activedocument (vlax-get-acad-object))
       BlkCol (vla-get-Blocks AcaDoc)
 )
 (vla-StartUndoMark AcaDoc)
 (vlax-for Obj BlkCol
  (if (= (vla-get-IsLayout Obj) :vlax-false)
   (MeChgCol Obj BlkCol)
  )
 )
 (vla-Regen AcaDoc acAllViewports)
 (vla-EndUndoMark AcaDoc)
 (princ)
)

(defun MeChgCol (Obj Bcl)
 (vlax-for Ent Obj
  (if (= (vla-get-ObjectName Ent) "AcDbBlockReference")
   (MeChgCol (vla-item Bcl (vla-get-Name Ent)) Bcl)
   (if (vlax-property-available-p Ent 'Color)
    (vla-put-Color Ent 8)
   )
  )
 )
)
--- End code ---
Cheers

Navigation

[0] Message Index

Go to full version