Is there a LISP solution for changing all block atts to be non-annotative?

Is there a LISP solution for changing all block atts to be non-annotative?

matthew_neesley
Collaborator Collaborator
2,646 Views
19 Replies
Message 1 of 20

Is there a LISP solution for changing all block atts to be non-annotative?

matthew_neesley
Collaborator
Collaborator

My company uses Factory Design Utilities; unfortunately, all the blocks that are produced in ACAD from Inventor come with attributes that are Annotative by default.  Is there a way through LISP to globally change them to non-Annotative?  I'm not talking about any drawn block geometry, I need the attributes inside to be plain, NON-annotative.  To further complicate things, AutoDesk did something VERY foolish and changed the format of the attributes so they can't be edited with tools lite BATTMAN or ATTSYC.....see the attached images.  

 

This is REALLY causing my company continuing difficulty so I really need all the block attributes to be NON-Annotative.  Thanks for any replies!  

0 Likes
Accepted solutions (1)
2,647 Views
19 Replies
Replies (19)
Message 2 of 20

dlanorh
Advisor
Advisor

It looks like the attributes may have been added to the block references after the block has been defined.

Can you post a drawing containing one of the blocks (AutoCAD2010 format).

 

Another thought, is the attribute text style annotative, and if it is what happens if you make the text style non -annotative?

I am not one of the robots you're looking for

0 Likes
Message 3 of 20

matthew_neesley
Collaborator
Collaborator

OMG I can't believe i didn't post an example drawing.  Duh.   Smiley Frustrated   See attached.  Some of these I've already manually gone in each one and unchecked "Annotative"...but this is a fairly small project.  We do conveyor layouts that span several football fields in size, so doing each block by hand is out of the question.

0 Likes
Message 4 of 20

matthew_neesley
Collaborator
Collaborator

Yes; I already tried making the base text style itself NON Annotative, but no dice, it doesn't reach inside the blocks and change all the imbedded attributes,

0 Likes
Message 5 of 20

ronjonp
Mentor
Mentor

Try this:

(defun c:foo (/ b s)
  ;; RJP » 2019-02-05
  (cond	((setq s (ssget "_X" '((0 . "insert") (66 . 1))))
	 (regapp "AcadAnnotative")
	 (foreach x (mapcar 'cadr (ssnamex s))
	   (while (and (setq x (entnext x)) (= "ATTRIB" (cdr (assoc 0 (setq b (entget x))))))
	     (entmod (append b
			     '((-3
				("AcadAnnotative"
				 (1000 . "AnnotativeData")
				 (1002 . "{")
				 (1070 . 1)
				 (1070 . 0)
				 (1002 . "}")
				)
			       )
			      )
		     )
	     )
	   )
	 )
	)
	(princ)
  )
  (princ)
)
0 Likes
Message 6 of 20

dlanorh
Advisor
Advisor
Accepted solution

Try this.

 

;;adaptation of HM Silva lisp https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/turn-on-off-annotative/m-p/3927678#M311500
(defun c:NAA (/ ed blk att)
  (setq ss (ssget '((0 . "INSERT") (66 . 1))))
  (repeat (setq cnt (sslength ss))
    (setq blk (ssname ss (setq cnt (1- cnt))))
    (setq att blk)
    (if (assoc 66 (entget blk))
      (while (= (cdr (assoc 0 (entget (setq att (entnext att))))) "ATTRIB")
        (setq ed (entget att '("AcadAnnotative")))
        (setq ed 
          (subst 
            (list -3
              (list "AcadAnnotative" '(1000 . "AnnotativeData") '(1002 . "{") '(1070 . 1) '(1070 . 0) '(1002 . "}"))
            )
            (assoc -3 ed)
            ed
          );end_subst
        );end_setq
        (entmod ed)
      );end_while
    );end_if
  );end_repeat  
  (princ)
);end_defun

Oops, beaten to it. Robot Sad Robot tongue

I am not one of the robots you're looking for

0 Likes
Message 7 of 20

matthew_neesley
Collaborator
Collaborator

Thanks very much, that seems to have done it!! Smiley Very Happy

0 Likes
Message 8 of 20

ronjonp
Mentor
Mentor

Did this NOT work?

 

0 Likes
Message 9 of 20

matthew_neesley
Collaborator
Collaborator

Ummm...I copied both programs into the VLIDE in ACAD.  I think yours just gave a blank result.  I will double-check tomorrow, but however it works out, I very much appreciate the response!

0 Likes
Message 10 of 20

dlanorh
Advisor
Advisor
It worked for me.

I am not one of the robots you're looking for

0 Likes
Message 11 of 20

ronjonp
Mentor
Mentor

Thanks for testing. It worked for me as well.

0 Likes
Message 12 of 20

matthew_neesley
Collaborator
Collaborator

Unfortunately there is another wrinkle.  Yes, it works perfectly on the file I posted.  But.....that file has attributes that are formatted in the "current" way, whereas the main problem I'm having at the moment deals with an older file, where the attributes are formatted differently.  

 

 

The infuriating this is that the code you both posted does indeed tick off the "Annotative" check box in the attribute editor for these older attributes...but SOME (of course) of the older attributes STILL MOVE when the Annotative scale is changed!!!!  ARRRRRRRGH!  So now I'm going through my older file and manually unchecking "Annotative" for every **** attribute in the file...several HUNDRED of them.  

0 Likes
Message 13 of 20

ronjonp
Mentor
Mentor

Post that file .. you should not be doing this manually :P.

0 Likes
Message 14 of 20

matthew_neesley
Collaborator
Collaborator

At this point I'm considering it to be penance for some unimagined sin I committed whenever ...but since you asked, here's the file I started with this morning.  Note all the attributes clustered near the origin.   ARRRGH 

0 Likes
Message 15 of 20

ronjonp
Mentor
Mentor

Hahaha 🙂 ... did the code do this to the attributes? Not sure what is going on?

0 Likes
Message 16 of 20

matthew_neesley
Collaborator
Collaborator

You like that?  Pretty cool, huh!  THAT's why I DO NOT WANT Annotative Attributes!

0 Likes
Message 17 of 20

ronjonp
Mentor
Mentor

So where are those blocks supposed to be? Have you tried a simple attsync on them?

0 Likes
Message 18 of 20

matthew_neesley
Collaborator
Collaborator

Yup tried the ATTSYNC several times...works on some, not on others.  BUT...the ATTSYNC will restore that blasted "Annotative" property to the attributes, and that's exactly what I'm trying to banish to the darkest corner of hell where it BELONGS.

0 Likes
Message 19 of 20

ronjonp
Mentor
Mentor

I used this code on your blocks near the origin

(defun c:mattsync (/ s)
  (if (setq s (ssget '((0 . "insert"))))
    (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
      (command "_.attsync" "name" (cdr (assoc 2 (entget x))))
    )
  )
  (princ)
)

Then the code posted above. There is a drawing attached to my previous post .. see if it's what you want.

0 Likes
Message 20 of 20

Anonymous
Not applicable

I have kind of the same issue. I have uploaded a sample file here in which I need to change all the annotative blocks to non-annotative. Is there any way to do this? None of the lisp routines above changed anything for me.

0 Likes