Jump to content

Detect document zoom change in PIO


Recommended Posts

Apologies for the cross post; I'm not entirely sure where to post general questions about Vectorworks scripting with the Vectorscript and Python categories separated.

 

I'm wondering if there is a way from within a scripted plug in object to detect that the user has changed the zoom level of the document in order to trigger a redraw or other action whenever the zoom changes?  I know how to get the current zoom level, but I don't know how to be alerted that it has changed.

  • Like 1
Link to comment

Python and VS are really run-time languages, so you can't really set up listeners. You can register a few events to trigger resets, like if the object's layer scale changes.

 

You can get a notification for view changes with the SDK (SDK plug-ins are compiled, load at launch, and can run in the background), but responding to zoom changes can be a little dangerous: if you have several copies of an object in the drawing, you could be triggering a lot of reset events with a little mouse scroll and really bog down Vectorworks. There are some ways of drawing on the screen that don't involve objects. Possible if we knew more of what you were trying to accomplish...

Link to comment

Thanks Josh, and Julian from the other thread.  Basically I'm looking to have part of the drawing in a PIO be scaled to the screen rather than to the layer, so that those elements always appear the same size regardless of zoom level.  GetZoom seems like it might be intended for this sort of thing, but without the ability to listen for zoom changes all the time, it only gets checked when some other event causes a reset.  Though I do see the issue with responding to all zoom changes.  Is there another way to draw in 'screen space' ?  If so, I suppose it may have the same performance risks

Link to comment

If you're looking to react to the current view, you probably want a tool or a tool within a menu than a drawing object. The object would make sense if you're actively asking it to refresh, otherwise you're envisioning a UI element, not a drawing object.

 

You can do this to some extent with VS and a larger extent with the SDK. Again, knowing exactly what you are trying to create would help. Feel free to contact me off list if you're reluctant to disclose the specifics of the project.

Link to comment

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
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...