How to make attributes the same height no matter the block scale.

How to make attributes the same height no matter the block scale.

john.uhden
Mentor Mentor
762 Views
12 Replies
Message 1 of 13

How to make attributes the same height no matter the block scale.

john.uhden
Mentor
Mentor

My apologies.  I had posted this in response to a topic that had already been solved, so no one was looking at it.

 

I have many insertions of the same block, with one attribute, inserted at different scales.

Is there a way to keep all the attributes at the same height, but annotative as well, because I will have differently scaled viewports?

It sounds like I should Burst the attributes to annotative text.

John F. Uhden

0 Likes
763 Views
12 Replies
Replies (12)
Message 2 of 13

dbroad
Mentor
Mentor

It's usually better to avoid burst.  Can't use dataextraction after that. Post a sample drawing.  For annotative blocks (presuming that that is the reason for the different scales), the blocks should all be the same scale and the various annotation scales should be added as needed.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 13

john.uhden
Mentor
Mentor

@dbroad 

Well, I've now experienced why to avoid BURST.

My problem is that the blocks are various 2D tree symbols, each scaled according to its caliper, and since the attributes are children of their parents, e.g. 20" Pine, they get sized according to their parents, which I guess is akin to Darwin's Origin of the Species.  You're not supposed to have Hulk Hogan fathering Danny DeVito, or Danny DeVito fathering Manute Bol.

John F. Uhden

0 Likes
Message 4 of 13

dbroad
Mentor
Mentor

Whomever built the blocks made a major error by relying on scaling while putting attributes in the block.  The blocks should be rebuilt in one of several ways:

1.  without attributes

2.  with invisible attributes for data tracking or

3.  As dynamic blocks either with or without that rely on dynamic block properties for scaling while keeping the attributes in a reasonable location without scaling.

 

Since the blocks represent model elements with actual sizes, the blocks should've been tagged instead of having integrated labels.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 5 of 13

john.uhden
Mentor
Mentor

@Anonymous 

That's "whoever" not "whomever."

What do you mean by "tagged?"

Anyway, my "BUST" routine is almost done and it works.

John F. Uhden

0 Likes
Message 6 of 13

pendean
Community Legend
Community Legend

@john.uhden wrote:

Anyway, my "BUST" routine is almost done and it works.


Can you share?

0 Likes
Message 7 of 13

dbroad
Mentor
Mentor

Thanks for correcting my grammar.  A tag block should be annotative and should identify the model geometry block.  In AutoCAD, this translates to inserting label blocks or using block content leaders.  Model geometry intended for scaling shouldn't include attributes.  >>Copy Attribute Values Demo<< 

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 8 of 13

john.uhden
Mentor
Mentor

@pendean 

Yes, I will be sharing after sufficient vetting.

John F. Uhden

0 Likes
Message 9 of 13

TomBeauford
Advisor
Advisor
To create an annotative attribute definition
  1. Click Blocks & References tab → Attributes panel → Define Attributes
  2. In the Attribute Definition dialog box, set the Attribute Modes and enter Tag information, Insertion Point and Text Settings.
  3. Under Text Settings, select Annotative.
  4. Click OK.
  5. Specify the start point.
  6. Press ENTER.
 
64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes
Message 10 of 13

john.uhden
Mentor
Mentor

@pendean  et al,

Here ya go for now.

I haven't added the text sizing because I want to learn how to programmatically add annotativity (?) first.

