Jump to content
Developer Wiki and Function Reference Links ×

Script to turn off the lights


fuberator

Recommended Posts

Hi

 

I would like to find out how to make a palette with a few functions.

 

A lot of times I want to work in shaded mode and I need to disable light fixtures temporarily to work in the default light, and then turn them back on to visualise what they are doing. 

 

To Quickly compose looks it would be marvellous to have a floating window/palette with everything that can be found in the render section of Lighting Device→OIP: EDIT dialogue

 

Lighting Device → OIP: Edit → Tab: Light Information → Section: Render

 

 

How would I go about this. Is there an example of a custom window/palette that I could try to build from?

 

Thank you

 

 

Screenshot 2023-01-19 at 15.19.36.png

Edited by fuberator
Link to comment

If you want the Default light, you can't just turn the lights off, you actually have to make them invisible.

 

The easiest way is to edit your workspace and add Custom Visibility from the Legacy menu commands.

 

From there you need to make two scripts:

1. Select Command to Show, Create Vectorscript, Hit the Criteria Button and set it to All Objects. Click OK.  This will give you a script that will make everything visible again after you have hidden them.

 

2. Command is Hide, Create Vectorscript, Criteria is Type is Light.  This will hide all of your lights.

 

You might want a third script also.  Command is Hide, Create Vectorscript. Criteria is Selected.  This on will hide all of the selected objects. Useful to get things out of the way.

  • Like 1
Link to comment

To the best of my knowledge, you cannot create a persistent floating palette as you pictured above. You can create a dialog with those options, but it needs to open and close so you can continue editing your file.

 

I believe what @Pat Stanford is suggesting is creating a Script Palette that contains Pascal or Python commands to achieve the various drawing states you desire.

 

You can also turn these script commands into Menu Commands, which can be loaded into your workspace and assigned hotkeys. These would be available in every open file (new or old), as opposed to a Script Palette which would have to exist in each file, either by copying it in, or adding it to your Template Files. Menu commands can perform simple or complex functions, and if you need to provide user input, they can open dialogs like the one you designed above. If you need help going down one of these paths, please write back.

 

Raymond

  • Like 1
Link to comment

Hi

 

Thank you for your answers. I think maybe I should clarify my intentions.

 

As I am considering positions and moving things about it is not optimal that the scene is darkened and only illuminated by the devices.

I do however want to switch to a "lit" scene every once in a while to see what it looks like. So far it is all about that on/off toggle.

To have access to color and brightness would be a bonus of course. Like a simple little light desk.

 

So in the best case scenario I would keep the lighting devices visible (otherwise I could just turn a layer off with all devices on it).

 

@MullinRJThe script menu command with hotkey sounds great. My programming skills are limited, but if I could look at some examples I might be able to cobble something together, at least for the on/off toggle.

 

Is there a resource for this that you can recommend as a starting place?

 

Thank you

 

Link to comment

Hi @fuberator,

   There are several documents you need to script effectively.

 

1) The VW Script Function Reference. There is an HTML version in the VW Application folder, here: /VWHelp/Script Reference/ScriptFunctionReference.html.

2) There is also an online version of the same document, and a whole lot more at: https://developer.vectorworks.net/index.php/Main_Page 

3) There are files in the SDK containing lists of the constants used in the program. You can download the SDK here:  https://www.vectorworks.net/support/custom/sdk/sdk_license

The files you need most are : ProgramVariables.h and ObjectVariables.h, located in the SDKLib/Include/Kernel/API/ directory.

 

If you get this far you're probably numb from the neck up. Sadly, there is not an official Starting Place. We all recommend jumping in then requesting a life preserver. Luckily, there are many people standing around who will gladly throw you a floating device.

 

But, to give you a nudge in the right direction, look in the VW Script Function Reference for the commands that @Pat Stanford mentioned above. You'll have lots of questions, and we'll have lots of answers.

 

Good luck and welcome to the Deep End of the Pool,

Raymond

 

 

  • Like 1
Link to comment

@fuberator First, you can go to the Default light by going to Top Plan view.  I don't know what conditions might change this, but it is working for me.  Perhaps this only works if the lights in the scene are only contained in Lighting Devices.

 

Second, I'm working on enhancing a command that I have already made to do much of what wish for.  Currently it only turns the beams on in the OIP, but turning the light objects on and off for rendering looks very doable.  See image of the current command dialog below; it will need to be expanded.  For your own programming investigations, you should know that  while the programming isn't rocket science, but it does involve getting the profile group of each Lighting Device, polling the objects in that group and finding the lights, then turning them on and off with procedures specific to Light objects.  I'll keep you informed of my progress.

 

Image.png.b48016ad9ec9556623d458dbe1f7c3cd.png

Link to comment
23 hours ago, Sam Jones said:

@fuberator First, you can go to the Default light by going to Top Plan view.  I don't know what conditions might change this, but it is working for me.  Perhaps this only works if the lights in the scene are only contained in Lighting Devices.

 

Second, I'm working on enhancing a command that I have already made to do much of what wish for.  Currently it only turns the beams on in the OIP, but turning the light objects on and off for rendering looks very doable.  See image of the current command dialog below; it will need to be expanded.  For your own programming investigations, you should know that  while the programming isn't rocket science, but it does involve getting the profile group of each Lighting Device, polling the objects in that group and finding the lights, then turning them on and off with procedures specific to Light objects.  I'll keep you informed of my progress.

 

Image.png.b48016ad9ec9556623d458dbe1f7c3cd.png

 

 

Hi

 

Very exciting! I had a look and realised this would have to be a future project as it would take too much time to even enter. 

 

ciao!

 

Link to comment

Here is a menu command that does much of what has been discussed here.  Placing it in the Plug-Ins folder of the 2023 user folder and then adding the command to your workspace should make it available to you.  It will be a part of the next version upload of AutoPlot Tools for Spotlight, so it will stop being functional 2 months after its first use, but it should be fully functional until then.  Let me know if you have any coments, questions, or problems.

 

Sam

sjones@autoplotvw.com

 

Beam Console New.vsm

  • Like 1
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...