Yet another tranche of module -> footprint.

This commit is contained in:
Jeff Young 2020-11-13 02:09:34 +00:00
parent 2cc9dad4ff
commit 9106cc19bf
26 changed files with 184 additions and 184 deletions

View File

@ -238,11 +238,11 @@ void BOARD_ADAPTER::SetFlag( DISPLAY3D_FLG aFlag, bool aState )
m_drawFlags[aFlag] = aState;
}
bool BOARD_ADAPTER::ShouldModuleBeDisplayed( MODULE_ATTR_T aModuleAttributs ) const
bool BOARD_ADAPTER::ShouldFPBeDisplayed( FOOTPRINT_ATTR_T aFPAttributes ) const
{
if( aModuleAttributs & MOD_SMD )
if( aFPAttributes & FP_SMD )
return GetFlag( FL_FP_ATTRIBUTES_NORMAL_INSERT );
else if( aModuleAttributs & MOD_THROUGH_HOLE )
else if( aFPAttributes & FP_THROUGH_HOLE )
return GetFlag( FL_FP_ATTRIBUTES_NORMAL );
else
return GetFlag( FL_FP_ATTRIBUTES_VIRTUAL );

View File

@ -117,7 +117,7 @@ class BOARD_ADAPTER
* relation to attributs and the flags
* @return true if module should be displayed, false if not
*/
bool ShouldModuleBeDisplayed( MODULE_ATTR_T aModuleAttributs ) const;
bool ShouldFPBeDisplayed( FOOTPRINT_ATTR_T aFPAttributes ) const;
/**
* @brief SetBoard - Set current board to be rendered

View File

@ -1287,7 +1287,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot,
if( !fp->Models().empty() )
{
if( m_boardAdapter.ShouldModuleBeDisplayed( (MODULE_ATTR_T) fp->GetAttributes() ) )
if( m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) )
{
if( ( aRenderTopOrBot && !fp->IsFlipped() )
|| ( !aRenderTopOrBot && fp->IsFlipped() ) )

View File

@ -1403,7 +1403,7 @@ void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSki
for( MODULE* fp : m_boardAdapter.GetBoard()->Footprints() )
{
if( !fp->Models().empty()
&& m_boardAdapter.ShouldModuleBeDisplayed( (MODULE_ATTR_T)fp->GetAttributes() ) )
&& m_boardAdapter.ShouldFPBeDisplayed((FOOTPRINT_ATTR_T) fp->GetAttributes()) )
{
double zpos = m_boardAdapter.GetModulesZcoord3DIU( fp->IsFlipped() );

View File

@ -134,8 +134,8 @@ void DIALOG_BOARD_STATISTICS::refreshItemsTypes()
// If you need some more types to be shown, simply add them to the
// corresponding list
m_componentsTypes.push_back( componentsType_t( MOD_THROUGH_HOLE, _( "THT:" ) ) );
m_componentsTypes.push_back( componentsType_t( MOD_SMD, _( "SMD:" ) ) );
m_componentsTypes.push_back( componentsType_t( FP_THROUGH_HOLE, _( "THT:" ) ) );
m_componentsTypes.push_back( componentsType_t( FP_SMD, _( "SMD:" ) ) );
m_padsTypes.clear();
m_padsTypes.push_back( padsType_t( PAD_ATTRIB_PTH, _( "Through hole:" ) ) );

View File

@ -73,14 +73,14 @@ public:
*/
struct componentsType_t
{
componentsType_t( MODULE_ATTR_T aAttribute, wxString aTitle )
componentsType_t( FOOTPRINT_ATTR_T aAttribute, wxString aTitle )
: attribute( aAttribute ),
title( aTitle ),
frontSideQty( 0 ),
backSideQty( 0 )
{
}
MODULE_ATTR_T attribute;
FOOTPRINT_ATTR_T attribute;
wxString title;
int frontSideQty;
int backSideQty;

View File

@ -235,16 +235,16 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() );
m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() );
if( m_footprint->GetAttributes() & MOD_THROUGH_HOLE )
if( m_footprint->GetAttributes() & FP_THROUGH_HOLE )
m_componentType->SetSelection( 0 );
else if( m_footprint->GetAttributes() & MOD_SMD )
else if( m_footprint->GetAttributes() & FP_SMD )
m_componentType->SetSelection( 1 );
else
m_componentType->SetSelection( 2 );
m_boardOnly->SetValue( m_footprint->GetAttributes() & MOD_BOARD_ONLY );
m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES );
m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_BOM );
m_boardOnly->SetValue( m_footprint->GetAttributes() & FP_BOARD_ONLY );
m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES );
m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM );
// Local Clearances
@ -650,19 +650,19 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
switch( m_componentType->GetSelection() )
{
case 0: attributes |= MOD_THROUGH_HOLE; break;
case 1: attributes |= MOD_SMD; break;
case 0: attributes |= FP_THROUGH_HOLE; break;
case 1: attributes |= FP_SMD; break;
default: break;
}
if( m_boardOnly->GetValue() )
attributes |= MOD_BOARD_ONLY;
attributes |= FP_BOARD_ONLY;
if( m_excludeFromPosFiles->GetValue() )
attributes |= MOD_EXCLUDE_FROM_POS_FILES;
attributes |= FP_EXCLUDE_FROM_POS_FILES;
if( m_excludeFromBOM->GetValue() )
attributes |= MOD_EXCLUDE_FROM_BOM;
attributes |= FP_EXCLUDE_FROM_BOM;
m_footprint->SetAttributes( attributes );

View File

@ -316,16 +316,16 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() );
m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() );
if( m_footprint->GetAttributes() & MOD_THROUGH_HOLE )
if( m_footprint->GetAttributes() & FP_THROUGH_HOLE )
m_componentType->SetSelection( 0 );
else if( m_footprint->GetAttributes() & MOD_SMD )
else if( m_footprint->GetAttributes() & FP_SMD )
m_componentType->SetSelection( 1 );
else
m_componentType->SetSelection( 2 );
m_boardOnly->SetValue( m_footprint->GetAttributes() & MOD_BOARD_ONLY );
m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES );
m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & MOD_EXCLUDE_FROM_BOM );
m_boardOnly->SetValue( m_footprint->GetAttributes() & FP_BOARD_ONLY );
m_excludeFromPosFiles->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES );
m_excludeFromBOM->SetValue( m_footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM );
// Local Clearances
@ -706,19 +706,19 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
switch( m_componentType->GetSelection() )
{
case 0: attributes |= MOD_THROUGH_HOLE; break;
case 1: attributes |= MOD_SMD; break;
case 0: attributes |= FP_THROUGH_HOLE; break;
case 1: attributes |= FP_SMD; break;
default: break;
}
if( m_boardOnly->GetValue() )
attributes |= MOD_BOARD_ONLY;
attributes |= FP_BOARD_ONLY;
if( m_excludeFromPosFiles->GetValue() )
attributes |= MOD_EXCLUDE_FROM_POS_FILES;
attributes |= FP_EXCLUDE_FROM_POS_FILES;
if( m_excludeFromBOM->GetValue() )
attributes |= MOD_EXCLUDE_FROM_BOM;
attributes |= FP_EXCLUDE_FROM_BOM;
m_footprint->SetAttributes( attributes );

View File

@ -193,7 +193,7 @@ void DRC_TEST_PROVIDER_LVS::testFootprints( NETLIST& aNetlist )
if( m_drcEngine->IsErrorLimitExceeded( DRCE_EXTRA_FOOTPRINT ) )
break;
if( footprint->GetAttributes() & MOD_BOARD_ONLY )
if( footprint->GetAttributes() & FP_BOARD_ONLY )
continue;
if( !aNetlist.GetComponentByReference( footprint->GetReference() ) )

View File

@ -123,7 +123,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
continue;
}
if( footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES )
if( footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES )
continue;
if( m_excludeAllTH && footprint->HasThroughHolePads() )
@ -328,13 +328,13 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
buffer += "attribut";
if(( footprint->GetAttributes() & ( MOD_THROUGH_HOLE | MOD_SMD ) ) == 0 )
if(( footprint->GetAttributes() & ( FP_THROUGH_HOLE | FP_SMD ) ) == 0 )
buffer += " virtual";
if( footprint->GetAttributes() & MOD_SMD )
if( footprint->GetAttributes() & FP_SMD )
buffer += " smd";
if( footprint->GetAttributes() & MOD_THROUGH_HOLE )
if( footprint->GetAttributes() & FP_THROUGH_HOLE )
buffer += " none";
buffer += "\n";

View File

@ -1144,7 +1144,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aS
/* creates header: */
fprintf( aFile, "\nSHAPE \"%s\"\n", TO_UTF8( escapeString( aShapeName ) ) );
if( module->GetAttributes() & MOD_THROUGH_HOLE )
if( module->GetAttributes() & FP_THROUGH_HOLE )
fprintf( aFile, "INSERT TH\n" );
else
fprintf( aFile, "INSERT SMD\n" );

View File

@ -69,7 +69,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
for( MODULE* footprint : m_pcb->Footprints() )
{
if( footprint->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES )
if( footprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES )
continue;
if( footprint->GetLayer() == aLayer )
@ -146,9 +146,9 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
pnpAttrib.m_MountType = GBR_CMP_PNP_METADATA::MOUNT_TYPE_UNSPECIFIED;
if( footprint->GetAttributes() & MOD_THROUGH_HOLE )
if( footprint->GetAttributes() & FP_THROUGH_HOLE )
pnpAttrib.m_MountType = GBR_CMP_PNP_METADATA::MOUNT_TYPE_TH;
else if( footprint->GetAttributes() & MOD_SMD )
else if( footprint->GetAttributes() & FP_SMD )
pnpAttrib.m_MountType = GBR_CMP_PNP_METADATA::MOUNT_TYPE_SMD;
// Add component value info:

View File

@ -765,13 +765,13 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
if( m_ModuleStatus & MODULE_is_PLACED )
addToken( &status, _( "autoplaced" ) );
if( m_Attributs & MOD_BOARD_ONLY )
if( m_Attributs & FP_BOARD_ONLY )
addToken( &attrs, _( "not in schematic" ) );
if( m_Attributs & MOD_EXCLUDE_FROM_POS_FILES )
if( m_Attributs & FP_EXCLUDE_FROM_POS_FILES )
addToken( &attrs, _( "exclude from pos files" ) );
if( m_Attributs & MOD_EXCLUDE_FROM_BOM )
if( m_Attributs & FP_EXCLUDE_FROM_BOM )
addToken( &attrs, _( "exclude from BOM" ) );
aList.emplace_back( _( "Status: " ) + status, _( "Attributes:" ) + wxS( " " ) + attrs, BROWN );

View File

@ -58,18 +58,18 @@ enum INCLUDE_NPTH_T
};
/**
* Enum MODULE_ATTR_T
* is the set of attributes allowed within a MODULE, using MODULE::SetAttributes()
* and MODULE::GetAttributes(). These are to be ORed together when calling
* MODULE::SetAttributes()
* Enum FOOTPRINT_ATTR_T
* is the set of attributes allowed within a FOOTPRINT, using FOOTPRINT::SetAttributes()
* and FOOTPRINT::GetAttributes(). These are to be ORed together when calling
* FOOTPRINT::SetAttributes()
*/
enum MODULE_ATTR_T
enum FOOTPRINT_ATTR_T
{
MOD_THROUGH_HOLE = 0x0001,
MOD_SMD = 0x0002,
MOD_EXCLUDE_FROM_POS_FILES = 0x0004,
MOD_EXCLUDE_FROM_BOM = 0x0008,
MOD_BOARD_ONLY = 0x0010 // Footprint has no corresponding symbol
FP_THROUGH_HOLE = 0x0001,
FP_SMD = 0x0002,
FP_EXCLUDE_FROM_POS_FILES = 0x0004,
FP_EXCLUDE_FROM_BOM = 0x0008,
FP_BOARD_ONLY = 0x0010 // Footprint has no corresponding symbol
};
class FP_3DMODEL

View File

@ -122,28 +122,28 @@ void FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( wxCommandEvent& event )
class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO
{
public:
BASIC_FOOTPRINT_INFO( MODULE* aModule )
BASIC_FOOTPRINT_INFO( MODULE* aFootprint )
{
m_nickname = aModule->GetFPID().GetLibNickname().wx_str();
m_fpname = aModule->GetFPID().GetLibItemName().wx_str();
m_pad_count = aModule->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_unique_pad_count = aModule->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = aModule->GetKeywords();
m_doc = aModule->GetDescription();
m_nickname = aFootprint->GetFPID().GetLibNickname().wx_str();
m_fpname = aFootprint->GetFPID().GetLibItemName().wx_str();
m_pad_count = aFootprint->GetPadCount( DO_NOT_INCLUDE_NPTH );
m_unique_pad_count = aFootprint->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
m_keywords = aFootprint->GetKeywords();
m_doc = aFootprint->GetDescription();
m_loaded = true;
}
};
void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aFootprint )
{
LIB_ID oldFPID = aModule->GetFPID();
LIB_ID oldFPID = aFootprint->GetFPID();
DIALOG_FOOTPRINT_FP_EDITOR dialog( this, aModule );
DIALOG_FOOTPRINT_FP_EDITOR dialog( this, aFootprint );
dialog.ShowModal();
// Update library tree
BASIC_FOOTPRINT_INFO footprintInfo( aModule );
BASIC_FOOTPRINT_INFO footprintInfo( aFootprint );
wxDataViewItem treeItem = m_adapter->FindItem( oldFPID );
if( treeItem.IsOk() ) // Can be not found in tree if the current footprint is imported

View File

@ -416,7 +416,7 @@ MODULE* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aIn
MODULE* footprint = editFrame.CreateNewFootprint( msg );
footprint->SetFPID( LIB_ID( wxEmptyString, wxT( "mw_inductor" ) ) );
footprint->SetAttributes( MOD_EXCLUDE_FROM_POS_FILES | MOD_EXCLUDE_FROM_BOM );
footprint->SetAttributes( FP_EXCLUDE_FROM_POS_FILES | FP_EXCLUDE_FROM_BOM );
footprint->ClearFlags();
footprint->SetPosition( aInductorPattern.m_End );

View File

@ -310,19 +310,19 @@ bool BOARD_NETLIST_UPDATER::updateComponentParameters( MODULE* aPcbComponent,
}
if( ( aNewComponent->GetProperties().count( "exclude_from_bom" ) > 0 )
!= ( ( aPcbComponent->GetAttributes() & MOD_EXCLUDE_FROM_BOM ) > 0 ) )
!= ( ( aPcbComponent->GetAttributes() & FP_EXCLUDE_FROM_BOM ) > 0 ) )
{
int attributes = aPcbComponent->GetAttributes();
if( aNewComponent->GetProperties().count( "exclude_from_bom" ) )
{
attributes |= MOD_EXCLUDE_FROM_BOM;
attributes |= FP_EXCLUDE_FROM_BOM;
msg.Printf( _( "Setting %s 'exclude from BOM' fabrication attribute." ),
aPcbComponent->GetReference() );
}
else
{
attributes &= ~MOD_EXCLUDE_FROM_BOM;
attributes &= ~FP_EXCLUDE_FROM_BOM;
msg.Printf( _( "Removing %s 'exclude from BOM' fabrication attribute." ),
aPcbComponent->GetReference() );
}
@ -626,7 +626,7 @@ bool BOARD_NETLIST_UPDATER::deleteUnusedComponents( NETLIST& aNetlist )
for( MODULE* footprint : m_board->Footprints() )
{
if(( footprint->GetAttributes() & MOD_BOARD_ONLY ) > 0 )
if(( footprint->GetAttributes() & FP_BOARD_ONLY ) > 0 )
continue;
if( m_lookupByTimestamp )

View File

@ -1568,10 +1568,10 @@ void PCB_EDIT_FRAME::ShowFootprintPropertiesDialog( MODULE* aFootprint )
}
int PCB_EDIT_FRAME::ShowExchangeFootprintsDialog( MODULE* aModule, bool updateMode,
int PCB_EDIT_FRAME::ShowExchangeFootprintsDialog( MODULE* aFootprint, bool updateMode,
bool selectedMode )
{
DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aModule, updateMode, selectedMode );
DIALOG_EXCHANGE_FOOTPRINTS dialog( this, aFootprint, updateMode, selectedMode );
return dialog.ShowQuasiModal();
}

View File

@ -736,7 +736,7 @@ public:
// Footprint editing (see also PCB_BASE_FRAME)
void ShowFootprintPropertiesDialog( MODULE* aFootprint );
int ShowExchangeFootprintsDialog( MODULE* aModule, bool updateMode, bool selectedMode );
int ShowExchangeFootprintsDialog( MODULE* aFootprint, bool updateMode, bool selectedMode );
/**
* Function Exchange_Module

View File

@ -1299,11 +1299,11 @@ void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
}
void PCB_PAINTER::draw( const MODULE* aModule, int aLayer )
void PCB_PAINTER::draw( const MODULE* aFootprint, int aLayer )
{
if( aLayer == LAYER_ANCHOR )
{
const COLOR4D color = m_pcbSettings.GetColor( aModule, aLayer );
const COLOR4D color = m_pcbSettings.GetColor( aFootprint, aLayer );
// Keep the size and width constant, not related to the scale because the anchor
// is just a marker on screen
@ -1316,14 +1316,14 @@ void PCB_PAINTER::draw( const MODULE* aModule, int aLayer )
m_gal->SetStrokeColor( color );
m_gal->SetLineWidth( anchorThickness );
VECTOR2D center = aModule->GetPosition();
VECTOR2D center = aFootprint->GetPosition();
m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) );
m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) );
#if 0 // For debug purpose only: draw the footing bounding box
double bboxThickness = 1.0 / m_gal->GetWorldScale();
m_gal->SetLineWidth( bboxThickness );
EDA_RECT rect = aModule->GetBoundingBoxBase();
EDA_RECT rect = aFootprint->GetBoundingBoxBase();
m_gal->DrawRectangle( VECTOR2D( rect.GetOrigin() ), VECTOR2D( rect.GetEnd() ) );
#endif
}

View File

@ -288,7 +288,7 @@ protected:
void draw( const PCB_SHAPE* aSegment, int aLayer );
void draw( const PCB_TEXT* aText, int aLayer );
void draw( const FP_TEXT* aText, int aLayer );
void draw( const MODULE* aModule, int aLayer );
void draw( const MODULE* aFootprint, int aLayer );
void draw( const PCB_GROUP* aGroup, int aLayer );
void draw( const ZONE* aZone, int aLayer );
void draw( const DIMENSION_BASE* aDimension, int aLayer );

View File

@ -61,19 +61,19 @@ using namespace PCB_KEYS_T;
class FP_CACHE_ITEM
{
WX_FILENAME m_filename;
std::unique_ptr<MODULE> m_module;
std::unique_ptr<MODULE> m_footprint;
public:
FP_CACHE_ITEM( MODULE* aModule, const WX_FILENAME& aFileName );
FP_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName );
const WX_FILENAME& GetFileName() const { return m_filename; }
const MODULE* GetModule() const { return m_module.get(); }
const MODULE* GetModule() const { return m_footprint.get(); }
};
FP_CACHE_ITEM::FP_CACHE_ITEM( MODULE* aModule, const WX_FILENAME& aFileName ) :
FP_CACHE_ITEM::FP_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName ) :
m_filename( aFileName ),
m_module( aModule )
m_footprint( aFootprint )
{ }
@ -109,9 +109,9 @@ public:
/**
* Save the footprint cache or a single module from it to disk
*
* @param aModule if set, save only this module, otherwise, save the full library
* @param aFootprint if set, save only this module, otherwise, save the full library
*/
void Save( MODULE* aModule = NULL );
void Save( MODULE* aFootprint = NULL );
void Load();
@ -154,7 +154,7 @@ FP_CACHE::FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath )
}
void FP_CACHE::Save( MODULE* aModule )
void FP_CACHE::Save( MODULE* aFootprint )
{
m_cache_timestamp = 0;
@ -172,7 +172,7 @@ void FP_CACHE::Save( MODULE* aModule )
for( MODULE_ITER it = m_modules.begin(); it != m_modules.end(); ++it )
{
if( aModule && aModule != it->second->GetModule() )
if( aFootprint && aFootprint != it->second->GetModule() )
continue;
WX_FILENAME fn = it->second->GetFileName();
@ -216,7 +216,7 @@ void FP_CACHE::Save( MODULE* aModule )
m_cache_timestamp += m_lib_path.GetModificationTime().GetValue().GetValue();
// If we've saved the full cache, we clear the dirty flag.
if( !aModule )
if( !aFootprint )
m_cache_dirty = false;
}
@ -846,39 +846,39 @@ void PCB_IO::format( PCB_SHAPE* aShape, int aNestLevel ) const
}
void PCB_IO::format( FP_SHAPE* aModuleDrawing, int aNestLevel ) const
void PCB_IO::format( FP_SHAPE* aFPShape, int aNestLevel ) const
{
switch( aModuleDrawing->GetShape() )
switch( aFPShape->GetShape() )
{
case S_SEGMENT: // Line
m_out->Print( aNestLevel, "(fp_line (start %s) (end %s)",
FormatInternalUnits( aModuleDrawing->GetStart0() ).c_str(),
FormatInternalUnits( aModuleDrawing->GetEnd0() ).c_str() );
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
break;
case S_RECT: // Rectangle
m_out->Print( aNestLevel, "(fp_rect (start %s) (end %s)",
FormatInternalUnits( aModuleDrawing->GetStart0() ).c_str(),
FormatInternalUnits( aModuleDrawing->GetEnd0() ).c_str() );
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
break;
case S_CIRCLE: // Circle
m_out->Print( aNestLevel, "(fp_circle (center %s) (end %s)",
FormatInternalUnits( aModuleDrawing->GetStart0() ).c_str(),
FormatInternalUnits( aModuleDrawing->GetEnd0() ).c_str() );
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
break;
case S_ARC: // Arc
m_out->Print( aNestLevel, "(fp_arc (start %s) (end %s) (angle %s)",
FormatInternalUnits( aModuleDrawing->GetStart0() ).c_str(),
FormatInternalUnits( aModuleDrawing->GetEnd0() ).c_str(),
FormatAngle( aModuleDrawing->GetAngle() ).c_str() );
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
FormatInternalUnits( aFPShape->GetEnd0() ).c_str(),
FormatAngle( aFPShape->GetAngle() ).c_str() );
break;
case S_POLYGON: // Polygonal segment
if( aModuleDrawing->IsPolyShapeValid() )
if( aFPShape->IsPolyShapeValid() )
{
SHAPE_POLY_SET& poly = aModuleDrawing->GetPolyShape();
SHAPE_POLY_SET& poly = aFPShape->GetPolyShape();
SHAPE_LINE_CHAIN& outline = poly.Outline( 0 );
int pointsCount = outline.PointCount();
@ -909,23 +909,23 @@ void PCB_IO::format( FP_SHAPE* aModuleDrawing, int aNestLevel ) const
case S_CURVE: // Bezier curve
m_out->Print( aNestLevel, "(fp_curve (pts (xy %s) (xy %s) (xy %s) (xy %s))",
FormatInternalUnits( aModuleDrawing->GetStart0() ).c_str(),
FormatInternalUnits( aModuleDrawing->GetBezier0_C1() ).c_str(),
FormatInternalUnits( aModuleDrawing->GetBezier0_C2() ).c_str(),
FormatInternalUnits( aModuleDrawing->GetEnd0() ).c_str() );
FormatInternalUnits( aFPShape->GetStart0() ).c_str(),
FormatInternalUnits( aFPShape->GetBezier0_C1() ).c_str(),
FormatInternalUnits( aFPShape->GetBezier0_C2() ).c_str(),
FormatInternalUnits( aFPShape->GetEnd0() ).c_str() );
break;
default:
wxFAIL_MSG( "PCB_IO::format cannot format unknown FP_SHAPE shape:"
+ PCB_SHAPE_TYPE_T_asString( aModuleDrawing->GetShape() ) );
+ PCB_SHAPE_TYPE_T_asString( aFPShape->GetShape() ) );
return;
};
formatLayer( aModuleDrawing );
formatLayer( aFPShape );
m_out->Print( 0, " (width %s)", FormatInternalUnits( aModuleDrawing->GetWidth() ).c_str() );
m_out->Print( 0, " (width %s)", FormatInternalUnits( aFPShape->GetWidth() ).c_str() );
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aModuleDrawing->m_Uuid.AsString() ) );
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aFPShape->m_Uuid.AsString() ) );
m_out->Print( 0, ")\n" );
}
@ -949,11 +949,11 @@ void PCB_IO::format( PCB_TARGET* aTarget, int aNestLevel ) const
}
void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
void PCB_IO::format( MODULE* aFootprint, int aNestLevel ) const
{
if( !( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) )
{
const wxArrayString* initial_comments = aModule->GetInitialComments();
const wxArrayString* initial_comments = aFootprint->GetInitialComments();
if( initial_comments )
{
@ -966,45 +966,45 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
if( m_ctl & CTL_OMIT_LIBNAME )
m_out->Print( aNestLevel, "(module %s",
m_out->Quotes( aModule->GetFPID().GetLibItemNameAndRev() ).c_str() );
m_out->Quotes( aFootprint->GetFPID().GetLibItemNameAndRev() ).c_str() );
else
m_out->Print( aNestLevel, "(module %s",
m_out->Quotes( aModule->GetFPID().Format() ).c_str() );
m_out->Quotes( aFootprint->GetFPID().Format() ).c_str() );
if( aModule->IsLocked() )
if( aFootprint->IsLocked() )
m_out->Print( 0, " locked" );
if( aModule->IsPlaced() )
if( aFootprint->IsPlaced() )
m_out->Print( 0, " placed" );
formatLayer( aModule );
formatLayer( aFootprint );
m_out->Print( 0, " (tedit %lX)", (unsigned long)aModule->GetLastEditTime() );
m_out->Print( 0, " (tedit %lX)", (unsigned long)aFootprint->GetLastEditTime() );
if( !( m_ctl & CTL_OMIT_TSTAMPS ) )
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aModule->m_Uuid.AsString() ) );
m_out->Print( 0, " (tstamp %s)", TO_UTF8( aFootprint->m_Uuid.AsString() ) );
m_out->Print( 0, "\n" );
if( !( m_ctl & CTL_OMIT_AT ) )
{
m_out->Print( aNestLevel+1, "(at %s", FormatInternalUnits( aModule->GetPosition() ).c_str() );
m_out->Print( aNestLevel+1, "(at %s", FormatInternalUnits( aFootprint->GetPosition() ).c_str() );
if( aModule->GetOrientation() != 0.0 )
m_out->Print( 0, " %s", FormatAngle( aModule->GetOrientation() ).c_str() );
if( aFootprint->GetOrientation() != 0.0 )
m_out->Print( 0, " %s", FormatAngle( aFootprint->GetOrientation() ).c_str() );
m_out->Print( 0, ")\n" );
}
if( !aModule->GetDescription().IsEmpty() )
if( !aFootprint->GetDescription().IsEmpty() )
m_out->Print( aNestLevel+1, "(descr %s)\n",
m_out->Quotew( aModule->GetDescription() ).c_str() );
m_out->Quotew( aFootprint->GetDescription() ).c_str() );
if( !aModule->GetKeywords().IsEmpty() )
if( !aFootprint->GetKeywords().IsEmpty() )
m_out->Print( aNestLevel+1, "(tags %s)\n",
m_out->Quotew( aModule->GetKeywords() ).c_str() );
m_out->Quotew( aFootprint->GetKeywords() ).c_str() );
const std::map<wxString, wxString>& props = aModule->GetProperties();
const std::map<wxString, wxString>& props = aFootprint->GetProperties();
for( const std::pair<const wxString, wxString>& prop : props )
{
@ -1013,78 +1013,78 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
m_out->Quotew( prop.second ).c_str() );
}
if( !( m_ctl & CTL_OMIT_PATH ) && !aModule->GetPath().empty() )
if( !( m_ctl & CTL_OMIT_PATH ) && !aFootprint->GetPath().empty() )
m_out->Print( aNestLevel+1, "(path %s)\n",
m_out->Quotew( aModule->GetPath().AsString() ).c_str() );
m_out->Quotew( aFootprint->GetPath().AsString() ).c_str() );
if( aModule->GetPlacementCost90() != 0 )
m_out->Print( aNestLevel+1, "(autoplace_cost90 %d)\n", aModule->GetPlacementCost90() );
if( aFootprint->GetPlacementCost90() != 0 )
m_out->Print( aNestLevel+1, "(autoplace_cost90 %d)\n", aFootprint->GetPlacementCost90() );
if( aModule->GetPlacementCost180() != 0 )
m_out->Print( aNestLevel+1, "(autoplace_cost180 %d)\n", aModule->GetPlacementCost180() );
if( aFootprint->GetPlacementCost180() != 0 )
m_out->Print( aNestLevel+1, "(autoplace_cost180 %d)\n", aFootprint->GetPlacementCost180() );
if( aModule->GetLocalSolderMaskMargin() != 0 )
if( aFootprint->GetLocalSolderMaskMargin() != 0 )
m_out->Print( aNestLevel+1, "(solder_mask_margin %s)\n",
FormatInternalUnits( aModule->GetLocalSolderMaskMargin() ).c_str() );
FormatInternalUnits( aFootprint->GetLocalSolderMaskMargin() ).c_str() );
if( aModule->GetLocalSolderPasteMargin() != 0 )
if( aFootprint->GetLocalSolderPasteMargin() != 0 )
m_out->Print( aNestLevel+1, "(solder_paste_margin %s)\n",
FormatInternalUnits( aModule->GetLocalSolderPasteMargin() ).c_str() );
FormatInternalUnits( aFootprint->GetLocalSolderPasteMargin() ).c_str() );
if( aModule->GetLocalSolderPasteMarginRatio() != 0 )
if( aFootprint->GetLocalSolderPasteMarginRatio() != 0 )
m_out->Print( aNestLevel+1, "(solder_paste_ratio %s)\n",
Double2Str( aModule->GetLocalSolderPasteMarginRatio() ).c_str() );
Double2Str( aFootprint->GetLocalSolderPasteMarginRatio() ).c_str() );
if( aModule->GetLocalClearance() != 0 )
if( aFootprint->GetLocalClearance() != 0 )
m_out->Print( aNestLevel+1, "(clearance %s)\n",
FormatInternalUnits( aModule->GetLocalClearance() ).c_str() );
FormatInternalUnits( aFootprint->GetLocalClearance() ).c_str() );
if( aModule->GetZoneConnection() != ZONE_CONNECTION::INHERITED )
if( aFootprint->GetZoneConnection() != ZONE_CONNECTION::INHERITED )
m_out->Print( aNestLevel+1, "(zone_connect %d)\n",
static_cast<int>( aModule->GetZoneConnection() ) );
static_cast<int>( aFootprint->GetZoneConnection() ) );
if( aModule->GetThermalWidth() != 0 )
if( aFootprint->GetThermalWidth() != 0 )
m_out->Print( aNestLevel+1, "(thermal_width %s)\n",
FormatInternalUnits( aModule->GetThermalWidth() ).c_str() );
FormatInternalUnits( aFootprint->GetThermalWidth() ).c_str() );
if( aModule->GetThermalGap() != 0 )
if( aFootprint->GetThermalGap() != 0 )
m_out->Print( aNestLevel+1, "(thermal_gap %s)\n",
FormatInternalUnits( aModule->GetThermalGap() ).c_str() );
FormatInternalUnits( aFootprint->GetThermalGap() ).c_str() );
// Attributes
if( aModule->GetAttributes() )
if( aFootprint->GetAttributes() )
{
m_out->Print( aNestLevel+1, "(attr" );
if( aModule->GetAttributes() & MOD_SMD )
if( aFootprint->GetAttributes() & FP_SMD )
m_out->Print( 0, " smd" );
if( aModule->GetAttributes() & MOD_THROUGH_HOLE )
if( aFootprint->GetAttributes() & FP_THROUGH_HOLE )
m_out->Print( 0, " through_hole" );
if( aModule->GetAttributes() & MOD_BOARD_ONLY )
if( aFootprint->GetAttributes() & FP_BOARD_ONLY )
m_out->Print( 0, " board_only" );
if( aModule->GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES )
if( aFootprint->GetAttributes() & FP_EXCLUDE_FROM_POS_FILES )
m_out->Print( 0, " exclude_from_pos_files" );
if( aModule->GetAttributes() & MOD_EXCLUDE_FROM_BOM )
if( aFootprint->GetAttributes() & FP_EXCLUDE_FROM_BOM )
m_out->Print( 0, " exclude_from_bom" );
m_out->Print( 0, ")\n" );
}
Format( (BOARD_ITEM*) &aModule->Reference(), aNestLevel+1 );
Format( (BOARD_ITEM*) &aModule->Value(), aNestLevel+1 );
Format((BOARD_ITEM*) &aFootprint->Reference(), aNestLevel + 1 );
Format((BOARD_ITEM*) &aFootprint->Value(), aNestLevel + 1 );
std::set<PAD*, MODULE::cmp_pads> sorted_pads( aModule->Pads().begin(),
aModule->Pads().end() );
std::set<BOARD_ITEM*, MODULE::cmp_drawings> sorted_drawings( aModule->GraphicalItems().begin(),
aModule->GraphicalItems().end() );
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_zones( aModule->Zones().begin(),
aModule->Zones().end() );
std::set<BOARD_ITEM*, PCB_GROUP::ptr_cmp> sorted_groups( aModule->Groups().begin(),
aModule->Groups().end() );
std::set<PAD*, MODULE::cmp_pads> sorted_pads( aFootprint->Pads().begin(),
aFootprint->Pads().end() );
std::set<BOARD_ITEM*, MODULE::cmp_drawings> sorted_drawings( aFootprint->GraphicalItems().begin(),
aFootprint->GraphicalItems().end() );
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_zones( aFootprint->Zones().begin(),
aFootprint->Zones().end() );
std::set<BOARD_ITEM*, PCB_GROUP::ptr_cmp> sorted_groups( aFootprint->Groups().begin(),
aFootprint->Groups().end() );
// Save drawing elements.
@ -1104,8 +1104,8 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
Format( group, aNestLevel + 1 );
// Save 3D info.
auto bs3D = aModule->Models().begin();
auto es3D = aModule->Models().end();
auto bs3D = aFootprint->Models().begin();
auto es3D = aFootprint->Models().end();
while( bs3D != es3D )
{

View File

@ -260,7 +260,7 @@ private:
void format( DIMENSION_BASE* aDimension, int aNestLevel = 0 ) const;
void format( FP_SHAPE* aModuleDrawing, int aNestLevel = 0 ) const;
void format( FP_SHAPE* aFPShape, int aNestLevel = 0 ) const;
void format( PCB_GROUP* aGroup, int aNestLevel = 0 ) const;
@ -268,7 +268,7 @@ private:
void format( PCB_TARGET* aTarget, int aNestLevel = 0 ) const;
void format( MODULE* aModule, int aNestLevel = 0 ) const;
void format( MODULE* aFootprint, int aNestLevel = 0 ) const;
void format( PAD* aPad, int aNestLevel = 0 ) const;

View File

@ -2951,27 +2951,27 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
switch( token )
{
case T_virtual: // legacy token prior to version 20200826
attributes |= MOD_EXCLUDE_FROM_POS_FILES | MOD_EXCLUDE_FROM_BOM;
attributes |= FP_EXCLUDE_FROM_POS_FILES | FP_EXCLUDE_FROM_BOM;
break;
case T_through_hole:
attributes |= MOD_THROUGH_HOLE;
attributes |= FP_THROUGH_HOLE;
break;
case T_smd:
attributes |= MOD_SMD;
attributes |= FP_SMD;
break;
case T_board_only:
attributes |= MOD_BOARD_ONLY;
attributes |= FP_BOARD_ONLY;
break;
case T_exclude_from_pos_files:
attributes |= MOD_EXCLUDE_FROM_POS_FILES;
attributes |= FP_EXCLUDE_FROM_POS_FILES;
break;
case T_exclude_from_bom:
attributes |= MOD_EXCLUDE_FROM_BOM;
attributes |= FP_EXCLUDE_FROM_BOM;
break;
default:
@ -3082,7 +3082,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
// files. We probably don't want to get into that game so we'll just include them by
// default and let the user change it if required.
if( m_requiredVersion < 20200826 && attributes == 0 )
attributes |= MOD_THROUGH_HOLE;
attributes |= FP_THROUGH_HOLE;
module->SetAttributes( attributes );

View File

@ -1297,11 +1297,11 @@ void LEGACY_PLUGIN::loadFOOTPRINT( MODULE* aFootprint )
data = line + SZ( "At" );
if( strstr( data, "SMD" ) )
attrs |= MOD_SMD;
attrs |= FP_SMD;
else if( strstr( data, "VIRTUAL" ) )
attrs |= MOD_EXCLUDE_FROM_POS_FILES | MOD_EXCLUDE_FROM_BOM;
attrs |= FP_EXCLUDE_FROM_POS_FILES | FP_EXCLUDE_FROM_BOM;
else
attrs |= MOD_THROUGH_HOLE | MOD_EXCLUDE_FROM_POS_FILES;
attrs |= FP_THROUGH_HOLE | FP_EXCLUDE_FROM_POS_FILES;
aFootprint->SetAttributes( attrs );
}
@ -3017,10 +3017,10 @@ void LEGACY_PLUGIN::init( const PROPERTIES* aProperties )
}
void LEGACY_PLUGIN::SaveModule3D( const MODULE* me ) const
void LEGACY_PLUGIN::SaveFP3DModels( const MODULE* aFootprint ) const
{
auto sM = me->Models().begin();
auto eM = me->Models().end();
auto sM = aFootprint->Models().begin();
auto eM = aFootprint->Models().end();
while( sM != eM )
{

View File

@ -102,7 +102,7 @@ public:
void SetReader( LINE_READER* aReader ) { m_reader = aReader; }
void SetFilePtr( FILE* aFile ) { m_fp = aFile; }
void SaveModule3D( const MODULE* aModule ) const;
void SaveFP3DModels( const MODULE* aFootprint ) const;
// return the new .kicad_pcb layer id from the old (legacy) layer id
static PCB_LAYER_ID leg_layer2new( int cu_count, LAYER_NUM aLayerNum );