Select Subfixtures

This grandMA3 LUA script allows easy selection of combinations of subfixtures.

The example above uses 5 parent fixtures, starting at FID 401. Selection starts with the first warm-white beam (subfixture #2: 401.2). The fixture in total has 24 subfixtures. Stepsize „2“ means the gap between selected subfixtures is „1“, every second subfixture is selected.
For some applications the parent fixture has to be selected either. Just select the checkbox.

Download LUA script


-- Messagebox code from Hoss at
-- https://forum.malighting.com/forum/thread/5913-lua-messagebox-and-var/

-- Stefan Krumm, 20231103
-- tutorials@stkrumm.de
-- https://stkrumm.de/grandma3-tutorial/




function BOX()
    local options = {
        title="Select subfixtures",         --string
        backColor="Global.Focus",           --string: Color based on current theme.
        messageTextColor=nil,               --int|string
        message="Please enter values",      --string
        display= nil,                       --int? | handle?
        
        inputs={
            {name="1:   Parent FID                 ", value="401", blackFilter="", whiteFilter="0123456789", vkPlugin="TextInputNumOnly", maxTextLength = 6},
            {name="2:   No. of fixtures       ", value="5", blackFilter="", whiteFilter="0123456789", vkPlugin="TextInputNumOnly", maxTextLength = 6},            
            {name="3:   First child                ", value="2", blackFilter="", whiteFilter="0123456789", vkPlugin="TextInputNumOnly", maxTextLength = 6},
            {name="4:   No. of subfixtures", value="24", blackFilter="", whiteFilter="0123456789", vkPlugin="TextInputNumOnly", maxTextLength = 6},
            {name="5:   Step size                ", value="2", blackFilter="", whiteFilter="0123456789", vkPlugin="TextInputNumOnly", maxTextLength = 6},
        },
        states={{state=false, name="Select also parent fixture "}},
        commands={{value=1, name="O K"}}
    }
    
    local messageBoxResult = MessageBox(options);   
    
    local startfix = tonumber(messageBoxResult["inputs"]["1:   Parent FID                 "])
    local endfix = tonumber(messageBoxResult["inputs"]["2:   No. of fixtures       "]) + startfix -1
    local startchild = tonumber(messageBoxResult["inputs"]["3:   First child                "])
    local numchild = tonumber(messageBoxResult["inputs"]["4:   No. of subfixtures"])
    local stepchild = tonumber(messageBoxResult["inputs"]["5:   Step size                "])
    
   
      
    for i = startfix, endfix, 1
	do
	   if messageBoxResult["states"]["Select also parent fixture "] then
	       Cmd("Selfix Fixture " .. i  ) 
	   end
	    
	    for k = startchild, numchild, stepchild 
	    do
	        Cmd("Selfix Fixture " .. i .. "." .. k  )
	    end
   end
  
    
end

return BOX

,