KiCad PCB EDA Suite
Loading...
Searching...
No Matches
MODEL_SUBSTITUTION::STEP_CATALOG Class Reference

An index of STEP-family model files keyed by normalised filename stem. More...

#include <model_substitution_helpers.h>

Public Member Functions

void Build (const wxString &aProjectPath, const FILENAME_RESOLVER *aResolver)
 Walk the resolver's search paths, the project's 3dshapes/ subdirectory, and the user's COMMON_SETTINGS::m_Extra3DSearchDirs collecting every STEP-family file (.step, .stp, .stpz, .step.gz, .stp.gz, .iges, .igs) indexed by normalised stem.
 
wxString FindMatchFor (const wxString &aMissingWrl) const
 Look up the best STEP-family replacement for a missing WRL reference.
 
bool Empty () const
 

Private Attributes

std::unordered_map< wxString, std::vector< wxString > > m_byStem
 Normalised stem → list of absolute STEP-family paths sharing that stem.
 

Detailed Description

An index of STEP-family model files keyed by normalised filename stem.

The catalog is built by walking the 3D search paths once and is then consulted many times to resolve missing WRL references without re-walking the filesystem per lookup.

Definition at line 52 of file model_substitution_helpers.h.

Member Function Documentation

◆ Build()

void MODEL_SUBSTITUTION::STEP_CATALOG::Build ( const wxString & aProjectPath,
const FILENAME_RESOLVER * aResolver )

Walk the resolver's search paths, the project's 3dshapes/ subdirectory, and the user's COMMON_SETTINGS::m_Extra3DSearchDirs collecting every STEP-family file (.step, .stp, .stpz, .step.gz, .stp.gz, .iges, .igs) indexed by normalised stem.

Safe to call multiple times; each call rebuilds the index.

Parameters
aProjectPathis the project directory used to locate a local 3dshapes/ tree; may be empty.
aResolverprovides the list of standard search paths. May be null, in which case only the project path and common settings extra directories are scanned.

Definition at line 196 of file model_substitution_helpers.cpp.

References m_byStem.

Referenced by DIALOG_MIGRATE_3D_MODELS::AutoMigrateByFilename().

◆ Empty()

bool MODEL_SUBSTITUTION::STEP_CATALOG::Empty ( ) const
inline

Definition at line 83 of file model_substitution_helpers.h.

References m_byStem.

◆ FindMatchFor()

wxString MODEL_SUBSTITUTION::STEP_CATALOG::FindMatchFor ( const wxString & aMissingWrl) const

Look up the best STEP-family replacement for a missing WRL reference.

When multiple catalog entries share the same stem, prefer one whose parent-directory basename matches the parent directory of aMissingWrl (e.g. both sit in Resistor_SMD.3dshapes).

Parameters
aMissingWrlis the original (unresolved) .wrl / .wrz filename, possibly with ${VAR} aliases intact.
Returns
absolute path of the best match, or empty if none found or the input is not a WRL reference.

Definition at line 221 of file model_substitution_helpers.cpp.

References MODEL_SUBSTITUTION::IsWrlExtension(), and m_byStem.

Referenced by DIALOG_MIGRATE_3D_MODELS::AutoMigrateByFilename().

Member Data Documentation

◆ m_byStem

std::unordered_map<wxString, std::vector<wxString> > MODEL_SUBSTITUTION::STEP_CATALOG::m_byStem
private

Normalised stem → list of absolute STEP-family paths sharing that stem.

Definition at line 87 of file model_substitution_helpers.h.

Referenced by Build(), Empty(), and FindMatchFor().


The documentation for this class was generated from the following files: