There is no such thing as axis enable outputs. There are motor enable outputs. The concept is that motors are attached to some sort of drive that needs to be enabled. No axis is connected to any such creature. Enabling an axis is basically telling the G code interpreter that the enabled axis is ok to use in G code. if the axis is not enabled and it is used in G code, the interpreter will balk.
The enable button is enabling the control and the motors. So if that is what you want to duplicate, that API call is:
mc.mcCntlEnable(inst, 1) -- enable
mc.mcCntlEnable(inst, 0) -- enable
There is no code in the enable button itself. It is simply a toggle button with the up and down positions tied to the stock action of "Enable On" and "Enable Off" Open your screen in the editor and click on the enable button. Then in the properties window, click on the little lightening bolt button to switch from the properties view to the events view. Here you will see how the enable button is setup.
But basically, the stock action of "Enable On" is equivalent to mc.mcCntlEnable(inst, 1) and "Enable Off" is equivalent to mc.mcCntlEnable(inst, 0).
To keep someone from pressing the enable button unless some inputs are activated, all you need to do is "disable" the enable button.
You do that with the Enabled property and scr.SetProperty() screen API function.
scr.SetProperty(cntlName, propertyName, value)
where:
cntlName is the value of the "Name" propert of the enable button. In my scree, the enable button is "tbutton2".
propertName is the name of the property that you wish to modify. "Enabled" in this case.
value is what you want to set the property to. It is always a string value. Use "0" for disable and "1" for enable.
scr.SetProperty("tbutton2", "Enabled", "0") -- to disable the button so that a user cannot press it.
scr.SetProperty("tbutton2", "Enabled", "1") -- to enable the button so that a user can press it.
So now you need to tie that all together in the screen load, possible the signal library, or the PLC script. The button should be disabled initially in the screen load script. Next, the idea is to see if all of the conditions are there for the button to be enabled, or not, and set the Enabled property appropriately in the PLC or signal lib.
Steve