Jump to content
Developer Wiki and Function Reference Links ×

updating lights


Ben624

Recommended Posts

Hello. I'm in the home stretch of a long scripting project and I'm wondering if anyone can help me. I'm writing a script to update gobo projectors and their attached light sources with a worksheet. Unfortunately, in order apply the color change, I have to use ResetObject() on the gobo projector. This causes me to lose the beam angle value that I have applied to the light source. Yet if I write a separate script to change the beam angle of the light (without resetting the gobo projector) it changes it without a problem. Ideally, I'd like this to be one script that applies values to the gobo projector, updates it, THEN applies values to the light source. What it seems to do now is apply all values to both objects then update, causing me to lose the beam angle. Can anyone help me?

Thanks in advance,

Ben

Full Script:

PROCEDURE lightAndGoboUpdate;

VAR

theWS,proj,light : HANDLE;

projName,lightName,whichWS,color,pattern,spreadStr : STRING;

numRows,numColumns,i : INTEGER;

beam,intensity,spread : REAL;

BEGIN;

theWS := getTopVisibleWS;

GetWSRowColumnCount(theWS,numRows,numColumns);

BEGIN

FOR i := 2 TO numRows DO

BEGIN

GetWSCellFormula(theWS,i,2,projName);

proj := getObject(projName);

lightName := concat(projName,'.Light');

light := getObject(lightName);

GetWSCellFormula(theWS,i,3,color);

SetRField(proj,'gobo projector','color',color);

GetWSCellFormula(theWS,i,5,pattern);

SetRField(proj,'gobo projector','gobo 1',pattern);

GetWSCellvalue(theWS,i,7,spread);

spreadStr := concat(spread);

SetRField(proj,'gobo projector','Field Angle',spreadStr);

resetObject(proj);

GetWSCellValue(theWS,i,4,intensity);

SetObjectVariableReal(light,51,intensity/100);

GetWSCellValue(theWS,i,6,beam);

SetBeamAngle(light,beam/2);

END;

END;

END;

RUN(lightAndGoboUpdate);

Link to comment

The light takes on its properties if I don't use resetObject, but color is controlled through the gobo projector. If I don't use resetObject, the light doesn't take its color from the gobo projector. I've tried a number of different alternatives using redraw and redrawAll, none of them will make the light take its color.

Ben

Link to comment

Ok. So if you run the script as written this works:

GetWSCellValue(theWS,i,4,intensity);

SetObjectVariableReal(light,51,intensity/100)

And this doesn't:

GetWSCellValue(theWS,i,6,beam);

SetBeamAngle(light,beam/2);

And if you remove reset they both work?

So if I've got that right then how bout SetObjectVariableReal(light,62,beam/2);

instead of SetBeamAngle(light,beam/2);

If this doesn't work please write back and confirm that the script as written is performing exactly as I describe here. It's still unclear if SetObject is working for light intensity with reset present.

I'm trying to establish that you'r getting the correct handle for the light and that beam/2 is a valid setting.

Unfortunately I don't have a gobo to play with.There's a couple other things to try, but we should verify this first.

Charles

.

Link to comment

"Ok. So if you run the script as written this works:

GetWSCellValue(theWS,i,4,intensity);

SetObjectVariableReal(light,51,intensity/100)

And this doesn't:

GetWSCellValue(theWS,i,6,beam);

SetBeamAngle(light,beam/2);

And if you remove reset they both work?"

Correct. Everything that refers directly to the light works properly as long as I don't reset the gobo projector. Unfortunately, I need to reset the gobo projector to get the color change to apply. When I reset the gobo projector, the light's beam angle and the spread angle are both reset to the gobo projecter's field angle parameter. SetObjectVariableReal(light,62,beam/2) did not fix problem.

Link to comment

I'm thinking you might be losing the handle to the light after reset. What does the message say if you put Message(light) after the reset?

If it's zero then try getting the handle to the light after reset. I would guess that it is a number since setting the lights intensity still works after resetobject (correct?)

I also wonder if declaring the setting of the gobo and the setting of the light as 2 separate procedures and then calling them inside the loop might work.

At this point I'll leave you be. It seems I just don't know enough about these gobos.

Later

Charles

[ 08-02-2005, 10:31 PM: Message edited by: ccroft ]

Link to comment
  • Vectorworks, Inc Employee

The gobo projector sets the Beam Angle and Spread Angle when it gets reset. Vector Script can only run on session at once, so your code runs, updated the information on the gobo projector, and MARKS it for reset, then you update the attatched light. When your script is finished the Gobo Project actually runs its code and sets the parameters of the light, over your changes.

The only solution is to use 2 seperate scripts, one to change the attributes of the gobo projector, then run the seond to set the attributes of the light.

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