Author Topic: Help: Rotate text and block by viewport ucs rotation  (Read 853 times)

0 Members and 1 Guest are viewing this topic.

PM

  • Guest
Help: Rotate text and block by viewport ucs rotation
« 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

BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: Help: Rotate text and block by viewport ucs rotation
« Reply #1 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.
A man who never made a mistake never made anything

Crank

  • Water Moccasin
  • Posts: 1503
Re: Help: Rotate text and block by viewport ucs rotation
« Reply #2 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)
Vault Professional 2023     +     AEC Collection