Vica Posted March 9 Posted March 9 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? Quote
GLAVCVS Posted March 10 Posted March 10 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. Quote
GLAVCVS Posted March 10 Posted March 10 Therefore, this question is necessary: what screen does your PC use? Quote
Vica Posted March 10 Author Posted March 10 Thank you very much for your interest in my problem. I am using a 40" 4K resolution SmartTV as a screen. Quote
GLAVCVS Posted March 12 Posted March 12 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)))) Quote
GLAVCVS Posted March 12 Posted March 12 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. Quote
Vica Posted April 10 Author Posted April 10 Hi Glavcs I tried your Lisp code, but I think the measurement isn't the same as the cursor measurement. Quote
mhupp Posted April 10 Posted April 10 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. Quote
Vica Posted April 11 Author Posted April 11 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? Quote
GLAVCVS Posted April 11 Posted April 11 @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)) ) 1 Quote
GLAVCVS Posted April 11 Posted April 11 (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 April 11 by GLAVCVS 2 Quote
GLAVCVS Posted April 11 Posted April 11 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. 1 Quote
Vica Posted April 12 Author Posted April 12 Yes It's perfect This is exactly what I need Thank you so much 1 Quote
Recommended Posts
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.