For arbitrary waveforms, create an IClamp with del = 0, dur = 1e9, and use the Vector class's play() method to drive its amp variable.
If you want to generate a series of uniform pulses, see this item
I just want a current clamp that will deliver a sequence of current pulses at regular intervals.
in the FAQ list
https://neuron.yale.edu/neuron/faq/general-questions
How to make IClamp deliver multiple pulses or a waveform
Moderators: ted, wwlytton, tom_morse