EIA Posted April 11 Posted April 11 So I have this LISP routine (yeah it's in Spanish, sorry): (defun c:giraTexto(/ sel i en) (setq sel (ssget)) (command "gira" sel "" PAUSE PAUSE) ;Rotar texto: (if sel ;Si existe el conjunto de selección: (progn (setq i 0) ;Comienza la variable "i" para usar en el while loop (while (< i (sslength sel)) ; Activa el while loop con el contador en 0, hasta llegar a todos los elementos del conjunto de selección (setq en (ssname sel i)) ; Obtén el nombre de la entidad del bloque (setq i (1+ i)) ; Incrementa el contador (if (and en (eq (cdr (assoc 0 (entget en))) "MTEXT")) ;Mientras la entidad en juego sea un texto: (entmod (append (entget en) '((50 . 0.0)))) ;rota el texto a 0 grados manteniendo su posición ) ) (princ "\nTextos rotados") ) (princ "\nNo se encontró una selección") ) (princ) ) It works exactly the same than the rotate command (which is "gira" in Spanish), but then it takes every text and reverts their orientation to 0°. The thing is, this won't work if you rotate with reference (which I do a lot). I believe this is because there are only 2 PAUSE orders; if I put more, it will work with reference, but stop working with only numbers. Is there a way to put a PAUSE there that lasts for as long as the command is running? Is there anything else I am not seeing? Quote
PGia Posted April 11 Posted April 11 (edited) Hi I don't understand what you're doing: You create a selection set, rotate it, and...: then iterate over each entity in the array to set its angles to 0? What's the point of using the lisp code (command "gira"...) at the beginning? Edited April 11 by PGia Quote
EIA Posted April 14 Author Posted April 14 (edited) Hi PGIA, lemme explain with screenshots: Say I have a section line, like this: What I do first is rotate the whole thing, like this: The problem is, I want the text to be horizontal, no angle, so then I have to select the text and rotate it back to 0°, like this: So the rotate command is needed because I still need to rotate everything, hope this clarifies my issue. Edited April 14 by EIA Quote
GLAVCVS Posted April 14 Posted April 14 (edited) Hola @EIA Solo necesitas cambiar 'command' por 'command-s' Edited April 14 by GLAVCVS 1 Quote
GLAVCVS Posted April 14 Posted April 14 Although I just verified that it works for me in all cases. Perhaps you should post an example drawing where the code doesn't work. Quote
Nikon Posted April 14 Posted April 14 (edited) @EIA You can use a dynamic block. А-А.dwgFetching info... Edited April 15 by Nikon 2 1 Quote
EIA Posted April 15 Author Posted April 15 @GLAVCVS mil gracias máquina, te contesto en inglés para no hacer el lío a los mods y por si a alguien más le sirve esto. Indeed, command-s solved it, now I will take a look to see when to use command-s and when to use just command because apparently both have their limitations. @Nikon dynamic blocks are a great idea actually, I will investigate into this as well. Thank you both a lot! Quote
SLW210 Posted April 15 Posted April 15 I think I have posted a dynamic block for a section arrow like that on here. Maybe this? Quote
EIA Posted April 15 Author Posted April 15 Thank for the example SLW. From what I am seeing in that block, I might be very limited due to AutoCAD LT being very limited with restrictions, still I will see what I can do. Quote
SLW210 Posted April 16 Posted April 16 You can try, but there is a good chance a LISP to do this wouldn't work in LT. Best bet, see what needs changed/redone in the dynamic block and give a trial of Full AutoCAD a trial. You could also try to get a LISP working in Full AutoCAD. Show your boss the advantage of full AutoCAD and the time savings in the end, that should convince them to get at least one seat of full. A couple of newer Engineers keep asking for Inventor or Solidworks, they may just get it. Right now they have LT, I struggle to adapt some LISPs to work, though I have had a few I could get for them to use, very complicated things are a no-go as of now. Quote
BIGAL Posted April 17 Posted April 17 I don't have LT so checked as stuff is missing when using lisp etc, found this. Quote
EIA Posted Tuesday at 07:05 AM Author Posted Tuesday at 07:05 AM On 4/16/2025 at 12:47 PM, SLW210 said: You never posted a .dwg. Expand I never posted a .dwg because my main problem was a bug in a lisp routine, there wasn't really a special case (the routine was about rotating the text position but keeping it horizontal, just like it shows in the video you posted), and I didn't see the point on posting a .dwg with just a line and a text. On 4/17/2025 at 12:12 AM, BIGAL said: I don't have LT so checked as stuff is missing when using lisp etc, found this. Expand Indeed, I can make dynamic blocks, the problem comes when adding parametrics, although as I see in the video posted by SLW, parametrics are not really needed to achieve this. Still, not being able to do restrictions is, well, a big restriction for me. Thanks a lot for the answers, every single one has been really helpful, and in case there is any doubt about this my problem has been already solved by using command-s just like GLAVCVS suggested. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.