Step exporter: better values for min distance between 2 points to merge them.

- The default value is 0.01 mm (according to comments and similar to the 3D viewer
 settings that uses 0.02 mm)
- The export dialog  has now 3 values 1 micron, 0.01mm (default) and 0.1 mm
The 0.1 micron option is removed: it makes no sense for a mechanical tolerance.
This commit is contained in:
jean-pierre charras 2021-01-03 11:01:03 +01:00
parent a9feb1c2d4
commit 5db75805bd
6 changed files with 28 additions and 14 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Cirilo Bernardo
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2020 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
@ -255,7 +255,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
if( fn.FileExists() && !GetOverwriteFile() )
{
msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ),
fn.GetFullPath().GetData() );
fn.GetFullPath() );
if( wxMessageBox( msg, _( "STEP Export" ), wxYES_NO | wxICON_QUESTION, this ) == wxNO )
return;
@ -331,9 +331,24 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
if( m_tolerance->GetSelection() != 1 )
{
double tolerance = 0.01; // defautl value in mm
switch( m_tolerance->GetSelection() )
{
case 0: // small
tolerance = 0.001;
break;
default:
case 1: break; // Normal
case 2: // large
tolerance = 0.1;
break;
}
LOCALE_IO dummy;
double tolerance = 0.001 * std::pow<double>( 10.0, m_tolerance->GetSelection() - 1 );
cmdK2S.Append( wxString::Format( " --min-distance=\"%.4f mm\"", tolerance ) );
cmdK2S.Append( wxString::Format( " --min-distance=\"%.3f mm\"", tolerance ) );
}
cmdK2S.Append( " -f -o " );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -153,11 +153,11 @@ DIALOG_EXPORT_STEP_BASE::DIALOG_EXPORT_STEP_BASE( wxWindow* parent, wxWindowID i
m_staticTextTolerance->Wrap( -1 );
bSizerTolerance->Add( m_staticTextTolerance, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_toleranceChoices[] = { _("Tight"), _("Standard"), _("Loose"), _("Very loose") };
wxString m_toleranceChoices[] = { _("Tight (0.001 mm)"), _("Standard (0.01 mm)"), _("Loose (0.1 mm)") };
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.") );
m_tolerance->SetToolTip( _("Tolerance sets the distance between two points that are considered joined.") );
bSizerTolerance->Add( m_tolerance, 1, wxALL, 5 );

View File

@ -14,7 +14,6 @@
<property name="file">dialog_export_step_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_export_step_base</property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -1484,7 +1482,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Tight&quot; &quot;Standard&quot; &quot;Loose&quot; &quot;Very loose&quot;</property>
<property name="choices">&quot;Tight (0.001 mm)&quot; &quot;Standard (0.01 mm)&quot; &quot;Loose (0.1 mm)&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -1520,7 +1518,7 @@
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Tolerance sets the distance between two points that are considered joined. Standard is 0.001mm.</property>
<property name="tooltip">Tolerance sets the distance between two points that are considered joined.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jun 18 2020)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -34,8 +34,8 @@
#include <ostream>
///> Minimum distance between points to treat them as separate ones (mm)
static constexpr double MIN_DISTANCE = 0.001;
///> Default minimum distance between points to treat them as separate ones (mm)
static constexpr double MIN_DISTANCE = 0.01;
namespace SEXPR
{

View File

@ -131,6 +131,7 @@ public:
// aThickness > THICKNESS_MIN == use aThickness
void SetPCBThickness( double aThickness );
// Set the minimum distance (in mm) to consider 2 points have the same coordinates
void SetMinDistance( double aDistance );
// create the PCB model using the current outlines and drill holes