pcbnew: Allow STEP export tolerancing

kicad2step has a tolerance level that sets whether two points are at the
same location or not.  This allows KiCad to access these levels to some
degree, permitting a looser interpretation of a closed board outline.
This commit is contained in:
Seth Hillbrand 2019-01-28 22:15:38 -08:00
parent 9bd7ea815c
commit 914596fcbb
4 changed files with 361 additions and 647 deletions

View File

@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Cirilo Bernardo
* Copyright (C) 2016-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -315,6 +315,12 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
break;
}
if( m_tolerance->GetSelection() != 1 )
{
double tolerance = 0.001 * std::pow<double>( 10, m_tolerance->GetSelection() - 1.0 );
cmdK2S.Append( wxString::Format( " --min-distance=\"%.4f mm\"", tolerance ) );
}
cmdK2S.Append( " -f -o " );
cmdK2S.Append( wxString::Format("\"%s\"", m_filePickerSTEP->GetPath() ) ); // input file path

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// C++ code generated with wxFormBuilder (version Jan 17 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/text_ctrl_eval.h"
@ -23,7 +23,7 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
m_txtBrdFile->Wrap( -1 );
bSizerSTEPFile->Add( m_txtBrdFile, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_filePickerSTEP = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a STEP export filename"), wxT("STEP files (*.stp;*.step)|*.stp;*.step"), wxDefaultPosition, wxSize( -1,-1 ), wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
m_filePickerSTEP = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, _("Select a STEP export filename"), _("STEP files (*.stp;*.step)|*.stp;*.step"), wxDefaultPosition, wxSize( -1,-1 ), wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
bSizerSTEPFile->Add( m_filePickerSTEP, 0, wxEXPAND|wxALL, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
@ -134,6 +134,9 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
bSizer8->Add( m_staticText7, 0, wxALL, 5 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer3->SetFlexibleDirection( wxBOTH );
@ -146,7 +149,33 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
fgSizer3->Add( m_cbRemoveVirtual, 0, wxALL, 5 );
bSizer8->Add( fgSizer3, 1, wxEXPAND, 5 );
bSizer6->Add( fgSizer3, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer4->SetFlexibleDirection( wxBOTH );
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer4->Add( 0, 0, 0, wxALL|wxEXPAND, 5 );
m_staticText8 = new wxStaticText( this, wxID_ANY, _("Tolerance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
fgSizer4->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_toleranceChoices[] = { _("Tight"), _("Standard"), _("Loose"), _("Very loose") };
int m_toleranceNChoices = sizeof( m_toleranceChoices ) / sizeof( wxString );
m_tolerance = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_toleranceNChoices, m_toleranceChoices, 0 );
m_tolerance->SetSelection( 1 );
m_tolerance->SetToolTip( _("Tolerance sets the distance between two points that are considered joined. Standard is 0.001mm.") );
fgSizer4->Add( m_tolerance, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizer6->Add( fgSizer4, 1, wxEXPAND, 10 );
bSizer8->Add( bSizer6, 1, wxEXPAND, 5 );
bSizer2->Add( bSizer8, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,15 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// C++ code generated with wxFormBuilder (version Jan 17 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_EXPORT_STEP_BASE_H__
#define __DIALOG_EXPORT_STEP_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
class TEXT_CTRL_EVAL;
class WX_HTML_REPORT_PANEL;
@ -61,6 +59,8 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM
TEXT_CTRL_EVAL* m_STEP_Yorg;
wxStaticText* m_staticText7;
wxCheckBox* m_cbRemoveVirtual;
wxStaticText* m_staticText8;
wxChoice* m_tolerance;
WX_HTML_REPORT_PANEL* m_messagesPanel;
wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizer;
@ -76,9 +76,8 @@ class DIALOG_EXPORT_STEP_BASE : public DIALOG_SHIM
public:
DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export STEP"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 552,361 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export STEP"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 650,361 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXPORT_STEP_BASE();
};
#endif //__DIALOG_EXPORT_STEP_BASE_H__