Lisp that creates a text with dimensions of a rectangle

Lisp that creates a text with dimensions of a rectangle

Anonymous
Not applicable
1,545 Views
4 Replies
Message 1 of 5

Lisp that creates a text with dimensions of a rectangle

Anonymous
Not applicable

Screenshot_2.png

I need a LISP code that creates a text under the rectangle with the content as ( $RectangleHeight$ x $RectangleWidth$)

 

since i have over a hundred of objects like this, a code of it will be much appreciated. Thanks for the help 

0 Likes
1,546 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant

First, try some Searching of this Forum.  There have been other threads about Text showing the dimensions of rectangles -- I think typically in the middle of the rectangles, but the positioning should be adjustable easily enough.  [But what your image shows is not what I would expect from the wording "under the rectangle" -- you will need to spell out the criteria for where it should be positioned.]

Kent Cooper, AIA
0 Likes
Message 3 of 5

Anonymous
Not applicable

Im sorry about the wording but what i meant was something along the lines of:

 

Pick a Rectangle

Store width.PickedRectangle as XDIM

Store height.PickedRectangle as YDIM

Create Text at coordinates (RectangleMidPointx + 3, RectangleMidPointy - 3)

       with the following text "( $XDIM$, $YDIM$ )"

 

The positioning doesn't really matter, as I can move all of them myself

0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... 

The positioning doesn't really matter, as I can move all of them myself


Then I think you will find something already out there with a Search, and you can Move them from the middle of the rectangles if that's where it puts them and you don't easily see how to define the initial location differently.  You may need to adjust to add the parentheses around the Text, unless there's one out there that already does it that way -- I don't recall how others have wanted it spelled out.

 

But questions arise:  Are the rectangles always oriented orthogonally, or might some be at other angles?  [Some such routines may use the bounding box, rather than the lengths of the edges, which would give larger size numbers for one that's not orthogonal.]  Are they always closed Polylines?  [If they might ever be made of separate Lines, it would need to be done differently, though it would still be possible with selection of all of them.]

Kent Cooper, AIA
0 Likes
Message 5 of 5

Ranjit_Singh
Advisor
Advisor

@Anonymous wrote:

Screenshot_2.png

 


Those look like fields to me in your image? Is that the goal or are you looking for static text/mtext entities?

0 Likes