More module -> footprint.
This commit is contained in:
parent
522d64968e
commit
63a54d003e
|
@ -287,7 +287,7 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
|
|||
modelInfo->m_Offset.y = DoubleValueFromString( m_userUnits, yoff->GetValue() ) / IU_PER_MM;
|
||||
modelInfo->m_Offset.z = DoubleValueFromString( m_userUnits, zoff->GetValue() ) / IU_PER_MM;
|
||||
|
||||
// Update the dummy module for the preview
|
||||
// Update the dummy footprint for the preview
|
||||
UpdateDummyFootprint( false );
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void PANEL_PREV_3D::onOpacitySlider( wxCommandEvent& event )
|
|||
|
||||
modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
|
||||
|
||||
// Update the dummy module for the preview
|
||||
// Update the dummy footprint for the preview
|
||||
UpdateDummyFootprint( false );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @file panel_prev_model.h
|
||||
* @brief Defines a panel which is to be added to a wxFileDialog via
|
||||
* SetExtraControl();
|
||||
* The panel shows a preview of the module being edited and provides controls
|
||||
* The panel shows a preview of the footprint being edited and provides controls
|
||||
* to set the offset/rotation/scale of each model 3d shape as per KiCad's
|
||||
* current behavior. The panel may also be used in the 3D configuration dialog
|
||||
* to tune the positioning of the models without invoking a file selector dialog.
|
||||
|
@ -201,14 +201,14 @@ public:
|
|||
CCAMERA& GetCurrentCamera() override { return m_currentCamera; }
|
||||
|
||||
/**
|
||||
* @brief SetModelDataIdx - Sets the currently selected index in the model list so that
|
||||
* @brief SetSelectedModel - Sets the currently selected index in the model list so that
|
||||
* the scale/rotation/offset controls can be updated.
|
||||
*/
|
||||
void SetSelectedModel( int idx );
|
||||
|
||||
/**
|
||||
* @brief UpdateModelInfoList - copy shapes from the current shape list which are flagged
|
||||
* for preview to the copy of module that is on the preview dummy board
|
||||
* @brief UpdateDummyFootprint - copy shapes from the current shape list which are flagged
|
||||
* for preview to the copy of footprint that is on the preview dummy board
|
||||
*/
|
||||
void UpdateDummyFootprint( bool aRelaodRequired = true );
|
||||
};
|
||||
|
|
|
@ -108,14 +108,12 @@ class BOARD_ADAPTER
|
|||
/**
|
||||
* @brief Is3DLayerEnabled - Check if a layer is enabled
|
||||
* @param aLayer: layer ID to get status
|
||||
* @return true if layer should be displayed, false if not
|
||||
*/
|
||||
bool Is3DLayerEnabled( PCB_LAYER_ID aLayer ) const;
|
||||
|
||||
/**
|
||||
* @brief ShouldModuleBeDisplayed - Test if module should be displayed in
|
||||
* relation to attributs and the flags
|
||||
* @return true if module should be displayed, false if not
|
||||
* @brief ShouldFPBeDisplayed - Test if footprint should be displayed in relation to
|
||||
* attributes and the flags
|
||||
*/
|
||||
bool ShouldFPBeDisplayed( FOOTPRINT_ATTR_T aFPAttributes ) const;
|
||||
|
||||
|
@ -229,10 +227,10 @@ class BOARD_ADAPTER
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief GetModulesZcoord3DIU - Get the position of the module in 3d integer units
|
||||
* @brief GetModulesZcoord3DIU - Get the position of the footprint in 3d integer units
|
||||
* considering if it is flipped or not.
|
||||
* @param aIsFlipped: true for use in footprints on Front (top) layer, false
|
||||
* if module is on back (bottom) layer
|
||||
* if footprint is on back (bottom) layer
|
||||
* @return the Z position of 3D shapes, in 3D integer units
|
||||
*/
|
||||
float GetModulesZcoord3DIU( bool aIsFlipped ) const ;
|
||||
|
|
|
@ -1292,7 +1292,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot,
|
|||
if( ( aRenderTopOrBot && !fp->IsFlipped() )
|
||||
|| ( !aRenderTopOrBot && fp->IsFlipped() ) )
|
||||
{
|
||||
render_3D_module( fp, aRenderTransparentOnly, isIntersected );
|
||||
render_3D_footprint( fp, aRenderTransparentOnly, isIntersected );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1319,26 +1319,26 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models( bool aRenderTopOrBot,
|
|||
}
|
||||
|
||||
|
||||
void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
|
||||
void C3D_RENDER_OGL_LEGACY::render_3D_footprint( const MODULE* aFootprint,
|
||||
bool aRenderTransparentOnly,
|
||||
bool aIsSelected )
|
||||
{
|
||||
if( !module->Models().empty() )
|
||||
if( !aFootprint->Models().empty() )
|
||||
{
|
||||
const double zpos = m_boardAdapter.GetModulesZcoord3DIU( module->IsFlipped() );
|
||||
const double zpos = m_boardAdapter.GetModulesZcoord3DIU( aFootprint->IsFlipped() );
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
wxPoint pos = module->GetPosition();
|
||||
wxPoint pos = aFootprint->GetPosition();
|
||||
|
||||
glTranslatef( pos.x * m_boardAdapter.BiuTo3Dunits(),
|
||||
-pos.y * m_boardAdapter.BiuTo3Dunits(),
|
||||
zpos );
|
||||
|
||||
if( module->GetOrientation() )
|
||||
glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
|
||||
if( aFootprint->GetOrientation() )
|
||||
glRotated((double) aFootprint->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
|
||||
|
||||
if( module->IsFlipped() )
|
||||
if( aFootprint->IsFlipped() )
|
||||
{
|
||||
glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
|
||||
glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
|
||||
|
@ -1351,7 +1351,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
|
|||
modelunit_to_3d_units_factor );
|
||||
|
||||
// Get the list of model files for this model
|
||||
for( const FP_3DMODEL& sM : module->Models() )
|
||||
for( const FP_3DMODEL& sM : aFootprint->Models() )
|
||||
{
|
||||
if( !sM.m_Show || sM.m_Filename.empty() )
|
||||
continue;
|
||||
|
@ -1386,10 +1386,10 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
|
|||
|
||||
if( aRenderTransparentOnly )
|
||||
modelPtr->Draw_transparent( sM.m_Opacity,
|
||||
module->IsSelected() || aIsSelected,
|
||||
aFootprint->IsSelected() || aIsSelected,
|
||||
m_boardAdapter.m_opengl_selectionColor );
|
||||
else
|
||||
modelPtr->Draw_opaque( module->IsSelected() || aIsSelected,
|
||||
modelPtr->Draw_opaque( aFootprint->IsSelected() || aIsSelected,
|
||||
m_boardAdapter.m_opengl_selectionColor );
|
||||
|
||||
if( m_boardAdapter.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) )
|
||||
|
|
|
@ -203,7 +203,7 @@ private:
|
|||
|
||||
void render_3D_models_selected( bool aRenderTopOrBot, bool aRenderTransparentOnly, bool aRenderSelectedOnly );
|
||||
|
||||
void render_3D_module( const MODULE* module, bool aRenderTransparentOnly, bool aIsSelected );
|
||||
void render_3D_footprint( const MODULE* aFootprint, bool aRenderTransparentOnly, bool aIsSelected );
|
||||
|
||||
void setLight_Front( bool enabled );
|
||||
void setLight_Top( bool enabled );
|
||||
|
|
|
@ -106,7 +106,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
|
|||
|
||||
/**
|
||||
* Function GRText
|
||||
* Draw a graphic text (like module texts)
|
||||
* Draw a graphic text (like footprint texts)
|
||||
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
|
||||
* @param aPos = text position (according to h_justify, v_justify)
|
||||
* @param aColor (COLOR4D) = text color
|
||||
|
|
|
@ -374,8 +374,7 @@ bool LIB_ID::isLegalChar( unsigned aUniChar, LIB_ID_TYPE aType )
|
|||
if( aUniChar < ' ' )
|
||||
return false;
|
||||
|
||||
// This list of characters is also duplicated in validators.cpp and
|
||||
// class_module.cpp
|
||||
// This list of characters is also duplicated in validators.cpp and footprint.cpp
|
||||
// TODO: Unify forbidden character lists
|
||||
switch( aUniChar )
|
||||
{
|
||||
|
|
|
@ -71,8 +71,8 @@ void GRID_CELL_TEXT_EDITOR::StartingKey( wxKeyEvent& event )
|
|||
FOOTPRINT_NAME_VALIDATOR::FOOTPRINT_NAME_VALIDATOR( wxString* aValue ) :
|
||||
wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue )
|
||||
{
|
||||
// This list of characters follows the string from class_module.cpp
|
||||
// which, in turn mimics the strings from lib_id.cpp
|
||||
// This list of characters follows the string from footprint.cpp which, in turn mimics the
|
||||
// strings from lib_id.cpp
|
||||
// TODO: Unify forbidden character lists
|
||||
wxString illegalChars = "%$<>\t\n\r\"\\/:";
|
||||
SetCharExcludes( illegalChars );
|
||||
|
|
|
@ -62,7 +62,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
|
|||
ret |= fprintf( f, "\"%s\"\n", TO_UTF8( title ) );
|
||||
ret |= fprintf( f, ".TYP FULL\n\n" );
|
||||
|
||||
// Create netlist module section
|
||||
// Create netlist footprints section
|
||||
m_ReferencesAlreadyFound.Clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
|
|
@ -60,7 +60,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
ret |= fprintf( f, "( { %s created %s }\n",
|
||||
NETLIST_HEAD_STRING, TO_UTF8( DateAndTime() ) );
|
||||
|
||||
// Create netlist module section
|
||||
// Create netlist footprints section
|
||||
m_ReferencesAlreadyFound.Clear();
|
||||
|
||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||
|
|
|
@ -138,7 +138,7 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
|
|||
|
||||
PTREE& tree = doc.get_child( "pcb_netlist" );
|
||||
wxString msg;
|
||||
m_pcbModules.clear();
|
||||
m_pcbFootprints.clear();
|
||||
|
||||
for( const std::pair<const std::string, PTREE>& item : tree )
|
||||
{
|
||||
|
@ -184,9 +184,9 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
|
|||
}
|
||||
|
||||
// Use lower_bound for not to iterate over map twice
|
||||
auto nearestItem = m_pcbModules.lower_bound( path );
|
||||
auto nearestItem = m_pcbFootprints.lower_bound( path );
|
||||
|
||||
if( nearestItem != m_pcbModules.end() && nearestItem->first == path )
|
||||
if( nearestItem != m_pcbFootprints.end() && nearestItem->first == path )
|
||||
{
|
||||
// Module with this path already exists - generate error
|
||||
msg.Printf( _( "Pcb footprints '%s' and '%s' linked to same symbol." ),
|
||||
|
@ -196,9 +196,9 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
|
|||
}
|
||||
else
|
||||
{
|
||||
// Add module to the map
|
||||
// Add footprint to the map
|
||||
auto data = std::make_shared<PCB_FP_DATA>( ref, footprint, value, pinNetMap );
|
||||
m_pcbModules.insert( nearestItem, std::make_pair( path, data ) );
|
||||
m_pcbFootprints.insert( nearestItem, std::make_pair( path, data ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,10 +206,10 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
|
|||
|
||||
void BACK_ANNOTATE::getChangeList()
|
||||
{
|
||||
for( std::pair<const wxString, std::shared_ptr<PCB_FP_DATA>>& module : m_pcbModules )
|
||||
for( std::pair<const wxString, std::shared_ptr<PCB_FP_DATA>>& fpData : m_pcbFootprints )
|
||||
{
|
||||
const wxString& pcbPath = module.first;
|
||||
auto& pcbData = module.second;
|
||||
const wxString& pcbPath = fpData.first;
|
||||
auto& pcbData = fpData.second;
|
||||
int refIndex;
|
||||
bool foundInMultiunit = false;
|
||||
|
||||
|
@ -224,7 +224,7 @@ void BACK_ANNOTATE::getChangeList()
|
|||
|
||||
if( refIndex >= 0 )
|
||||
{
|
||||
// If module linked to multi unit symbol, we add all symbol's units to
|
||||
// If footprint linked to multi unit symbol, we add all symbol's units to
|
||||
// the change list
|
||||
foundInMultiunit = true;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ private:
|
|||
bool m_processNetNames;
|
||||
bool m_dryRun;
|
||||
|
||||
PCB_MODULES_MAP m_pcbModules;
|
||||
PCB_MODULES_MAP m_pcbFootprints;
|
||||
SCH_REFERENCE_LIST m_refs;
|
||||
SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs;
|
||||
std::deque<CHANGELIST_ITEM> m_changelist;
|
||||
|
|
|
@ -301,11 +301,11 @@ public:
|
|||
MODULE* CreateNewFootprint( const wxString& aFootprintName );
|
||||
|
||||
/**
|
||||
* Function PlaceModule
|
||||
* places \a aModule at the current cursor position and updates module coordinates
|
||||
* Function PlaceFootprint
|
||||
* places \a aFootprint at the current cursor position and updates footprint coordinates
|
||||
* with the new position.
|
||||
*
|
||||
* @param aRecreateRatsnest A bool true redraws the module rats nest.
|
||||
* @param aRecreateRatsnest A bool true redraws the footprint ratsnest.
|
||||
*/
|
||||
void PlaceFootprint( MODULE* aFootprint, bool aRecreateRatsnest = true );
|
||||
|
||||
|
@ -320,7 +320,7 @@ public:
|
|||
MODULE* SelectFootprintFromLibTree( LIB_ID aPreselect = LIB_ID() );
|
||||
|
||||
/**
|
||||
* Adds the given module to the board.
|
||||
* Adds the given footprint to the board.
|
||||
* @param aFootprint
|
||||
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
|
||||
*/
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
/* Bits characterizing cell */
|
||||
#define CELL_IS_EMPTY 0x00
|
||||
#define CELL_IS_HOLE 0x01 /* a conducting hole or obstacle */
|
||||
#define CELL_IS_MODULE 0x02 /* auto placement occupied by a module */
|
||||
#define CELL_IS_MODULE 0x02 /* auto placement occupied by a footprint */
|
||||
#define CELL_IS_EDGE 0x20 /* Area and auto-placement: limiting cell contour (Board, Zone) */
|
||||
#define CELL_IS_FRIEND 0x40 /* Area and auto-placement: cell part of the net */
|
||||
#define CELL_IS_ZONE 0x80 /* Area and auto-placement: cell available */
|
||||
|
@ -542,7 +542,7 @@ unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int sid
|
|||
}
|
||||
|
||||
|
||||
/* Test if the module can be placed on the board.
|
||||
/* Test if the footprint can be placed on the board.
|
||||
* Returns the value TstRectangle().
|
||||
* Module is known by its bounding box
|
||||
*/
|
||||
|
@ -651,7 +651,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
|
|||
if( keepOutCost >= 0 ) // i.e. if the footprint can be put here
|
||||
{
|
||||
error = 0;
|
||||
// m_frame->build_ratsnest_module( aFootprint ); // fixme
|
||||
// m_frame->build_ratsnest_footprint( aFootprint ); // fixme
|
||||
curr_cost = computePlacementRatsnestCost( aFootprint, fpOffset );
|
||||
Score = curr_cost + keepOutCost;
|
||||
|
||||
|
@ -816,9 +816,9 @@ MODULE* AR_AUTOPLACER::pickFootprint( )
|
|||
|
||||
sort( fpList.begin(), fpList.end(), sortFootprintsByRatsnestSize );
|
||||
|
||||
// Search for "best" module.
|
||||
MODULE* bestModule = nullptr;
|
||||
MODULE* altModule = nullptr;
|
||||
// Search for "best" footprint.
|
||||
MODULE* bestFootprint = nullptr;
|
||||
MODULE* altFootprint = nullptr;
|
||||
|
||||
for( unsigned ii = 0; ii < fpList.size(); ii++ )
|
||||
{
|
||||
|
@ -827,19 +827,19 @@ MODULE* AR_AUTOPLACER::pickFootprint( )
|
|||
if( !footprint->NeedsPlaced() )
|
||||
continue;
|
||||
|
||||
altModule = footprint;
|
||||
altFootprint = footprint;
|
||||
|
||||
if( footprint->GetFlag() == 0 )
|
||||
continue;
|
||||
|
||||
bestModule = footprint;
|
||||
bestFootprint = footprint;
|
||||
break;
|
||||
}
|
||||
|
||||
if( bestModule )
|
||||
return bestModule;
|
||||
if( bestFootprint )
|
||||
return bestFootprint;
|
||||
else
|
||||
return altModule;
|
||||
return altFootprint;
|
||||
}
|
||||
|
||||
|
||||
|
@ -890,7 +890,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
|
|||
if( m_matrix.m_GridRouting < Millimeter2iu( 0.25 ) )
|
||||
m_matrix.m_GridRouting = Millimeter2iu( 0.25 );
|
||||
|
||||
// Compute module parameters used in auto place
|
||||
// Compute footprint parameters used in autoplace
|
||||
if( genPlacementRoutingMatrix( ) == 0 )
|
||||
return AR_FAILURE;
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled )
|
|||
}
|
||||
|
||||
|
||||
bool BOARD::IsModuleLayerVisible( PCB_LAYER_ID aLayer )
|
||||
bool BOARD::IsFootprintLayerVisible( PCB_LAYER_ID aLayer )
|
||||
{
|
||||
switch( aLayer )
|
||||
{
|
||||
|
@ -1109,11 +1109,10 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
|
|||
++p;
|
||||
break;
|
||||
|
||||
/* Instances of the requested KICAD_T live in a list, either one
|
||||
* that I manage, or that my footprints manage. If it's a type managed
|
||||
* by class MODULE, then simply pass it on to each module's
|
||||
* MODULE::Visit() function by way of the
|
||||
* IterateForward( m_Modules, ... ) call.
|
||||
/*
|
||||
* Instances of the requested KICAD_T live in a list, either one that I manage, or one
|
||||
* that my footprints manage. If it's a type managed by class FOOTPRINT, then simply
|
||||
* pass it on to each footprint's Visit() function via IterateForward( m_footprints, ... ).
|
||||
*/
|
||||
|
||||
case PCB_MODULE_T:
|
||||
|
@ -1122,7 +1121,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
|
|||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
|
||||
// this calls MODULE::Visit() on each module.
|
||||
// this calls FOOTPRINT::Visit() on each footprint.
|
||||
result = IterateForward<MODULE*>( m_footprints, inspector, testData, p );
|
||||
|
||||
// skip over any types handled in the above call.
|
||||
|
@ -1689,7 +1688,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
|
|||
PCB_LAYER_ID layer = candidate->GetLayer();
|
||||
|
||||
// Filter non visible footprints if requested
|
||||
if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
|
||||
if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
|
||||
{
|
||||
EDA_RECT bb = candidate->GetFootprintRect();
|
||||
|
||||
|
@ -1709,7 +1708,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
|
|||
min_dim = dist;
|
||||
}
|
||||
}
|
||||
else if( aVisibleOnly && IsModuleLayerVisible( layer ) )
|
||||
else if( aVisibleOnly && IsFootprintLayerVisible( layer ) )
|
||||
{
|
||||
if( dist <= alt_min_dim )
|
||||
{
|
||||
|
|
|
@ -343,7 +343,7 @@ public:
|
|||
/**
|
||||
* Gets the first footprint on the board or nullptr.
|
||||
* This is used primarily by the footprint editor which knows there is only one.
|
||||
* @return first module or null pointer
|
||||
* @return first footprint or null pointer
|
||||
*/
|
||||
MODULE* GetFirstFootprint() const
|
||||
{
|
||||
|
@ -546,12 +546,12 @@ public:
|
|||
void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
|
||||
|
||||
/**
|
||||
* Expect either of the two layers on which a module can reside, and returns
|
||||
* Expect either of the two layers on which a footprint can reside, and returns
|
||||
* whether that layer is visible.
|
||||
* @param aLayer One of the two allowed layers for footprints: F_Cu or B_Cu
|
||||
* @return bool - true if the layer is visible, else false.
|
||||
*/
|
||||
bool IsModuleLayerVisible( PCB_LAYER_ID aLayer );
|
||||
bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer );
|
||||
|
||||
/**
|
||||
* @return the BOARD_DESIGN_SETTINGS for this BOARD
|
||||
|
@ -1035,18 +1035,17 @@ public:
|
|||
PAD* GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerMask );
|
||||
|
||||
/**
|
||||
* Delete a given pad from the BOARD by removing it from its module and
|
||||
* from the m_NetInfo. Makes no UI calls.
|
||||
* Delete a given pad from the BOARD by removing it from its footprint and from the
|
||||
* m_NetInfo. Makes no UI calls.
|
||||
* @param aPad is the pad to delete.
|
||||
*/
|
||||
void PadDelete( PAD* aPad );
|
||||
|
||||
/**
|
||||
* First empties then fills the vector with all pads and sorts them by
|
||||
* increasing x coordinate, and for increasing y coordinate for same values of x coordinates.
|
||||
* The vector only holds pointers to the pads and
|
||||
* those pointers are only references to pads which are owned by the BOARD
|
||||
* through other links.
|
||||
* First empties then fills the vector with all pads and sorts them by increasing x
|
||||
* coordinate, and for increasing y coordinate for same values of x coordinates. The vector
|
||||
* only holds pointers to the pads and those pointers are only references to pads which are
|
||||
* owned by the BOARD through other links.
|
||||
* @param aVector Where to put the pad pointers.
|
||||
* @param aNetCode = the netcode filter:
|
||||
* = -1 to build the full pad list.
|
||||
|
@ -1082,7 +1081,6 @@ public:
|
|||
* @param aActiveLayer Layer to test.
|
||||
* @param aVisibleOnly Search only the visible layers if true.
|
||||
* @param aIgnoreLocked Ignore locked footprints when true.
|
||||
* @return MODULE* The best module or NULL if none.
|
||||
*/
|
||||
MODULE* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
|
||||
bool aVisibleOnly, bool aIgnoreLocked = false );
|
||||
|
|
|
@ -105,11 +105,11 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
// Module items need to be saved in the undo buffer before modification
|
||||
if( m_isFootprintEditor )
|
||||
{
|
||||
// Be sure that we are storing a module
|
||||
// Be sure that we are storing a footprint
|
||||
if( ent.m_item->Type() != PCB_MODULE_T )
|
||||
ent.m_item = ent.m_item->GetParent();
|
||||
|
||||
// We have not saved the module yet, so let's create an entry
|
||||
// We have not saved the footprint yet, so let's create an entry
|
||||
if( savedModules.count( ent.m_item ) == 0 )
|
||||
{
|
||||
if( !ent.m_copy )
|
||||
|
@ -188,7 +188,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
// This level can only handle module items when editing footprints
|
||||
// This level can only handle footprint children when editing footprints
|
||||
wxASSERT( m_isFootprintEditor );
|
||||
|
||||
if( boardItem->Type() == PCB_FP_TEXT_T )
|
||||
|
@ -204,9 +204,9 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
{
|
||||
MODULE* module = static_cast<MODULE*>( boardItem->GetParent() );
|
||||
wxASSERT( module && module->Type() == PCB_MODULE_T );
|
||||
module->Delete( boardItem );
|
||||
MODULE* footprint = static_cast<MODULE*>( boardItem->GetParent() );
|
||||
wxASSERT( footprint && footprint->Type() == PCB_MODULE_T );
|
||||
footprint->Delete( boardItem );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -233,15 +233,15 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
|
|||
|
||||
case PCB_MODULE_T:
|
||||
{
|
||||
// There are no footprints inside a module yet
|
||||
// No support for nested footprints (yet)
|
||||
wxASSERT( !m_isFootprintEditor );
|
||||
|
||||
MODULE* module = static_cast<MODULE*>( boardItem );
|
||||
view->Remove( module );
|
||||
module->ClearFlags();
|
||||
MODULE* footprint = static_cast<MODULE*>( boardItem );
|
||||
view->Remove( footprint );
|
||||
footprint->ClearFlags();
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
board->Remove( module ); // handles connectivity
|
||||
board->Remove( footprint ); // handles connectivity
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -601,7 +601,7 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
|
|||
RefDesChange* newref;
|
||||
NETLIST netlist;
|
||||
|
||||
if( !BuildModuleList( BadRefDes ) )
|
||||
if( !BuildFootprintList( BadRefDes ) )
|
||||
{
|
||||
ShowReport( "Selected options resulted in errors! Change them and try again.",
|
||||
RPT_SEVERITY_ERROR );
|
||||
|
@ -664,41 +664,41 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
|
|||
|
||||
} //If updating schematic
|
||||
|
||||
bool reannotateok = payload.size( ) == 0;
|
||||
bool reannotateOk = payload.size( ) == 0;
|
||||
|
||||
ShowReport( payload, reannotateok ? RPT_SEVERITY_ACTION : RPT_SEVERITY_ERROR );
|
||||
ShowReport( payload, reannotateOk ? RPT_SEVERITY_ACTION : RPT_SEVERITY_ERROR );
|
||||
BOARD_COMMIT commit( m_frame );
|
||||
|
||||
if( reannotateok )
|
||||
{ //Only update if no errors
|
||||
if( reannotateOk )//Only update if no errors
|
||||
{
|
||||
|
||||
for( MODULE* mod : m_footprints )
|
||||
{ // Create a netlist
|
||||
newref = GetNewRefDes( mod );
|
||||
for( MODULE* footprint : m_footprints )
|
||||
{
|
||||
newref = GetNewRefDes( footprint );
|
||||
|
||||
if( nullptr == newref )
|
||||
return false;
|
||||
|
||||
commit.Modify( mod ); //Make a copy for undo
|
||||
mod->SetReference( newref->NewRefDes ); //Update the PCB reference
|
||||
m_frame->GetCanvas()->GetView()->Update( mod ); //Touch the module
|
||||
commit.Modify( footprint ); // Make a copy for undo
|
||||
footprint->SetReference( newref->NewRefDes ); // Update the PCB reference
|
||||
m_frame->GetCanvas()->GetView()->Update( footprint ); // Touch the footprint
|
||||
}
|
||||
}
|
||||
|
||||
commit.Push( "Geographic reannotation" );
|
||||
return reannotateok;
|
||||
return reannotateOk;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
/// Build the module lists, sort it, filter for excludes, then build the change list
|
||||
/// Build the footprint lists, sort it, filter for excludes, then build the change list
|
||||
/// @returns true if success, false if errors
|
||||
bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefDes )
|
||||
bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector<RefDesInfo>& aBadRefDes )
|
||||
{
|
||||
bool annotateselected;
|
||||
bool annotatefront = m_AnnotateFront->GetValue(); //Unless only doing back
|
||||
bool annotateback = m_AnnotateBack->GetValue(); //Unless only doing front
|
||||
bool skiplocked = m_ExcludeLocked->GetValue();
|
||||
bool annotateSelected;
|
||||
bool annotateFront = m_AnnotateFront->GetValue(); //Unless only doing back
|
||||
bool annotateBack = m_AnnotateBack->GetValue(); //Unless only doing front
|
||||
bool skipLocked = m_ExcludeLocked->GetValue();
|
||||
|
||||
int errorcount = 0;
|
||||
unsigned int backstartrefdes;
|
||||
|
@ -721,7 +721,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
|
|||
}
|
||||
}
|
||||
|
||||
annotateselected = !selected.empty();
|
||||
annotateSelected = !selected.empty();
|
||||
|
||||
wxString exclude;
|
||||
|
||||
|
@ -740,70 +740,72 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
|
|||
m_excludeArray.push_back( exclude );
|
||||
}
|
||||
|
||||
RefDesInfo thismodule;
|
||||
RefDesInfo fpData;
|
||||
bool useModuleLocation = m_locationChoice->GetSelection() == 0;
|
||||
|
||||
for( MODULE* mod : m_footprints )
|
||||
for( MODULE* footprint : m_footprints )
|
||||
{
|
||||
thismodule.Uuid = mod->m_Uuid;
|
||||
thismodule.RefDesString = mod->GetReference();
|
||||
thismodule.FPID = mod->GetFPID();
|
||||
thismodule.x = useModuleLocation ? mod->GetPosition().x
|
||||
: mod->Reference().GetPosition().x;
|
||||
thismodule.y = useModuleLocation ? mod->GetPosition().y
|
||||
: mod->Reference().GetPosition().y;
|
||||
thismodule.roundedx = RoundToGrid( thismodule.x, m_sortGridx ); //Round to sort
|
||||
thismodule.roundedy = RoundToGrid( thismodule.y, m_sortGridy );
|
||||
thismodule.Front = mod->GetLayer() == F_Cu;
|
||||
thismodule.Action = UpdateRefDes; //Usually good
|
||||
fpData.Uuid = footprint->m_Uuid;
|
||||
fpData.RefDesString = footprint->GetReference();
|
||||
fpData.FPID = footprint->GetFPID();
|
||||
fpData.x = useModuleLocation ? footprint->GetPosition().x
|
||||
: footprint->Reference().GetPosition().x;
|
||||
fpData.y = useModuleLocation ? footprint->GetPosition().y
|
||||
: footprint->Reference().GetPosition().y;
|
||||
fpData.roundedx = RoundToGrid( fpData.x, m_sortGridx ); //Round to sort
|
||||
fpData.roundedy = RoundToGrid( fpData.y, m_sortGridy );
|
||||
fpData.Front = footprint->GetLayer() == F_Cu;
|
||||
fpData.Action = UpdateRefDes; //Usually good
|
||||
|
||||
if( thismodule.RefDesString.IsEmpty() )
|
||||
thismodule.Action = EmptyRefDes;
|
||||
if( fpData.RefDesString.IsEmpty() )
|
||||
{
|
||||
fpData.Action = EmptyRefDes;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstnum = thismodule.RefDesString.find_first_of( "0123456789" );
|
||||
firstnum = fpData.RefDesString.find_first_of( "0123456789" );
|
||||
|
||||
if( std::string::npos == firstnum )
|
||||
thismodule.Action = InvalidRefDes; //do not change ref des such as 12 or +1, or L
|
||||
fpData.Action = InvalidRefDes; //do not change ref des such as 12 or +1, or L
|
||||
}
|
||||
|
||||
//Get the type (R, C, etc)
|
||||
thismodule.RefDesType = thismodule.RefDesString.substr( 0, firstnum );
|
||||
fpData.RefDesType = fpData.RefDesString.substr( 0, firstnum );
|
||||
|
||||
for( wxString excluded : m_excludeArray )
|
||||
{
|
||||
if( excluded == thismodule.RefDesType ) //Am I supposed to exclude this type?
|
||||
if( excluded == fpData.RefDesType ) //Am I supposed to exclude this type?
|
||||
{
|
||||
thismodule.Action = Exclude; //Yes
|
||||
fpData.Action = Exclude; //Yes
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( ( thismodule.Front && annotateback ) || //If a front module and doing backs only
|
||||
( !thismodule.Front && annotatefront ) || //If a back module and doing front only
|
||||
( mod->IsLocked() && skiplocked ) ) //If excluding locked and it is locked
|
||||
if(( fpData.Front && annotateBack ) || // If a front module and doing backs only
|
||||
( !fpData.Front && annotateFront ) || // If a back module and doing front only
|
||||
( footprint->IsLocked() && skipLocked ) ) // If excluding locked and it is locked
|
||||
{
|
||||
thismodule.Action = Exclude;
|
||||
fpData.Action = Exclude;
|
||||
}
|
||||
|
||||
if( annotateselected )
|
||||
if( annotateSelected )
|
||||
{ // If onnly annotating selected c
|
||||
thismodule.Action = Exclude; //Assume it isn't selected
|
||||
fpData.Action = Exclude; // Assume it isn't selected
|
||||
|
||||
for( KIID sel : selected )
|
||||
{
|
||||
if( thismodule.Uuid == sel )
|
||||
if( fpData.Uuid == sel )
|
||||
{ // Found in selected footprints
|
||||
thismodule.Action = UpdateRefDes; //Update it
|
||||
fpData.Action = UpdateRefDes; // Update it
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( thismodule.Front )
|
||||
m_frontFootprints.push_back( thismodule );
|
||||
if( fpData.Front )
|
||||
m_frontFootprints.push_back( fpData );
|
||||
else
|
||||
m_backFootprints.push_back( thismodule );
|
||||
m_backFootprints.push_back( fpData );
|
||||
}
|
||||
|
||||
SetSortCodes( FrontDirectionsArray, m_sortCode ); //Determine the sort order for the front
|
||||
|
@ -865,7 +867,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
|
|||
|
||||
|
||||
//
|
||||
/// Scan through the module arrays and create the from -> to array
|
||||
/// Scan through the footprint arrays and create the from -> to array
|
||||
void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootprints,
|
||||
unsigned int aStartRefDes, wxString aPrefix,
|
||||
bool aRemovePrefix,
|
||||
|
@ -894,44 +896,44 @@ void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootpr
|
|||
m_refDesTypes[i].RefDesCount = aStartRefDes;
|
||||
}
|
||||
|
||||
for( RefDesInfo footprint : aFootprints )
|
||||
{ //For each module
|
||||
change.Uuid = footprint.Uuid;
|
||||
change.Action = footprint.Action;
|
||||
change.OldRefDesString = footprint.RefDesString;
|
||||
change.NewRefDes = footprint.RefDesString;
|
||||
change.Front = footprint.Front;
|
||||
for( RefDesInfo fpData : aFootprints )
|
||||
{
|
||||
change.Uuid = fpData.Uuid;
|
||||
change.Action = fpData.Action;
|
||||
change.OldRefDesString = fpData.RefDesString;
|
||||
change.NewRefDes = fpData.RefDesString;
|
||||
change.Front = fpData.Front;
|
||||
|
||||
if( footprint.RefDesString.IsEmpty() )
|
||||
footprint.Action = EmptyRefDes;
|
||||
if( fpData.RefDesString.IsEmpty() )
|
||||
fpData.Action = EmptyRefDes;
|
||||
|
||||
if( ( change.Action == EmptyRefDes ) || ( change.Action == InvalidRefDes ) )
|
||||
{
|
||||
m_changeArray.push_back( change );
|
||||
aBadRefDes.push_back( footprint );
|
||||
aBadRefDes.push_back( fpData );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( change.Action == UpdateRefDes )
|
||||
{
|
||||
refdestype = footprint.RefDesType;
|
||||
prefixpresent = ( 0 == footprint.RefDesType.find( aPrefix ) );
|
||||
refdestype = fpData.RefDesType;
|
||||
prefixpresent = ( 0 == fpData.RefDesType.find( aPrefix ) );
|
||||
|
||||
if( addprefix && !prefixpresent )
|
||||
footprint.RefDesType.insert( 0, aPrefix ); //Add prefix once only
|
||||
fpData.RefDesType.insert( 0, aPrefix ); //Add prefix once only
|
||||
|
||||
if( aRemovePrefix && prefixpresent ) //If there is a prefix remove it
|
||||
footprint.RefDesType.erase( 0, prefixsize );
|
||||
fpData.RefDesType.erase( 0, prefixsize );
|
||||
|
||||
for( i = 0; i < m_refDesTypes.size(); i++ ) //See if it is in the types array
|
||||
{
|
||||
if( m_refDesTypes[i].RefDesType == footprint.RefDesType ) //Found it!
|
||||
if( m_refDesTypes[i].RefDesType == fpData.RefDesType ) //Found it!
|
||||
break;
|
||||
}
|
||||
|
||||
if( i == m_refDesTypes.size() )
|
||||
{ //Wasn't in the types array so add it
|
||||
newtype.RefDesType = footprint.RefDesType;
|
||||
newtype.RefDesType = fpData.RefDesType;
|
||||
newtype.RefDesCount = ( aStartRefDes == 0 ? 1 : aStartRefDes );
|
||||
m_refDesTypes.push_back( newtype );
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ private:
|
|||
void LogChangePlan( void );
|
||||
|
||||
bool ReannotateBoard( void );
|
||||
bool BuildModuleList( std::vector<RefDesInfo>& aBadRefDes );
|
||||
bool BuildFootprintList( std::vector<RefDesInfo>& aBadRefDes );
|
||||
void BuildChangeArray( std::vector<RefDesInfo>& aFootprints, unsigned int aStartRefDes,
|
||||
wxString aPrefix, bool aRemovePrefix,
|
||||
std::vector<RefDesInfo>& aBadRefDes );
|
||||
|
|
|
@ -175,7 +175,7 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
}
|
||||
|
||||
// Do not enable/disable antipad clearance and spoke width. They might be needed if
|
||||
// a module or pad overrides the zone to specify a thermal connection.
|
||||
// a footprint or pad overrides the zone to specify a thermal connection.
|
||||
m_antipadClearance.SetValue( m_settings.m_ThermalReliefGap );
|
||||
m_spokeWidth.SetValue( m_settings.m_ThermalReliefSpokeWidth );
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::Validate()
|
|||
if( !DIALOG_SHIM::Validate() )
|
||||
return false;
|
||||
|
||||
// First, test for invalid chars in module name
|
||||
// First, test for invalid chars in footprint name
|
||||
wxString footprintName = m_FootprintNameCtrl->GetValue();
|
||||
|
||||
if( !checkFootprintName( footprintName ) )
|
||||
|
@ -703,7 +703,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
|
|||
|
||||
m_footprint->CalculateBoundingBox();
|
||||
|
||||
commit.Push( _( "Modify module properties" ) );
|
||||
commit.Push( _( "Modify footprint properties" ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1469,7 +1469,7 @@ void DIALOG_NET_INSPECTOR::buildNetsList()
|
|||
}
|
||||
|
||||
// count the pads for each net. since the nets are sorted by netcode
|
||||
// iterating over the modules' pads is faster.
|
||||
// iterating over the footprints' pads is faster.
|
||||
|
||||
for( MODULE* footprint : m_brd->Footprints() )
|
||||
{
|
||||
|
|
|
@ -249,16 +249,16 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
if( m_item->Type() == PCB_FP_TEXT_T && m_fpText )
|
||||
{
|
||||
MODULE* module = dynamic_cast<MODULE*>( m_fpText->GetParent() );
|
||||
MODULE* footprint = dynamic_cast<MODULE*>( m_fpText->GetParent() );
|
||||
wxString msg;
|
||||
|
||||
if( module )
|
||||
if( footprint )
|
||||
{
|
||||
msg.Printf( _( "Footprint %s (%s), %s, rotated %.1f deg"),
|
||||
module->GetReference(),
|
||||
module->GetValue(),
|
||||
module->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
|
||||
module->GetOrientation() / 10.0 );
|
||||
footprint->GetReference(),
|
||||
footprint->GetValue(),
|
||||
footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
|
||||
footprint->GetOrientation() / 10.0 );
|
||||
}
|
||||
|
||||
m_statusLine->SetLabel( msg );
|
||||
|
|
|
@ -659,12 +659,12 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
|
|||
for( ZONE* zone : m_board->Zones() )
|
||||
zone->CacheBoundingBox();
|
||||
|
||||
for( MODULE* module : m_board->Footprints() )
|
||||
for( MODULE* footprint : m_board->Footprints() )
|
||||
{
|
||||
for( ZONE* zone : module->Zones() )
|
||||
for( ZONE* zone : footprint->Zones() )
|
||||
zone->CacheBoundingBox();
|
||||
|
||||
module->BuildPolyCourtyards();
|
||||
footprint->BuildPolyCourtyards();
|
||||
}
|
||||
|
||||
for( DRC_TEST_PROVIDER* provider : m_testProviders )
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/*
|
||||
* 1 - create ascii/csv files for automatic placement of smd components
|
||||
* 2 - create a module report (pos and module descr) (ascii file)
|
||||
* 2 - create a footprint report (pos and footprint descr) (ascii file)
|
||||
*/
|
||||
|
||||
#include <kicad_string.h>
|
||||
|
@ -35,7 +35,7 @@
|
|||
class LIST_MOD // An helper class used to build a list of useful footprints.
|
||||
{
|
||||
public:
|
||||
MODULE* m_Module; // Link to the actual footprint
|
||||
MODULE* m_Footprint; // Link to the actual footprint
|
||||
wxString m_Reference; // Its schematic reference
|
||||
wxString m_Value; // Its schematic value
|
||||
LAYER_NUM m_Layer; // its side (B_Cu, or F_Cu)
|
||||
|
@ -132,7 +132,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
m_fpCount++;
|
||||
|
||||
LIST_MOD item;
|
||||
item.m_Module = footprint;
|
||||
item.m_Footprint = footprint;
|
||||
item.m_Reference = footprint->Reference().GetShownText();
|
||||
item.m_Value = footprint->Value().GetShownText();
|
||||
item.m_Layer = footprint->GetLayer();
|
||||
|
@ -140,7 +140,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
|
||||
lenRefText = std::max( lenRefText, (int) item.m_Reference.length() );
|
||||
lenValText = std::max( lenValText, (int) item.m_Value.length() );
|
||||
lenPkgText = std::max( lenPkgText, (int) item.m_Module->GetFPID().GetLibItemName().length() );
|
||||
lenPkgText = std::max( lenPkgText, (int) item.m_Footprint->GetFPID().GetLibItemName().length() );
|
||||
}
|
||||
|
||||
if( list.size() > 1 )
|
||||
|
@ -162,10 +162,10 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
for( int ii = 0; ii < m_fpCount; ii++ )
|
||||
{
|
||||
wxPoint footprint_pos;
|
||||
footprint_pos = list[ii].m_Module->GetPosition();
|
||||
footprint_pos = list[ii].m_Footprint->GetPosition();
|
||||
footprint_pos -= m_place_Offset;
|
||||
|
||||
LAYER_NUM layer = list[ii].m_Module->GetLayer();
|
||||
LAYER_NUM layer = list[ii].m_Footprint->GetLayer();
|
||||
wxASSERT( layer == F_Cu || layer == B_Cu );
|
||||
|
||||
if( layer == B_Cu )
|
||||
|
@ -175,7 +175,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
tmp << "\"" << csv_sep;
|
||||
tmp << "\"" << list[ii].m_Value;
|
||||
tmp << "\"" << csv_sep;
|
||||
tmp << "\"" << list[ii].m_Module->GetFPID().GetLibItemName().wx_str();
|
||||
tmp << "\"" << list[ii].m_Footprint->GetFPID().GetLibItemName().wx_str();
|
||||
tmp << "\"" << csv_sep;
|
||||
|
||||
tmp << wxString::Format( "%f%c%f%c%f",
|
||||
|
@ -183,7 +183,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
// Keep the Y axis oriented from bottom to top,
|
||||
// ( change y coordinate sign )
|
||||
-footprint_pos.y * conv_unit, csv_sep,
|
||||
list[ii].m_Module->GetOrientation() / 10.0 );
|
||||
list[ii].m_Footprint->GetOrientation() / 10.0 );
|
||||
tmp << csv_sep;
|
||||
|
||||
tmp << ( (layer == F_Cu ) ? PLACE_FILE_EXPORTER::GetFrontSideName()
|
||||
|
@ -228,10 +228,10 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
for( int ii = 0; ii < m_fpCount; ii++ )
|
||||
{
|
||||
wxPoint footprint_pos;
|
||||
footprint_pos = list[ii].m_Module->GetPosition();
|
||||
footprint_pos = list[ii].m_Footprint->GetPosition();
|
||||
footprint_pos -= m_place_Offset;
|
||||
|
||||
LAYER_NUM layer = list[ii].m_Module->GetLayer();
|
||||
LAYER_NUM layer = list[ii].m_Footprint->GetLayer();
|
||||
wxASSERT( layer == F_Cu || layer == B_Cu );
|
||||
|
||||
if( layer == B_Cu )
|
||||
|
@ -239,7 +239,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
|
||||
wxString ref = list[ii].m_Reference;
|
||||
wxString val = list[ii].m_Value;
|
||||
wxString pkg = list[ii].m_Module->GetFPID().GetLibItemName();
|
||||
wxString pkg = list[ii].m_Footprint->GetFPID().GetLibItemName();
|
||||
ref.Replace( wxT( " " ), wxT( "_" ) );
|
||||
val.Replace( wxT( " " ), wxT( "_" ) );
|
||||
pkg.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
@ -251,7 +251,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
|
|||
// Keep the coordinates in the first quadrant,
|
||||
// (i.e. change y sign
|
||||
-footprint_pos.y * conv_unit,
|
||||
list[ii].m_Module->GetOrientation() / 10.0,
|
||||
list[ii].m_Footprint->GetOrientation() / 10.0,
|
||||
(layer == F_Cu ) ? GetFrontSideName().c_str() : GetBackSideName().c_str() );
|
||||
buffer += line;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb );
|
|||
static void CreateSignalsSection( FILE* aFile, BOARD* aPcb );
|
||||
static void CreateShapesSection( FILE* aFile, BOARD* aPcb );
|
||||
static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb );
|
||||
static void FootprintWriteShape( FILE* File, MODULE* module, const wxString& aShapeName );
|
||||
static void FootprintWriteShape( FILE* File, MODULE* aFootprint, const wxString& aShapeName );
|
||||
|
||||
// layer names for Gencad export
|
||||
|
||||
|
@ -259,7 +259,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
|
|||
// Update some board data, to ensure a reliable gencad export
|
||||
GetBoard()->ComputeBoundingBox();
|
||||
|
||||
// Save the auxiliary origin for the rest of the module
|
||||
// Save the auxiliary origin for the rest of the footprint
|
||||
wxPoint auxOrigin = m_pcb->GetDesignSettings().m_AuxOrigin;
|
||||
GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.x : 0;
|
||||
GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.y : 0;
|
||||
|
@ -1065,10 +1065,15 @@ static void CreateDevicesSection( FILE* aFile, BOARD* aPcb )
|
|||
if( !newDevice ) // do not repeat device definitions
|
||||
continue;
|
||||
|
||||
const MODULE* module = componentShape.first;
|
||||
const MODULE* footprint = componentShape.first;
|
||||
|
||||
fprintf( aFile, "\nDEVICE \"DEV_%s\"\n", TO_UTF8( escapeString( shapeName ) ) );
|
||||
fprintf( aFile, "PART \"%s\"\n", TO_UTF8( escapeString( module->GetValue() ) ) );
|
||||
fprintf( aFile, "PACKAGE \"%s\"\n", TO_UTF8( escapeString( module->GetFPID().Format() ) ) );
|
||||
|
||||
fprintf( aFile, "PART \"%s\"\n",
|
||||
TO_UTF8( escapeString( footprint->GetValue() ) ) );
|
||||
|
||||
fprintf( aFile, "PACKAGE \"%s\"\n",
|
||||
TO_UTF8( escapeString( footprint->GetFPID().Format() ) ) );
|
||||
}
|
||||
|
||||
fputs( "$ENDDEVICES\n\n", aFile );
|
||||
|
@ -1137,14 +1142,14 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
|
|||
* It's almost guaranteed that the silk layer will be imported wrong but
|
||||
* the shape also contains the pads!
|
||||
*/
|
||||
static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aShapeName )
|
||||
static void FootprintWriteShape( FILE* aFile, MODULE* aFootprint, const wxString& aShapeName )
|
||||
{
|
||||
FP_SHAPE* shape;
|
||||
|
||||
/* creates header: */
|
||||
fprintf( aFile, "\nSHAPE \"%s\"\n", TO_UTF8( escapeString( aShapeName ) ) );
|
||||
|
||||
if( module->GetAttributes() & FP_THROUGH_HOLE )
|
||||
if( aFootprint->GetAttributes() & FP_THROUGH_HOLE )
|
||||
fprintf( aFile, "INSERT TH\n" );
|
||||
else
|
||||
fprintf( aFile, "INSERT SMD\n" );
|
||||
|
@ -1153,7 +1158,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module, const wxString& aS
|
|||
// CAM350 read it right but only closed shapes
|
||||
// ProntoPlace double-flip it (at least the pads are correct)
|
||||
// GerberTool usually get it right...
|
||||
for( BOARD_ITEM* PtStruct : module->GraphicalItems() )
|
||||
for( BOARD_ITEM* PtStruct : aFootprint->GraphicalItems() )
|
||||
{
|
||||
switch( PtStruct->Type() )
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
// NOTE: IMPLEMENTATION
|
||||
// If/when component cutouts are allowed, we must implement them separately. Cutouts
|
||||
// must be added to the board outline section and not to the Other Outline section.
|
||||
// The module cutouts should be handled via the idf_export_footprint() routine.
|
||||
// The footprint cutouts should be handled via the idf_export_footprint() routine.
|
||||
|
||||
double offX, offY;
|
||||
aIDFBoard.GetUserOffset( offX, offY );
|
||||
|
@ -219,10 +219,9 @@ UseBoundingBox:
|
|||
else
|
||||
outline = new IDF_OUTLINE;
|
||||
|
||||
// fetch a rectangular bounding box for the board;
|
||||
// there is always some uncertainty in the board dimensions
|
||||
// computed via ComputeBoundingBox() since this depends on the
|
||||
// individual module entities.
|
||||
// Fetch a rectangular bounding box for the board; there is always some uncertainty in the
|
||||
// board dimensions computed via ComputeBoundingBox() since this depends on the individual
|
||||
// footprint entities.
|
||||
EDA_RECT bbbox = aPcb->GetBoardEdgesBoundingBox();
|
||||
|
||||
// convert to mm and compensate for an assumed LINE_WIDTH line thickness
|
||||
|
@ -284,14 +283,14 @@ static void idf_export_footprint( BOARD* aPcb, MODULE* aFootprint, IDF3_BOARD& a
|
|||
std::string cvalue = TO_UTF8( aFootprint->Value().GetShownText() );
|
||||
|
||||
// if both the RefDes and Value are empty or set to '~' the board owns the part,
|
||||
// otherwise associated parts of the module must be marked NOREFDES.
|
||||
// otherwise associated parts of the footprint must be marked NOREFDES.
|
||||
if( cvalue.empty() || !cvalue.compare( "~" ) )
|
||||
crefdes = "BOARD";
|
||||
else
|
||||
crefdes = "NOREFDES";
|
||||
}
|
||||
|
||||
// TODO: If module cutouts are supported we must add code here
|
||||
// TODO: If footprint cutouts are supported we must add code here
|
||||
// for( EDA_ITEM* item = aFootprint->GraphicalItems(); item != NULL; item = item->Next() )
|
||||
// {
|
||||
// if( item->Type() != PCB_FP_SHAPE_T || item->GetLayer() != Edge_Cuts )
|
||||
|
@ -616,7 +615,7 @@ bool PCB_EDIT_FRAME::Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
|
|||
// Export the board outline
|
||||
idf_export_outline( aPcb, idfBoard );
|
||||
|
||||
// Output the drill holes and module (library) data.
|
||||
// Output the drill holes and footprint (library) data.
|
||||
for( MODULE* footprint : aPcb->Footprints() )
|
||||
idf_export_footprint( aPcb, footprint, idfBoard );
|
||||
|
||||
|
|
|
@ -1373,7 +1373,7 @@ static void export_vrml_footprint( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aFoo
|
|||
if( aFootprint->Value().IsVisible() )
|
||||
export_vrml_fp_text( &aFootprint->Value());
|
||||
|
||||
// Export module edges
|
||||
// Export footprint graphics
|
||||
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
|
@ -1439,8 +1439,8 @@ static void export_vrml_footprint( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aFoo
|
|||
build_quat( 0, 0, 1, DEG2RAD( rotz ), q2 );
|
||||
compose_quat( q1, q2, q1 );
|
||||
|
||||
// Note here aFootprint->GetOrientation() is in 0.1 degrees,
|
||||
// so module rotation has to be converted to radians
|
||||
// Note here aFootprint->GetOrientation() is in 0.1 degrees, so footprint rotation
|
||||
// has to be converted to radians
|
||||
build_quat( 0, 0, 1, DECIDEG2RAD( aFootprint->GetOrientation() ), q2 );
|
||||
compose_quat( q1, q2, q1 );
|
||||
from_quat( q1, rot );
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
/*
|
||||
* 1 - create ascii files for automatic placement of smd components
|
||||
* 2 - create a module report (pos and module descr) (ascii file)
|
||||
* 2 - create a footprint report (pos and footprint descr) (ascii file)
|
||||
*/
|
||||
|
||||
#include <confirm.h>
|
||||
|
@ -528,7 +528,7 @@ void PCB_EDIT_FRAME::GenFootprintsReport( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
/* Print a module report.
|
||||
/* Print a footprint report.
|
||||
*/
|
||||
bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM )
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ MODULE::MODULE( BOARD* parent ) :
|
|||
m_attributes = 0;
|
||||
m_Layer = F_Cu;
|
||||
m_orient = 0;
|
||||
m_moduleStatus = FP_PADS_are_LOCKED;
|
||||
m_fpStatus = FP_PADS_are_LOCKED;
|
||||
m_arflag = 0;
|
||||
m_rot90Cost = m_rot180Cost = 0;
|
||||
m_link = 0;
|
||||
|
@ -73,7 +73,7 @@ MODULE::MODULE( const MODULE& aFootprint ) :
|
|||
m_pos = aFootprint.m_pos;
|
||||
m_fpid = aFootprint.m_fpid;
|
||||
m_attributes = aFootprint.m_attributes;
|
||||
m_moduleStatus = aFootprint.m_moduleStatus;
|
||||
m_fpStatus = aFootprint.m_fpStatus;
|
||||
m_orient = aFootprint.m_orient;
|
||||
m_boundingBox = aFootprint.m_boundingBox;
|
||||
m_rot90Cost = aFootprint.m_rot90Cost;
|
||||
|
@ -207,7 +207,7 @@ MODULE& MODULE::operator=( MODULE&& aOther )
|
|||
m_pos = aOther.m_pos;
|
||||
m_fpid = aOther.m_fpid;
|
||||
m_attributes = aOther.m_attributes;
|
||||
m_moduleStatus = aOther.m_moduleStatus;
|
||||
m_fpStatus = aOther.m_fpStatus;
|
||||
m_orient = aOther.m_orient;
|
||||
m_boundingBox = aOther.m_boundingBox;
|
||||
m_rot90Cost = aOther.m_rot90Cost;
|
||||
|
@ -302,7 +302,7 @@ MODULE& MODULE::operator=( const MODULE& aOther )
|
|||
m_pos = aOther.m_pos;
|
||||
m_fpid = aOther.m_fpid;
|
||||
m_attributes = aOther.m_attributes;
|
||||
m_moduleStatus = aOther.m_moduleStatus;
|
||||
m_fpStatus = aOther.m_fpStatus;
|
||||
m_orient = aOther.m_orient;
|
||||
m_boundingBox = aOther.m_boundingBox;
|
||||
m_rot90Cost = aOther.m_rot90Cost;
|
||||
|
@ -762,7 +762,7 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
|
|||
if( IsLocked() )
|
||||
addToken( &status, _( "locked" ) );
|
||||
|
||||
if( m_moduleStatus & FP_is_PLACED )
|
||||
if( m_fpStatus & FP_is_PLACED )
|
||||
addToken( &status, _( "autoplaced" ) );
|
||||
|
||||
if( m_attributes & FP_BOARD_ONLY )
|
||||
|
@ -1293,7 +1293,7 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
|
|||
m_reference->Flip( m_pos, false );
|
||||
m_value->Flip( m_pos, false );
|
||||
|
||||
// Reverse mirror module graphics and texts.
|
||||
// Reverse mirror footprint graphics and texts.
|
||||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
switch( item->Type() )
|
||||
|
|
|
@ -289,7 +289,7 @@ public:
|
|||
|
||||
bool IsLocked() const override
|
||||
{
|
||||
return ( m_moduleStatus & FP_is_LOCKED ) != 0;
|
||||
return ( m_fpStatus & FP_is_LOCKED ) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,37 +300,37 @@ public:
|
|||
void SetLocked( bool isLocked ) override
|
||||
{
|
||||
if( isLocked )
|
||||
m_moduleStatus |= FP_is_LOCKED;
|
||||
m_fpStatus |= FP_is_LOCKED;
|
||||
else
|
||||
m_moduleStatus &= ~FP_is_LOCKED;
|
||||
m_fpStatus &= ~FP_is_LOCKED;
|
||||
}
|
||||
|
||||
bool IsPlaced() const { return m_moduleStatus & FP_is_PLACED; }
|
||||
bool IsPlaced() const { return m_fpStatus & FP_is_PLACED; }
|
||||
void SetIsPlaced( bool isPlaced )
|
||||
{
|
||||
if( isPlaced )
|
||||
m_moduleStatus |= FP_is_PLACED;
|
||||
m_fpStatus |= FP_is_PLACED;
|
||||
else
|
||||
m_moduleStatus &= ~FP_is_PLACED;
|
||||
m_fpStatus &= ~FP_is_PLACED;
|
||||
}
|
||||
|
||||
bool NeedsPlaced() const { return m_moduleStatus & FP_to_PLACE; }
|
||||
bool NeedsPlaced() const { return m_fpStatus & FP_to_PLACE; }
|
||||
void SetNeedsPlaced( bool needsPlaced )
|
||||
{
|
||||
if( needsPlaced )
|
||||
m_moduleStatus |= FP_to_PLACE;
|
||||
m_fpStatus |= FP_to_PLACE;
|
||||
else
|
||||
m_moduleStatus &= ~FP_to_PLACE;
|
||||
m_fpStatus &= ~FP_to_PLACE;
|
||||
}
|
||||
|
||||
bool PadsLocked() const { return m_moduleStatus & FP_PADS_are_LOCKED; }
|
||||
bool PadsLocked() const { return m_fpStatus & FP_PADS_are_LOCKED; }
|
||||
|
||||
void SetPadsLocked( bool aPadsLocked )
|
||||
{
|
||||
if( aPadsLocked )
|
||||
m_moduleStatus |= FP_PADS_are_LOCKED;
|
||||
m_fpStatus |= FP_PADS_are_LOCKED;
|
||||
else
|
||||
m_moduleStatus &= ~FP_PADS_are_LOCKED;
|
||||
m_fpStatus &= ~FP_PADS_are_LOCKED;
|
||||
}
|
||||
|
||||
void SetLastEditTime( timestamp_t aTime ) { m_lastEditTime = aTime; }
|
||||
|
@ -702,7 +702,7 @@ private:
|
|||
FP_TEXT* m_value; // Component value (74LS00, 22K..)
|
||||
LIB_ID m_fpid; // The #LIB_ID of the MODULE.
|
||||
int m_attributes; // Flag bits ( see FOOTPRINT_ATTR_T )
|
||||
int m_moduleStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
|
||||
int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
|
||||
EDA_RECT m_boundingBox; // Bounding box : coordinates on board, real orientation.
|
||||
|
||||
ZONE_CONNECTION m_zoneConnection;
|
||||
|
|
|
@ -784,7 +784,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( MODULE* aFootprint,
|
|||
|
||||
bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
||||
{
|
||||
// update module in the current board,
|
||||
// update footprint in the current board,
|
||||
// not just add it to the board with total disregard for the netlist...
|
||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
|
||||
|
||||
|
@ -824,7 +824,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
|||
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
BOARD_COMMIT commit( pcbframe );
|
||||
|
||||
// Create the "new" module
|
||||
// Create the "new" footprint
|
||||
MODULE* newFootprint = new MODULE( *editorFootprint );
|
||||
const_cast<KIID&>( newFootprint->m_Uuid ) = KIID();
|
||||
|
||||
|
@ -838,7 +838,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
|||
// deleted
|
||||
pcbframe->ExchangeFootprint( sourceFootprint, newFootprint, commit );
|
||||
const_cast<KIID&>( newFootprint->m_Uuid ) = editorFootprint->GetLink();
|
||||
commit.Push( wxT( "Update module" ) );
|
||||
commit.Push( wxT( "Update footprint" ) );
|
||||
}
|
||||
else // This is an insert command
|
||||
{
|
||||
|
@ -851,7 +851,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
|
|||
newFootprint->SetPosition( wxPoint( 0, 0 ) );
|
||||
viewControls->SetCrossHairCursorPosition( cursorPos, false );
|
||||
const_cast<KIID&>( newFootprint->m_Uuid ) = KIID();
|
||||
commit.Push( wxT( "Insert module" ) );
|
||||
commit.Push( wxT( "Insert footprint" ) );
|
||||
|
||||
pcbframe->Raise();
|
||||
pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::placeModule, true, newFootprint );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@ajo.es>
|
||||
* Copyright (C) 2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2013-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
|
||||
|
@ -47,8 +47,8 @@ const wxString WIZARD_PARAM_UNITS_STRING = "string"; // String
|
|||
|
||||
/**
|
||||
* FOOTPRINT_WIZARD
|
||||
* This is the parent class from where any footprint wizard class must
|
||||
* derive */
|
||||
* This is the parent class from where any footprint wizard class must derive
|
||||
*/
|
||||
class FOOTPRINT_WIZARD
|
||||
{
|
||||
public:
|
||||
|
@ -145,9 +145,9 @@ public:
|
|||
virtual void ResetParameters() = 0;
|
||||
|
||||
/**
|
||||
* Function GetModule
|
||||
* This method builds the module itself and returns it to the caller function
|
||||
* @return PCB module built from the parameters given to the class
|
||||
* Function GetFootprint
|
||||
* This method builds the footprint itself and returns it to the caller function
|
||||
* @return PCB footprint built from the parameters given to the class
|
||||
* @param aMessage a wxString to store messages (if any) generated by the
|
||||
* footprint generator
|
||||
*/
|
||||
|
|
|
@ -101,7 +101,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
|
|||
// Delete the current footprint
|
||||
GetBoard()->DeleteAllModules();
|
||||
|
||||
// Creates the module
|
||||
// Creates the footprint
|
||||
wxString msg;
|
||||
MODULE* footprint = footprintWizard->GetFootprint( &msg );
|
||||
DisplayBuildMessage( msg );
|
||||
|
|
|
@ -78,13 +78,13 @@ private:
|
|||
int drawMicrowaveInductor( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Creates a module "GAP" or "STUB" used in micro wave designs.
|
||||
* This module has 2 pads:
|
||||
* Creates a footprint "GAP" or "STUB" used in micro wave designs.
|
||||
* This footprint has 2 pads:
|
||||
* PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.
|
||||
* the "gap" is isolation created between this 2 pads
|
||||
*
|
||||
* @param aComponentShape is the component to create
|
||||
* @return the new module
|
||||
* @return the new footprint
|
||||
*/
|
||||
MODULE* createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprintShape );
|
||||
|
||||
|
@ -104,7 +104,7 @@ private:
|
|||
* @param aValue is the text value
|
||||
* @param aTextSize is the size of ref and value texts ( <= 0 to use board default values )
|
||||
* @param aPadCount is number of pads
|
||||
* @return the new module
|
||||
* @return the new footprint
|
||||
*/
|
||||
MODULE* createBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount );
|
||||
};
|
||||
|
|
|
@ -134,7 +134,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
|
|||
wxString msg;
|
||||
LIB_ID lastFPID;
|
||||
COMPONENT* component;
|
||||
MODULE* module = nullptr;
|
||||
MODULE* footprint = nullptr;
|
||||
MODULE* fpOnBoard;
|
||||
|
||||
if( aNetlist.IsEmpty() || Prj().PcbFootprintLibs()->IsEmpty() )
|
||||
|
@ -184,7 +184,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
|
|||
|
||||
if( component->GetFPID() != lastFPID )
|
||||
{
|
||||
module = nullptr;
|
||||
footprint = nullptr;
|
||||
|
||||
// The LIB_ID is ok as long as there is a footprint portion coming the library if
|
||||
// it's needed. Nickname can be blank.
|
||||
|
@ -199,15 +199,16 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
|
|||
}
|
||||
|
||||
// loadFootprint() can find a footprint with an empty nickname in fpid.
|
||||
module = PCB_BASE_FRAME::loadFootprint( component->GetFPID() );
|
||||
footprint = PCB_BASE_FRAME::loadFootprint( component->GetFPID() );
|
||||
|
||||
if( module )
|
||||
if( footprint )
|
||||
{
|
||||
lastFPID = component->GetFPID();
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "%s footprint \"%s\" not found in any libraries in the footprint library table.\n" ),
|
||||
msg.Printf( _( "%s footprint \"%s\" not found in any libraries in the footprint "
|
||||
"library table.\n" ),
|
||||
component->GetReference(),
|
||||
component->GetFPID().GetLibItemName().wx_str() );
|
||||
aReporter.Report( msg, RPT_SEVERITY_ERROR );
|
||||
|
@ -218,14 +219,14 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )
|
|||
else
|
||||
{
|
||||
// Footprint already loaded from a library, duplicate it (faster)
|
||||
if( !module )
|
||||
continue; // Module does not exist in any library.
|
||||
if( !footprint )
|
||||
continue; // Footprint does not exist in any library.
|
||||
|
||||
module = new MODULE( *module );
|
||||
const_cast<KIID&>( module->m_Uuid ) = KIID();
|
||||
footprint = new MODULE( *footprint );
|
||||
const_cast<KIID&>( footprint->m_Uuid ) = KIID();
|
||||
}
|
||||
|
||||
if( module )
|
||||
component->SetModule( module );
|
||||
if( footprint )
|
||||
component->SetModule( footprint );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -346,10 +346,10 @@ private:
|
|||
* (pin (num 1) (name ~) (type passive))
|
||||
* (pin (num 2) (name ~) (type passive))))
|
||||
*
|
||||
* And add the strings giving the footprint filter (subsection footprints)
|
||||
* of the corresponding module info
|
||||
* <p>This section is used by CvPcb, and is not useful in Pcbnew,
|
||||
* therefore it it not always read </p>
|
||||
* And add the strings giving the footprint filter (subsection footprints) of the
|
||||
* corresponding footprint info
|
||||
* <p>This section is used by CvPcb, and is not useful in Pcbnew, therefore it it not
|
||||
* always read </p>
|
||||
*/
|
||||
void parseLibPartList();
|
||||
|
||||
|
|
|
@ -335,10 +335,10 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( MODULE* aModule )
|
|||
}
|
||||
|
||||
|
||||
// plot items like text and graphics, but not tracks and module
|
||||
// plot items like text and graphics, but not tracks and footprints
|
||||
void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
|
||||
{
|
||||
for( auto item : m_board->Drawings() )
|
||||
for( BOARD_ITEM* item : m_board->Drawings() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
|
|
@ -120,15 +120,16 @@ PCB_SHAPE* ALTIUM_PCB::HelperCreateAndAddDrawsegment( uint16_t aComponent )
|
|||
{
|
||||
if( m_components.size() <= aComponent )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
"Component creator tries to access component id %d of %d existing components",
|
||||
aComponent, m_components.size() ) );
|
||||
THROW_IO_ERROR( wxString::Format( "Component creator tries to access component id %d "
|
||||
"of %d existing components",
|
||||
aComponent,
|
||||
m_components.size() ) );
|
||||
}
|
||||
|
||||
MODULE* module = m_components.at( aComponent );
|
||||
PCB_SHAPE* fpShape = new FP_SHAPE( module );
|
||||
MODULE* footprint = m_components.at( aComponent );
|
||||
PCB_SHAPE* fpShape = new FP_SHAPE( footprint );
|
||||
|
||||
module->Add( fpShape, ADD_MODE::APPEND );
|
||||
footprint->Add( fpShape, ADD_MODE::APPEND );
|
||||
return fpShape;
|
||||
}
|
||||
}
|
||||
|
@ -444,11 +445,9 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader,
|
|||
zone.second->SetPriority( 0 );
|
||||
}
|
||||
|
||||
// Finish Board by recalculating module boundingboxes
|
||||
// Finish Board by recalculating footprint boundingboxes
|
||||
for( MODULE* footprint : m_board->Footprints() )
|
||||
{
|
||||
footprint->CalculateBoundingBox();
|
||||
}
|
||||
|
||||
// Otherwise we cannot save the imported board
|
||||
m_board->SetModified();
|
||||
|
@ -750,28 +749,28 @@ void ALTIUM_PCB::ParseComponents6Data(
|
|||
{
|
||||
ACOMPONENT6 elem( reader );
|
||||
|
||||
MODULE* module = new MODULE( m_board );
|
||||
m_board->Add( module, ADD_MODE::APPEND );
|
||||
m_components.emplace_back( module );
|
||||
MODULE* footprint = new MODULE( m_board );
|
||||
m_board->Add( footprint, ADD_MODE::APPEND );
|
||||
m_components.emplace_back( footprint );
|
||||
|
||||
LIB_ID fpID = AltiumToKiCadLibID(LIB_ID::ID_PCB, elem.sourcefootprintlibrary, elem.sourcelibreference );
|
||||
|
||||
module->SetFPID( fpID );
|
||||
footprint->SetFPID( fpID );
|
||||
|
||||
module->SetPosition( elem.position );
|
||||
module->SetOrientationDegrees( elem.rotation );
|
||||
footprint->SetPosition( elem.position );
|
||||
footprint->SetOrientationDegrees( elem.rotation );
|
||||
|
||||
// KiCad netlisting requires parts to have non-digit + digit annotation.
|
||||
// If the reference begins with a number, we prepend 'UNK' (unknown) for the source designator
|
||||
wxString reference = elem.sourcedesignator;
|
||||
if( reference.find_first_not_of( "0123456789" ) == wxString::npos )
|
||||
reference.Prepend( "UNK" );
|
||||
module->SetReference( reference );
|
||||
footprint->SetReference( reference );
|
||||
|
||||
module->SetLocked( elem.locked );
|
||||
module->Reference().SetVisible( elem.nameon );
|
||||
module->Value().SetVisible( elem.commenton );
|
||||
module->SetLayer( elem.layer == ALTIUM_LAYER::TOP_LAYER ? F_Cu : B_Cu );
|
||||
footprint->SetLocked( elem.locked );
|
||||
footprint->Reference().SetVisible( elem.nameon );
|
||||
footprint->Value().SetVisible( elem.commenton );
|
||||
footprint->SetLayer( elem.layer == ALTIUM_LAYER::TOP_LAYER ? F_Cu : B_Cu );
|
||||
|
||||
componentId++;
|
||||
}
|
||||
|
@ -817,20 +816,20 @@ void ALTIUM_PCB::ParseComponentsBodies6Data(
|
|||
elem.modelId ) );
|
||||
}
|
||||
|
||||
MODULE* module = m_components.at( elem.component );
|
||||
const wxPoint& modulePosition = module->GetPosition();
|
||||
MODULE* footprint = m_components.at( elem.component );
|
||||
const wxPoint& fpPosition = footprint->GetPosition();
|
||||
|
||||
FP_3DMODEL modelSettings;
|
||||
|
||||
modelSettings.m_Filename = modelTuple->second;
|
||||
|
||||
modelSettings.m_Offset.x = Iu2Millimeter( (int) elem.modelPosition.x - modulePosition.x );
|
||||
modelSettings.m_Offset.y = -Iu2Millimeter( (int) elem.modelPosition.y - modulePosition.y );
|
||||
modelSettings.m_Offset.x = Iu2Millimeter((int) elem.modelPosition.x - fpPosition.x );
|
||||
modelSettings.m_Offset.y = -Iu2Millimeter((int) elem.modelPosition.y - fpPosition.y );
|
||||
modelSettings.m_Offset.z = Iu2Millimeter( (int) elem.modelPosition.z );
|
||||
|
||||
double orientation = module->GetOrientation();
|
||||
double orientation = footprint->GetOrientation();
|
||||
|
||||
if( module->IsFlipped() )
|
||||
if( footprint->IsFlipped() )
|
||||
{
|
||||
modelSettings.m_Offset.y = -modelSettings.m_Offset.y;
|
||||
orientation = -orientation;
|
||||
|
@ -845,7 +844,7 @@ void ALTIUM_PCB::ParseComponentsBodies6Data(
|
|||
|
||||
modelSettings.m_Opacity = elem.bodyOpacity;
|
||||
|
||||
module->Models().push_back( modelSettings );
|
||||
footprint->Models().push_back( modelSettings );
|
||||
}
|
||||
|
||||
if( reader.GetRemainingBytes() != 0 )
|
||||
|
@ -1681,26 +1680,28 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
|||
}
|
||||
|
||||
// Create Pad
|
||||
MODULE* module = nullptr;
|
||||
MODULE* footprint = nullptr;
|
||||
|
||||
if( elem.component == ALTIUM_COMPONENT_NONE )
|
||||
{
|
||||
module = new MODULE( m_board ); // We cannot add a pad directly into the PCB
|
||||
m_board->Add( module, ADD_MODE::APPEND );
|
||||
module->SetPosition( elem.position );
|
||||
footprint = new MODULE( m_board ); // We cannot add a pad directly into the PCB
|
||||
m_board->Add( footprint, ADD_MODE::APPEND );
|
||||
footprint->SetPosition( elem.position );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_components.size() <= elem.component )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
"Pads6 stream tries to access component id %d of %d existing components",
|
||||
elem.component, m_components.size() ) );
|
||||
THROW_IO_ERROR( wxString::Format( "Pads6 stream tries to access component id %d "
|
||||
"of %d existing components",
|
||||
elem.component,
|
||||
m_components.size() ) );
|
||||
}
|
||||
module = m_components.at( elem.component );
|
||||
footprint = m_components.at( elem.component );
|
||||
}
|
||||
|
||||
PAD* pad = new PAD( module );
|
||||
module->Add( pad, ADD_MODE::APPEND );
|
||||
PAD* pad = new PAD( footprint );
|
||||
footprint->Add( pad, ADD_MODE::APPEND );
|
||||
|
||||
pad->SetName( elem.name );
|
||||
pad->SetNetCode( GetNetCode( elem.net ) );
|
||||
|
@ -1723,7 +1724,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
|||
// TODO: I assume other values are possible as well?
|
||||
wxLogError( wxString::Format(
|
||||
"Pad '%s' of Footprint %s is not marked as multilayer, but it is an THT pad",
|
||||
elem.name, module->GetReference() ) );
|
||||
elem.name, footprint->GetReference() ) );
|
||||
}
|
||||
pad->SetAttribute( elem.plated ? PAD_ATTR_T::PAD_ATTRIB_PTH :
|
||||
PAD_ATTR_T::PAD_ATTRIB_NPTH );
|
||||
|
@ -1743,7 +1744,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
|||
case ALTIUM_PAD_HOLE_SHAPE::SQUARE:
|
||||
wxLogWarning( wxString::Format(
|
||||
_( "Pad '%s' of Footprint %s has a square hole. KiCad does not support this yet" ),
|
||||
elem.name, module->GetReference() ) );
|
||||
elem.name, footprint->GetReference() ) );
|
||||
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
|
||||
pad->SetDrillSize( wxSize( elem.holesize, elem.holesize ) ); // Workaround
|
||||
// TODO: elem.sizeAndShape->slotsize was 0 in testfile. Either use holesize in this case or rect holes have a different id
|
||||
|
@ -1764,7 +1765,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
|||
{
|
||||
wxLogWarning( wxString::Format(
|
||||
_( "Pad '%s' of Footprint %s has a hole-rotation of %f degree. KiCad only supports 90 degree angles" ),
|
||||
elem.name, module->GetReference(), normalizedSlotrotation ) );
|
||||
elem.name, footprint->GetReference(), normalizedSlotrotation ) );
|
||||
}
|
||||
|
||||
pad->SetDrillSize( wxSize( elem.holesize, elem.sizeAndShape->slotsize ) );
|
||||
|
@ -1776,7 +1777,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
|||
case ALTIUM_PAD_HOLE_SHAPE::UNKNOWN:
|
||||
wxLogError( wxString::Format(
|
||||
"Pad '%s' of Footprint %s uses a hole of unknown kind %d", elem.name,
|
||||
module->GetReference(), elem.sizeAndShape->holeshape ) );
|
||||
footprint->GetReference(), elem.sizeAndShape->holeshape ) );
|
||||
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
|
||||
pad->SetDrillSize( wxSize( elem.holesize, elem.holesize ) ); // Workaround
|
||||
break;
|
||||
|
@ -1793,7 +1794,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
|||
{
|
||||
wxLogWarning( wxString::Format(
|
||||
_( "Pad '%s' of Footprint %s uses a complex pad stack (kind %d), which is not supported yet" ),
|
||||
elem.name, module->GetReference(), elem.padmode ) );
|
||||
elem.name, footprint->GetReference(), elem.padmode ) );
|
||||
}
|
||||
|
||||
switch( elem.topshape )
|
||||
|
@ -1826,7 +1827,7 @@ void ALTIUM_PCB::ParsePads6Data( const CFB::CompoundFileReader& aReader,
|
|||
case ALTIUM_PAD_SHAPE::UNKNOWN:
|
||||
default:
|
||||
wxLogError( wxString::Format( "Pad '%s' of Footprint %s uses a unknown pad-shape",
|
||||
elem.name, module->GetReference() ) );
|
||||
elem.name, footprint->GetReference() ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2248,26 +2249,27 @@ void ALTIUM_PCB::ParseTexts6Data(
|
|||
{
|
||||
if( m_components.size() <= elem.component )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format(
|
||||
"Texts6 stream tries to access component id %d of %d existing components",
|
||||
elem.component, m_components.size() ) );
|
||||
THROW_IO_ERROR( wxString::Format( "Texts6 stream tries to access component id %d "
|
||||
"of %d existing components",
|
||||
elem.component,
|
||||
m_components.size() ) );
|
||||
}
|
||||
|
||||
MODULE* module = m_components.at( elem.component );
|
||||
MODULE* footprint = m_components.at( elem.component );
|
||||
FP_TEXT* fpText;
|
||||
|
||||
if( elem.isDesignator )
|
||||
{
|
||||
fpText = &module->Reference();
|
||||
fpText = &footprint->Reference();
|
||||
}
|
||||
else if( elem.isComment )
|
||||
{
|
||||
fpText = &module->Value();
|
||||
fpText = &footprint->Value();
|
||||
}
|
||||
else
|
||||
{
|
||||
fpText = new FP_TEXT( module );
|
||||
module->Add( fpText, ADD_MODE::APPEND );
|
||||
fpText = new FP_TEXT( footprint );
|
||||
footprint->Add( fpText, ADD_MODE::APPEND );
|
||||
}
|
||||
|
||||
fpText->SetKeepUpright( false );
|
||||
|
|
|
@ -562,7 +562,9 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDesignRules()
|
|||
BOARD_DESIGN_SETTINGS& ds = mBoard->GetDesignSettings();
|
||||
std::map<SPACINGCODE_ID, SPACINGCODE>& spacingCodes = Assignments.Codedefs.SpacingCodes;
|
||||
|
||||
auto applyRule = [&]( wxString aID, int* aVal ) {
|
||||
auto applyRule =
|
||||
[&]( wxString aID, int* aVal )
|
||||
{
|
||||
if( spacingCodes.find( aID ) == spacingCodes.end() )
|
||||
wxLogWarning( _( "Design rule %s was not found. This was ignored." ) );
|
||||
else
|
||||
|
@ -588,12 +590,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDesignRules()
|
|||
|
||||
applyNetClassRule( "T_T", ds.GetDefault(), &::NETCLASS::SetClearance );
|
||||
|
||||
wxLogWarning(
|
||||
_( "KiCad design rules are different from CADSTAR ones. Only the compatible "
|
||||
wxLogWarning( _( "KiCad design rules are different from CADSTAR ones. Only the compatible "
|
||||
"design rules were imported. It is recommended that you review the design "
|
||||
"rules that have been applied." ) );
|
||||
wxLogWarning(
|
||||
_( "KiCad design rules are different from CADSTAR ones. Only the compatible "
|
||||
wxLogWarning( _( "KiCad design rules are different from CADSTAR ones. Only the compatible "
|
||||
"design rules were imported. It is recommended that you review the design "
|
||||
"rules that have been applied." ) );
|
||||
}
|
||||
|
@ -605,23 +605,22 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponentLibrary()
|
|||
{
|
||||
SYMDEF_ID key = symPair.first;
|
||||
SYMDEF_PCB component = symPair.second;
|
||||
wxString moduleName = component.ReferenceName
|
||||
+ ( ( component.Alternate.size() > 0 ) ?
|
||||
wxString fpName = component.ReferenceName + ( ( component.Alternate.size() > 0 ) ?
|
||||
( wxT( " (" ) + component.Alternate + wxT( ")" ) ) :
|
||||
wxT( "" ) );
|
||||
MODULE* m = new MODULE( mBoard );
|
||||
m->SetPosition( getKiCadPoint( component.Origin ) );
|
||||
MODULE* footprint = new MODULE( mBoard );
|
||||
footprint->SetPosition( getKiCadPoint( component.Origin ) );
|
||||
|
||||
LIB_ID libID;
|
||||
libID.Parse( moduleName, LIB_ID::LIB_ID_TYPE::ID_PCB, true );
|
||||
libID.Parse( fpName, LIB_ID::LIB_ID_TYPE::ID_PCB, true );
|
||||
|
||||
m->SetFPID( libID );
|
||||
loadLibraryFigures( component, m );
|
||||
loadLibraryCoppers( component, m );
|
||||
loadLibraryAreas( component, m );
|
||||
loadLibraryPads( component, m );
|
||||
footprint->SetFPID( libID );
|
||||
loadLibraryFigures( component, footprint );
|
||||
loadLibraryCoppers( component, footprint );
|
||||
loadLibraryAreas( component, footprint );
|
||||
loadLibraryPads( component, footprint );
|
||||
|
||||
mLibraryMap.insert( std::make_pair( key, m ) );
|
||||
mLibraryMap.insert( std::make_pair( key, footprint ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1194,20 +1193,20 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents()
|
|||
{
|
||||
COMPONENT& comp = compPair.second;
|
||||
|
||||
auto moduleIter = mLibraryMap.find( comp.SymdefID );
|
||||
auto fpIter = mLibraryMap.find( comp.SymdefID );
|
||||
|
||||
if( moduleIter == mLibraryMap.end() )
|
||||
if( fpIter == mLibraryMap.end() )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Unable to find component '%s' in the library"
|
||||
"(Symdef ID: '%s')" ),
|
||||
comp.Name, comp.SymdefID ) );
|
||||
}
|
||||
|
||||
// copy constructor to clone the module from the library
|
||||
MODULE* m = new MODULE( *moduleIter->second );
|
||||
const_cast<KIID&>( m->m_Uuid ) = KIID();
|
||||
// copy constructor to clone the footprint from the library
|
||||
MODULE* footprint = new MODULE( *fpIter->second );
|
||||
const_cast<KIID&>( footprint->m_Uuid ) = KIID();
|
||||
|
||||
mBoard->Add( m, ADD_MODE::APPEND );
|
||||
mBoard->Add( footprint, ADD_MODE::APPEND );
|
||||
|
||||
//Override pads with pad exceptions
|
||||
if( comp.PadExceptions.size() > 0 )
|
||||
|
@ -1231,37 +1230,37 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadComponents()
|
|||
if( padEx.OverrideSide )
|
||||
csPad.Side = padEx.Side;
|
||||
|
||||
//Find the pad in the module definition
|
||||
PAD* kiPad = m->Pads().at( padEx.ID - (long) 1 );
|
||||
// Find the pad in the footprint definition
|
||||
PAD* kiPad = footprint->Pads().at( padEx.ID - (long) 1 );
|
||||
|
||||
if( kiPad )
|
||||
delete kiPad;
|
||||
|
||||
m->Pads().at( padEx.ID - (long) 1 ) = getKiCadPad( csPad, m );
|
||||
footprint->Pads().at( padEx.ID - (long) 1 ) = getKiCadPad( csPad, footprint );
|
||||
}
|
||||
}
|
||||
|
||||
//set to empty string to avoid duplication when loading attributes:
|
||||
m->SetValue( wxEmptyString );
|
||||
footprint->SetValue( wxEmptyString );
|
||||
|
||||
m->SetPosition( getKiCadPoint( comp.Origin ) );
|
||||
m->SetOrientation( getAngleTenthDegree( comp.OrientAngle ) );
|
||||
m->SetReference( comp.Name );
|
||||
footprint->SetPosition( getKiCadPoint( comp.Origin ) );
|
||||
footprint->SetOrientation( getAngleTenthDegree( comp.OrientAngle ) );
|
||||
footprint->SetReference( comp.Name );
|
||||
|
||||
if( comp.Mirror )
|
||||
{
|
||||
double mirroredAngle = - getAngleTenthDegree( comp.OrientAngle );
|
||||
NORMALIZE_ANGLE_180( mirroredAngle );
|
||||
m->SetOrientation( mirroredAngle );
|
||||
m->Flip( getKiCadPoint( comp.Origin ), true );
|
||||
footprint->SetOrientation( mirroredAngle );
|
||||
footprint->Flip( getKiCadPoint( comp.Origin ), true );
|
||||
}
|
||||
|
||||
loadComponentAttributes( comp, m );
|
||||
loadComponentAttributes( comp, footprint );
|
||||
|
||||
if( !comp.PartID.IsEmpty() && comp.PartID != wxT( "NO_PART" ) )
|
||||
m->SetDescription( getPart( comp.PartID ).Definition.Name );
|
||||
footprint->SetDescription( getPart( comp.PartID ).Definition.Name );
|
||||
|
||||
mComponentMap.insert( { comp.ID, m } );
|
||||
mComponentMap.insert( { comp.ID, footprint } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1601,8 +1600,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadNets()
|
|||
}
|
||||
else
|
||||
{
|
||||
// The below works because we have added the pads in the correct order to the module and
|
||||
// it so happens that PAD_ID in Cadstar is a sequential, numerical ID
|
||||
// The below works because we have added the pads in the correct order to the
|
||||
// footprint and the PAD_ID in Cadstar is a sequential, numerical ID
|
||||
m->Pads().at( pin.PadID - (long) 1 )->SetNet( getKiCadNet( net.ID ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,8 +159,10 @@ private:
|
|||
void drawCadstarText( const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const LAYER_ID& aCadstarLayerOverride = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0, const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const bool& aMirrorInvert = false );
|
||||
|
||||
/**
|
||||
|
@ -178,10 +180,13 @@ private:
|
|||
* @param aMirrorInvert if true, mirrors the shape
|
||||
*/
|
||||
void drawCadstarShape( const SHAPE& aCadstarShape, const PCB_LAYER_ID& aKiCadLayer,
|
||||
const int& aLineThickness, const wxString& aShapeName, BOARD_ITEM_CONTAINER* aContainer,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString, const wxPoint& aMoveVector = { 0, 0 },
|
||||
const int& aLineThickness, const wxString& aShapeName,
|
||||
BOARD_ITEM_CONTAINER* aContainer,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false );
|
||||
const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const bool& aMirrorInvert = false );
|
||||
|
||||
/**
|
||||
* @brief Uses PCB_SHAPE to draw the cutouts on mBoard object
|
||||
|
@ -198,9 +203,12 @@ private:
|
|||
*/
|
||||
void drawCadstarCutoutsAsSegments( const std::vector<CUTOUT>& aCutouts,
|
||||
const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
|
||||
BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0, const wxPoint& aTransformCentre = { 0, 0 },
|
||||
BOARD_ITEM_CONTAINER* aContainer,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const bool& aMirrorInvert = false );
|
||||
|
||||
/**
|
||||
|
@ -219,9 +227,12 @@ private:
|
|||
*/
|
||||
void drawCadstarVerticesAsSegments( const std::vector<VERTEX>& aCadstarVertices,
|
||||
const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness,
|
||||
BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0, const wxPoint& aTransformCentre = { 0, 0 },
|
||||
BOARD_ITEM_CONTAINER* aContainer,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const bool& aMirrorInvert = false );
|
||||
|
||||
/**
|
||||
|
@ -236,11 +247,14 @@ private:
|
|||
* @param aMirrorInvert if true, mirrors the drawsegment
|
||||
* @return
|
||||
*/
|
||||
std::vector<PCB_SHAPE*> getDrawSegmentsFromVertices(
|
||||
const std::vector<VERTEX>& aCadstarVertices, BOARD_ITEM_CONTAINER* aContainer = nullptr,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString, const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false );
|
||||
std::vector<PCB_SHAPE*> getDrawSegmentsFromVertices( const std::vector<VERTEX>& aCadstarVertices,
|
||||
BOARD_ITEM_CONTAINER* aContainer = nullptr,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const bool& aMirrorInvert = false );
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to a PCB_SHAPE object. Caller owns the object.
|
||||
|
@ -256,10 +270,14 @@ private:
|
|||
* @return
|
||||
*/
|
||||
PCB_SHAPE* getDrawSegmentFromVertex( const POINT& aCadstarStartPoint,
|
||||
const VERTEX& aCadstarVertex, BOARD_ITEM_CONTAINER* aContainer = nullptr,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString, const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false );
|
||||
const VERTEX& aCadstarVertex,
|
||||
BOARD_ITEM_CONTAINER* aContainer = nullptr,
|
||||
const GROUP_ID& aCadstarGroupID = wxEmptyString,
|
||||
const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const bool& aMirrorInvert = false );
|
||||
|
||||
/**
|
||||
* @brief
|
||||
|
@ -284,9 +302,12 @@ private:
|
|||
* @return
|
||||
*/
|
||||
SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape,
|
||||
const int& aLineThickness = -1, BOARD_ITEM_CONTAINER* aContainer = nullptr,
|
||||
const wxPoint& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0, const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const int& aLineThickness = -1,
|
||||
BOARD_ITEM_CONTAINER* aContainer = nullptr,
|
||||
const wxPoint& aMoveVector = { 0, 0 },
|
||||
const double& aRotationAngle = 0.0,
|
||||
const double& aScalingFactor = 1.0,
|
||||
const wxPoint& aTransformCentre = { 0, 0 },
|
||||
const bool& aMirrorInvert = false );
|
||||
|
||||
/**
|
||||
|
@ -308,11 +329,13 @@ private:
|
|||
* @return
|
||||
*/
|
||||
std::vector<TRACK*> makeTracksFromDrawsegments( const std::vector<PCB_SHAPE*> aDrawsegments,
|
||||
BOARD_ITEM_CONTAINER* aParentContainer, NETINFO_ITEM* aNet = nullptr,
|
||||
PCB_LAYER_ID aLayerOverride = PCB_LAYER_ID::UNDEFINED_LAYER, int aWidthOverride = -1 );
|
||||
BOARD_ITEM_CONTAINER* aParentContainer,
|
||||
NETINFO_ITEM* aNet = nullptr,
|
||||
PCB_LAYER_ID aLayerOverride = UNDEFINED_LAYER,
|
||||
int aWidthOverride = -1 );
|
||||
|
||||
/**
|
||||
* @brief Adds a CADSTAR Attribute to a KiCad module
|
||||
* @brief Adds a CADSTAR Attribute to a KiCad footprint
|
||||
* @param aCadstarAttrLoc
|
||||
* @param aCadstarAttributeID
|
||||
* @param aFootprint
|
||||
|
|
|
@ -838,12 +838,12 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
|
|||
// Fabricate a MODULE with a single PAD_ATTRIB_NPTH pad.
|
||||
// Use m_hole_count to gen up a unique name.
|
||||
|
||||
MODULE* module = new MODULE( m_board );
|
||||
m_board->Add( module, ADD_MODE::APPEND );
|
||||
module->SetReference( wxString::Format( "@HOLE%d", m_hole_count++ ) );
|
||||
module->Reference().SetVisible( false );
|
||||
MODULE* footprint = new MODULE( m_board );
|
||||
m_board->Add( footprint, ADD_MODE::APPEND );
|
||||
footprint->SetReference( wxString::Format( "@HOLE%d", m_hole_count++ ) );
|
||||
footprint->Reference().SetVisible( false );
|
||||
|
||||
packageHole( module, gr, true );
|
||||
packageHole( footprint, gr, true );
|
||||
|
||||
m_xpath->pop();
|
||||
}
|
||||
|
@ -2138,7 +2138,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aFootprint, wxXmlNode* aTree, bool aCent
|
|||
{
|
||||
EHOLE e( aTree );
|
||||
|
||||
// we add a PAD_ATTRIB_NPTH pad to this module.
|
||||
// we add a PAD_ATTRIB_NPTH pad to this footprint.
|
||||
PAD* pad = new PAD( aFootprint );
|
||||
aFootprint->Add( pad );
|
||||
|
||||
|
@ -2249,8 +2249,8 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const
|
|||
{
|
||||
aPad->SetName( FROM_UTF8( aEaglePad.name.c_str() ) );
|
||||
|
||||
// pad's "Position" is not relative to the module's,
|
||||
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
|
||||
// pad's "Position" is not relative to the footprint's,
|
||||
// whereas Pos0 is relative to the footprint's but is the unrotated coordinate.
|
||||
wxPoint padPos( kicad_x( aEaglePad.x ), kicad_y( aEaglePad.y ) );
|
||||
aPad->SetPos0( padPos );
|
||||
|
||||
|
@ -2265,10 +2265,10 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const
|
|||
if( aEaglePad.thermals && !*aEaglePad.thermals )
|
||||
aPad->SetZoneConnection( ZONE_CONNECTION::FULL );
|
||||
|
||||
MODULE* module = aPad->GetParent();
|
||||
wxCHECK( module, /* void */ );
|
||||
RotatePoint( &padPos, module->GetOrientation() );
|
||||
aPad->SetPosition( padPos + module->GetPosition() );
|
||||
MODULE* footprint = aPad->GetParent();
|
||||
wxCHECK( footprint, /* void */ );
|
||||
RotatePoint( &padPos, footprint->GetOrientation() );
|
||||
aPad->SetPosition( padPos + footprint->GetPosition() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ private:
|
|||
XPATH* m_xpath; ///< keeps track of what we are working on within
|
||||
///< XML document during a Load().
|
||||
|
||||
int m_hole_count; ///< generates unique module names from eagle "hole"s.
|
||||
int m_hole_count; ///< generates unique footprint names from eagle "hole"s.
|
||||
|
||||
NET_MAP m_pads_to_nets; ///< net list
|
||||
|
||||
|
@ -300,10 +300,10 @@ private:
|
|||
|
||||
/**
|
||||
* Function packageHole
|
||||
* @parameter aFootprint - The KiCad module to which to assign the hole
|
||||
* @parameter aFootprint - The KiCad footprint to which to assign the hole
|
||||
* @parameter aTree - The Eagle XML node that is of type "hole"
|
||||
* @parameter aCenter - If true, center the hole in the module and
|
||||
* offset the module position
|
||||
* @parameter aCenter - If true, center the hole in the footprint and
|
||||
* offset the footprint position
|
||||
*/
|
||||
void packageHole( MODULE* aFootprint, wxXmlNode* aTree, bool aCenter ) const;
|
||||
void packageSMD( MODULE* aFootprint, wxXmlNode* aTree ) const;
|
||||
|
|
|
@ -100,27 +100,27 @@ static inline long parseInt( const wxString& aValue, double aScalar )
|
|||
* GPCB_FPL_CACHE_ITEM
|
||||
* is helper class for creating a footprint library cache.
|
||||
*
|
||||
* The new footprint library design is a file path of individual module files
|
||||
* that contain a single module per file. This class is a helper only for the
|
||||
* The new footprint library design is a file path of individual footprint files
|
||||
* that contain a single footprint per file. This class is a helper only for the
|
||||
* footprint portion of the PLUGIN API, and only for the #PCB_IO plugin. It is
|
||||
* private to this implementation file so it is not placed into a header.
|
||||
*/
|
||||
class GPCB_FPL_CACHE_ITEM
|
||||
{
|
||||
WX_FILENAME m_filename; ///< The the full file name and path of the footprint to cache.
|
||||
std::unique_ptr<MODULE> m_module;
|
||||
std::unique_ptr<MODULE> m_footprint;
|
||||
|
||||
public:
|
||||
GPCB_FPL_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName );
|
||||
|
||||
WX_FILENAME GetFileName() const { return m_filename; }
|
||||
MODULE* GetModule() const { return m_module.get(); }
|
||||
MODULE* GetFootprint() const { return m_footprint.get(); }
|
||||
};
|
||||
|
||||
|
||||
GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( MODULE* aFootprint, const WX_FILENAME& aFileName ) :
|
||||
m_filename( aFileName ),
|
||||
m_module( aFootprint )
|
||||
m_footprint( aFootprint )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -132,14 +132,14 @@ typedef MODULE_MAP::const_iterator MODULE_CITER;
|
|||
|
||||
class GPCB_FPL_CACHE
|
||||
{
|
||||
GPCB_PLUGIN* m_owner; /// Plugin object that owns the cache.
|
||||
wxFileName m_lib_path; /// The path of the library.
|
||||
MODULE_MAP m_modules; /// Map of footprint file name per MODULE*.
|
||||
GPCB_PLUGIN* m_owner; ///< Plugin object that owns the cache.
|
||||
wxFileName m_lib_path; ///< The path of the library.
|
||||
MODULE_MAP m_footprints; ///< Map of footprint file name to MODULE*.
|
||||
|
||||
bool m_cache_dirty; // Stored separately because it's expensive to check
|
||||
// m_cache_timestamp against all the files.
|
||||
long long m_cache_timestamp; // A hash of the timestamps for all the footprint
|
||||
// files.
|
||||
bool m_cache_dirty; ///< Stored separately because it's expensive to check
|
||||
///< m_cache_timestamp against all the files.
|
||||
long long m_cache_timestamp; ///< A hash of the timestamps for all the footprint
|
||||
///< files.
|
||||
|
||||
MODULE* parseMODULE( LINE_READER* aLineReader );
|
||||
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
|
||||
wxString GetPath() const { return m_lib_path.GetPath(); }
|
||||
bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); }
|
||||
MODULE_MAP& GetModules() { return m_modules; }
|
||||
MODULE_MAP& GetModules() { return m_footprints; }
|
||||
|
||||
// Most all functions in this class throw IO_ERROR exceptions. There are no
|
||||
// error codes nor user interface calls from here, nor in any PLUGIN.
|
||||
|
@ -258,7 +258,7 @@ void GPCB_FPL_CACHE::Load()
|
|||
|
||||
// The footprint name is the file name without the extension.
|
||||
footprint->SetFPID( LIB_ID( wxEmptyString, fn.GetName() ) );
|
||||
m_modules.insert( name, new GPCB_FPL_CACHE_ITEM( footprint, fn ) );
|
||||
m_footprints.insert( name, new GPCB_FPL_CACHE_ITEM( footprint, fn ) );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
|
@ -278,18 +278,18 @@ void GPCB_FPL_CACHE::Remove( const wxString& aFootprintName )
|
|||
{
|
||||
std::string footprintName = TO_UTF8( aFootprintName );
|
||||
|
||||
MODULE_CITER it = m_modules.find( footprintName );
|
||||
MODULE_CITER it = m_footprints.find( footprintName );
|
||||
|
||||
if( it == m_modules.end() )
|
||||
if( it == m_footprints.end() )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "library \"%s\" has no footprint \"%s\" to delete" ),
|
||||
m_lib_path.GetPath().GetData(),
|
||||
aFootprintName.GetData() ) );
|
||||
}
|
||||
|
||||
// Remove the module from the cache and delete the module file from the library.
|
||||
// Remove the footprint from the cache and delete the footprint file from the library.
|
||||
wxString fullPath = it->second->GetFileName().GetFullPath();
|
||||
m_modules.erase( footprintName );
|
||||
m_footprints.erase( footprintName );
|
||||
wxRemoveFile( fullPath );
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
wxPoint textPos;
|
||||
wxString msg;
|
||||
wxArrayString parameters;
|
||||
std::unique_ptr<MODULE> module = std::make_unique<MODULE>( nullptr );
|
||||
std::unique_ptr<MODULE> footprint = std::make_unique<MODULE>( nullptr );
|
||||
|
||||
|
||||
if( aLineReader->ReadLine() == NULL )
|
||||
|
@ -364,22 +364,22 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
|
||||
if( paramCnt > 10 )
|
||||
{
|
||||
module->SetDescription( parameters[3] );
|
||||
module->SetReference( parameters[4] );
|
||||
footprint->SetDescription( parameters[3] );
|
||||
footprint->SetReference( parameters[4] );
|
||||
}
|
||||
else
|
||||
{
|
||||
module->SetDescription( parameters[2] );
|
||||
module->SetReference( parameters[3] );
|
||||
footprint->SetDescription( parameters[2] );
|
||||
footprint->SetReference( parameters[3] );
|
||||
}
|
||||
|
||||
// Read value
|
||||
if( paramCnt > 10 )
|
||||
module->SetValue( parameters[5] );
|
||||
footprint->SetValue( parameters[5] );
|
||||
// With gEDA/pcb, value is meaningful after instantiation, only, so it's
|
||||
// often empty in bare footprints.
|
||||
if( module->Value().GetText().IsEmpty() )
|
||||
module->Value().SetText( wxT( "Val**" ) );
|
||||
if( footprint->Value().GetText().IsEmpty() )
|
||||
footprint->Value().SetText( wxT( "Val**" ) );
|
||||
|
||||
|
||||
if( paramCnt == 14 )
|
||||
|
@ -394,7 +394,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
}
|
||||
|
||||
int orientation = parseInt( parameters[paramCnt-4], 1.0 );
|
||||
module->Reference().SetTextAngle( (orientation % 2) ? 900 : 0 );
|
||||
footprint->Reference().SetTextAngle(( orientation % 2) ? 900 : 0 );
|
||||
|
||||
// Calculate size: default height is 40 mils, width 30 mil.
|
||||
// real size is: default * ibuf[idx+3] / 100 (size in gpcb is given in percent of default size
|
||||
|
@ -406,7 +406,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
// gEDA/pcb aligns top/left, not pcbnew's default, center/center.
|
||||
// Compensate for this by shifting the insertion point instead of the
|
||||
// alignment, because alignment isn't changeable in the GUI.
|
||||
textPos.x = textPos.x + twsize * module->GetReference().Len() / 2;
|
||||
textPos.x = textPos.x + twsize * footprint->GetReference().Len() / 2;
|
||||
textPos.y += thsize / 2;
|
||||
|
||||
// gEDA/pcb draws a bit too low/left, while pcbnew draws a bit too
|
||||
|
@ -414,20 +414,20 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
textPos.x -= thsize / 10;
|
||||
textPos.y += thsize / 2;
|
||||
|
||||
module->Reference().SetTextPos( textPos );
|
||||
module->Reference().SetPos0( textPos );
|
||||
module->Reference().SetTextSize( wxSize( twsize, thsize ) );
|
||||
module->Reference().SetTextThickness( thickness );
|
||||
footprint->Reference().SetTextPos( textPos );
|
||||
footprint->Reference().SetPos0( textPos );
|
||||
footprint->Reference().SetTextSize( wxSize( twsize, thsize ) );
|
||||
footprint->Reference().SetTextThickness( thickness );
|
||||
|
||||
// gEDA/pcb shows only one of value/reference/description at a time. Which
|
||||
// one is selectable by a global menu setting. pcbnew needs reference as
|
||||
// well as value visible, so place the value right below the reference.
|
||||
module->Value().SetTextAngle( module->Reference().GetTextAngle() );
|
||||
module->Value().SetTextSize( module->Reference().GetTextSize() );
|
||||
module->Value().SetTextThickness( module->Reference().GetTextThickness());
|
||||
footprint->Value().SetTextAngle( footprint->Reference().GetTextAngle() );
|
||||
footprint->Value().SetTextSize( footprint->Reference().GetTextSize() );
|
||||
footprint->Value().SetTextThickness( footprint->Reference().GetTextThickness());
|
||||
textPos.y += thsize * 13 / 10; // 130% line height
|
||||
module->Value().SetTextPos( textPos );
|
||||
module->Value().SetPos0( textPos );
|
||||
footprint->Value().SetTextPos( textPos );
|
||||
footprint->Value().SetPos0( textPos );
|
||||
|
||||
while( aLineReader->ReadLine() )
|
||||
{
|
||||
|
@ -464,7 +464,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
aLineReader->LineNumber(), 0 );
|
||||
}
|
||||
|
||||
FP_SHAPE* shape = new FP_SHAPE( module.get() );
|
||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get() );
|
||||
shape->SetLayer( F_SilkS );
|
||||
shape->SetShape( S_SEGMENT );
|
||||
shape->SetStart0( wxPoint( parseInt( parameters[2], conv_unit ),
|
||||
|
@ -473,7 +473,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
parseInt( parameters[5], conv_unit ) ) );
|
||||
shape->SetWidth( parseInt( parameters[6], conv_unit ) );
|
||||
shape->SetDrawCoord();
|
||||
module->Add( shape );
|
||||
footprint->Add( shape );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -488,10 +488,10 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
}
|
||||
|
||||
// Pcbnew does know ellipse so we must have Width = Height
|
||||
FP_SHAPE* shape = new FP_SHAPE( module.get() );
|
||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get() );
|
||||
shape->SetLayer( F_SilkS );
|
||||
shape->SetShape( S_ARC );
|
||||
module->Add( shape );
|
||||
footprint->Add( shape );
|
||||
|
||||
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
|
||||
int radius = ( parseInt( parameters[4], conv_unit ) +
|
||||
|
@ -539,7 +539,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
aLineReader->LineNumber(), 0 );
|
||||
}
|
||||
|
||||
PAD* pad = new PAD( module.get() );
|
||||
PAD* pad = new PAD( footprint.get() );
|
||||
|
||||
static const LSET pad_front( 3, F_Cu, F_Mask, F_Paste );
|
||||
static const LSET pad_back( 3, B_Cu, B_Mask, B_Paste );
|
||||
|
@ -597,7 +597,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
|
||||
// Set the relative position before adjusting the absolute position
|
||||
pad->SetPos0( padPos );
|
||||
padPos += module->GetPosition();
|
||||
padPos += footprint->GetPosition();
|
||||
pad->SetPosition( padPos );
|
||||
|
||||
if( !testFlags( parameters[paramCnt-2], 0x0100, wxT( "square" ) ) )
|
||||
|
@ -608,7 +608,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
pad->SetShape( PAD_SHAPE_OVAL );
|
||||
}
|
||||
|
||||
module->Add( pad );
|
||||
footprint->Add( pad );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
aLineReader->LineNumber(), 0 );
|
||||
}
|
||||
|
||||
PAD* pad = new PAD( module.get() );
|
||||
PAD* pad = new PAD( footprint.get() );
|
||||
|
||||
pad->SetShape( PAD_SHAPE_CIRCLE );
|
||||
|
||||
|
@ -680,20 +680,20 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
|
||||
// Set the relative position before adjusting the absolute position
|
||||
pad->SetPos0( padPos );
|
||||
padPos += module->GetPosition();
|
||||
padPos += footprint->GetPosition();
|
||||
pad->SetPosition( padPos );
|
||||
|
||||
if( pad->GetShape() == PAD_SHAPE_CIRCLE && pad->GetSize().x != pad->GetSize().y )
|
||||
pad->SetShape( PAD_SHAPE_OVAL );
|
||||
|
||||
module->Add( pad );
|
||||
footprint->Add( pad );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Recalculate the bounding box
|
||||
module->CalculateBoundingBox();
|
||||
return module.release();
|
||||
footprint->CalculateBoundingBox();
|
||||
return footprint.release();
|
||||
}
|
||||
|
||||
|
||||
|
@ -925,7 +925,7 @@ const MODULE* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return it->second->GetModule();
|
||||
return it->second->GetFootprint();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue