The program LTSpice allows to use a switch controlled by current of independent source. The symbolic name of this switch is CSW, and its file name is csw.asy. In the Component Selection window (press F2 button in the main screen to get there) this switch is located in the root directory:
Place this component in the circuit, click on then by the Right Mouse Button, fill the field "Value" as shown in Figure below:
Add the parameters "VSensor TheSwitch" to this field. This is arbitrary names, the first one ("VSensor") describes parameters of the current sensor, the second parameter ("TheSwitch") describes the contacts parameters of the switch (it will be explained later). Press "OK", and complete the schematic as shown in Figure below:
In this circuit diagram the capacitor C1 charges through the resistor R2 (the resistor R1 doesn't count because it shunted by the terminals "A" and "B" of the current sensor with zero resistance). When the current in the network C1R2R1 gets some value (in this example 15 mA), the switch W1 will closed, so the voltage at the output OUT of the circuit will be zero.
The circuit diagram comprises three terminals - "A", "B" and "OUT".
Also this circuit diagram needs some SPICE directives:
The first directive (.tran 0 3 0 0.00001 startup) determines type of analysis (a Nonlinear Transient Analysis, time = 3 sec, Timestep = 0.00001 sec, Start external DC supply voltages at 0V).
The second directive - "Vsensor A B 0" determines the parameters of when the switch will be activated. This directive shows that a current sensor with zero resistance (the "0" at the end of this directive) is placed between the terminals "A" and "B". In our case the terminals "A" and "B" connected across resistor R1, its resistance is not considered at all (the resistance of R1 is overriding by the resistance of the current sensor with a zero resistance).
The third directive - ".model TheSwitch CSW(Ron=1Meg Roff=0.01 It=15uA Ih=0)" describes the switching parameters of the switch: Ron, Roff - this is the resistance of the switch in open/closed state, It - the threshold current, Ih - the hysteresis current (in our example it is a zero, so we don't use the hysteresis, and the switch is always completely open or closed).
If the parameter Ih is positive, then switch will "on" at the current It+Ih, and "off" when the current reaches It-Ih, therefore the switch will works as a Schmitt trigger. If the parameter Ih is negative, the switch will smoothly transition between the "on" and "off" impedances. The transition occurs between the control currents of It-Ih and It+Ih.
Start the simulation, click with the probe on the resistor R2 and the output OUT, and you'll see this result:
Now we can see that the output voltage on node V(out) become zero in the same moment as the current in the resistor R2 become equal to 15 mA.
You can download this current controlled switch schematic: current_controlled_switch.asc.