Sounds like the same action as an old-fashioned ball-point pen: press to extend pen nib, press again to retract it. Inside is a little plastic rotary cam, and a spring. The same action is available in commercial push-button switches.
@Minder has recommended one line and brand that may suit your purposes. Why not purchase one and see if it can be adapted to your requirements?
Visit this page to find a distributor on an online re-seller.
The action that occurs when a block is inserted is not compatible with a push-on, push-off type of switch action. If I understand you correctly, you want the switch to rise up and de-actuate when the block is removed. That is the mode of operation for a standard push-on, release-off switch. It is not going to happen with push-on, push-off mechanical action. After removing the block, the switch actuator would rise up but the switch would remain actuated, just as it did if a finger pressed and released it. To get both actions, which are fundamentally different for finger-press versus block press, you need to use those two male legs to identify whether a finger or block is pressing the switch. Having distinguished between the two modes of operation, you can respond appropriately.
I would suggest you use
two switches to identify the mode of operation: a first switch, actuated by the male legs on a block, and a second switch
(the visible part of the array of switches) actuated by
either a finger
or the block. A normal SPDT push-button switch with push-on, release-off action would be used at all positions within the grid, including the male leg-sensing switches which would be hidden behind the switch panel. However, the response to grid switch actuation would depend on the actuation method. If finger-actuated, an external circuit would implement push-on, push-off, operation. If block-actuated, the switch responds as a normal press-on, release-off, push-button switch.
It could be desirable to have a lighted push-button switch, unless an external display shows which switches have been actuated., The light would illuminate if the switch is "actuated" and would be un-illuminated if the switch is "de-actuated" by a second button-press or removal of a previously inserted block. A lighted switch allows the operator to determine if a finger-actuated switch has been actuated. The presence of the light for a block-actuated switch would not be very useful unless the block is either transparent or translucent, allowing an illuminated switch to be visible.
If you go with this "two switch" design (and I think you should), small push-on, release-off, push-button switches are available in very small sizes, mostly without illumination, but some have small LEDs built into the button. External circuitry to convert this type of switch to push-on, push-off, operation is simple: a D-type flip-flop that alternates its output state each time the switch is pressed and released will do the job. If the switch array is largeish, that would require a lot of flip-flops. It would then be better to use a microprocessor to scan the switch states. Note, since more than one switch or block will be actuated at any given time, a matrix approach to switch identification is not practical. However, if you apply the outputs of the entire array of switches to N-line multiplexors, where N is usually 8, 10, or 16, you can use as many multiplexors as needed to scan all the switches. For example, sixteen bits from the microprocessor can address 65.536 switches (a 256 x 256 switch array) if needed.
Finally, the switch that senses when a block is inserted does not necessarily have to be the same as the main push-button switch. It doesn't even have to be a switch if the "male legs" are something like banana plugs or phone plugs that mate with two receptacles. The blocks would have a small conductor connecting the two legs, and the two receptacles would provide a continuity path to sense their presence, or perhaps (if phone jacks) have contacts that open a continuity path when a plug is inserted, requiring only a passive "male leg" to mechanically operate the receptacle switch. There are very small banana plugs and phone plugs and mating receptacles available. The cost is probably comparable or less than the cost of a push-button switch actuated by one male leg.
Hmmm. This sounds like it could be adapted as an electrical version of the "Battleship" game, the blocks representing ships and the free buttons being used for "shots". Problem with that would be how to "fire" a shot aimed where one of your ships is since that will be occupied by your own block. So, never mind about that. Can you tell us what this project is
really for? Don't want you to compromise patent-ability by public disclosure, but I
am curious.
Hop
.