OnOffAttributeSelected

This is a place for people to chare the custom macros they have written.

Moderator: Moderators

User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

OnOffAttributeSelected

Postby sideshowbond » 05 Nov 2018, 10:45

http://api.avolites.com/11.0/Programmer.Editor.Fixtures.OnOffAttributeSelected.html

Code: Select all

Programmer.Editor.Fixtures.OnOffAttributeSelected(MenuItem item, Boolean on)

I am trying to figure out how to set attribute values either on or off using a coded macro. I came across the function in the link however I can't figure out what MenuItem is meant to be. I figured Titan is expecting a string of sorts but no idea what exactly.

Any help would be great, thanks :)
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: OnOffAttributeSelected

Postby Gregory » 05 Nov 2018, 13:22

MenuItem refers to one of the softkey menu options, specifically in this case it is one of the attribute softkeys shown when you press the Off button. When you press the softkey in the menu it calls this function passing in a reference to itself, from this it determines which attribute was selected. This is not something that it practical to use in your own macros, instead you should consider the SetControlOff* function.

Code: Select all

Group.RecallGroup(userNumber:1)
Programmer.Editor.Fixtures.SetControlOff(Programmer.Editor.Fixtures.GetControlIdFromName("Shutter"))

Above I have also used the GetControlIdFromName function to get the control/attribute ID which SetControlOff takes as a parameter, some of these are pre-defined such as Dimmer being 16 however many others are not.

To remove the Off flag you can call SetControlProgrammer, if the programmer parameter is set to true it will leave/put the value in the programmer (and remove the Off flag if there is one), if it is set to false the attribute will be cleared.

Code: Select all

Group.RecallGroup(userNumber:1)
Programmer.Editor.Fixtures.SetControlProgrammer(Programmer.Editor.Fixtures.GetControlIdFromName("Shutter"), true)


To turn an attribute on you need to first select the attribute you want to change and then run the SetSelectedControlsOn function:

Code: Select all

Group.RecallGroup(userNumber:1)
Programmer.Editor.Fixtures.SetContextAttributeFromId(Programmer.Editor.Fixtures.GetControlIdFromName("Shutter"))
Programmer.Editor.Fixtures.SetSelectedControlsOn(true)

Pass in true to set the flag, false to remove it. If you prefer there is a matching SetSelectedControlsOff function that you can use in the same way.

* Internally attributes are referred to as controls so the two terms are sometimes used interchangeably.
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: OnOffAttributeSelected

Postby sideshowbond » 06 Nov 2018, 17:59

great, thank you. This is to set specific attributes on or off, right? How would I go about an attribute group? I mean I got that as a recorded macro which works perfectly fine yet I am curious.
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: OnOffAttributeSelected

Postby Gregory » 06 Nov 2018, 18:16

Yes, the previous examples were for an individual attribute, try the example below for one or more attribute groups:

Code: Select all

Group.RecallGroup(userNumber:1)
Attribute.Mask.SetMask("OnOff", "IP")
Programmer.Editor.Fixtures.OnOffFixtureControls(false)

The IP can be any combination of the IPCGBES letters, the parameter for OnOffFixtureControls should be false to turn the attributes off and true to flag them as on.
User avatar
sideshowbond
Posts: 182
Joined: 18 Nov 2016, 20:58

Re: OnOffAttributeSelected

Postby sideshowbond » 06 Nov 2018, 20:11

Brilliant, thank you!

Is there a list of the different maskIds?
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: OnOffAttributeSelected

Postby Gregory » 12 Nov 2018, 22:03

There isn't a published list as such however each mask has a set of functions for it so if you look in the documentation for anything of the form: Attribute.Mask.<MaskId>.SetSoloAttribute.

Here is a brief description of them:
Patch: Used in the attribute invert, freeze, curve, limit and offset menus.
EditTimes: Setting attribute group times in Edit Times.
OnOff: Turning attributes on or off in the programmer.
OnOffPlayback: Turning attributes on or off in a playback.
TempRelease: Temporary release mask used when releasing a playback using the Release button.
Release: The release mask for a playback in Playback Options.
Clear: The mask to use when clearing the programmer.
Update: Mask used for the Update function.
Record: The mask used when recording playbacks.
Align: Mask used in the Align menu.
Include: Attribute groups used when including a playback.
Locate: The mask used when holding down the locate button.
Highlight: Mask used when storing a new highlight or lowlight value.
GlobalRelease: The Global Release Mask.
Palette: The mask used when recording palettes.

Who is online

Users browsing this forum: No registered users and 21 guests