Jump to content
AlHanson

Get Device Parameters with LDevice_GetParam

Recommended Posts

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?

Share this post


Link to post
Posted (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 by tbexon

Share this post


Link to post
Posted (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.

SpotlightPreferencesParameters.thumb.png.ed90856d6be8c2f36467dcfbce611690.png

 

Edited by Yasen Aleksiev
  • Like 2
  • Love 1

Share this post


Link to post

Thanks Yasen, that makes sense.

 

Quick follow up question, is there a way (via Vectorscript) to add parameters to the Lighting Device Parameter worksheet?

Share this post


Link to post

@tbexon You can not add parameters with Vectorscript or Python. It can be done with the C++ SDK.

Share this post


Link to post

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)

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