Pat Stanford Posted February 19, 2015 Share Posted February 19, 2015 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); Quote Link to comment
GameCrasher545 Posted April 30, 2024 Share Posted April 30, 2024 Hi Pat, I have just come across your script from above and but I can't seem to get it to update any fields in the lighting device OIP would you be able to assist? Thanks Quote Link to comment
Jesse Cogswell Posted May 4, 2024 Share Posted May 4, 2024 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. 1 Quote Link to comment
Recommended Posts
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.