Author Topic: Attribute lisp Request?  (Read 2449 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
Attribute lisp Request?
« on: January 19, 2006, 12:02:10 PM »
Does anyone have a lisp that will move the attributes of all blocks onto the same layer that the block is inserted?

I making DWF copies of drawings and the attibutes are all showing on layer 0 as well as the layers the blocks are inserted on.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Attribute lisp Request?
« Reply #1 on: January 19, 2006, 12:30:35 PM »
Not tested:
Code: [Select]
(defun C:ChgAttLays ( / AcaDoc AttLst CurEnt CurLay CurObj CurSet FltLst)
 (vl-load-com)
 (setq FltLst '((0 . "INSERT") (66 . 1))
       AcaDoc (vla-get-ActiveDocument (vlax-get-acad-object))
 )
 (vla-StartUndoMark AcaDoc)
 (princ "\nSelect blocks or <all>...")
 (if (setq CurSet (cond ((ssget FltLst)) ((ssget "_X" FltLst))))
  (while (setq CurEnt (ssname CurSet 0))
   (setq CurObj (vlax-ename->vla-object CurEnt)
         CurLay (vla-get-Layer CurObj)
         AttLst (append
                 (vlax-invoke CurObj 'GetAttributes)
                 (vlax-invoke CurObj 'GetConstantAttributes)
                )
   )
   (foreach memb AttLst (vla-put-Layer memb CurLay))
   (vla-Update CurObj)
   (ssdel CurEnt CurSet)
  )
 )
 (vla-EndUndoMark AcaDoc)
 (princ)
)
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

hudster

  • Gator
  • Posts: 2848
Re: Attribute lisp Request?
« Reply #2 on: January 20, 2006, 04:18:28 AM »
Brilliant.

Cheers mate.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Attribute lisp Request?
« Reply #3 on: January 20, 2006, 07:12:09 AM »
Glad to help you... :-)
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18