Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 6767) +++ trunk/scconfig/Rev.h (revision 6768) @@ -1 +1 @@ -static const int myrev = 6735; +static const int myrev = 6767; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 6767) +++ trunk/scconfig/Rev.tab (revision 6768) @@ -1,3 +1,4 @@ +6767 configure new import plugins 6735 configure gtk splitup 6392 configure draw cross section plugin (gtk and lesstif depend on it) 6365 configure gtk splitup Index: trunk/scconfig/plugins.h =================================================================== --- trunk/scconfig/plugins.h (revision 6767) +++ trunk/scconfig/plugins.h (revision 6768) @@ -48,6 +48,7 @@ plugin_def("import_dsn", "specctra .dsn importer", sbuildin, 1) plugin_def("import_hyp", "hyperlynx .hyp importer", sdisable, 0) plugin_def("import_mucs", "import mucs routing", sbuildin, 1) +plugin_def("import_ltspice", "import ltspice .net+.asc", sdisable, 1) plugin_header("\nExport plugins:\n") plugin_def("export_gcode", "gcode pcb_exporter", sbuildin, 1) Index: trunk/src_plugins/import_ltspice/Makefile =================================================================== --- trunk/src_plugins/import_ltspice/Makefile (nonexistent) +++ trunk/src_plugins/import_ltspice/Makefile (revision 6768) @@ -0,0 +1,5 @@ +all: + cd ../../src && $(MAKE) mod_import_ltspice + +clean: + rm *.o *.so 2>/dev/null ; true Index: trunk/src_plugins/import_ltspice/Plug.tmpasm =================================================================== --- trunk/src_plugins/import_ltspice/Plug.tmpasm (nonexistent) +++ trunk/src_plugins/import_ltspice/Plug.tmpasm (revision 6768) @@ -0,0 +1,8 @@ +put /local/pcb/mod {import_ltspice} +put /local/pcb/mod/OBJS [@ $(PLUGDIR)/import_ltspice/ltspice.o @] + +switch /local/pcb/import_ltspice/controls + case {buildin} include /local/pcb/tmpasm/buildin; end; + case {plugin} include /local/pcb/tmpasm/plugin; end; + case {disable} include /local/pcb/tmpasm/disable; end; +end Index: trunk/src_plugins/import_ltspice/README =================================================================== --- trunk/src_plugins/import_ltspice/README (nonexistent) +++ trunk/src_plugins/import_ltspice/README (revision 6768) @@ -0,0 +1,5 @@ +Import the netlist and footprints from an ltspice .asc and .net pair of files + +#state: WIP +#default: disable +#implements: import Index: trunk/src_plugins/import_ltspice/ltspice.c =================================================================== --- trunk/src_plugins/import_ltspice/ltspice.c (nonexistent) +++ trunk/src_plugins/import_ltspice/ltspice.c (revision 6768) @@ -0,0 +1,84 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * + * LTSpice import HID + * pcb-rnd Copyright (C) 2017 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include "config.h" + +#include +#include +#include + +#include "board.h" +#include "data.h" +#include "error.h" +#include "pcb-printf.h" +#include "compat_misc.h" + +#include "action_helper.h" +#include "hid_actions.h" +#include "plugins.h" +#include "hid.h" + +static const char *ltspice_cookie = "ltspice importer"; + +static const char pcb_acts_LoadLtspiceFrom[] = "LoadLtspiceFrom(filename)"; +static const char pcb_acth_LoadLtspiceFrom[] = "Loads the specified ltspice routing file."; +int pcb_act_LoadLtspiceFrom(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + const char *fname = NULL; + static char *default_file = NULL; + + fname = argc ? argv[0] : 0; + + if (!fname || !*fname) { + fname = pcb_gui->fileselect("Load ltspice net+asc file pair...", + "Picks a ltspice net or asc file to load.\n", + default_file, ".asc", "ltspice", HID_FILESELECT_READ); + if (fname == NULL) + PCB_ACT_FAIL(LoadLtspiceFrom); + if (default_file != NULL) { + free(default_file); + default_file = NULL; + } + } + + return 0; +} + +pcb_hid_action_t ltspice_action_list[] = { + {"LoadLtspiceFrom", 0, pcb_act_LoadLtspiceFrom, pcb_acth_LoadLtspiceFrom, pcb_acts_LoadLtspiceFrom} +}; + +PCB_REGISTER_ACTIONS(ltspice_action_list, ltspice_cookie) + +static void hid_ltspice_uninit() +{ + pcb_hid_remove_actions_by_cookie(ltspice_cookie); +} + +#include "dolists.h" +pcb_uninit_t hid_import_ltspice_init() +{ + PCB_REGISTER_ACTIONS(ltspice_action_list, ltspice_cookie) + return hid_ltspice_uninit; +} Index: trunk/src_plugins/plugins_io.tmpasm =================================================================== --- trunk/src_plugins/plugins_io.tmpasm (revision 6767) +++ trunk/src_plugins/plugins_io.tmpasm (revision 6768) @@ -6,6 +6,7 @@ include {../src_plugins/import_dsn/Plug.tmpasm} include {../src_plugins/import_hyp/Plug.tmpasm} include {../src_plugins/import_mucs/Plug.tmpasm} +include {../src_plugins/import_ltspice/Plug.tmpasm} include {../src_plugins/export_ps/Plug.tmpasm} include {../src_plugins/export_lpr/Plug.tmpasm}