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

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.


 

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.

×
×
  • Create New...