Jump to content
Pat Stanford

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;
	Begin
		{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}
		R1:=GetSymRot(ThisObject);

		{Get the current location of the object. GetSymLoc also works with PIOs as well as symbols}
		GetSymLoc(ThisObject,X1,Y1);

		{Set Rotation to Zero by rotating the negative of the current value}
		HRotate(ThisObject,X1,Y1,-R1);

		{Move to a Y value of zero by moving by negative of current Y value}
		HMove(ThisObject,0,-Y1);

	End;

Begin
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}
End;

Run(SetLightParams);

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×