Proposed feature request, C block as a pre-processor

Hi all,

I managed to get a worse case function working for the most part just lifted from the article from It works well.

LTspice: Worst-Case Circuit Analysis with Minimal Simulations Runs

Regulator Scaling WC.qsch (5.0 KB)

Unfortunately, it’s not a real worse case because it doesn’t include things like tempco. To make the issue worse, resistors are unpredictable as to having a pos or neg tempco. This can all be implemented with more code but lines like the two .func are about as complicated as can be designed and debugged by mere mortals because of the format. When I try to expand them, I quickly realize life is too short.

A pre-processor C-block would solve the problem very nicely.

  • Only one instance allowed per file
  • Limited to param inputs and outputs, any practical number
  • Runs first to evaluate and assign params and before each .step iteration if present
  • Could be limited to a single I/O data type, float/double

I think this would be a huge improvement to an already excellent spice program.


OK, so… not a popular idea. I may be thinking wrong about this so plan B. Maybe breaking the funcs into multiple lines using an external editor to add syntax coloring would help. I think it does. I tried using my default editor, Notepad++, but VScode is easier because there is already a LTspice plugin. The plugin may need to be forked and tweaked for Qspice long term but it’s very useable now.