Jump to content

Set Lighting Device Values

Recommended Posts

This is an example script that shows how to use the ForEachObject call to find certain Lighting Devices and rotate, move and change field values.

Please use as you see fit.

Procedure SetLightParams;

{An example script showing how to rotate, move and set field values of a lighting object}

{February 19, 2015}
{© 2015, Patrick Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}

Var	ThisLight: Handle;

Procedure ActOn(ThisObject:Handle); {ThisObject is a handle to the object passes by ForEachObject}

Var X1,Y1,R1 : Real;
		{Set the Symbol Name field to desired value}
		SetRField(ThisObject,'Lighting Device','Symbol Name','Conventional');

		{Get the current rotation of the object. GetSymRot works on PIOs as well as symbols}

		{Get the current location of the object. GetSymLoc also works with PIOs as well as symbols}

		{Set Rotation to Zero by rotating the negative of the current value}

		{Move to a Y value of zero by moving by negative of current Y value}


ForEachObject(ActOn,(((PON='Lighting Device') & ('Lighting Device'.'Device Type'='Light'))));

{ForEachObject will run the procedure named ActON one for each Lighting Device of type Light}


Link to comment
  • 9 years later...

Some difficulty comes depending on which fields you are updating and which version of Vectorworks you are using.  For instance, if you are trying to change the Symbol field of the Lighting Device and are using VW2021 or newer, you need to update both the 'Symbol Name' field as well as the 'Symbol Definition' field with the new symbol name.  The other very important thing is to include a ResetObject command for the chosen Lighting Device after changing fields using SetRField so that the new values take to the Lighting Device.  And also include an ApplyLightInfoRecord command if you are using a script to change Lighting Device instrument types.

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

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