AlHanson Posted February 28, 2021 Share Posted February 28, 2021 I notice there's some new vs commands to get Lighting Device information in 2021 and am trying to decipher the specific details for these: VS:LDevice_GetParamBool - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamBool VS:LDevice_GetParamLong - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamLong VS:LDevice_GetParamReal - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamReal VS:LDevice_GetParamStr - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamStr I've been able to get MOST of the data in the record working after some digging through the worksheet to get correct names on some of the more oddball parameters, but for some reason I'm not able to get a few of these fields to return anything on any of the commands, and they're mostly simple fields that I wouldn't have expected to have issues with: Device Type Instrument Type (Inst Type) Fixture Mode GDTF Fixture Mode GDTF Fixture Wattage Purpose DMX Footprint (Num Channels) Time Cost Frame Size Weight Symbol Name Anybody else have any luck with these or some other insight? Quote Link to comment
tbexon Posted March 3, 2021 Share Posted March 3, 2021 (edited) So I I go about this a slightly different way. I'm not saying it's the correct way, or that there aren't better ways, but it atleast works for me! To get a Lighting Device parameter I simply do a GetRField() command on the objects 'Lighting Device' Parametric Record (which as far as i'm aware is attached to all Spotlight Lighting Devices) I did a test comparing both methods, and got the same results as you with LDevice_GetParamStr not returning Inst Type, however querying the record via GetRField did return the correct results. I also confirmed that LDevice_GetParamStr does work on some fields (such as Position). (Apologies it's written in Python Script rather than Vectorscript, but the results should be the same!) import vs field = 'Inst Type' handle = vs.FSActLayer() param = vs.LDevice_GetParamStr(handle, 0, -1, field) vs.AlrtDialog("Param: {}".format(param)) val = vs.GetRField(handle, 'Lighting Device', field) vs.AlrtDialog("Rec Val: {}".format(str(val))) It is strange that LDevice_GetParamStr doesn't return certain field (and some fairly critical fields one could argue) could this be a potential bug? @JBenghiat or @K.Lalkovski Have you come across this at all? Edited March 3, 2021 by tbexon Quote Link to comment
Vectorworks, Inc Employee K.Lalkovski Posted March 4, 2021 Vectorworks, Inc Employee Share Posted March 4, 2021 @tbexon I asked my colleagues @Yasen Aleksiev to look into this and answer you. 1 Quote Link to comment
Yasen Aleksiev Posted March 4, 2021 Share Posted March 4, 2021 (edited) Hello, everyone First things first, the help description in developer site was incomplete and has already been updated. With VW2021 we changed how we save Lighting Device Parameters, so that they can be multicell and/or multi accessory. To do that we introduced two new constants in our code - one for 'set all' cells or accessories when the value is set on Lighting Device or specified cell and the value of this constant is -1. Second constant is 'ignore accessories' and its value is -2. It's work only for accessories. For instance if you want to get Instrument Type of some Lighting Device you need to write: LDevice_GetParamStr(handle, 0, -2, "Inst Type") // 'Inst Type' is not milticell parameter so we should use indexes from range [0..cell_count - 1]. We should use -2 for accessory index, because we want to get Instrument Type of the Lighting Device, so we ignore accessories If you want to get Instrument Type of some accessory on your Lighting Device, for instance, on the first cell, 3th accessory, you need to write: LDevice_GetParamStr(handle, 0, 2, "Inst Type") // the indexes start from 0, on both cells and accessories. The first accessory of every cell is with index 0. And one last example: If you want to get milticell parameter, such as 'Purpose' and if you want to get it only for second cell(or every cell you want), you need to write: LDevice_GetParamStr(handle, 1, -2, "Purpose") // 1 is the index of the second cell, and -2 for ignore accessories 'Purpose' also is milti accessory parameter, so you can get purpose of every accessory on your Lighting Device like this: LDevice_GetParamStr(handle, cellIndex, accessoryIndex, "Purpose") Notice the constant -1 for cells is not supported for Get methods. For Set methods is the same, but with one more parameter for every function that is the new value. If you ask yourself what is the worksheet name of some parameter of the LightingDevice, you may find it in Spotlight Preferences -> Parameters -> Worksheet Name column. If you wonder which parameter is Multi-cell and which is Accessory, you may find this information at the same place, but the last two columns. Notice they aren't editable, so you can't change which parameter is Multi-cell and which is Accessory. Edited March 4, 2021 by Yasen Aleksiev 1 1 Quote Link to comment
tbexon Posted March 5, 2021 Share Posted March 5, 2021 Thanks Yasen, that makes sense. Quick follow up question, is there a way (via Vectorscript) to add parameters to the Lighting Device Parameter worksheet? Quote Link to comment
Vectorworks, Inc Employee klinzey Posted March 5, 2021 Vectorworks, Inc Employee Share Posted March 5, 2021 @tbexon You can not add parameters with Vectorscript or Python. It can be done with the C++ SDK. Quote Link to comment
tbexon Posted March 5, 2021 Share Posted March 5, 2021 I thought as much, are you aware of any handy guide or helpful threads that may point me in the right direction? (I can't say i've delved too far into the SDK yet) Quote Link to comment
AlHanson Posted March 5, 2021 Author Share Posted March 5, 2021 @Yasen Aleksiev Thanks for the correction and clarification to make this work. Very helpful! Quote Link to comment
Jiajing Posted February 23, 2023 Share Posted February 23, 2023 (edited) @klinzey is there a way I can read the parameter name by script. For instance, I change 'USER FIELD 1' name to 'PROJECT', is there a way I can read 'PROJECT' via script? Edited February 23, 2023 by Jiajing Quote Link to comment
Vectorworks, Inc Employee klinzey Posted February 23, 2023 Vectorworks, Inc Employee Share Posted February 23, 2023 GetLocalizedPluginParameter() will return the parameter name that is displayed to the user.https://developer.vectorworks.net/index.php/VS:GetLocalizedPluginParameter 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.