ra3xdh / qucs_s

Qucs-S is a circuit simulation program with Qt-based GUI
https://ra3xdh.github.io/
GNU General Public License v2.0
851 stars 110 forks source link

Extent open schematic from CLI #973

Open njascgil opened 1 week ago

njascgil commented 1 week ago

Using the "-i" parameter I am not able to open files from the command line. Qucs-s opens fine, but with the default empty document (latest continuous build). At first I though it might have something to do with spaces in the path, but it does not work even if I open a cmd prompt inside the qucs-s.exe folder and copy the sch file also to this location (then trying "qucs-s.exe -i pl1.sch"). Is this a real issue or am I doing something wrong?

TODO list

ra3xdh commented 1 week ago

I cannot reproduce this. The qucs-s -i schematic.sch opens a document on my machine. Probably you may have $PATH issues on Windows. Try to specify the full path to file.

njascgil commented 1 week ago

I think I may have found the issue, but perhaps it's by design. When the default simulator is Qucsator (e.g. by closing Qucs-s with that simulator selected in the toolbar), opening a sch via the command line works just fine. If the default is Ngspice instead, Qucs-s starts with the default "untitled" empty sheet. (I found it after running Qucs-s inside a VM and comparing the registry entries for both cases. DefaultSimulator=0x08 is ok, but DefaultSimulator=0x01 is not...)

ra3xdh commented 1 week ago

Sorry, I still cannot reproduce this. The Qucs-S opens schematic from CLI using both Qucsator and Ngspice modes.

ra3xdh commented 1 week ago

The exception is when schematic contains SPICE-incompatible or Qucsator-incompatible device. It shows an empty schematic and prints in the console message like this:

Critical: "Schematic loading error! Unknown device K_SPICE"
njascgil commented 1 week ago

That may be it. When I remove the (old) Qucs transformer from my model the sch opens just fine either way. However, I do not see that message when trying to open the sch containing the Spice incompatible file...

ra3xdh commented 1 week ago

Maybe Windows redirects the stderr stream and you don't see the error messages in CLI.

ra3xdh commented 1 week ago

I have added TODO list for this issue. The first task is to allow to load schematic with incompatible devices from CLI. The CLI options to load schematic needs a bit redesign. The -i option should not be required. The syntax should be qucs-s schematic.sch as used by all applications. This will allow to associate SCH files to Qucs-S by system tools.