Jump to content

Recommended Posts

Posted

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?

Posted (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 by PGia
Posted (edited)

Hi PGIA, lemme explain with screenshots:

Say I have a section line, like this:

image.thumb.png.4cb610ce06cf576a1ffbb824b24465a4.png

What I do first is rotate the whole thing, like this:

image.png.23e808d27541bb1af0d4a56fc199c14d.png

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:

image.png.eb07c5f394160d2db77ec95d38163f6e.png

So the rotate command is needed because I still need to rotate everything, hope this clarifies my issue.

Edited by EIA
Posted (edited)

Hola @EIA

Solo necesitas cambiar 'command' por 'command-s'

Edited by GLAVCVS
  • Like 1
Posted

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.

Posted

@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!

Posted

I think I have posted a dynamic block for a section arrow like that on here.

 

Maybe this? 

 

Posted

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.

Posted

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.

Posted

You never posted a .dwg.

 

 

Posted

I don't have LT so checked as stuff is missing when using lisp etc, found this.

image.thumb.png.2fb35335b419183716981dab83946d5b.png

Posted
  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.

image.thumb.png.2fb35335b419183716981dab83946d5b.png

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...