From eadf6d93bcf8eafb5d1d4383522fae4229c5f9d1 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 13 Apr 2019 15:34:55 -0400 Subject: [PATCH] Fix ngspice netlisting when net names contain '/' Fixes: lp:1821502 * https://bugs.launchpad.net/kicad/+bug/1821502 (cherry picked from commit 216573bf4827e8ca98635e1b95efa0c02c94b53f) --- eeschema/netlist_exporters/netlist_exporter_pspice.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp index 898fa859ae..ec006d39e3 100644 --- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp @@ -150,6 +150,15 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl // Replace parenthesis with underscore to prevent parse issues with simulators ReplaceForbiddenChars( netName ); + // Add quotes to nets containing slashes. This isn't added to ReplaceForbidenChars + // because this is only necessary for file writing; nets with slashes can be + // handled by ngspice after loading. + if( netName.Contains( "/" ) ) + { + netName.Prepend( '"' ); + netName.Append( '"' ); + } + // Borrow LTSpice's nomenclature for unconnected nets if( netName.IsEmpty() ) netName = wxString::Format( wxT( "NC_%.2u" ), NC_counter++ );