Jump to content
Sam Jones

How do I get the symbol name of an attached accessory

Recommended Posts

How do I get the symbol name of an accessory that is attached to a light at a given cell index and accessory index?  There does not seem to be a parameter to query.

Share this post


Link to post

I just ran a test using LDevice_GetParamStr(<handle to light>,<cell index>,<accessory index>,'Symbol Name') and was able to successfully get the symbol name of an attached accessory.  The LDevice_GetParam series uses the standard Lighting Device parameter names in for the "universalName" listings in the Function Reference, so if you have a list of the Lighting Device parameters handy, you should be able to get all the parameters you need.

Share this post


Link to post
19 minutes ago, Jesse Cogswell said:

so if you have a list of the Lighting Device parameters handy, you should be able to get all the parameters you need.

 

Thank you for the pointer.  I will try it out, however.  Below is the list of LD parameters that I have and no where does the syntax that are using shows up.  Where is "cell index", "accessory index", and "Symbol Name".  I can use "Symbol Name to get the symbol name of the lighting device that has accessories.

Though I haven't tried it yet, I'm confident that your use of ...GetParamStr works, but how did you think to use it in the way that you did, because to me there is not hint about doing that that I can derive from the LD parameter list.

 

Lighting Device
Universal
Device Type
Inst Type
Edit Cell
Edit Accessory
FixtureID
Old Inst Type
Gobo Data
Color Data
Color Flag Data
Fixture Mode
Old Fixture Mode
Vision Lit Override
Vision Fixture Name
GDTF Fixture Name
GDTF Fixture Mode
GDTF Fixture Type ID
GDTF Fixture Custom ID
GDTF CIE Color
Wattage
Purpose
Position
Unit Number
Color
Dimmer
Absolute Address
Channel
UniverseAddress
Universe
DMX Address
Num Channels
Circuit Number
Circuit Name
System
User Field 1
User Field 2
User Field 3
User Field 4
User Field 5
User Field 6
Voltage
Breaker ID
Time
Cost
Frame Size
Field Angle
Field Angle 2
Beam Angle
Beam Angle 2
Weight
Template
TemplateRot1
Template2
TemplateRot2
Gobo Shift
Mark
Draw Beam
Draw Beam as Solid
Use Vertical Beam
Show Beam at
Fall off distance
Lamp Rotation Angle
Top Shutter Depth
Top Shutter Angle
Left Shutter Depth
Left Shutter Angle
Right Shutter Depth
Right Shutter Angle
Bottom Shutter Depth
Bottom Shutter Angle
Light On
Lit Fog
Brightness
Symbol Name
Use Legend
Legend View 3D
Flip 3D Top Bottom
Flip 3D Left Right
Rotate 3D Legend
Flip Front Back
Flip Left Right
Focus
Pan
Tilt
Throw Distance
Rotate3DPosition
xRot
yRot
EnableZRot
zRot
zRot2D
Focus Angle Vertical
Focus Angle Horizontal
Angle To Face Plane
Off Axis Angle
ShowData
Ganged With
Use Active Symbol
ControlPoint01X
ControlPoint01Y
ControlPoint02X
ControlPoint02Y
ControlPoint03X
ControlPoint03Y
ControlPoint04X
ControlPoint04Y
ControlPoint05X
ControlPoint05Y
ControlPoint06X
ControlPoint06Y
ControlPoint07X
ControlPoint07Y
ControlPoint08X
ControlPoint08Y
X Location
Y Location
Z Location
Do Not Edit
Alt-Chan
Alt-Dim
Alt-Unit
Alt-Circ
Is New
__Version
NoExport
Lightwright ID
RGBColor
UID
__CommPasteName
__LabelHandlesData
__LabelHandles3DData
__CellsCount
__AccessoriesCount
Dimension
UseGDTFGeometry
WeightDouble
Edit GDTF Data
 

Share this post


Link to post

It's tricky, since there doesn't seem to be a script to get a handle to an attached accessory, but that doesn't matter in this case.  The Function Reference continues to be rather dreadful, so it took some trial and error to get the information I needed.  The Function Reference doesn't break down the passed variables its looking for the LDevice_GetParam commands, but the description says, "Get parameter of a Lighting Device or attached Accessory by Worksheet Name.  Use cell index 0 to operate on the first cell.  Use accessory index -1 to access the lighting device parameters."

 

That's not super clear, but what I got from it is that accessoryIndex is 0-based with -1 then being used to get the parameter from the parent Lighting Device.  Worksheet Name keyed me in to look at the Spotlight Parameters in Document Settings - Spotlight Preferences since that's the name of the List Browser column that displays the "universal" name.  I have a bunch of plug-ins and scripts that reference a Lighting Device's symbol, so I also knew that the universal name would be "Symbol Name" (which also appears in your list of parameters above, halfway down between "Brightness" and "Use Legend").

Share this post


Link to post

What is odd is that I just looked up the Developer Wiki and it directly contradicts the Script Function Reference included in the VWHelp folder by saying that "accessory index -1 is not supported by Get," so instead you pass -2 as the accessory index to get to the parent Lighting Device.  Neat.

Share this post


Link to post
8 minutes ago, Jesse Cogswell said:

I also knew that the universal name would be "Symbol Name" (which also appears in your list of parameters above, halfway down between "Brightness" and "Use Legend").

 

First of all I'm super glad that you found away to get the symbol name of the accessory, but the symbol name that you reference above and that I reference in the lighting device parameter list is the symbol used by the lighting device that has the accessory not the accessory.  GetRField(ObjHandle, 'Lighting Device', 'Symbol Name').  Once I test it, I will use what you have figured out to reference bunch of stuff (I hope).

Share this post


Link to post

That's what passing the accessory index in to the LDevice_GetParam code is for, to get to the parameters of the accessory's Lighting Device object since you can't get a handle to use the GetRField(ObjHandle, 'Lighting Device', 'Symbol Name') like you normally would.

 

The test code that I used is below:

PROCEDURE GetAccessorySymbol;

VAR

	numAcc:LONGINT;
	blah:STRING;
	lightHd:HANDLE;

BEGIN
	lightHd:=FSObject(ActLayer);
	numAcc:=LDevice_GetAccCount(lightHd,0);
	blah:=Concat('Lighting Device Symbol: ',LDevice_GetParamStr(lightHd,0,-2,'Symbol Name'));
	
	IF(numAcc>0) THEN blah:=Concat(blah,' | Accessory Symbol: ',LDevice_GetParamStr(lightHd,0,0,'Symbol Name'));
	
	Message(blah);
END;

Run(GetAccessorySymbol);

 

Share this post


Link to post

Glad you figured it out.  To me, it was the a question of "Universal Name" of what since I would be passing the handle to the lighting device and not the accessory. 

Good for you, and thanks.

 

Share this post


Link to post

Don't get me wrong, it truly baffles me that they didn't just add a GetLDeviceAccessory function that passes in a handle to the Lighting Device, a cell index, and an accessory index and returns a handle to the accessory and let us use the existing functions to get at its parameters.  I mean, in one sense the new LDevice_GetParams allow for the same code to be used on fixtures, fixture cells, and accessories, but it does seem a bit backward and is not very well explained at all in the Function Reference.

Share this post


Link to post

For 2021, there is no separate accessory object. There are objects that represent the accessory geometry, but the data stores in a data structure attached to the lighting device. So there really is no handle to an accessory any more. 
The new function call looks at the data structure attached to the lighting device and retrieves data by cell index, accessory index, and field name. 
If you want to see which fields can hold discrete data for cells and accessories, open Spotlight preferences and look at the parameter list. The two right columns of check marks show which data can be discrete. 

Share this post


Link to post

Josh,  and perhaps Vlado and Kevin could way in,

 

Paragraph 1
I get the concept

 

Paragraph 2 brings up a set of questions.


Question 1
Does this mean that the "LDevice_GetParamStr()" calls can be substituted for the "GetRField()" calls wherever there is a check mark in the "Multi-cell" or "Accessory" columns?


Question 2
Would the following be true?
"LDevice_SetParamStr(FixtureHandle, -1, -2, 'Breaker ID', '34');"
and
"SetRField(FixtureHandle, 'Breaker ID', '34');"
are both syntactically correct
and
are effectively the same statements

 

