Jump to content

Recommended Posts

Posted

Hi everyone I'm just starting to experiment with Lisp.

I downloaded a file that, among other things, is supposed to calculate the cursor size in drawing units. However, it doesn't seem to calculate it correctly. At least on my PC.

Can anyone tell me the correct way to calculate it? 

 

 

Posted

Hi Vica.
In principle, the cursor size is obtained from system variables such as "VIEWSIZE" and "CURSORSIZE".
But there is a factor in that equation that can alter the result: the size and resolution of your screen.
 

Posted

Therefore, this question is necessary: what screen does your PC use?

Posted

Thank you very much for your interest in my problem.

I am using a 40" 4K resolution SmartTV as a screen.

Posted

This should return the length, in drawing units, of the crosshair from end to end.

 

(* (/ (car (getvar "SCREENSIZE")) 100.0) 10 (/ (getvar 'VIEWSIZE) (cadr (getvar 'SCREENSIZE))))

 

Posted

Where 'CURSORSIZE' is the cursor size as a percentage of the screen's WIDTH in pixels.
'VIEWSIZE' is the height of the drawing area in drawing units; and
SCREENSIZE is the width and height of the screen in pixels.

  • 5 weeks later...
Posted

Hi Glavcs I tried your Lisp code, but I think the measurement isn't the same as the cursor measurement.

Posted

I would just change it in the os but that is just me. I researched the 4k TV but found (back then) the refresh rate isn't worth it in the end. causing ghosting and such.

Its also recommended to be 1.5 the distance from the screen as the size or would just cause to much eye strain.

productivity-thomas-frank.gif.eea2cda78bcda9b6397803ef8f85294a.gif

 

 

Posted

Thanks for the advice Mhupp.

My desk is large, and I can see my screen from a little over 1 meter away. I don't like small screens.

But I suppose this question applies to any screen you use.

Is there really no one here who can answer this question?

Posted

It might help if you shared the LISP.

 

 

Posted

@Vica
Excuse me.
You're right.
To make the calculation correct, it's essential to include the screen resolution in the equation. AutoCAD's system variables only refer to the dimensions of the drawing area.
Therefore, my previous formula could only be approximate.

If you want to calculate the cursor dimensions exactly, you need to obtain the screen resolution.
To do this, you can use this function

(defun AnchoResol (/ s i is)
  (setq s (vlax-invoke (vlax-create-object "WbemScripting.SWbemLocator") 'ConnectServer nil nil nil nil nil nil nil)
        is (vlax-invoke s 'ExecQuery "SELECT CurrentHorizontalResolution, CurrentVerticalResolution FROM Win32_VideoController")
  )
  (vlax-for i is (vlax-get i 'CurrentHorizontalResolution))
)

 

  • Like 1
Posted (edited)

 

  On 4/11/2025 at 11:01 AM, GLAVCVS said:

@Vica
Excuse me.
You're right.
To make the calculation correct, it's essential to include the screen resolution in the equation. AutoCAD's system variables only refer to the dimensions of the drawing area.
Therefore, my previous formula could only be approximate.

If you want to calculate the cursor dimensions exactly, you need to obtain the screen resolution.
To do this, you can use this function

(defun AnchoResol (/ s i is)
  (setq s (vlax-invoke (vlax-create-object "WbemScripting.SWbemLocator") 'ConnectServer nil nil nil nil nil nil nil)
        is (vlax-invoke s 'ExecQuery "SELECT CurrentHorizontalResolution, CurrentVerticalResolution FROM Win32_VideoController")
  )
  (vlax-for i is (vlax-get i 'CurrentHorizontalResolution))
)

 

Expand  

 

This function returns the screen resolution.
To get the cursor size in real time and drawing units, simply run the following:

(* (/ (AnchoResol) 100.0) 
   (getvar "CURSORSIZE")
   (/ (GETVAR "VIEWSIZE") (cadr (getvar "SCREENSIZE")))
)

 

Edited by GLAVCVS
  • Like 2
Posted

This way you'll get the longitude from the north end to the south end of the cursor (or from the east end to the west end).

I hope this is what you're looking for.

  • Like 1
Posted

Yes

It's perfect

This is exactly what I need

Thank you so much 😊

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...