Colour Mixing in Avolites WebAPI

Discussion and chat related to developing interfaces to the Titan software using the web API.

Moderator: Moderators

User avatar
Olie
Site Admin
Posts: 456
Joined: 11 Feb 2004, 15:24
Location: London
Contact:

Colour Mixing in Avolites WebAPI

Postby Olie » 23 May 2017, 15:28

I have now been asked a couple of times how you might achieve colour mixing through the WebAPI interface. So I have put together this short guide on how you can control fixture attributes through the WebAPI. It also contains bits that are necessary but not documented so is well worth a read. Although this is aimed at colour mixing the same principals will work for any fixture controls.

The method for adjusting the fixture attributes is similar to the console. First you must select the fixtures, then you adjust the attribute values and finally you record the programmer contents. However please take note that the WebAPI is its own user with its own programmer and selection. So if you select some fixtures using the WebAPI and expect that selection to appear on the console you will be disappointed. The fixtures are selected but within their own environment that is separate from the console. It is the same as having a multi user console and having someone else operating it.

So to get started you need to have some LED fixtures patched such as the Robe 100 LED Beams in Mode 1 and my guide assumes you are using a mobile and running the commands on the same PC. If you are using a console replace localhost with the IP address of the console. The guide is done using V10.1.
The first thing you need to do is select fixtures using the command:

http://localhost:4430/titan/script/2/Selection/Context/SelectFixture?handle_userNumber=2

This will select the fixture with the user number 2. Well if you have tried this on V10.1 you have discovered that it returns an error and does not select the fixture. In fact there is a bug where allot of the fixture selection commands won’t work with the syntax handle_userNumber=?. So we have to do a bit more work to select our fixture.

Now run the command:

http://localhost:4430/titan/handles/Fixtures

you should see something that looks a bit like this returned:

[
{
"handleLocation": {
"group": "Fixtures",
"index": 0,
"page": 0
},
"properties": [{"Key": "lockState","Value": "Unlocked"}],
"titanId": 1836,
"type": "fixtureHandle",
"Active": false,
"Legend": ""
,"Selected": false},

I am using the Chrome plugin JSON Formatter to make it look pretty but you should still be able to pick out the Titan Id which in this case is 1836.
Now we can select the fixture again but in this case using the Titan Id:

http://localhost:4430/titan/script/2/Selection/Context/SelectFixture?handle_titanId=1836

The result from this is nothing, which is a good thing as if there was an error you would see a return. For the moment you will have to take my word that the fixture is selected.

However selecting fixtures individually is very tedious so let’s use groups to make life simpler. As before the following won’t work in V10.1 but will work in future updates.

http://localhost:4430/titan/script/2/Group/RecallGroup?handle_userNumber=2

So query all the groups and extract the Titan Id:

http://localhost:4430/titan/handles/Groups

Then call the recall group function to select the fixtures in the group.

http://localhost:4430/titan/script/2/Group/RecallGroup?handle_titanId=1876

Still though the fixtures are only selected inside the WebAPI and there is nothing to see yet. If we now locate the fixtures you will see those fixtures output to the stage.

http://localhost:4430/titan/script/2/Programmer/Editor/Fixtures/LocateSelectedFixtures?allAttributes=true

This function locates all the attributes of the selected fixtures. Before I move on to changing the attribute values I am quickly going to show you the two functions to clear the selection and both programmer and selection.

http://localhost:4430/titan/script/2/Playbacks/Selection/Clear

This will clear just the selection leaving any programmer content behind. This is useful when coding as it ensures the selection starts from nothing selected.

http://localhost:4430/titan/script/2/Programmer/Editor/ClearAll

This will clear everything in a similar manner to the clear button on the console.

Now we move onto actually changing the attribute values, first remember to run the recall group command again so we have some fixtures selected. There is one command for changing all attribute values and depending on the parameters you will effect different attributes.

The following command can be used to set the Dimmer level of the selected fixtures.

http://localhost:4430/titan/script/2/Programmer/Editor/Fixtures/SetControlValueById?controlId=16&functionId=1&value=0.5&programmer=true&createRestorePoint=true

Please notice that this command has three special parameters controlId, functionId and value.

controlId = this is a special ID assigned by the Titan system and references the specific attributes within a fixture. There are a number of fixed ID’s which I have listed below and relate to common attributes. Some are specifically created depending on the fixture type. For the purposes of this guide we only need to refer to the fixed ID’s. In this example the control ID is 16 which is for dimmer.

functionId = the function ID is defined by the personality but normally starts from 1 and indexes each function in a personality. In the case of dimmer it only has a single function and so we set this to 1.

value = this is a value between zero and one where one is normally full. It sets the range level of the selected function.
So in this example we set the dimmer controls first function to 50%. If we were changing Gobo then you might assign function ID 4 and ignore the value parameter as it does not have any ranges.

As we now know how to set the level of any attribute in a fixture we can use this knowledge to change the colour of an RGB fixture and start colour mixing. Here are the functions you need to call.

Set Red to 50%
http://localhost:4430/titan/script/2/Programmer/Editor/Fixtures/SetControlValueById?controlId=240&functionId=1&value=0.5&programmer=true&createRestorePoint=true

Set Green to 50%
http://localhost:4430/titan/script/2/Programmer/Editor/Fixtures/SetControlValueById?controlId=256&functionId=1&value=0.5&programmer=true&createRestorePoint=true


Set Blue to 50%
http://localhost:4430/titan/script/2/Programmer/Editor/Fixtures/SetControlValueById?controlId=272&functionId=1&value=0.5&programmer=true&createRestorePoint=true

I hope you have fun with your new life in technicolour.

public enum FixtureControlId
{
/// <summary>
/// The intensity control of a fixture.
/// </summary>
Dimmer = 0x10,
/// <summary>
/// The horizontal position control for a fixture.
/// </summary>
Pan = 0x20,
/// <summary>
/// The Vertical position control of a fixture.
/// </summary>
Tilt = 0x30,
/// <summary>
/// Cyan component used in subtracted colour mixing
/// </summary>
Cyan = 0x40,
/// <summary>
/// The amount of cyan in the output colour of a fixture.
/// </summary>
CyanAdditive = 0x41,
/// <summary>
/// Magenta component used in subtracted colour mixing
/// </summary>
Magenta = 0x50,
/// <summary>
/// The amount of magenta in the output colour of a fixture.
/// </summary>
MagentaAdditive = 0x51,
/// <summary>
/// Yellow component used in subtracted colour mixing
/// </summary>
Yellow = 0x60,
/// <summary>
/// The amount of yellow in the output colour of a fixture.
/// </summary>
YellowAdditive = 0x61,
/// <summary>
/// The amount of red in the output colour of a fixture.
/// </summary>
Red = 0xf0,
/// <summary>
/// The amount of green in the output colour of a fixture.
/// </summary>
Green = 0x100,
/// <summary>
/// The amount of blue in the output colour of a fixture.
/// </summary>
Blue = 0x110,
/// <summary>
/// The amount of Amber in the output colour of a fixture.
/// </summary>
Amber = 0x111,
/// <summary>
/// The amount of White in the output colour of a fixture.
/// </summary>
White = 0x112,
/// <summary>
/// The amount of Warm White in the output colour of a fixture.
/// </summary>
WarmWhite = 0x113,
/// <summary>
/// The amount of Cold White in the output colour of a fixture.
/// </summary>
ColdWhite = 0x114,
/// <summary>
/// Colour temperature correction channel.
/// </summary>
CTO = 0x115,
/// <summary>
/// UV Colour Channel
/// </summary>
UV = 0x116,
/// <summary>
/// Lime Colour Channel
/// </summary>
Lime = 0x117,
/// <summary>
/// Colour wheel 1
/// </summary>
Colour1 = 0x70,
/// <summary>
/// Colour wheel 2
/// </summary>
Colour2 = 0x80,
/// <summary>
/// Gobo wheel 1
/// </summary>
Gobo1 = 0x90,
/// <summary>
/// Gobo wheel 2
/// </summary>
Gobo2 = 0xa0,
/// <summary>
/// Gobo wheel 1 rotation
/// </summary>
Gobo1Rotate = 0xb0,
/// <summary>
/// Gobo wheel 2 rotation
/// </summary>
Gobo2Rotate = 0xc0,
/// <summary>
/// Fixture iris
/// </summary>
Iris = 0xd0,
/// <summary>
/// Fixture focus
/// </summary>
Focus = 0xe0,
/// <summary>
/// Fixture Zoom
/// </summary>
Zoom = 0xe1,
/// <summary>
/// Keystone top left x
/// </summary>
KeystoneTopLeftX = 0x130,
/// <summary>
/// Keystone top left Y
/// </summary>
KeystoneTopLeftY = 0x140,
/// <summary>
/// Keystone top right x
/// </summary>
KeystoneTopRightX = 0x150,
/// <summary>
/// Keystone top right y
/// </summary>
KeystoneTopRightY = 0x160,
/// <summary>
/// Keystone bottom right x
/// </summary>
KeystoneBottomRightX = 0x170,
/// <summary>
/// Keystone bottom right y
/// </summary>
KeystoneBottomRightY = 0x180,
/// <summary>
/// Keystone bottom left X
/// </summary>
KeystoneBottomLeftX = 0x190,
/// <summary>
/// Keystone bottom left Y
/// </summary>
KeystoneBottomLeftY = 0x1a0,
/// <summary>
/// Position of the top keystone edge
/// </summary>
Keystone1 = 0x2e0,
/// <summary>
/// Position of the right keystone edge
/// </summary>
Keystone2 = 0x2f0,
/// <summary>
/// Position of the bottom keystone edge
/// </summary>
Keystone3 = 0x300,
/// <summary>
/// Position of the left keystone edge
/// </summary>
Keystone4 = 0x310,
/// <summary>
/// Rotation of the top keystone edge
/// </summary>
Keystone1Rotation = 0x320,
/// <summary>
/// Rotation of the right keystone edge
/// </summary>
Keystone2Rotation = 0x330,
/// <summary>
/// Rotation of the bottom keystone edge
/// </summary>
Keystone3Rotation = 0x340,
/// <summary>
/// Rotation to the left keystone edge
/// </summary>
Keystone4Rotation = 0x350,
/// <summary>
/// Top blade left corner
/// </summary>
BladeTopLeft = 0x1b0,
/// <summary>
/// Top blade right corner
/// </summary>
BladeTopRight = 0x1c0,
/// <summary>
/// Right blade top corner
/// </summary>
BladeRightTop = 0x1d0,
/// <summary>
/// Right blade bottom corner
/// </summary>
BladeRightBottom = 0x1e0,
/// <summary>
/// Bottom blade right corner
/// </summary>
BladeBottomRight = 0x1f0,
/// <summary>
/// Bottom blade left corner
/// </summary>
BladeBottomLeft = 0x200,
/// <summary>
/// Left blade bottom corner
/// </summary>
BladeLeftBottom = 0x210,
/// <summary>
/// Left blade top corner
/// </summary>
BladeLeftTop = 0x220,
/// <summary>
/// Blade 1 position
/// </summary>
Blade1 = 0x230,
/// <summary>
/// Blade 2 position
/// </summary>
Blade2 = 0x240,
/// <summary>
/// Blade 3 postion
/// </summary>
Blade3 = 0x250,
/// <summary>
/// Blade 4 position
/// </summary>
Blade4 = 0x260,
/// <summary>
/// Blade 1 Rotation
/// </summary>
Blade1Rotation = 0x270,
/// <summary>
/// Blade 2 Rotation
/// </summary>
Blade2Rotation = 0x280,
/// <summary>
/// Blade 3 Rotation
/// </summary>
Blade3Rotation = 0x290,
/// <summary>
/// Blade 4 Rotation
/// </summary>
Blade4Rotation = 0x2a0,
/// <summary>
/// Blade system overall rotate
/// </summary>
BladeAllRotation = 0x2b0,
/// <summary>
/// Keystone x ratio
/// </summary>
KeystoneXRatio = 0x2c0,
/// <summary>
/// Keystone y ratio
/// </summary>
KeystoneYRatio = 0x2d0,
/// <summary>
/// Image Size
/// </summary>
ImageZoom = 0x380,
/// <summary>
/// Aspect Ratio
/// </summary>
AspectRatio = 0x381,
/// <summary>
/// Aspect Mode
/// </summary>
AspectMode = 0x382,
/// <summary>
/// MTC Hour
/// </summary>
MTC_Hour = 0x383,
/// <summary>
/// MTC Minute
/// </summary>
MTC_Minute = 0x384,
/// <summary>
/// MTC Second
/// </summary>
MTC_Second = 0x385,
/// <summary>
/// MTC Frame
/// </summary>
MTC_Frame = 0x386,
/// <summary>
/// Play Mode
/// </summary>
Play_Mode = 0x387,
/// <summary>
/// Play Speed
/// </summary>
Play_Speed = 0x388,
/// <summary>
/// In Point
/// </summary>
In_Point = 0x389,
/// <summary>
/// Out Point
/// </summary>
Out_Point = 0x38a,
}
Avolites Software Team

Who is online

Users browsing this forum: No registered users and 18 guests