Gerbview: add a error message for invalid files missing G74 or G75 commands.
They are mandatory to read arc coordinates.
This commit is contained in:
parent
b067e441c7
commit
d146839f0f
|
@ -206,6 +206,7 @@ void GERBER_FILE_IMAGE::ResetDefaultValues()
|
||||||
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ.
|
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Linear, 90 arc, Circ.
|
||||||
m_360Arc_enbl = false; // 360 deg circular
|
m_360Arc_enbl = false; // 360 deg circular
|
||||||
// interpolation disable
|
// interpolation disable
|
||||||
|
m_AsArcG74G75Cmd = false; // false untile a G74 or G75 comand is found
|
||||||
m_Current_Tool = 0; // Current Dcode selected
|
m_Current_Tool = 0; // Current Dcode selected
|
||||||
m_CommandState = 0; // State of the current command
|
m_CommandState = 0; // State of the current command
|
||||||
m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord
|
m_CurrentPos.x = m_CurrentPos.y = 0; // current specified coord
|
||||||
|
|
|
@ -167,6 +167,8 @@ public:
|
||||||
bool m_Has_MissingDCode; // true = some DCodes in file are not defined
|
bool m_Has_MissingDCode; // true = some DCodes in file are not defined
|
||||||
// (broken file or deprecated RS274D file)
|
// (broken file or deprecated RS274D file)
|
||||||
bool m_360Arc_enbl; // Enbl 360 deg circular interpolation
|
bool m_360Arc_enbl; // Enbl 360 deg circular interpolation
|
||||||
|
bool m_AsArcG74G75Cmd; // Set to true when a circular interpolation command
|
||||||
|
// type is found. Mandatory before drawing an arc.
|
||||||
bool m_PolygonFillMode; // Enable polygon mode (read coord as a polygon descr)
|
bool m_PolygonFillMode; // Enable polygon mode (read coord as a polygon descr)
|
||||||
int m_PolygonFillModeState; // In polygon mode: 0 = first segm, 1 = next segm
|
int m_PolygonFillModeState; // In polygon mode: 0 = first segm, 1 = next segm
|
||||||
|
|
||||||
|
|
|
@ -530,10 +530,12 @@ bool GERBER_FILE_IMAGE::Execute_G_Command( char*& text, int G_command )
|
||||||
case GC_TURN_OFF_360_INTERPOL: // disable Multi cadran arc and Arc interpol
|
case GC_TURN_OFF_360_INTERPOL: // disable Multi cadran arc and Arc interpol
|
||||||
m_360Arc_enbl = false;
|
m_360Arc_enbl = false;
|
||||||
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
|
m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
|
||||||
|
m_AsArcG74G75Cmd = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GC_TURN_ON_360_INTERPOL:
|
case GC_TURN_ON_360_INTERPOL:
|
||||||
m_360Arc_enbl = true;
|
m_360Arc_enbl = true;
|
||||||
|
m_AsArcG74G75Cmd = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GC_SPECIFY_ABSOLUES_COORD:
|
case GC_SPECIFY_ABSOLUES_COORD:
|
||||||
|
@ -639,6 +641,15 @@ bool GERBER_FILE_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
|
||||||
{
|
{
|
||||||
case GERB_INTERPOL_ARC_NEG:
|
case GERB_INTERPOL_ARC_NEG:
|
||||||
case GERB_INTERPOL_ARC_POS:
|
case GERB_INTERPOL_ARC_POS:
|
||||||
|
// Before any arc command, a G74 or G75 command must be set.
|
||||||
|
// Otherwise the Gerber file is invalid
|
||||||
|
if( !m_AsArcG74G75Cmd )
|
||||||
|
{
|
||||||
|
AddMessageToList( _( "Invalide Gerber file: missing G74 or G75 arc command" ) );
|
||||||
|
// Disable further warning messages:
|
||||||
|
m_AsArcG74G75Cmd = true;
|
||||||
|
}
|
||||||
|
|
||||||
gbritem = GetLastItemInList();
|
gbritem = GetLastItemInList();
|
||||||
|
|
||||||
fillArcPOLY( gbritem, m_PreviousPos,
|
fillArcPOLY( gbritem, m_PreviousPos,
|
||||||
|
|
Loading…
Reference in New Issue