Author Topic: delete invisible attributes help  (Read 7180 times)

0 Members and 1 Guest are viewing this topic.

Pad

  • Bull Frog
  • Posts: 342
Re: delete invisible attributes help
« Reply #15 on: December 23, 2010, 09:33:54 AM »
I've played around with this some more today.
The problem with attsync is that any attributes which have been repositioned during drafting are reset back to their original position.
The same thing happens with battman.

'Gatte' seems to be the best option, replacing the invisible attribute with a null value.

Code: [Select]
Enter block name: pt2

Known tag names for block: TYPE HEIGHT SPREAD GIRTH CODE NO LEVEL
Select attribute or type attribute name: code

Block: pt2   Attribute tag: CODE
Enter new text:

Number of inserts in drawing = 31  Process all of them? [Yes/No] <Yes>:

Please wait...
31 attributes changed.

Maybe the best way is to get a list of all the blocks with invisible attributes.  (setq BlocksInCtab (ssget "_X" (list (cons 0 "INSERT") (cons 66 1) (cons 410 (getvar 'CTAB))))) ?
Find out which attribute tag in the blocks are invisible and then parse all this info into the 'gatte' command.

P

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: delete invisible attributes help
« Reply #16 on: December 23, 2010, 09:37:01 AM »
Why use GATTE? With the code in this thread you already have the Attribute Objects, just feed them a null textstring.

As a modification of my original code:

Code: [Select]
(defun c:NIA nil (c:NullInvisibleAttributes))

(defun c:NullInvisibleAttributes ( / ss ) (vl-load-com)
  ;; Example by Lee Mac 2010 - www.lee-mac.com

  (if (ssget '((0 . "INSERT") (66 . 1)))
    (progn
      (vlax-for obj
        (setq ss
          (vla-get-ActiveSelectionSet
            (vla-get-ActiveDocument (vlax-get-acad-object))
          )
        )
        (mapcar
          (function
            (lambda ( attrib )
              (if (eq :vlax-true (vla-get-Invisible attrib))
                (vla-put-TextString attrib "")
              )
            )
          )
          (vlax-invoke obj 'GetAttributes)
        )
      )
      (vla-delete ss)
    )
  )
  (princ)
)

Pad

  • Bull Frog
  • Posts: 342
Re: delete invisible attributes help
« Reply #17 on: December 23, 2010, 09:56:12 AM »
ahh I see, perfect.
Cheers Lee!