Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Create a Block with Attributes, where text covers block if exists given area.

dylanwagner1996
Observer

Create a Block with Attributes, where text covers block if exists given area.

dylanwagner1996
Observer
Observer

I want to create a block with text attributes inside, where if the attribute text is too long the text box will cover the block lines beneath. 

Is this possible? If so how is it done?

0 Me gusta
Responder
930 Vistas
8 Respuestas
Respuestas (8)

pendean
Community Legend
Community Legend
There is no "if" ability in blocks: the attribute text either covers everything below it all the time or not.
Are you by chance using multi-line attributes, or single?

Can you post your block too so we can see what you are working with, and post a screenshot of the effect you wish to create (or avoid)?

0 Me gusta

dylanwagner1996
Observer
Observer

This would be the block I would like to work with. Depending on if the tag number on the bottom is shorter or longer, it would be nice to not have to explode it each time to trim the box around the text

Screen Shot 2019-05-31 at 3.14.28 PM.png

0 Me gusta

RobDraw
Mentor
Mentor

Make the attribute multi-line and add a background mask.

 

IMHO, the linework should be sized to accommodate the longest the attribute value could be. I don't like seeing the symbol broken.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
0 Me gusta

leeminardi
Mentor
Mentor

You could create a dynamic block with a wipeout object that is in front of the geometry but in back of the attribute text.  Use wipeoutframe to turn off the lines of the wipeout frame. The wipeout frame would normally be within the bounds of the block geometry but if you had a long text string you could stretch the wipeout frame to see the text clearly and hide the geometry it overlaps.

lee.minardi
0 Me gusta

Moshe-A
Mentor
Mentor

@dylanwagner1996  hi,

 

here is a lisp command to condense an attribute by setting it to fit justify.

wrap this in a lisp file than load it and run CSA command.

 

Command: CSA

Pick an Attribute: <do that>

Max characters <3>:  <Specify max characters width>

 

it runs in a loop and remembers your last Max value.

 

enjoy

moshe

 

 

; condense attribute
(defun c:csa (/ getMaxChar pick ename elist n dbTextBox attang atthgt lowerLeft
	        upperRight diagonal midJustify cenJustify dbSample charWidth p10 p11)

 (defun getMaxChar (msg def / ask)
  (if (setq ask (getint (strcat "\n" msg " <" (itoa def) ">: ")))
   (setq def ask)
   (setq ask def)
  )  
 ); getMaxChar
  
 ; here start command 
 (if (= (getvar "useri1") 0)
  (setvar "useri1" 3)
 )

 (while (and
          (setq pick (nentsel "\nPick an Attribute: "))
          (setq ename (car pick))
          (setq elist (entget ename))
          (eq (cdr (assoc '0 elist)) "ATTRIB")
          (setvar "useri1" (setq n (getMaxChar "Max characters" (getvar "useri1"))))
        )
  (setq dbTextBox (textbox elist))
  (setq attang (cdr (assoc '50 elist)))
  (setq atthgt (cdr (assoc '40 elist)))
   
  (setq lowerLeft (cdr (assoc '10 elist)))
  (setq upperRight (list (+ (car lowerLeft) (caadr dbTextBox)) (+ (cadr lowerLeft) (cadadr dbTextBox))))
  (setq diagonal (distance lowerLeft upperRight) ang (angle lowerLeft upperRight))
  (setq midJustify (polar lowerLeft (+ attang ang) (/ diagonal 2)))
  (setq cenJustify (polar midJustify (- attang (/ pi 2)) (/ atthgt 2)))
   
  (setq dbSample (textbox (list (assoc '0 elist) (assoc '7 elist) (assoc '40 elist) '(1 . "8"))))
  (setq charWidth (car (cadr dbSample)))
  (setq p10 (polar cenJustify (+ attang pi) (* charWidth n 0.5)))
  (setq p11 (polar cenJustify attang (* charWidth n 0.5)))

  ; replace start point
  (setq elist (subst (cons '10 p10) (assoc '10 elist) elist))

  ; set fitted alignment
  (if (assoc '72 elist)
   (setq elist (subst '(72 . 5) (assoc '72 elist) elist))
   (setq elist (append elist (list '(72 . 5))))
  )

  ; replace alignment point
  (if (assoc '11 elist)
   (setq elist (subst (cons '11 p11) (assoc '11 elist) elist))
   (setq elist (append elist (list (cons '11 p11))))
  )

  (entmod elist) ; update datbase
 ); while

 (princ) 
); c:csa

 

0 Me gusta

ВeekeeCZ
Consultant
Consultant

@RobDraw wrote:

Make the attribute multi-line and add a background mask.

 


don't think it's possible, but could be wrong. Would you show us an example?

0 Me gusta

Moshe-A
Mentor
Mentor

@dylanwagner1996,

 

made a tiny change, turn max characters to real value cause it does not really represent a full character but a width factor, this way you better control the text width to be fit Emoticono riéndose a carcajadas 

 

please mark this as your solution.

 

moshe

 

0 Me gusta

RobDraw
Mentor
Mentor

I'll let Lynn Allen explain how to do make a multiline attribute:

https://www.youtube.com/watch?time_continue=275&v=MakurPMU9no

 

Let me know if you need help applying a background mask.

 

Why didn't you try to find out for yourself?

 

IMVHO, wipeouts are not a good solution. They can cause issues at printing time.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
0 Me gusta