TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: PM on July 31, 2022, 01:01:53 PM

Title: Help: Rotate text and block by viewport ucs rotation
Post by: PM on July 31, 2022, 01:01:53 PM
Hi. I am using this code to rote the text (to be easy to read) when i rotate viewport ucs (in case to print a drawing). I need help  to update this code.  I want to select multiple block and text or Mtext

Code - Auto/Visual Lisp: [Select]
  1. (defun c:ROV ( / ss2 i vta tmp)
  2.   (prompt "\n Select TEXT and MTEXT to rotate ")
  3.   (setq ss2 (ssget '((0 . "*TEXT")))
  4.         i   0
  5.         vta (- 0 (getvar "viewtwist"))
  6.   )
  7.   (repeat (sslength ss2)
  8.     (setq tmp (vlax-ename->vla-object (ssname ss2 i)))
  9.     (if (eq (vla-get-ObjectName tmp) "AcDbText")
  10.       (progn
  11.         (vlax-put tmp "Rotation" vta)
  12.         (vlax-put tmp "Alignment" acAlignmentLeft)
  13.       )
  14.       (progn
  15.         (vlax-put tmp "Rotation" 0.0)
  16.         (vlax-put tmp "AttachmentPoint" acAttachmentPointTopLeft)
  17.       )
  18.     )
  19.     (setq i (1+ i))
  20.   )
  21. )
  22.  

Thanks
Title: Re: Help: Rotate text and block by viewport ucs rotation
Post by: BIGAL on July 31, 2022, 07:46:25 PM
Not sure how you want to pick blocks, (setq ss2 (ssget '((0 . "*TEXT,INSERT")))

Mtext supports the auto rotation in a viewport your homework.
Title: Re: Help: Rotate text and block by viewport ucs rotation
Post by: Crank on August 01, 2022, 01:20:15 PM
@PM:
If you have the expresstools installed, then look at the TORIENT command. (You can find the lisp in ACETTXT.lsp)