38#include <Message_PrinterOStream.hxx>
39#include <Standard_Failure.hxx>
41#include <Standard_Version.hxx>
45#define OCC_VERSION_MIN 0x070500
47#if OCC_VERSION_HEX < OCC_VERSION_MIN
48#include <Message_Messenger.hxx>
51#define DEFAULT_BOARD_THICKNESS 1.6
65#if OCC_VERSION_HEX < OCC_VERSION_MIN
66 virtual void Send(
const TCollection_ExtendedString& theString,
67 const Message_Gravity theGravity,
68 const Standard_Boolean theToPutEol )
const override
70 Send( TCollection_AsciiString( theString ), theGravity, theToPutEol );
73 virtual void Send(
const TCollection_AsciiString& theString,
74 const Message_Gravity theGravity,
75 const Standard_Boolean theToPutEol )
const override
77 virtual void send(
const TCollection_AsciiString& theString,
78 const Message_Gravity theGravity )
const override
81 if( theGravity >= Message_Warning
82 || ( wxLog::IsAllowedTraceMask(
traceKiCad2Step ) && theGravity == Message_Info ) )
86#if OCC_VERSION_HEX < OCC_VERSION_MIN
94 if( theGravity == Message_Warning )
97 if( theGravity >= Message_Alarm )
100 if( theGravity == Message_Fail )
114 m_hasDrillOrigin( false ),
115 m_hasGridOrigin( false ),
117 m_pcbModel( nullptr ),
124 m_resolver = std::make_unique<FILENAME_RESOLVER>();
137 bool hasdata =
false;
147 wxString footprintBasePath = wxEmptyString;
161 footprintBasePath = fpRow->
GetFullURI(
true );
186 if( !fp_model.m_Show || fp_model.m_Filename.empty() )
190 std::vector<wxString> searchedPaths;
191 wxString mname =
m_resolver->ResolvePath( fp_model.m_Filename, wxEmptyString );
194 if( !wxFileName::FileExists( mname ) )
197 "File not found: %s\n" ),
202 std::string fname( mname.ToUTF8() );
203 std::string refName( aFootprint->
GetReference().ToUTF8() );
209 VECTOR3D modelRot = fp_model.m_Rotation;
213 if(
m_pcbModel->AddComponent( fname, refName, bottomSide,
216 fp_model.m_Offset, modelRot,
222 catch(
const Standard_Failure& e )
225 "OpenCASCADE error: %s\n" ),
244 wxLogWarning(
_(
"Board outline is malformed. Run DRC for a full analysis." ) );
274 if( !
m_pcbModel->CreatePCB( pcbOutlines, origin ) )
276 ReportMessage( wxT(
"could not create PCB solid model\n" ) );
296 switch( item->GetType() )
299 thickness += item->GetThickness();
303 if( item->IsEnabled() )
304 thickness += item->GetThickness();
321 Message::DefaultMessenger()->RemovePrinters( STANDARD_TYPE( Message_PrinterOStream ) );
322 Message::DefaultMessenger()->AddPrinter(
new KiCadPrinter(
this ) );
333 ReportMessage(
_(
"\n** Error building STEP board model. Export aborted. **\n" ) );
349 catch(
const Standard_Failure& e )
352 ReportMessage(
_(
"\n** Error exporting STEP file. Export aborted. **\n" ) );
357 ReportMessage(
_(
"\n** Error exporting STEP file. Export aborted. **\n" ) );
367 msg =
_(
"Unable to create STEP file.\n"
368 "Check that the board has a valid outline and models." );
372 msg =
_(
"STEP file has been created, but there are warnings." );
constexpr EDA_IU_SCALE pcbIUScale
@ BS_ITEM_TYPE_DIELECTRIC
Container for design settings for a BOARD object.
const VECTOR2I & GetGridOrigin()
const VECTOR2I & GetAuxOrigin()
BOARD_STACKUP & GetStackupDescriptor()
Manage one layer needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
Information pertinent to a Pcbnew printed circuit board.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
FOOTPRINTS & Footprints()
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
bool m_includeExcludedBom
KIGFX::COLOR4D m_solderMaskColor
EXPORTER_STEP_PARAMS m_params
EXPORTER_STEP(BOARD *aBoard, const EXPORTER_STEP_PARAMS &aParams)
std::unique_ptr< FILENAME_RESOLVER > m_resolver
std::unique_ptr< STEP_PCB_MODEL > m_pcbModel
void determinePcbThickness()
Hold a record identifying a library accessed by the appropriate footprint library PLUGIN object in th...
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
A color representation with 4 components: red, green, blue, alpha.
EXPORTER_STEP * m_converter
KiCadPrinter(EXPORTER_STEP *aConverter)
virtual void Send(const TCollection_ExtendedString &theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const override
virtual void Send(const TCollection_AsciiString &theString, const Message_Gravity theGravity, const Standard_Boolean theToPutEol) const override
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Represent a set of closed polygons.
#define DEFAULT_BOARD_THICKNESS
void ReportMessage(const wxString &aMessage)
const wxChar *const traceKiCad2Step
Flag to enable KiCad2Step debug tracing.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
static constexpr double STEPEXPORT_MIN_DISTANCE
< Default minimum distance between points to treat them as separate ones (mm)
static constexpr double STEPEXPORT_MIN_ACCEPTABLE_DISTANCE
constexpr double IUTomm(int iu) const
wxLogTrace helper definitions.