center text inside of a rectangle

center text inside of a rectangle

Migumby
Advocate Advocate
2,760 Views
7 Replies
Message 1 of 8

center text inside of a rectangle

Migumby
Advocate
Advocate

Hello,

I'm hoping to find a lsp that would allow me to select a text string and then select a rectangle and the text would auto center with the rectangle.

I size control panels often and I stretch wire duct (rectangles) causing the wire duct label to be off center.

thanks

I'm using AutoCad 2019 with Windows 10.

0 Likes
Accepted solutions (1)
2,761 Views
7 Replies
Replies (7)
Message 2 of 8

dlanorh
Advisor
Advisor
Does the rectangle always have to be the same size i.e. fit text size and width to rectangle, or can the rectangle expand to fit the text?

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

0 Likes
Message 3 of 8

Migumby
Advocate
Advocate

The text is always the same size and rotation, but the rectangle is stretched to different lengths often.

I'm just looking for a fast way to center the text after the rectangle has been stretched.

thanks

0 Likes
Message 4 of 8

dlanorh
Advisor
Advisor
Find the center of the text using the bounding box method, and do the same with the rectangle, then move the text using the bounding box center to the rectangle center.

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

0 Likes
Message 5 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

@Migumby wrote:

... a lsp that would allow me to select a text string and then select a rectangle and the text would auto center with the rectangle. ....


Check >this< out.  It's in the middle of a thread mostly about MText, but it's designed to center anything  on anything else.  If you're talking Mtext, there are a variety of approaches in that thread, and if you're talking about plain Text, most of those approaches could be adjusted easily enough.  Beyond those, Search for terms like "center text" and you'll find more than you'd ever dream of....

Kent Cooper, AIA
0 Likes
Message 6 of 8

Migumby
Advocate
Advocate

that's what I do.

I was just looking for something faster.

0 Likes
Message 7 of 8

Migumby
Advocate
Advocate

Kent.

thank you very much.

that's perfect.

0 Likes
Message 8 of 8

dlanorh
Advisor
Advisor
So you want a lisp (see Kent's post above) or a block with an attribute and boundary that stretches automatically. select the text, text is deleted and in its place is the block where the attribute value is the same as the text. No stretching rectangles.

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

0 Likes