Merge pull request #642 from ra3xdh/639_fix

Fix save netlist from CLI
This commit is contained in:
Vadim Kuznetsov 2024-03-13 11:16:28 +01:00 committed by GitHub
commit 801da6c1a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 9 deletions

View File

@ -123,15 +123,17 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
stream << "\n.control\n\n"; //execute simulations stream << "\n.control\n\n"; //execute simulations
if (!QucsMain->ProjName.isEmpty()) { if (QucsMain != nullptr) { // if not run from CLI
// always load osdi from the project directory if (!QucsMain->ProjName.isEmpty()) {
QStringList osdi_ext; // always load osdi from the project directory
osdi_ext<<"*.osdi"; QStringList osdi_ext;
QStringList osdi_files = QucsSettings.QucsWorkDir.entryList(osdi_ext,QDir::Files); osdi_ext<<"*.osdi";
for(const auto &file : osdi_files) { QStringList osdi_files = QucsSettings.QucsWorkDir.entryList(osdi_ext,QDir::Files);
QString abs_file = QucsSettings.QucsWorkDir.absolutePath() + for(const auto &file : osdi_files) {
QDir::separator() + file; QString abs_file = QucsSettings.QucsWorkDir.absolutePath() +
stream<<QString("pre_osdi '%1'\n").arg(abs_file); QDir::separator() + file;
stream<<QString("pre_osdi '%1'\n").arg(abs_file);
}
} }
} }

View File

@ -369,6 +369,7 @@ Schematic *openSchematic(QString schematic)
int doNetlist(QString schematic, QString netlist) int doNetlist(QString schematic, QString netlist)
{ {
QucsSettings.DefaultSimulator = spicecompat::simQucsator; QucsSettings.DefaultSimulator = spicecompat::simQucsator;
Module::registerModules();
Schematic *sch = openSchematic(schematic); Schematic *sch = openSchematic(schematic);
if (sch == NULL) { if (sch == NULL) {
return 1; return 1;
@ -473,6 +474,7 @@ int runXyce(QString schematic, QString dataset)
int doNgspiceNetlist(QString schematic, QString netlist) int doNgspiceNetlist(QString schematic, QString netlist)
{ {
QucsSettings.DefaultSimulator = spicecompat::simNgspice; QucsSettings.DefaultSimulator = spicecompat::simNgspice;
Module::registerModules();
Schematic *sch = openSchematic(schematic); Schematic *sch = openSchematic(schematic);
if (sch == NULL) { if (sch == NULL) {
return 1; return 1;
@ -488,6 +490,7 @@ int doNgspiceNetlist(QString schematic, QString netlist)
int doXyceNetlist(QString schematic, QString netlist) int doXyceNetlist(QString schematic, QString netlist)
{ {
QucsSettings.DefaultSimulator = spicecompat::simXyce; QucsSettings.DefaultSimulator = spicecompat::simXyce;
Module::registerModules();
Schematic *sch = openSchematic(schematic); Schematic *sch = openSchematic(schematic);
if (sch == NULL) { if (sch == NULL) {
return 1; return 1;