Rotation (Properties) versus UCS and WCS

Hi fellow BricsCAD users, I have a question regarding elements (such as a line, a MText or a Text) properties.

I noticed a while ago that elements' rotation angle (in the properties) is always compared with the WCS. Unfortunately, it would be much more practical for me to see (and edit) the rotation angle related to the current UCS (that is not the same).

Anyone can help me with this?

Comments

  • Actually the displayed rotation angle is relative to the OCS (object coordinate system) of the entity. But when you only work in 2D the OCS of every entity you create matches the WCS.

    If indeed you only work in 2D the macro below may be useful. It changes the value of the ANGBASE variable to match the X direction of the current UCS.
    [code]^c^c^p(setvar 'angbase (angle '(0.0 0.0 0.0) (getvar 'ucsxdir)))(princ)^p[/code]

    Using the _LIST command (without the macro) can also work, but is less convenient.
  • ... changing the ANGBASE however may trip you up in other parts of your workflow. For instance when you enter this: '@1000&lt;45' for a relative coordinate. So handle with caution.<br>
  • Thank you very much Roy, that will certainly help me!
  • Here is some Lisp code that will work better:
    [code](defun KGA_Math_LimitAngleRange (ang / ret)
      (rem (+ (rem ang (+ pi pi)) pi pi) (+ pi pi))
    )

    (defun KGA_Math_Rad_To_Dgr (rad)
      (* (/ rad pi) 180.0)
    )

    (defun c:ChangeAngle ( / angBase angUser doc ename)
      (if
        (and
          (setq ename (car (entsel)))
          (setq angBase (angle '(0.0 0.0 0.0) (trans '(1.0 0.0 0.0) 1 ename T)))
          (setq angUser
            (getangle
              (strcat
                "\nNew angle: <"
                (rtos
                  (KGA_Math_Rad_To_Dgr (KGA_Math_LimitAngleRange (- (vle-entget 50 ename) angBase)))
                  2
                  (getvar 'auprec)
                )
                ">: "
              )
            )
          )
        )
        (progn
          (setq doc (vla-get-activedocument (vlax-get-acad-object)))
          (if (= (logand (getvar 'undoctl) 8) 8)
            (vla-endundomark doc)
          )
          (vla-startundomark doc)
          (vle-entmod 50 ename (+ angUser angBase))
          (vla-endundomark doc)
        )
      )
      (princ)
    )[/code]
This discussion has been closed.