Question 3
Does an ETC Source 436 fixture have 1 cell whose index would be 0?

 

Question 4
If so, when considering an ETC Source 436 fixture are the following statements syntactically valid and effectively equivalent?
"LDevice_SetParamStr(FixtureHandle, -1, -2, 'Breaker ID', '34');"
"LDevice_SetParamStr(FixtureHandle, 0, -2, 'Breaker ID', '34');"
"SetRField(FixtureHandle, 'Breaker ID', '34');"

 

Question 5
If not, why not?

 

Question 6
What does "LDevice_ReleaseRes;" do?

 

Question 7 (4 parts)
What does the following do?
LDevice_DlgResource(
                LayoutID     :INTEGER;
                ControlID    :INTEGER;
                SymbolName   :STRING);
what layout?
what control?
symbolName of what?

Share this post


Link to post

@JBenghiat I see.  I guess I had assumed that it was still a Lighting Device object, just embedded directly into the geometry of the PIO since the Lighting Device object can still have a Device Type of Accessory or Static Accessory.   So is the Lighting Device Accessory object selectable in the Edit Accessory mode just a temporary construct that exists solely when in that mode?  I see that it doesn't have any dedicated parameters listed in the Plug-in Manager.

Share this post


Link to post
12 hours ago, Sam Jones said:

Question 1
Does this mean that the "LDevice_GetParamStr()" calls can be substituted for the "GetRField()" calls wherever there is a check mark in the "Multi-cell" or "Accessory" columns?

Yes

12 hours ago, Sam Jones said:

Question 2
Would the following be true?
"LDevice_SetParamStr(FixtureHandle, -1, -2, 'Breaker ID', '34');"
and
"SetRField(FixtureHandle, 'Breaker ID', '34');"
are both syntactically correct
and
are effectively the same statements

Assuming you would want the breaker ID to apply to all cells in a multi-cell, yes. I’m actually not sure what would happen if you have discrete data in Beaker ID and then call SetRField.

 

12 hours ago, Sam Jones said:

 

Question 3
Does an ETC Source 436 fixture have 1 cell whose index would be 0?

 

Yes. Using a cell index of -1 and 0 is effectively the same for a one cell lighting device.

 

12 hours ago, Sam Jones said:

Question 4
If so, when considering an ETC Source 436 fixture are the following statements syntactically valid and effectively equivalent?
"LDevice_SetParamStr(FixtureHandle, -1, -2, 'Breaker ID', '34');"
"LDevice_SetParamStr(FixtureHandle, 0, -2, 'Breaker ID', '34');"
"SetRField(FixtureHandle, 'Breaker ID', '34');"

 

Yes

 

12 hours ago, Sam Jones said:

Question 6
What does "LDevice_ReleaseRes;" do?

 

No idea, but it’s from 2019, so not relevant to the data discussion. I think it relates to your next question.

 

12 hours ago, Sam Jones said:

 

Question 7 (4 parts)
What does the following do?
LDevice_DlgResource(
                LayoutID     :INTEGER;
                ControlID    :INTEGER;
                SymbolName   :STRING);
what layout?
what control?
symbolName of what?

 

No idea what this does, but Layout is a dialog ID and Control is an item in the dialog. My guess is this fills a symbol resource picker with eligible lighting device symbols and selects SymbolName.

 

7 hours ago, Jesse Cogswell said:

@JBenghiat I see.  I guess I had assumed that it was still a Lighting Device object, just embedded directly into the geometry of the PIO since the Lighting Device object can still have a Device Type of Accessory or Static Accessory.   So is the Lighting Device Accessory object selectable in the Edit Accessory mode just a temporary construct that exists solely when in that mode?  I see that it doesn't have any dedicated parameters listed in the Plug-in Manager.

 

Anything in the edit mode is just there for editing. I can’t remember if the accessory objects are PIOs or if the objects just have a special object info display (like text in Data Tags or Title Blocks). The edit objects get created at edit time, and then the data, location, and orientation write back to the Lighting Device on exit.

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