Jump to content

Updating Lighting Device Color


Recommended Posts

I'm attempting to update Lighting Device colors via script and can update the field values just fine but the light output does not update to the new color unless you manually click into the color field on the OIP force it to think about applying the new color. (I've just been adding and deleting a space at the end of the color so it detects a change)

 

Example: Device has no color, output is white. Script sets Color parameter to be something different (Have tried string Gel names like R02 and color vectors like (255, 0, 0) both which work correctly when entered directly into the field as intended). The updated color is displayed in the field, however the color of the light output is still white until manually entering the OIP color field to force it to refresh.

 

I've tried applying the field value with both vs.SetRField and vs.LDevice_SetParamStr, both change the field but make no difference in the updating.

 

I've run these after setting the color and none of them seem to help in updating the fixture:

vs.ResetObject

vs.LDevice_Reset

vs.LDevice_ResetVisual

vs.ResetBBox

vs.Redraw

vs.RedrawAll

vs.RedrawSelection

 

I've also attempted to do vs.DoMenuTextByName with the Spotlight/Refresh Lightning Device command but can't seem to get this call to work correctly for this command (sounds like because its a plug in it needs to be called differently?), but running the same menu command manually also does not update the light output anyway...

 

Also other things on the Lighting Device which cause updates like clicking buttons in the OIP do not update the fixture color to the new value- like "Refresh Labels" or even "Replace Lighting Device...". However, clicking the Edit button opens up the Lighting Device dialog and the Color pulldown does show the new color... but selecting Ok does not update it. You must manually enter the oip color field itself to update.

 

Anybody else had any luck with this and can point out what I'm missing here?

Link to comment

Just a guess, but the render light exists in the profile group and its data needs to sync from the OIP. The sync is probably triggered from the OIP field, which doesn’t happen when the data is set by script. Probably no easy solution that doesn’t involve finding the light in the profile group and directly setting the color to match the lighting device. 

Link to comment
  • Vectorworks, Inc Employee

Try setting the RGBColor field to an empty string.
The RGB color is stored here so we don't have to take the time to process the color names.
Setting it to an empty string forces the lighting device to process the color set in the color field.

  • Like 1
  • Love 1
Link to comment

@JBenghiat 

A solid thought- Actually very easy to find the light in the group of the Lighting Device, however setting the color of the light this way doesn't doesn't help. The light will take the color value but not update. You can check the color of the light after setting it and it will return the color applied but its still outputting the original color. 

 

While I was testing this @klinzey popped in and saved the day! This is working perfectly now!

 

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