(defun c:BUST ( / *error* cmd ITEM ATT-TEXT e ent i n bname ctab Blayer Anno)
   ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   ;*                                                           *
   ;*  BUST.LSP   by   John F. Uhden                            *
   ;*                  2 Village Road                           *
   ;*                  Sea Girt, NJ  08750                      *
   ;*                                                           *
   ;* * * * * * * *  Do not delete this heading!  * * * * * * * *

   ; Program improves on Autodesk's BURST command.
   ; v1.0 (11-11-2022)
   ; I have not yet found a way to programmatically make text annotative,
   ; So that portion has been remmed out.
   
   (gc)
   (prompt "\nBUST v1.0 (c)2022, John F. Uhden")

   (defun *error* (err)
      (setvar "cmdecho" cmd)
      (vla-endundomark Doc)
      (cond
         ((not err))
         ((wcmatch (strcase err) "*CANCEL*,*QUIT*")
            (vl-exit-with-error "\r                                              ")
         )
         (1 (vl-exit-with-error (strcat "\r*ERROR*: " err)))
      )
      (princ)
   )
   ;;-------------------------------------------
   ;; Initialize drawing and program variables:
   ;;
   (setq Doc (vlax-get (vlax-get-acad-object) 'Activedocument)
         cmd (getvar "cmdecho")
   )
   (vla-endundomark Doc)
   (vla-startundomark Doc)
   (setvar "cmdecho" 0)
   (command "_.expert" (getvar "expert")) ;; dummy command

;;;    Taken from BURST.lsp
;;;    Copyright c 1999-2006 by Autodesk, Inc.

   ;-----------------------------------------------------
   ; Item from association list
   ;-----------------------------------------------------
   (Defun ITEM (N E) (CDR (Assoc N E)))
   ;-----------------------------------------------------
   ; Error Handler (this is my own)
   ;-----------------------------------------------------
   ;-----------------------------------------------------
   ; Convert Attribute Entity to Text Entity or MText Entity
   ; Uhden added layer checking because most times attribute
   ; definitions are on layer 0 since layer 0 acts like a chameleon
   ; and the attributes inherit their color from their parents.
   ; I don't want the text on layer 0.
   ;-----------------------------------------------------
 
   (Defun ATT-TEXT (AENT / ANAME TENT ILIST INUM layer)
      (setq ANAME (cdr (assoc -1 AENT)))
      ;(if (_MATTS_UTIL ANAME)
      ;   (progn
      ;      ; Multiple Line Text Attributes (MATTS) -
      ;      ; make an MTEXT entity from the MATTS data
      ;      (_MATTS_UTIL ANAME 1)
      ;   )
         (progn
            ; else -Single line attribute conversion
            (Setq TENT '((0 . "TEXT")))
            (setq layer (cdr (assoc 8 AENT)))
            (ForEach INUM '(8
                            6
                            38
                            39
                            62
                            67
                            210
                            10
                            40
                            1
                            50
                            41
                            51
                            7
                            71
                            72
                            73
                            11
                            74
                           )
               (if (and (= INUM 8)(= (cdr (assoc 8 AENT)) "0"))
                 (setq ILIST (cons 8 Blayer) TENT (cons ILIST TENT))
                 (If (Setq ILIST (Assoc INUM AENT))
                   (Setq TENT (Cons ILIST TENT))
                 )
               )
            )
            (Setq
               tent (Subst
                       (Cons 73 (item 74 aent))
                       (Assoc 74 tent)
                       tent
                    )
            )
            (if (= Anno "Yes")
              (setq TENT
                (cons
                  '(-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}")))  
                   TENT
                )
              )
            )
            (EntMakeX (Reverse TENT))
         )
    ; ) if
   )
   ;; Uhden work:
  ; (initget "Yes No")
  ; (if (not (setq Anno (getkword "\nMake annotative? <Yes>/No: ")))
  ;   (setq Anno "Yes")
  ; )
   (and
     (setq e (car (entsel "\nSelect block to get name to bust: ")))
     (setq ent (entget e))
     (or
       (= (cdr (assoc 0 ent)) "INSERT")
       (prompt "\n  Object selected is not a block insertion.")
     )
     (setq bname (cdr (assoc 2 ent)))
     (setq ctab (getvar "ctab"))
     (setq ss (ssget "X" (list '(0 . "INSERT")(cons 2 bname)(cons 410 ctab)'(66 . 1))))
     (setq n (sslength ss) i 1 m 0)
     (princ "\n")
     (repeat n
       (princ (strcat "\rProcessing " (itoa i) " of " (itoa n) " insertions."))(princ)
       (setq e (ssname ss (1- i)))
       (setq Blayer (cdr (assoc 8 (entget e))))
       (while (and e (= (cdr (assoc 0 (entget (setq e (entnext e))))) "ATTRIB"))
         (ATT-TEXT (entget e))
         (vla-delete (vlax-ename->vla-object e))
         (setq m (1+ m))
       )
       (setq i (1+ i))
     )
     (princ (strcat "\nBusted out " (itoa m) " attributes."))
   ) ; and
   (*error* nil)
)

John F. Uhden

0 Likes
Message 11 of 13

dbroad
Mentor
Mentor

Seems to work very well. Other solution other than deleting the attribute references would be to replace their text strings with empty strings,  mark them as invisible, or put them on a non-plotting layer.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 12 of 13

john.uhden
Mentor
Mentor

@dbroad 

Those are good ideas, Doug, but I think I want to disable the attributes altogether lest someone double-clicks on an insertion and is then confused by what's going on.  For now this is just my project.  I will add the uniform height and annotative stuff manually just using the properties palette (or whatever it's called).

It's a beautiful 5 acre residential site on the Shrewsbury River in Rumson, NJ.  We'll be doing a plot plan and waterfront permit plan for some kind of expensive add-on.  Sometimes I get to have some fun, though I miss doing 1.1M SF office parks and shopping centers and 300 unit single-family developments as "when I wore a younger man's clothes."  I'm lucky to have a job at all.

John F. Uhden

Message 13 of 13

dbroad
Mentor
Mentor

One way to convert to annotative is to add the xdata to the object that marks the object as annotative 

(-3 ("AcadAnnotative"
(1000 . "AnnotativeData")
(1002 . "{")
(1070 . 1)
(1070 . 1)
(1002 . "}")
)
)

and then to call  _AIOBJECTSCALEADD and select that object.  Of course you could also just manipulate the annotative scale dictionary to add the annotation scale to that object.   You would also need the logic to change the text height to paper size. BTW, just adding the xdata to the text will make the text disappear.

Architect, Registered NC, VA, SC, & GA.
0 Likes