[Kicad-developers] [PATCH] [RFC] Exporter for Mentor Hyperlynx

2019-04-04 Thread Tomasz Wlostowski
Hi,

We needed to do some signal/power integrity simulations on one of our
Kicad designs and in order to do that, we needed to convert a Kicad PCB
to Hyperlynx format. Luckily, the format is simple, all text and well
documented in [1], so here comes a patch that adds a Hyperlynx exporter.

Notes:
- since Kicad doesn't have a concept of board stackup (permittivities,
loss tangent, dielectric types, etc.), the exporter writes a dummy
stackup. Edit it to match the PCB spec in Hyperlynx.
- no support for offset pad holes, slotted pad holes,
trapezoid/polygonal pads (it seems HL format doesn't support such
features or I need to figure out how to emulate them).
- no support for thermal pads (yet)
- no error reporting.

Looking forward to your feedback & wish you happy testing,
Tom

[1] http://www.ibis.org/birds/bird33.txt
>From e966c63a6f00959e359be36bfc0b8206e01ed4bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= 
Date: Thu, 4 Apr 2019 18:07:12 +0200
Subject: [PATCH] pcbnew: Initial support for Mentor Hyperlynx export

---
 pcbnew/CMakeLists.txt |   1 +
 pcbnew/dialogs/dialog_export_idf.cpp  |   1 +
 pcbnew/exporters/export_hyperlynx.cpp | 547 ++
 pcbnew/menubar_pcb_editor.cpp |   5 +
 pcbnew/pcb_edit_frame.cpp |  29 +
 pcbnew/pcb_edit_frame.h   |   7 +
 pcbnew/pcbnew_id.h|   1 +
 qa/CMakeLists.txt |   1 +
 qa/hyperlynx_export/CMakeLists.txt|  64 ++
 qa/hyperlynx_export/test_hyperlynx_export.cpp |  61 ++
 10 files changed, 717 insertions(+)
 create mode 100644 pcbnew/exporters/export_hyperlynx.cpp
 create mode 100644 qa/hyperlynx_export/CMakeLists.txt
 create mode 100644 qa/hyperlynx_export/test_hyperlynx_export.cpp

diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 3bbdd8723..9f0f5eac1 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -193,6 +193,7 @@ set( PCBNEW_IMPORT_GFX
 )
 
 set( PCBNEW_EXPORTERS
+exporters/export_hyperlynx.cpp
 exporters/export_d356.cpp
 exporters/export_footprint_associations.cpp
 exporters/export_gencad.cpp
diff --git a/pcbnew/dialogs/dialog_export_idf.cpp b/pcbnew/dialogs/dialog_export_idf.cpp
index e9e16bfbc..882224b7c 100644
--- a/pcbnew/dialogs/dialog_export_idf.cpp
+++ b/pcbnew/dialogs/dialog_export_idf.cpp
@@ -229,3 +229,4 @@ void PCB_EDIT_FRAME::OnExportIDF3( wxCommandEvent& event )
 return;
 }
 }
+
diff --git a/pcbnew/exporters/export_hyperlynx.cpp b/pcbnew/exporters/export_hyperlynx.cpp
new file mode 100644
index 0..5f5c678dd
--- /dev/null
+++ b/pcbnew/exporters/export_hyperlynx.cpp
@@ -0,0 +1,547 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2019 CERN
+ *
+ * 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, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static double iu2hyp( double iu )
+{
+return iu / 1e9 / 0.0254;
+}
+
+class PAD_STACK
+{
+public:
+PAD_STACK( BOARD* aBoard, const D_PAD* aPad );
+PAD_STACK( BOARD* aBoard, const VIA* aVia );
+~PAD_STACK(){};
+
+
+bool isThrough() const
+{
+return m_type == PAD_ATTRIB_HOLE_NOT_PLATED || m_type == PAD_ATTRIB_STANDARD;
+}
+
+bool operator==( const PAD_STACK& other ) const
+{
+if( m_shape != other.m_shape )
+return false;
+
+if( m_type != other.m_type )
+return false;
+
+if( isThrough() && other.isThrough() && m_drill != other.m_drill )
+return false;
+
+if( m_sx != other.m_sx )
+return false;
+
+if( m_sy != other.m_sy )
+return false;
+
+if( m_layers != other.m_layers )
+return false;
+
+if( m_angle != other.m_angle )
+return false;
+
+return true;
+}
+
+bool isSMD() const
+{
+return m_type == PAD_ATTRIB_SMD;
+}
+
+PCB_LAYER_ID getSMDLayer() const
+   

Re: [Kicad-developers] Printing dangling flags

2019-04-04 Thread Wayne Stambaugh
It might be handy in debug builds to show the dangling state for
development purposes but I don't see this being useful for users.

On 4/4/2019 1:39 PM, Jon Evans wrote:
> I bet it's an oversight.  Dangling flags are in the category of "live
> ERC warnings" in my opinion, and should never be printed.
> 
> On Thu, Apr 4, 2019 at 1:11 PM Jeff Young  > wrote:
> 
> SCH_BUS_ENTRY is the only item which /prints/ its dangling flags.
>  (Everything else only draws them on screen.)
> 
> Is this an oversight or intentional?
> 
> Thanks,
> Jeff.
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@lists.launchpad.net
> 
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Printing dangling flags

2019-04-04 Thread Jon Evans
I bet it's an oversight.  Dangling flags are in the category of "live ERC
warnings" in my opinion, and should never be printed.

On Thu, Apr 4, 2019 at 1:11 PM Jeff Young  wrote:

> SCH_BUS_ENTRY is the only item which *prints* its dangling flags.
>  (Everything else only draws them on screen.)
>
> Is this an oversight or intentional?
>
> Thanks,
> Jeff.
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Printing dangling flags

2019-04-04 Thread Jeff Young
SCH_BUS_ENTRY is the only item which prints its dangling flags.  (Everything 
else only draws them on screen.)

Is this an oversight or intentional?

Thanks,
Jeff.___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp