Author Topic: screensize reactor  (Read 5144 times)

0 Members and 1 Guest are viewing this topic.

Bobb

  • Guest
screensize reactor
« on: April 17, 2013, 03:16:30 PM »
All,

New to your forum.  Just went searching for the capability in the subject.

I've discovered that some system variables cannot be used with reactors, and SCREENSIZE is one of those.  I have managed to set a reactor to the USERS(1-5) systems variables.  So, the question is, what would be the best option for updating one of the USERS variables on a timer, say every 1/4 second, with the values in SCREENSIZE that can be run in the background 100% of the time without affecting other routines like LISP and/or other scripting?

Or, am I plain old loony, and this can indeed be accomplished with LISP??

Thanks

bobb


BlackBox

  • King Gator
  • Posts: 3770
Re: screensize reactor
« Reply #1 on: April 17, 2013, 03:27:59 PM »
Welcome to TheSwamp!

Without your code, I'm not sure that I can follow what you're doing with ScreenSize / UserS* System Variables.

You're not 'loony' but perhaps just new(-ish) to the API... Perhaps if you could clarify what it is exactly that you're attempting to do, as there may be alternatives that would preclude the need to have a constant timer running at all (tabling feasibility for the moment).
"How we think determines what we do, and what we do determines what we get."

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: screensize reactor
« Reply #2 on: April 17, 2013, 06:11:05 PM »
Welcome to the Swamp Bobb! :)

Since the vlr-sysvar-reactor can only monitor the values of certain System Variables, an alternative approach might be to use a different reactor type that will be triggered relatively often (such as a vlr-command-reactor or vlr-mouse-reactor), and store the value of the SCREENSIZE System Variable when the callback function is evaluated.

I am curious however as to the application for this?

TheMaster

  • Guest
Re: screensize reactor
« Reply #3 on: April 19, 2013, 05:36:17 PM »
All,

New to your forum.  Just went searching for the capability in the subject.

I've discovered that some system variables cannot be used with reactors, and SCREENSIZE is one of those.  I have managed to set a reactor to the USERS(1-5) systems variables.  So, the question is, what would be the best option for updating one of the USERS variables on a timer, say every 1/4 second, with the values in SCREENSIZE that can be run in the background 100% of the time without affecting other routines like LISP and/or other scripting?

Or, am I plain old loony, and this can indeed be accomplished with LISP??

Thanks

bobb

Have you tried using vlr-Window-Reactor ?


Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: screensize reactor
« Reply #4 on: April 20, 2013, 03:42:39 PM »
Have you tried using vlr-Window-Reactor ?

Nice idea Tony; however unfortunately this reactor only fires when the drawing window frame or application window frame is moved or resized (returning T or nil respectively for each action). Zooming or panning within the window frame goes unnoticed by the reactor :-(

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: screensize reactor
« Reply #5 on: April 21, 2013, 05:02:48 AM »
@ Lee Mac:
Actually Tony's suggestion is correct. Zooming and panning do not change the screensize (= size in pixels).
Although in BricsCAD the reactor seems to fire before the window is changed.

If you want to catch zooming and panning you can use vlr-acdb-reactor. See:
http://www.theswamp.org/index.php?topic=43408.0

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: screensize reactor
« Reply #6 on: April 21, 2013, 11:05:20 AM »
@ Lee Mac:
Actually Tony's suggestion is correct. Zooming and panning do not change the screensize (= size in pixels).
Although in BricsCAD the reactor seems to fire before the window is changed.

My apologies, you are absolutely correct - for some reason I was sidetracked into thinking the OP was looking for a reactor to fire when the zoom magnification was altered, but after re-reading the first post I realise the OP was referring to the SCREENSIZE system variable (dependent on window size) rather than the VIEWSIZE system variable (dependent on zoom); thanks roy.
« Last Edit: April 21, 2013, 11:15:12 AM by Lee Mac »

TheMaster

  • Guest
Re: screensize reactor
« Reply #7 on: April 21, 2013, 11:09:14 AM »
Have you tried using vlr-Window-Reactor ?

Nice idea Tony; however unfortunately this reactor only fires when the drawing window frame or application window frame is moved or resized (returning T or nil respectively for each action). Zooming or panning within the window frame goes unnoticed by the reactor :-(

Yes, SCREENSIZE is the size of the document view window's client rectangle, it's not the size of the virtual screen or anything that would be affected by ZOOM or PAN.

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: screensize reactor
« Reply #8 on: April 21, 2013, 11:19:14 AM »
Yes, SCREENSIZE is the size of the document view window's client rectangle, it's not the size of the virtual screen or anything that would be affected by ZOOM or PAN.

Thanks Tony, I realised my mistake.

TheMaster

  • Guest
Re: screensize reactor
« Reply #9 on: April 21, 2013, 11:26:33 AM »
@ Lee Mac:
Actually Tony's suggestion is correct. Zooming and panning do not change the screensize (= size in pixels).
Although in BricsCAD the reactor seems to fire before the window is changed.

If you want to catch zooming and panning you can use vlr-acdb-reactor. See:
http://www.theswamp.org/index.php?topic=43408.0

Can't speak for what happens in BricsCAD, but in AutoCAD, there's quite a few reasons why a AcDbViewport or AcDbViewPortTableRecord could be modified, aside from pans/zooms, and I know from experience that detecting transparent pans and zooms is actually quite difficult to do even in ObjectARX.  The native ObjectARX AcEditorReactor has a viewChanged notification (which fires for pans/zooms, and also for viewport and layout switches), but it's not exposed to Visual LISP's :vlr-editor-reactor) :S


roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: screensize reactor
« Reply #10 on: April 22, 2013, 03:48:05 AM »
@ TT:
You are right that a AcDbViewport or AcDbViewPortTableRecord can be changed without panning or zooming. These objects will, for example, also change if you toggle the grid. So you will need additional code to detect if a pan or zoom has in fact occurred. But in BricsCAD ALL zooms and pans are detected (including transparent and real-time zooms and pans).