Author Topic: change nested block colour  (Read 3089 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
change nested block colour
« on: May 23, 2005, 12:13:42 PM »
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.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

daron

  • Guest
change nested block colour
« Reply #1 on: May 23, 2005, 12:19:09 PM »
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

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Edited
« Reply #2 on: May 23, 2005, 01:23:18 PM »
May this one helps (doesn't work with attributes in Xrefs):
Code: [Select]
(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)
   )
  )
 )
)
Cheers
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18