Set crosshairs orthogonal to screen (not object) or get screen display angle

Set crosshairs orthogonal to screen (not object) or get screen display angle

WKolo
Contributor Contributor
900 Views
13 Replies
Message 1 of 14

Set crosshairs orthogonal to screen (not object) or get screen display angle

WKolo
Contributor
Contributor

Hi everyone,

 

I know about ortho mode [F8], polar tracking [F10] and SNAPANG (where I can set an angle of the crosshairs), but is it possible to set the crosshairs orthogonal to the screen?

Or is there any way to get the screen display angle relative to WCS?

 

I don't want estimated orthogonal crosshairs, I'd like the crosshairs to show up perfectly orthogonal to the screen.

This should be possible, since ACAD shows a perfectly orthogonal rectangle on selection of objects, so the system does know the angle, but how can I get it and set my SNAPANG accordingly?

 

Any hints on this?

 

Best regards

0 Likes
Accepted solutions (1)
901 Views
13 Replies
Replies (13)
Message 2 of 14

ВeekeeCZ
Consultant
Consultant

Use this line?

(setvar 'snapang (- (/ pi 2) (angle '(0 0 0) (getvar 'ucsxdir))))

 

Message 3 of 14

WKolo
Contributor
Contributor

Unfortunately this is not doing the job.

Any ideas?

 

before:

WKolo_0-1744015675119.png

 

after:

WKolo_1-1744015740728.png

 

Is there an AutoLISP variable storing the information (the current 'display angle')?

That would help a lot, I could write some AutoLISP code then.

0 Likes
Message 4 of 14

Simon_Weel
Advisor
Advisor

Use UCS. Rotate along Z-axis. Then use UCSFollow to either rotate the cross hairs or drawing.

0 Likes
Message 5 of 14

WKolo
Contributor
Contributor

@Simon_Weel I need to stay in WCS while the crosshairs should be orthogonal to the screen.

I can do that approximately by hand, but there has to be a more precise way to do that.

0 Likes
Message 6 of 14

ВeekeeCZ
Consultant
Consultant

Post dwgs instead of pictures to take a look.

0 Likes
Message 7 of 14

tramber
Advisor
Advisor

Use the PLAN command 😉

Edit : 

Or even VPOINT


EESignature

0 Likes
Message 8 of 14

WKolo
Contributor
Contributor

@ВeekeeCZ It's drawing-independant. It could be any blank template even from Autodesk itself, so no need to post a DWG.

@tramber Many thanks, I know all of these commands, but I still like to get the current "display" or "AutoCAD window" angle.

Is that not possible?

 

Take a look at my screen recording:

ACAD_Crosshairs.gif

As you can see the crosshairs align perfectly orthogonal when in selection mode.

How does the Software (ACAD, C3D) know that angle? Isn't it stored somewhere deep inside the system?

0 Likes
Message 9 of 14

tramber
Advisor
Advisor

You are showing us an angle of view relative to the UCS.... 

And I must say that I don't understand the issue. We are seeing usual things.


EESignature

0 Likes
Message 10 of 14

tramber
Advisor
Advisor
Accepted solution

VIEWTWIST would be the variable you may search for....


EESignature

Message 11 of 14

WKolo
Contributor
Contributor

Let me try to explain:

 

As you can see in my second screen recording, the current view is set to WCS.

If, just for example, I would like to draw a rectangle it will be parallel to the WCS, but i would like it to be parallel to the screen.

 

ACAD_Crosshairs2.gif

I hope I explained it better now.

0 Likes
Message 12 of 14

DGCSCAD
Collaborator
Collaborator

If I'm understanding you correctly, to get the screen view relative to the WCS values try:

 

UCS: V (for VIEW)

UCS: S (save the UCS to any name)

DDUCS

Select your saved UCS then select Details

 

This can also be obtained through LISP.

AutoCad 2018 (full)
Win 11 Pro
0 Likes
Message 13 of 14

WKolo
Contributor
Contributor

@tramber Yes, that is it! Perfect!

 

I played around and if I'd like the crosshairs to match the VIEWTWIST angle I have to set SNAPANG as negative value.

For example I have VIEWTWIST = 36.740 and if I set SNAPANG to -36.740 it's exactly what I want! (with default unit and angle settings)

Thanks!

0 Likes
Message 14 of 14

tramber
Advisor
Advisor

I got you now 😂

(setvar "SNAPANG"(/(* -360(getvar"VIEWTWIST"))pi))

Most often you will need to convert from Radians to degrees .

And I included the negative in 360


EESignature