Commit a71857ba authored by Dick Hollenbeck's avatar Dick Hollenbeck Committed by Wayne Stambaugh

Commit Dick's Pcbnew s-expression file parser bug fixes.

* Apply Dick's patch along with a few minor changes to fix some clashes with
  changes in my branch.  Thanks Dick!
* Added missing DRAWSEGMENT line angle.
* Fix thru hole pad layer mask issue.
parent d3f95548
......@@ -70,11 +70,11 @@ else (KICAD_STABLE_VERSION )
endif(KICAD_STABLE_VERSION )
# Nanometers must be enabled when USE_PCBNEW_SEXPR_FILE_FORMAT=ON.
if( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
set( TMP "The Pcbnew s-expression file format requires nano-meter internal units to be " )
set( TMP "${TMP} enabled using -DUSE_PCBNEW_NANOMETRES=ON." )
message( FATAL_ERROR ${TMP} )
endif( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
#if( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
# set( TMP "The Pcbnew s-expression file format requires nano-meter internal units to be " )
# set( TMP "${TMP} enabled using -DUSE_PCBNEW_NANOMETRES=ON." )
# message( FATAL_ERROR ${TMP} )
#endif( USE_PCBNEW_SEXPR_FILE_FORMAT AND NOT USE_PCBNEW_NANOMETRES )
#================================================
# Set flags for GCC.
......
This diff is collapsed.
......@@ -120,6 +120,7 @@ page
path
pcb_text_size
pcb_text_width
pcbplotparams
placed
plus
polygon
......
......@@ -93,13 +93,23 @@ std::string BOARD_ITEM::FormatInternalUnits( int aValue )
{
char buf[50];
#if defined( USE_PCBNEW_NANOMETRES )
int nm = aValue;
#else
int nm = KIROUND( ( aValue / 10000.0 ) * 25.4 * 1e6 );
#endif
double mm = aValue / IU_PER_MM;
int len;
if( mm != 0.0 && fabs( mm ) <= 0.0001 )
{
len = sprintf( buf, "%.10f", mm );
int len = snprintf( buf, 49, "%g", nm / 1e6 );
while( --len > 0 && buf[len] == '0' )
buf[len] = '\0';
++len;
}
else
{
len = sprintf( buf, "%.10g", mm );
}
return std::string( buf, len );
}
......
......@@ -209,6 +209,7 @@ public:
const wxString& GetNetName() const { return m_Netname; };
void SetNetName( const wxString& aName ) { m_Netname = aName; }
/// How to fill areas: 0 = use filled polygons, 1 => fill with segments.
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
int GetFillMode() const { return m_FillMode; }
......@@ -550,7 +551,7 @@ public:
int m_ZoneClearance; // clearance value
int m_ZoneMinThickness; // Min thickness value in filled areas
// How to fill areas: 0 = use filled polygons, != 0 fill with segments.
/// How to fill areas: 0 => use filled polygons, 1 => fill with segments.
int m_FillMode;
// number of segments to convert a circle to a polygon (uses
......
......@@ -39,6 +39,7 @@
#include <class_drawsegment.h>
#include <class_mire.h>
#include <class_edge_mod.h>
#include <pcb_plot_params.h>
#include <zones.h>
#include <kicad_plugin.h>
#include <pcb_parser.h>
......@@ -324,6 +325,8 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(visible_elements %X)\n",
aBoard->GetDesignSettings().GetVisibleElements() );
// aBoard->GetPlotOptions().Format( m_out, aNestLevel+1 );
m_out->Print( aNestLevel, ")\n\n" );
......@@ -448,9 +451,10 @@ void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const
switch( aSegment->GetShape() )
{
case S_SEGMENT: // Line
m_out->Print( aNestLevel, "(gr_line (pts (xy %s) (xy %s))",
m_out->Print( aNestLevel, "(gr_line (pts (xy %s) (xy %s)) (angle %s)",
FMT_IU( aSegment->GetStart() ).c_str(),
FMT_IU( aSegment->GetEnd() ).c_str() );
FMT_IU( aSegment->GetEnd() ).c_str(),
FMT_ANGLE( aSegment->GetAngle() ).c_str() );
break;
case S_CIRCLE: // Circle
......@@ -863,11 +867,17 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
if( parent )
orient += parent->GetOrientation();
m_out->Print( aNestLevel, "(fp_text %s %s (at %s %s)%s\n",
m_out->Print( aNestLevel, "(fp_text %s %s (at %s %s)",
m_out->Quotew( type ).c_str(),
m_out->Quotew( aText->GetText() ).c_str(),
FMT_IU( aText->GetPos0() ).c_str(), FMT_ANGLE( orient ).c_str(),
(!aText->IsVisible()) ? " hide" : "" );
FMT_IU( aText->GetPos0() ).c_str(), FMT_ANGLE( orient ).c_str() );
formatLayer( aText );
if( !aText->IsVisible() )
m_out->Print( 0, " hide" );
m_out->Print( 0, "\n" );
aText->EDA_TEXT::Format( m_out, aNestLevel, m_ctl );
......
This diff is collapsed.
This diff is collapsed.
......@@ -120,7 +120,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
const char* falseStr = getTokenName( T_false );
const char* trueStr = getTokenName( T_true );
aFormatter->Print( aNestLevel, "(%s", getTokenName( T_pcbplotparams ) );
aFormatter->Print( aNestLevel, "(%s\n", getTokenName( T_pcbplotparams ) );
aFormatter->Print( aNestLevel+1, "(%s %ld)\n", getTokenName( T_layerselection ),
layerSelection );
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_usegerberextensions ),
......@@ -173,7 +173,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
scaleSelection );
aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_outputdirectory ),
aFormatter->Quotew( outputDirectory ).c_str() );
aFormatter->Print( 0, ")\n" );
aFormatter->Print( aNestLevel, ")\n" );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment