VIEWTWIST > 2 * pi ? Yep

VIEWTWIST > 2 * pi ? Yep

JamesMaeding
Advisor Advisor
881 Views
4 Replies
Message 1 of 5

VIEWTWIST > 2 * pi ? Yep

JamesMaeding
Advisor
Advisor

Just found a sheet where the viewtwist of a viewport was greater than 360 deg!

 

Command: (GETVAR "VIEWTWIST")
12.1987

 The number here is radians, so way more than 2 pi.

I assume negative values are also acceptable to a dwg.

 

The end result being all my functions that check viewtwist need to "normalize" to between 0 and 2pi.

Something new....


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
882 Views
4 Replies
Replies (4)
Message 2 of 5

john.uhden
Mentor
Mentor
Yes, you can "normalize" the angle (ang) by (rem ang (* pi 2)).

John F. Uhden

Message 3 of 5

SeeMSixty7
Advisor
Advisor
if you find that it is greater than PI, then simply use

(rem viewtwist (* 2 PI))

The result will be a value less than 2PI but represents the proper radian value.

Good luck
Message 4 of 5

JamesMaeding
Advisor
Advisor

of course your code is one line and mine is like 7 🙂


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 5 of 5

SeeMSixty7
Advisor
Advisor
yes what @john.uhden said. LOL.
0 Likes