Change environmental variables to human-readable
Versions specific variables that may point to objects that change through versions, allowing multiple KiCad versions to operate correctly (even on MSW) on the same machine.
This commit is contained in:
parent
6a81113c2d
commit
8de9cff4e0
|
@ -42,7 +42,7 @@
|
|||
|
||||
/// A variable name whose value holds the path of 3D shape files.
|
||||
/// Currently an environment variable, eventually a project variable.
|
||||
#define KISYS3DMOD wxT( "KISYS3DMOD" )
|
||||
#define KICAD6_3DMODEL_DIR wxT( "KICAD6_3DMODEL_DIR" )
|
||||
|
||||
|
||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE (wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
|
||||
|
|
|
@ -112,7 +112,7 @@ bool DIALOG_GLOBAL_LIB_TABLE_CONFIG::TransferDataToWindow()
|
|||
SystemDirsAppend( &ss );
|
||||
|
||||
wxString templatePath =
|
||||
Pgm().GetLocalEnvVariables().at( wxT( "KICAD_TEMPLATE_DIR" ) ).GetValue();
|
||||
Pgm().GetLocalEnvVariables().at( wxT( "KICAD6_TEMPLATE_DIR" ) ).GetValue();
|
||||
|
||||
if( !templatePath.IsEmpty() )
|
||||
ss.AddPaths( templatePath, 0 );
|
||||
|
|
|
@ -35,10 +35,10 @@ using STRING_MAP = std::map<wxString, wxString>;
|
|||
*/
|
||||
static const ENV_VAR_LIST predefined_env_vars = {
|
||||
"KIPRJMOD",
|
||||
"KICAD_SYMBOL_DIR",
|
||||
"KISYS3DMOD",
|
||||
"KISYSMOD",
|
||||
"KICAD_TEMPLATE_DIR",
|
||||
"KICAD6_SYMBOL_DIR",
|
||||
"KICAD6_3DMODEL_DIR",
|
||||
"KICAD6_FOOTPRINT_DIR",
|
||||
"KICAD6_TEMPLATE_DIR",
|
||||
"KICAD_USER_TEMPLATE_DIR",
|
||||
"KICAD_PTEMPLATES",
|
||||
};
|
||||
|
@ -66,14 +66,14 @@ void initialiseEnvVarHelp( STRING_MAP& aMap )
|
|||
{
|
||||
// Set up dynamically, as we want to be able to use _() translations,
|
||||
// which can't be done statically
|
||||
aMap["KISYSMOD"] =
|
||||
aMap["KICAD6_FOOTPRINT_DIR"] =
|
||||
_( "The base path of locally installed system "
|
||||
"footprint libraries (.pretty folders).");
|
||||
aMap["KISYS3DMOD"] =
|
||||
aMap["KICAD6_3DMODEL_DIR"] =
|
||||
_( "The base path of system footprint 3D shapes (.3Dshapes folders).");
|
||||
aMap["KICAD_SYMBOL_DIR"] =
|
||||
aMap["KICAD6_SYMBOL_DIR"] =
|
||||
_( "The base path of the locally installed symbol libraries.");
|
||||
aMap["KICAD_TEMPLATE_DIR"] =
|
||||
aMap["KICAD6_TEMPLATE_DIR"] =
|
||||
_( "A directory containing project templates installed with KiCad.");
|
||||
aMap["KICAD_USER_TEMPLATE_DIR"] =
|
||||
_( "Optional. Can be defined if you want to create your own project "
|
||||
|
@ -84,10 +84,20 @@ void initialiseEnvVarHelp( STRING_MAP& aMap )
|
|||
"variable can be used to define files and paths relative to the currently loaded "
|
||||
"project. For instance, ${KIPRJMOD}/libs/footprints.pretty can be defined as a "
|
||||
"folder containing a project specific footprint library named footprints.pretty." );
|
||||
aMap["KICAD6_SCRIPTING_DIR"] =
|
||||
_( "A directory containing system-wide scripts installed with KiCad" );
|
||||
aMap["KICAD6_USER_SCRIPTING_DIR"] =
|
||||
_( "A directory containing user-specific scripts installed with KiCad" );
|
||||
|
||||
// Deprecated vars
|
||||
aMap["KICAD_PTEMPLATES"] =
|
||||
_( "Deprecated version of KICAD_TEMPLATE_DIR.");
|
||||
aMap["KISYS3DMOD"] =
|
||||
_( "Deprecated version of KICAD6_3DMODEL_DIR." );
|
||||
aMap["KISYSMOD"] =
|
||||
_( "Deprecated version of KICAD6_FOOTPRINT_DIR." );
|
||||
aMap["KICAD_SYMBOL_DIR"] =
|
||||
_( "Deprecated version of KICAD_SYMBOL_DIR.");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -324,8 +324,8 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
// directory, which has already been checked. This case accounts
|
||||
// for partial paths which do not contain ${KIPRJMOD}.
|
||||
// This check is performed before checking the path relative to
|
||||
// ${KISYS3DMOD} so that users can potentially override a model
|
||||
// within ${KISYS3DMOD}
|
||||
// ${KICAD6_3DMODEL_DIR} so that users can potentially override a model
|
||||
// within ${KICAD6_3DMODEL_DIR}
|
||||
if( !sPL->m_Pathexp.empty() && !tname.StartsWith( ":" ) )
|
||||
{
|
||||
tmpFN.Assign( sPL->m_Pathexp, "" );
|
||||
|
@ -343,11 +343,11 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
|
||||
}
|
||||
|
||||
// check the partial path relative to ${KISYS3DMOD} (legacy behavior)
|
||||
// check the partial path relative to ${KICAD6_3DMODEL_DIR} (legacy behavior)
|
||||
if( !tname.StartsWith( ":" ) )
|
||||
{
|
||||
wxFileName fpath;
|
||||
wxString fullPath( "${KISYS3DMOD}" );
|
||||
wxString fullPath( "${KICAD6_3DMODEL_DIR}" );
|
||||
fullPath.Append( fpath.GetPathSeparator() );
|
||||
fullPath.Append( tname );
|
||||
fullPath = ExpandEnvVarSubstitutions( fullPath, m_project );
|
||||
|
@ -374,7 +374,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
if( !( m_errflags & ERRFLG_RELPATH ) )
|
||||
{
|
||||
// this can happen if the file was intended to be relative to
|
||||
// ${KISYS3DMOD} but ${KISYS3DMOD} not set or incorrect.
|
||||
// ${KICAD6_3DMODEL_DIR} but ${KICAD6_3DMODEL_DIR} not set or incorrect.
|
||||
m_errflags |= ERRFLG_RELPATH;
|
||||
wxString errmsg = "[3D File Resolver] No such path";
|
||||
errmsg.append( "\n" );
|
||||
|
@ -447,8 +447,8 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
|||
if( !path.DirExists() )
|
||||
{
|
||||
// suppress the message if the missing pathvar is the
|
||||
// legacy KISYS3DMOD variable
|
||||
if( aPath.m_Pathvar.compare( wxT( "${KISYS3DMOD}" ) ) )
|
||||
// legacy KICAD6_3DMODEL_DIR variable
|
||||
if( aPath.m_Pathvar.compare( wxT( "${KICAD6_3DMODEL_DIR}" ) ) )
|
||||
{
|
||||
wxString msg = _( "The given path does not exist" );
|
||||
msg.append( wxT( "\n" ) );
|
||||
|
@ -581,8 +581,8 @@ bool FILENAME_RESOLVER::readPathList()
|
|||
if( !getHollerith( cfgLine, idx, al.m_Alias ) )
|
||||
continue;
|
||||
|
||||
// never add on KISYS3DMOD from a config file
|
||||
if( !al.m_Alias.Cmp( wxT( "KISYS3DMOD" ) ) )
|
||||
// never add on KICAD6_3DMODEL_DIR from a config file
|
||||
if( !al.m_Alias.Cmp( wxT( "KICAD6_3DMODEL_DIR" ) ) )
|
||||
continue;
|
||||
|
||||
if( !getHollerith( cfgLine, idx, al.m_Pathvar ) )
|
||||
|
@ -1024,7 +1024,7 @@ bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths )
|
|||
{
|
||||
// filter out URLs, template directories, and known system paths
|
||||
if( mS->first == wxString( "KICAD_PTEMPLATES" )
|
||||
|| mS->first == wxString( "KISYSMOD" ) )
|
||||
|| mS->first == wxString( "KICAD6_FOOTPRINT_DIR" ) )
|
||||
{
|
||||
++mS;
|
||||
continue;
|
||||
|
@ -1041,14 +1041,14 @@ bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths )
|
|||
tmp.Append( "}" );
|
||||
paths.push_back( tmp );
|
||||
|
||||
if( tmp == "${KISYS3DMOD}" )
|
||||
if( tmp == "${KICAD6_3DMODEL_DIR}" )
|
||||
hasKisys3D = true;
|
||||
|
||||
++mS;
|
||||
}
|
||||
|
||||
if( !hasKisys3D )
|
||||
paths.emplace_back("${KISYS3DMOD}" );
|
||||
paths.emplace_back("${KICAD6_3DMODEL_DIR}" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ FOOTPRINT* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootp
|
|||
|
||||
const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
|
||||
{
|
||||
return "KISYSMOD";
|
||||
return "KICAD6_FOOTPRINT_DIR";
|
||||
}
|
||||
|
||||
|
||||
|
@ -491,7 +491,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
|
|||
SystemDirsAppend( &ss );
|
||||
|
||||
wxString templatePath =
|
||||
Pgm().GetLocalEnvVariables().at( wxT( "KICAD_TEMPLATE_DIR" ) ).GetValue();
|
||||
Pgm().GetLocalEnvVariables().at( wxT( "KICAD6_TEMPLATE_DIR" ) ).GetValue();
|
||||
|
||||
if( !templatePath.IsEmpty() )
|
||||
ss.AddPaths( templatePath, 0 );
|
||||
|
|
|
@ -279,8 +279,8 @@ bool PGM_BASE::InitPgm()
|
|||
baseSharePath.AppendDir( "kicad" );
|
||||
#endif
|
||||
|
||||
// KISYSMOD
|
||||
wxString envVarName = wxT( "KISYSMOD" );
|
||||
// KICAD6_FOOTPRINT_DIR
|
||||
wxString envVarName = wxT( "KICAD6_FOOTPRINT_DIR" );
|
||||
ENV_VAR_ITEM envVarItem;
|
||||
wxString envValue;
|
||||
wxFileName tmpFileName;
|
||||
|
@ -303,8 +303,8 @@ bool PGM_BASE::InitPgm()
|
|||
envVarName, envVarItem.GetValue() );
|
||||
m_local_env_vars[ envVarName ] = envVarItem;
|
||||
|
||||
// KISYS3DMOD
|
||||
envVarName = wxT( "KISYS3DMOD" );
|
||||
// KICAD6_3DMODEL_DIR
|
||||
envVarName = wxT( "KICAD6_3DMODEL_DIR" );
|
||||
|
||||
if( wxGetEnv( envVarName, &envValue ) == true && !envValue.IsEmpty() )
|
||||
{
|
||||
|
@ -324,8 +324,8 @@ bool PGM_BASE::InitPgm()
|
|||
envVarName, envVarItem.GetValue() );
|
||||
m_local_env_vars[ envVarName ] = envVarItem;
|
||||
|
||||
// KICAD_TEMPLATE_DIR
|
||||
envVarName = "KICAD_TEMPLATE_DIR";
|
||||
// KICAD6_TEMPLATE_DIR
|
||||
envVarName = "KICAD6_TEMPLATE_DIR";
|
||||
|
||||
if( wxGetEnv( envVarName, &envValue ) == true && !envValue.IsEmpty() )
|
||||
{
|
||||
|
@ -400,7 +400,7 @@ bool PGM_BASE::InitPgm()
|
|||
m_local_env_vars[ envVarName ] = envVarItem;
|
||||
|
||||
// KICAD_SYMBOLS
|
||||
envVarName = wxT( "KICAD_SYMBOL_DIR" );
|
||||
envVarName = wxT( "KICAD6_SYMBOL_DIR" );
|
||||
|
||||
if( wxGetEnv( envVarName, &envValue ) == true && !envValue.IsEmpty() )
|
||||
{
|
||||
|
|
|
@ -121,7 +121,7 @@ FP_LIB_TABLE GFootprintTable;
|
|||
|
||||
|
||||
// A short lived implementation. cvpcb will get combine into pcbnew shortly, so
|
||||
// we skip setting KISYSMOD here for now. User should set the environment
|
||||
// we skip setting KICAD6_FOOTPRINT_DIR here for now. User should set the environment
|
||||
// variable.
|
||||
|
||||
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <gestfich.h>
|
||||
#include <id.h>
|
||||
#include <project.h> // For PROJECT_VAR_NAME definition
|
||||
#include <fp_lib_table.h> // For KISYSMOD definition
|
||||
#include <fp_lib_table.h> // For KICAD6_FOOTPRINT_DIR definition
|
||||
|
||||
#include <cvpcb_mainframe.h>
|
||||
#include <dialog_config_equfiles.h>
|
||||
|
|
|
@ -478,7 +478,7 @@ LIB_PART* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId
|
|||
|
||||
const wxString SYMBOL_LIB_TABLE::GlobalPathEnvVariableName()
|
||||
{
|
||||
return "KICAD_SYMBOL_DIR";
|
||||
return "KICAD6_SYMBOL_DIR";
|
||||
}
|
||||
|
||||
|
||||
|
@ -504,7 +504,7 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
|
|||
SystemDirsAppend( &ss );
|
||||
|
||||
wxString templatePath =
|
||||
Pgm().GetLocalEnvVariables().at( wxT( "KICAD_TEMPLATE_DIR" ) ).GetValue();
|
||||
Pgm().GetLocalEnvVariables().at( wxT( "KICAD6_TEMPLATE_DIR" ) ).GetValue();
|
||||
|
||||
if( !templatePath.IsEmpty() )
|
||||
ss.AddPaths( templatePath, 0 );
|
||||
|
|
|
@ -49,7 +49,7 @@ struct SEARCH_PATH
|
|||
* Provide an extensible class to resolve 3D model paths.
|
||||
*
|
||||
* Initially the legacy behavior will be implemented and an incomplete path would be checked
|
||||
* against the project directory or the KISYS3DMOD environment variable. In the future a
|
||||
* against the project directory or the KICAD6_3DMODEL_DIR environment variable. In the future a
|
||||
* configurable set of search paths may be specified.
|
||||
*/
|
||||
class FILENAME_RESOLVER
|
||||
|
@ -132,13 +132,13 @@ public:
|
|||
/**
|
||||
* Return a list of path environment variables local to KiCad.
|
||||
*
|
||||
* This list always includes KISYS3DMOD even if it is not defined locally.
|
||||
* This list always includes KICAD6_3DMODEL_DIR even if it is not defined locally.
|
||||
*/
|
||||
bool GetKicadPaths( std::list< wxString >& paths );
|
||||
|
||||
private:
|
||||
/**
|
||||
* Build the path list using available information such as KISYS3DMOD and the 3d_path_list
|
||||
* Build the path list using available information such as KICAD6_3DMODEL_DIR and the 3d_path_list
|
||||
* configuration file.
|
||||
*
|
||||
* @warning Invalid paths are silently discarded and removed from the configuration file.
|
||||
|
|
|
@ -363,7 +363,7 @@ protected:
|
|||
wxString m_editor_name;
|
||||
wxSize m_help_size;
|
||||
|
||||
/// Local environment variable expansion settings such as KISYSMOD, and KISYS3DMOD.
|
||||
/// Local environment variable expansion settings such as KICAD6_FOOTPRINT_DIR, and KICAD6_3DMODEL_DIR.
|
||||
ENV_VAR_MAP m_local_env_vars;
|
||||
|
||||
/// Flag to indicate if the environment variable overwrite warning dialog should be shown.
|
||||
|
|
|
@ -119,13 +119,13 @@ bool PGM_KICAD::OnPgmInit()
|
|||
m_bm.m_search.AddPaths( fn.GetPath() );
|
||||
}
|
||||
|
||||
// The KICAD_TEMPLATE_DIR takes precedence over the search stack template path.
|
||||
ENV_VAR_MAP_CITER it = GetLocalEnvVariables().find( "KICAD_TEMPLATE_DIR" );
|
||||
// The KICAD6_TEMPLATE_DIR takes precedence over the search stack template path.
|
||||
ENV_VAR_MAP_CITER it = GetLocalEnvVariables().find( "KICAD6_TEMPLATE_DIR" );
|
||||
|
||||
if( it != GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
|
||||
m_bm.m_search.Insert( it->second.GetValue(), 0 );
|
||||
|
||||
// The KICAD_USER_TEMPLATE_DIR takes precedence over KICAD_TEMPLATE_DIR and the search
|
||||
// The KICAD_USER_TEMPLATE_DIR takes precedence over KICAD6_TEMPLATE_DIR and the search
|
||||
// stack template path.
|
||||
it = GetLocalEnvVariables().find( "KICAD_USER_TEMPLATE_DIR" );
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
|||
wxString envStr;
|
||||
|
||||
// KiCad system template path.
|
||||
ENV_VAR_MAP_CITER it = Pgm().GetLocalEnvVariables().find( "KICAD_TEMPLATE_DIR" );
|
||||
ENV_VAR_MAP_CITER it = Pgm().GetLocalEnvVariables().find( "KICAD6_TEMPLATE_DIR" );
|
||||
|
||||
if( it != Pgm().GetLocalEnvVariables().end() && it->second.GetValue() != wxEmptyString )
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aP
|
|||
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
if( cfg->m_lastFootprint3dDir.IsEmpty() )
|
||||
{
|
||||
wxGetEnv( KISYS3DMOD, &cfg->m_lastFootprint3dDir );
|
||||
wxGetEnv( KICAD6_3DMODEL_DIR, &cfg->m_lastFootprint3dDir );
|
||||
}
|
||||
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
|
@ -289,7 +289,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow()
|
|||
// 3D Settings
|
||||
|
||||
wxString default_path;
|
||||
wxGetEnv( KISYS3DMOD, &default_path );
|
||||
wxGetEnv( KICAD6_3DMODEL_DIR, &default_path );
|
||||
#ifdef __WINDOWS__
|
||||
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
#endif
|
||||
|
@ -443,11 +443,11 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel( wxCommandEvent& )
|
|||
wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
|
||||
int filter = 0;
|
||||
|
||||
// If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KISYS3DMOD environment
|
||||
// If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KICAD6_3DMODEL_DIR environment
|
||||
// varaible and fall back to the project path if necessary.
|
||||
if( initialpath.IsEmpty() )
|
||||
{
|
||||
if( !wxGetEnv( "KISYS3DMOD", &initialpath ) || initialpath.IsEmpty() )
|
||||
if( !wxGetEnv( "KICAD6_3DMODEL_DIR", &initialpath ) || initialpath.IsEmpty() )
|
||||
initialpath = prj.GetProjectPath();
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen
|
|||
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
|
||||
if( cfg->m_lastFootprint3dDir.IsEmpty() )
|
||||
{
|
||||
wxGetEnv( KISYS3DMOD, &cfg->m_lastFootprint3dDir );
|
||||
wxGetEnv( KICAD6_3DMODEL_DIR, &cfg->m_lastFootprint3dDir );
|
||||
}
|
||||
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
|
@ -515,11 +515,11 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DModel( wxCommandEvent& )
|
|||
wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
|
||||
int filter = 0;
|
||||
|
||||
// If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KISYS3DMOD environment
|
||||
// If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KICAD6_3DMODEL_DIR environment
|
||||
// variable and fall back to the project path if necessary.
|
||||
if( initialpath.IsEmpty() )
|
||||
{
|
||||
if( !wxGetEnv( "KISYS3DMOD", &initialpath ) || initialpath.IsEmpty() )
|
||||
if( !wxGetEnv( "KICAD6_3DMODEL_DIR", &initialpath ) || initialpath.IsEmpty() )
|
||||
initialpath = prj.GetProjectPath();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <wx/grid.h>
|
||||
|
||||
#include <project.h>
|
||||
#include <3d_viewer/eda_3d_viewer.h> // for KISYS3DMOD
|
||||
#include <3d_viewer/eda_3d_viewer.h> // for KICAD6_3DMODEL_DIR
|
||||
#include <panel_fp_lib_table.h>
|
||||
#include <lib_id.h>
|
||||
#include <fp_lib_table.h>
|
||||
|
@ -991,7 +991,7 @@ void PANEL_FP_LIB_TABLE::populateEnvironReadOnlyTable()
|
|||
unique.insert( PROJECT_VAR_NAME );
|
||||
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
|
||||
// This special environment variable is used to locate 3d shapes
|
||||
unique.insert( KISYS3DMOD );
|
||||
unique.insert( KICAD6_3DMODEL_DIR );
|
||||
|
||||
for( const wxString& evName : unique )
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ std::string g_previewBoard =
|
|||
" (net 1 \"GND\") (tstamp 7920b7f9-55c4-4584-bf5c-436e8ef95e74))\n"
|
||||
" (pad \"2\" thru_hole circle (at 2 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)\n"
|
||||
" (net 1 \"GND\") (tstamp e4c29d51-7825-48f6-aae3-5e0ea3eb6e7a))\n"
|
||||
" (model \"${KISYS3DMOD}/Capacitors_THT.3dshapes/CP_Radial_D5.0mm_P2.00mm.wrl\"\n"
|
||||
" (model \"${KICAD6_3DMODEL_DIR}/Capacitors_THT.3dshapes/CP_Radial_D5.0mm_P2.00mm.wrl\"\n"
|
||||
" (offset (xyz 0 0 0))\n"
|
||||
" (scale (xyz 1 1 1))\n"
|
||||
" (rotate (xyz 0 0 0))\n"
|
||||
|
@ -157,7 +157,7 @@ std::string g_previewBoard =
|
|||
" (pad \"1\" thru_hole circle (at 0 0) (size 1.8 1.8) (drill 0.85) (layers *.Cu *.Mask)\n"
|
||||
" (net 1 \"GND\") (tstamp def83b42-5ec2-442a-8f2b-ffd7b14105ce))\n"
|
||||
" (pad \"2\" thru_hole circle (at 10.16 0) (size 1.8 1.8) (drill 0.85) (layers *.Cu *.Mask) (tstamp 6386fdb7-f3d1-4839-9830-ab733b3e8d94))\n"
|
||||
" (model \"${KISYS3DMOD}/Resistors_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl\"\n"
|
||||
" (model \"${KICAD6_3DMODEL_DIR}/Resistors_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl\"\n"
|
||||
" (offset (xyz 0 0 0))\n"
|
||||
" (scale (xyz 0.393701 0.393701 0.393701))\n"
|
||||
" (rotate (xyz 0 0 0))\n"
|
||||
|
@ -195,7 +195,7 @@ std::string g_previewBoard =
|
|||
" (pad \"1\" thru_hole circle (at 0 0) (size 1.8 1.8) (drill 0.85) (layers *.Cu *.Mask)\n"
|
||||
" (net 1 \"GND\") (tstamp 5a702112-f16c-4b59-9902-914db0fa4360))\n"
|
||||
" (pad \"2\" thru_hole circle (at 10.16 0) (size 1.8 1.8) (drill 0.85) (layers *.Cu *.Mask) (tstamp b2b0d740-b086-433e-90f5-ffe119efdd07))\n"
|
||||
" (model \"${KISYS3DMOD}/Resistors_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl\"\n"
|
||||
" (model \"${KICAD6_3DMODEL_DIR}/Resistors_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl\"\n"
|
||||
" (offset (xyz 0 0 0))\n"
|
||||
" (scale (xyz 0.393701 0.393701 0.393701))\n"
|
||||
" (rotate (xyz 0 0 0))\n"
|
||||
|
@ -232,7 +232,7 @@ std::string g_previewBoard =
|
|||
" (fp_line (start 8.23 -1.25) (end 1.93 -1.25) (layer \"F.Fab\") (width 0.1) (tstamp c0322b20-ac45-4f20-bbab-44368f60ac5d))\n"
|
||||
" (pad \"1\" thru_hole circle (at 0 0 180) (size 1.8 1.8) (drill 0.85) (layers *.Cu *.Mask) (tstamp 945fccb0-61fe-41e2-8f09-c8a33f294a3e))\n"
|
||||
" (pad \"2\" thru_hole circle (at 10.16 0 180) (size 1.8 1.8) (drill 0.85) (layers *.Cu *.Mask) (tstamp d8e786d3-14bf-403c-80db-810abc9eda53))\n"
|
||||
" (model \"${KISYS3DMOD}/Resistors_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl\"\n"
|
||||
" (model \"${KICAD6_3DMODEL_DIR}/Resistors_THT.3dshapes/R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal.wrl\"\n"
|
||||
" (offset (xyz 0 0 0))\n"
|
||||
" (scale (xyz 0.393701 0.393701 0.393701))\n"
|
||||
" (rotate (xyz 0 0 0))\n"
|
||||
|
@ -267,7 +267,7 @@ std::string g_previewBoard =
|
|||
" (net 1 \"GND\") (tstamp 7ef87fdc-802f-4acb-9867-18732d4a7e7a))\n"
|
||||
" (pad \"2\" thru_hole circle (at 2 0) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)\n"
|
||||
" (net 1 \"GND\") (tstamp 1ad1f5f9-68f6-4131-9e09-bd1d361fc282))\n"
|
||||
" (model \"${KISYS3DMOD}/Capacitors_THT.3dshapes/CP_Radial_D5.0mm_P2.00mm.wrl\"\n"
|
||||
" (model \"${KICAD6_3DMODEL_DIR}/Capacitors_THT.3dshapes/CP_Radial_D5.0mm_P2.00mm.wrl\"\n"
|
||||
" (offset (xyz 0 0 0))\n"
|
||||
" (scale (xyz 1 1 1))\n"
|
||||
" (rotate (xyz 0 0 0))\n"
|
||||
|
|
|
@ -204,7 +204,7 @@ bool S3D_RESOLVER::createPathList( void )
|
|||
m_Paths.push_back( lpath );
|
||||
wxFileName fndummy;
|
||||
wxUniChar psep = fndummy.GetPathSeparator();
|
||||
bool hasKISYS3DMOD = false;
|
||||
bool hasKICAD6_3DMODEL_DIR = false;
|
||||
|
||||
// iterate over the list of internally defined ENV VARs
|
||||
// and add existing paths to the resolver
|
||||
|
@ -215,7 +215,7 @@ bool S3D_RESOLVER::createPathList( void )
|
|||
{
|
||||
// filter out URLs, template directories, and known system paths
|
||||
if( mS->first == wxString( "KICAD_PTEMPLATES" )
|
||||
|| mS->first == wxString( "KISYSMOD" ) )
|
||||
|| mS->first == wxString( "KICAD6_FOOTPRINT_DIR" ) )
|
||||
{
|
||||
++mS;
|
||||
continue;
|
||||
|
@ -248,8 +248,8 @@ bool S3D_RESOLVER::createPathList( void )
|
|||
tmp.Append( mS->first );
|
||||
tmp.Append( "}" );
|
||||
|
||||
if( tmp == "${KISYS3DMOD}" )
|
||||
hasKISYS3DMOD = true;
|
||||
if( tmp == "${KICAD6_3DMODEL_DIR}" )
|
||||
hasKICAD6_3DMODEL_DIR = true;
|
||||
|
||||
lpath.m_Alias = tmp;
|
||||
lpath.m_Pathvar = tmp;
|
||||
|
@ -263,14 +263,14 @@ bool S3D_RESOLVER::createPathList( void )
|
|||
++mS;
|
||||
}
|
||||
|
||||
// special case: if KISYSMOD is not internally defined but is defined by
|
||||
// special case: if KICAD6_FOOTPRINT_DIR is not internally defined but is defined by
|
||||
// the system, then create an entry here
|
||||
wxString envar;
|
||||
|
||||
if( !hasKISYS3DMOD && wxGetEnv( "KISYS3DMOD", &envar ) )
|
||||
if( !hasKICAD6_3DMODEL_DIR && wxGetEnv( "KICAD6_3DMODEL_DIR", &envar ) )
|
||||
{
|
||||
lpath.m_Alias = "${KISYS3DMOD}";
|
||||
lpath.m_Pathvar = "${KISYS3DMOD}";
|
||||
lpath.m_Alias = "${KICAD6_3DMODEL_DIR}";
|
||||
lpath.m_Pathvar = "${KICAD6_3DMODEL_DIR}";
|
||||
fndummy.Assign( envar, "" );
|
||||
fndummy.Normalize();
|
||||
|
||||
|
@ -416,8 +416,8 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
// directory, which has already been checked. This case accounts
|
||||
// for partial paths which do not contain ${KIPRJMOD}.
|
||||
// This check is performed before checking the path relative to
|
||||
// ${KISYS3DMOD} so that users can potentially override a model
|
||||
// within ${KISYS3DMOD}
|
||||
// ${KICAD6_3DMODEL_DIR} so that users can potentially override a model
|
||||
// within ${KICAD6_3DMODEL_DIR}
|
||||
if( !sPL->m_Pathexp.empty() && !tname.StartsWith( ":" ) )
|
||||
{
|
||||
tmpFN.Assign( sPL->m_Pathexp, "" );
|
||||
|
@ -438,11 +438,11 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
|
||||
}
|
||||
|
||||
// check the partial path relative to ${KISYS3DMOD} (legacy behavior)
|
||||
// check the partial path relative to ${KICAD6_3DMODEL_DIR} (legacy behavior)
|
||||
if( !tname.StartsWith( ":" ) )
|
||||
{
|
||||
wxFileName fpath;
|
||||
wxString fullPath( "${KISYS3DMOD}" );
|
||||
wxString fullPath( "${KICAD6_3DMODEL_DIR}" );
|
||||
fullPath.Append( fpath.GetPathSeparator() );
|
||||
fullPath.Append( tname );
|
||||
fullPath = expandVars( fullPath );
|
||||
|
@ -470,7 +470,7 @@ wxString S3D_RESOLVER::ResolvePath( const wxString& aFileName )
|
|||
if( !( m_errflags & ERRFLG_RELPATH ) )
|
||||
{
|
||||
// this can happen if the file was intended to be relative to
|
||||
// ${KISYS3DMOD} but ${KISYS3DMOD} not set or incorrect.
|
||||
// ${KICAD6_3DMODEL_DIR} but ${KICAD6_3DMODEL_DIR} not set or incorrect.
|
||||
m_errflags |= ERRFLG_RELPATH;
|
||||
wxString errmsg = "[3D File Resolver] No such path";
|
||||
errmsg.append( "\n" );
|
||||
|
@ -541,8 +541,8 @@ bool S3D_RESOLVER::addPath( const SEARCH_PATH& aPath )
|
|||
|
||||
if( !path.DirExists() )
|
||||
{
|
||||
// suppress the message if the missing pathvar is the legacy KISYS3DMOD variable
|
||||
if( aPath.m_Pathvar != "${KISYS3DMOD}" && aPath.m_Pathvar != "$(KISYS3DMOD)" )
|
||||
// suppress the message if the missing pathvar is the legacy KICAD6_3DMODEL_DIR variable
|
||||
if( aPath.m_Pathvar != "${KICAD6_3DMODEL_DIR}" && aPath.m_Pathvar != "$(KICAD6_3DMODEL_DIR)" )
|
||||
{
|
||||
wxString msg = _( "The given path does not exist" );
|
||||
msg.append( "\n" );
|
||||
|
@ -675,8 +675,8 @@ bool S3D_RESOLVER::readPathList( void )
|
|||
if( !getHollerith( cfgLine, idx, al.m_Alias ) )
|
||||
continue;
|
||||
|
||||
// never add on KISYS3DMOD from a config file
|
||||
if( !al.m_Alias.Cmp( "KISYS3DMOD" ) )
|
||||
// never add on KICAD6_3DMODEL_DIR from a config file
|
||||
if( !al.m_Alias.Cmp( "KICAD6_3DMODEL_DIR" ) )
|
||||
continue;
|
||||
|
||||
if( !getHollerith( cfgLine, idx, al.m_Pathvar ) )
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
/**
|
||||
* Function createPathList
|
||||
* builds the path list using available information such as
|
||||
* KISYS3DMOD and the 3d_path_list configuration file. Invalid
|
||||
* KICAD6_3DMODEL_DIR and the 3d_path_list configuration file. Invalid
|
||||
* paths are silently discarded and removed from the configuration
|
||||
* file.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue