Micheal Puckett wrote this piece of code for me earlier this year and I've updated a couple of times to my liking. I just added the ability to let the user pick the TitleLine whose width they want to adjust.
It works fine in that it adjusts a TitleLine that extends outside the title block. However, it doesn't seem to matter where on the attribute a user picks. The routine simply adjust whichever TitleLine overruns the title block. So if TitleLine1 is wider than the title block and a user picks TitleLine4 or just somewhere on the attribute, the routine adjusts TitleLine1. But that's not how it should work. It should be, Pick the TitleLine you want to adjust. Not just pick anywhere. Or maybe it shouldn't. As long as it's working. My guess is that any text that is wider than 5.25 gets adjust down. I haven't tried expanding any of the other attribute lines to see because their width will never be larger than what is already specified. The concern is really just TitleLines1,2, & 3
At any rate. I'd like to know where I've gone wrong.
;;Adjusts any selected TitleLine whose text is wider than the defined width of the title block.
;;User selects the STA_TW button and then selects desired text.
;;
;;4-12-2018 Routine created by Michael Puckett @ CAD ANALYST
;;4-12-2018 Modified by Jerry Logan
;;4-12-2018 Added functionality for use with dimscale.
;;9-28-2018 Added user selection to change width of any tag that is outside the title block lines.
;;
;;After select STA_TW button select attribute. The routine will find any TitleLine that is wider than the
;;title block allows and adjust it's width to fit inside the title block.
;;
;;Command: STA_ATT_WIDTH
;;
;;
(defun mpx
-get
-bounding
-box
( object
/ a b
) )
(defun mpx
-restrict
-attrib
-widths
( block
-reference tag
-spec max
-width
/ bb dx ratio flag
) (setq bb
(mpx
-get
-bounding
-box a
)) (< 1.0 (setq ratio
(/ dx max
-width
))) )
)
)
)
(defun c:STA_ATT_WIDTH
( / block
-spec tag
-spec max
-width ss i
)
;;--------------------------------
;;This was Micheal's original code
;;(setq
;;block-spec "TBLK_ATT_CTL"
;;tag-spec "Desired TitleLine tag goes here"
;;max-width (* 5.25 (getvar 'dimscale));;multiply 5.25 dimscale
;;)
;;--------------------------------
;;This is how I changed it
block-spec "TBLK_ATT_CTL"
max
-width
(* 5.25 (getvar 'dimscale
));;multiply 5.25 dimscale )
(setq tag
-spec
(entsel "\nselect TitleLine: ") ;;removed tag-spec "TitleLine#"
)
;;------------------------------
(mpx-restrict-attrib-widths
tag-spec
max-width
)
)
)
)
(prompt "\nResetting System Variables ") )
J. Logan