- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
Hello,
I'm hoping to find a lsp to create a rectangle with a variable size and allow me to write text inside it and center the text.
Thanks for the help.
¡Resuelto! Ir a solución.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Anonymous ,
This sounds like an ideal scenario for a block. Have you considered that route? If that does not work can you elaborate as to why?
Best
~DD
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
In simplest terms, here's one way:
(defun C:TEST (/ pt1 pt2)
(command
"_.rectang"
(setq pt1 (getpoint "\nCorner of rectangle: "))
(setq pt2 (getcorner pt1 "\nOpposite corner: "))
"_.dtext" "_mc" "_m2p" pt1 pt2 "" ""
); command
(princ)
)
It assumes you want to draw the rectangle by simple opposite corners, and not call for any of the options within this routine [filleted corners, etc.], and that the Text would be at 0° rotation and in whatever the current Style is, and that Style does not have a fixed height. Variations in such things can be accounted for.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Kent1Cooper , hi Kent , what about I want the text to fill the rectangle .
I try with this code
(setq rect-heigth ( * (distance pt1 pt2) (sin (angle pt1 pt2))))
(setq text-height (* 0.80 rect-heigth))
(setq text-obj (vlax-ename->vla-object (entlast)))
(vla-put-Height text-obj text-height)But it exceed the rectangle wide . I test with 0.80 the rectangle height , but it depend from the how much characters has te text .
Thanks in advance
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
You can also just turn on the text frame for your mtext that has justification set to be middle centered.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
HI
you can use tcircle from express tools
1- tcircle
2-select object/s.
3-enter your offset ( gap between text and rectangle )
4- rectangle
5- Variable
good luck
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
@Anonymous wrote:
.... to create a rectangle with a variable size and allow me to write text inside it and center the text. ....
Clarify something for us....
Several suggestions here are about a relationship between the size of the Text and the size of the rectangle, with either the rectangle determining the size of the Text [the Fit-justification approach] or the other way around [the Mtext-with-frame and TCIRCLE approaches]. That's not part of your original request, but is that something you need? If so, which one should determine the size of the other, and in what way?