From b052d56c7b7b37cf5f14c510bff130791812117c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 23 Nov 2021 22:15:25 +0000 Subject: [PATCH] R/W uuids for junctions. --- eeschema/sch_file_versions.h | 3 ++- eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp | 8 +++++++- eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/eeschema/sch_file_versions.h b/eeschema/sch_file_versions.h index 8e3a6283d0..e9b7e6a5ce 100644 --- a/eeschema/sch_file_versions.h +++ b/eeschema/sch_file_versions.h @@ -65,4 +65,5 @@ //#define SEXPR_SCHEMATIC_FILE_VERSION 20210406 // Add schematic level uuids. //#define SEXPR_SCHEMATIC_FILE_VERSION 20210606 // Change overbar syntax from `~...~` to `~{...}`. //#define SEXPR_SCHEMATIC_FILE_VERSION 20210615 // Update overbar syntax in net names. -#define SEXPR_SCHEMATIC_FILE_VERSION 20210621 // Update overbar syntax in bus aliases. +//#define SEXPR_SCHEMATIC_FILE_VERSION 20210621 // Update overbar syntax in bus aliases. +#define SEXPR_SCHEMATIC_FILE_VERSION 20211123 // R/W uuids for junctions. diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 222f450413..0bc9d8d437 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -2650,8 +2650,14 @@ SCH_JUNCTION* SCH_SEXPR_PARSER::parseJunction() break; } + case T_uuid: + NeedSYMBOL(); + const_cast( junction->m_Uuid ) = KIID( FromUTF8() ); + NeedRIGHT(); + break; + default: - Expecting( "at" ); + Expecting( "at, diameter, color or uuid" ); } } diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 37fb68654d..68d8b9f24b 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -1296,7 +1296,7 @@ void SCH_SEXPR_PLUGIN::saveJunction( SCH_JUNCTION* aJunction, int aNestLevel ) { wxCHECK_RET( aJunction != nullptr && m_out != nullptr, "" ); - m_out->Print( aNestLevel, "(junction (at %s %s) (diameter %s) (color %d %d %d %s))\n", + m_out->Print( aNestLevel, "(junction (at %s %s) (diameter %s) (color %d %d %d %s)\n", FormatInternalUnits( aJunction->GetPosition().x ).c_str(), FormatInternalUnits( aJunction->GetPosition().y ).c_str(), FormatInternalUnits( aJunction->GetDiameter() ).c_str(), @@ -1304,6 +1304,10 @@ void SCH_SEXPR_PLUGIN::saveJunction( SCH_JUNCTION* aJunction, int aNestLevel ) KiROUND( aJunction->GetColor().g * 255.0 ), KiROUND( aJunction->GetColor().b * 255.0 ), Double2Str( aJunction->GetColor().a ).c_str() ); + + m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aJunction->m_Uuid.AsString() ) ); + + m_out->Print( aNestLevel, ")\n" ); }