Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to add a rectangle and a line around MText using lisp ?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Jyh2003
379 Views, 4 Replies

Is it possible to add a rectangle and a line around MText using lisp ?

I want to to implement such a function, your help is much appreciated.

 

mtext.png

4 REPLIES 4
Message 2 of 5
Kent1Cooper
in reply to: Jyh2003

Similar questions have come up here before.  Look at, for example this thread, not just the indicated solution but the rest of it, too.  If that gives you something to make the rectangle, it wouldn't be hard to add the Line part -- any particular length, or should it leave the User in the Line command to pick their own other end?

Kent Cooper, AIA
Message 3 of 5
Jyh2003
in reply to: Kent1Cooper

Thank you very much for your thread.

 

Now, I could add a rectangle to MText, but I still couldn't add a vertical line to rectangle.

 

Please see if you can help to align line vertically center, and set the length of line to 100.

Message 4 of 5
Kent1Cooper
in reply to: Jyh2003


@Jyh2003 wrote:

.... I still couldn't add a vertical line to rectangle.

 

Please see if you can help to align line vertically center, and set the length of line to 100.


It's just a matter of finding the midpoint of the bottom edge, and drawing downward from there.  If you used my routine on that thread, try:

 

(command "_.line"

  "_none"

  (list ; midpoint of bottom edge

    (/ ; average X coordinates of corners

      (+

        (car LL); X coordinate of lower left

        (car UR); X coordinate of upper right

      ); +

      2

    ); /

    (cadr LL); Y coordinate of lower left

  ); list

  "_none" (polar (getvar 'lastpoint) (* pi 1.5) 100); downward by 100 units

  ""

); command

 

Or if you used Lee Mac's routine, get those coordinates differently from the 'box' variable, since it's a single list of two points -- try:

 

(command "_.line"

  "_none" (list (/ (+ (caar box) (caadr box)) 2) (cadar box)); [same structure as above, without individual-line comments]

  "_none" (polar (getvar 'lastpoint) (* pi 1.5) 100)

  ""

); command

 

Kent Cooper, AIA
Message 5 of 5
Jyh2003
in reply to: Kent1Cooper

Thanks for your help, the issue has been solved.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost