KiCad PCB EDA Suite
|
#include <step_pcb_model.h>
Public Member Functions | |
STEP_PCB_MODEL (const wxString &aPcbName) | |
virtual | ~STEP_PCB_MODEL () |
bool | AddPadHole (const PAD *aPad, const VECTOR2D &aOrigin) |
bool | AddPadShape (const PAD *aPad, const VECTOR2D &aOrigin, bool aVia) |
bool | AddViaShape (const PCB_VIA *aVia, const VECTOR2D &aOrigin) |
bool | AddTrackSegment (const PCB_TRACK *aTrack, const VECTOR2D &aOrigin) |
bool | AddCopperPolygonShapes (const SHAPE_POLY_SET *aPolyShapes, PCB_LAYER_ID aLayer, const VECTOR2D &aOrigin, bool aTrack) |
bool | AddComponent (const std::string &aFileName, const std::string &aRefDes, bool aBottom, VECTOR2D aPosition, double aRotation, VECTOR3D aOffset, VECTOR3D aOrientation, VECTOR3D aScale, bool aSubstituteModels=true) |
void | SetBoardColor (double r, double g, double b) |
void | SetCopperColor (double r, double g, double b) |
void | SetEnabledLayers (const LSET &aLayers) |
void | SetFuseShapes (bool aValue) |
void | SetStackup (const BOARD_STACKUP &aStackup) |
void | SetNetFilter (const wxString &aFilter) |
void | OCCSetMergeMaxDistance (double aDistance=OCC_MAX_DISTANCE_TO_MERGE_POINTS) |
void | SetMaxError (int aMaxError) |
bool | CreatePCB (SHAPE_POLY_SET &aOutline, VECTOR2D aOrigin, bool aPushBoardBody) |
bool | MakeShapes (std::vector< TopoDS_Shape > &aShapes, const SHAPE_POLY_SET &aPolySet, bool aConvertToArcs, double aThickness, double aZposition, const VECTOR2D &aOrigin) |
Convert a SHAPE_POLY_SET to TopoDS_Shape's (polygonal vertical prisms) | |
bool | MakeShapeAsCylinder (TopoDS_Shape &aShape, const SHAPE_LINE_CHAIN &aChain, double aThickness, double aZposition, const VECTOR2D &aOrigin) |
Convert a SHAPE_LINE_CHAIN containing only one 360 deg arc to a TopoDS_Shape ( vertical cylinder) it is a specialized version of MakeShape() | |
bool | MakeShapeAsThickSegment (TopoDS_Shape &aShape, VECTOR2D aStartPoint, VECTOR2D aEndPoint, double aWidth, double aThickness, double aZposition, const VECTOR2D &aOrigin) |
Convert a SHAPE_LINE_CHAIN containing only one 360 deg arc to a TopoDS_Shape ( vertical cylinder) it is a specialized version of MakeShape() | |
bool | WriteSTEP (const wxString &aFileName, bool aOptimize) |
bool | WriteBREP (const wxString &aFileName) |
bool | WriteXAO (const wxString &aFileName) |
bool | WriteGLTF (const wxString &aFileName) |
Write the assembly in binary GLTF Format. | |
Private Member Functions | |
bool | isBoardOutlineValid () |
void | getLayerZPlacement (const PCB_LAYER_ID aLayer, double &aZPos, double &aThickness) |
void | getBoardBodyZPlacement (double &aZPos, double &aThickness) |
bool | getModelLabel (const std::string &aFileNameUTF8, VECTOR3D aScale, TDF_Label &aLabel, bool aSubstituteModels, wxString *aErrorMessage=nullptr) |
Load a 3D model data. | |
bool | getModelLocation (bool aBottom, VECTOR2D aPosition, double aRotation, VECTOR3D aOffset, VECTOR3D aOrientation, TopLoc_Location &aLocation) |
bool | readIGES (Handle(TDocStd_Document)&m_doc, const char *fname) |
bool | readSTEP (Handle(TDocStd_Document)&m_doc, const char *fname) |
TDF_Label | transferModel (Handle(TDocStd_Document)&source, Handle(TDocStd_Document) &dest, VECTOR3D aScale) |
Handle (XCAFApp_Application) m_app | |
Handle (TDocStd_Document) m_doc | |
Handle (XCAFDoc_ShapeTool) m_assy | |
Private Attributes | |
TDF_Label | m_assy_label |
bool | m_hasPCB |
bool | m_fuseShapes |
int | m_platingThickness |
std::vector< TDF_Label > | m_pcb_labels |
MODEL_MAP | m_models |
int | m_components |
double | m_precision |
double | m_angleprec |
double | m_boardColor [3] |
double | m_copperColor [3] |
BOARD_STACKUP | m_stackup |
LSET | m_enabledLayers |
wxString | m_netFilter |
double | m_minx |
double | m_mergeOCCMaxDist |
std::vector< TopoDS_Shape > | m_copperCutouts |
std::vector< TopoDS_Shape > | m_boardCutouts |
std::vector< TopoDS_Shape > | m_board_outlines |
std::vector< TopoDS_Shape > | m_board_copper_zones |
std::vector< TopoDS_Shape > | m_board_copper_tracks |
std::vector< TopoDS_Shape > | m_board_copper_pads |
std::vector< TopoDS_Shape > | m_board_copper_fused |
std::map< wxString, std::pair< gp_Pnt, TopoDS_Shape > > | m_pad_points |
wxString | m_pcbName |
Name of the PCB, which will most likely be the file name of the path. | |
int | m_maxError |
Definition at line 78 of file step_pcb_model.h.
STEP_PCB_MODEL::STEP_PCB_MODEL | ( | const wxString & | aPcbName | ) |
Definition at line 423 of file step_pcb_model.cpp.
References ARC_TO_SEGMENT_MAX_ERROR_MM, m_angleprec, m_assy_label, m_components, m_fuseShapes, m_hasPCB, m_maxError, m_mergeOCCMaxDist, m_minx, m_pcbName, m_platingThickness, m_precision, EDA_IU_SCALE::mmToIU(), OCC_MAX_DISTANCE_TO_MERGE_POINTS, pcbIUScale, USER_ANGLE_PREC, and USER_PREC.
|
virtual |
Definition at line 444 of file step_pcb_model.cpp.
bool STEP_PCB_MODEL::AddComponent | ( | const std::string & | aFileName, |
const std::string & | aRefDes, | ||
bool | aBottom, | ||
VECTOR2D | aPosition, | ||
double | aRotation, | ||
VECTOR3D | aOffset, | ||
VECTOR3D | aOrientation, | ||
VECTOR3D | aScale, | ||
bool | aSubstituteModels = true |
||
) |
Definition at line 838 of file step_pcb_model.cpp.
References getModelLabel(), getModelLocation(), m_assy_label, and ReportMessage().
bool STEP_PCB_MODEL::AddCopperPolygonShapes | ( | const SHAPE_POLY_SET * | aPolyShapes, |
PCB_LAYER_ID | aLayer, | ||
const VECTOR2D & | aOrigin, | ||
bool | aTrack | ||
) |
Definition at line 759 of file step_pcb_model.cpp.
References LSET::Contains(), SHAPE_POLY_SET::FullPointCount(), getLayerZPlacement(), SHAPE_POLY_SET::IsEmpty(), LayerName(), m_board_copper_tracks, m_board_copper_zones, m_enabledLayers, MakeShapes(), and ReportMessage().
Definition at line 787 of file step_pcb_model.cpp.
References B_Cu, F_Cu, PAD::GetAttribute(), PAD::GetDrillSize(), PAD::GetEffectiveHoleShape(), getLayerZPlacement(), m_boardCutouts, m_copperCutouts, m_platingThickness, MakeShapeAsThickSegment(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddViaShape().
Definition at line 451 of file step_pcb_model.cpp.
References _, SEG::A, ARC_HIGH_DEF, SEG::B, B_Cu, LSET::Contains(), ERROR_INSIDE, F_Cu, PAD::GetAttribute(), SHAPE_CIRCLE::GetCenter(), PAD::GetDrillSize(), PAD::GetEffectiveHoleShape(), PAD::GetEffectiveShape(), PAD::GetLayerSet(), getLayerZPlacement(), PAD::GetNumber(), BOARD_ITEM::GetParentFootprint(), SHAPE_CIRCLE::GetRadius(), FOOTPRINT::GetReferenceAsString(), SHAPE_SEGMENT::GetSeg(), BOARD_CONNECTED_ITEM::GetShortNetname(), SHAPE_SEGMENT::GetWidth(), BOARD_ITEM::GetX(), BOARD_ITEM::GetY(), IsCopperLayer(), PAD::IsOnLayer(), EDA_IU_SCALE::IUTomm(), m_board_copper_pads, m_enabledLayers, m_pad_points, MakeShapeAsThickSegment(), MakeShapes(), name, pcbIUScale, ReportMessage(), LSET::Seq(), SHAPE_COMPOUND::Shapes(), SHAPE_POLY_SET::TransformToPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddViaShape().
Definition at line 679 of file step_pcb_model.cpp.
References LSET::Contains(), PCB_TRACK::GetEnd(), BOARD_ITEM::GetLayer(), getLayerZPlacement(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), m_board_copper_tracks, m_enabledLayers, and MakeShapeAsThickSegment().
Definition at line 659 of file step_pcb_model.cpp.
References AddPadHole(), AddPadShape(), dummy, PCB_VIA::GetDrillValue(), PCB_TRACK::GetStart(), and PCB_TRACK::GetWidth().
bool STEP_PCB_MODEL::CreatePCB | ( | SHAPE_POLY_SET & | aOutline, |
VECTOR2D | aOrigin, | ||
bool | aPushBoardBody | ||
) |
Definition at line 1453 of file step_pcb_model.cpp.
References _, SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::CPolygons(), cut, SHAPE_POLY_SET::FullPointCount(), getBoardBodyZPlacement(), Handle(), isBoardOutlineValid(), m_assy_label, m_board_copper_fused, m_board_copper_pads, m_board_copper_tracks, m_board_copper_zones, m_board_outlines, m_boardColor, m_boardCutouts, m_copperColor, m_copperCutouts, m_fuseShapes, m_hasPCB, m_pcb_labels, m_pcbName, MakeShapes(), SHAPE_POLY_SET::OutlineCount(), and ReportMessage().
|
private |
Definition at line 743 of file step_pcb_model.cpp.
References B_Cu, F_Cu, and getLayerZPlacement().
Referenced by CreatePCB(), and getModelLocation().
|
private |
Definition at line 701 of file step_pcb_model.cpp.
References B_Cu, BS_ITEM_TYPE_COPPER, BS_ITEM_TYPE_DIELECTRIC, F_Cu, BOARD_STACKUP_ITEM::GetBrdLayerId(), BOARD_STACKUP::GetList(), BOARD_STACKUP_ITEM::GetSublayersCount(), BOARD_STACKUP_ITEM::GetThickness(), BOARD_STACKUP_ITEM::GetType(), BOARD_STACKUP_ITEM::GetTypeName(), EDA_IU_SCALE::IUTomm(), KEY_PREPREG, m_stackup, and pcbIUScale.
Referenced by AddCopperPolygonShapes(), AddPadHole(), AddPadShape(), AddTrackSegment(), and getBoardBodyZPlacement().
|
private |
Load a 3D model data.
aFileNameUTF8 | is the filename encoded UTF8 (different formats allowed) but for WRML files a model data can be loaded instead of the vrml data, not suitable in a step file. |
aScale | is the X,Y,Z scaling factors. |
aLabel | is the TDF_Label to store the data. |
aSubstituteModels | = true to allows data substitution, false to disallow. |
aErrorMessage | (can be nullptr) is an error message to be displayed on error. |
Definition at line 2085 of file step_pcb_model.cpp.
References fileType(), FMT_IGES, FMT_STEP, FMT_STEPZ, FMT_WRL, FMT_WRZ, getModelLabel(), Handle(), m_components, m_models, readIGES(), readSTEP(), ReportMessage(), TO_UTF8, transferModel(), VECTOR3< T >::x, VECTOR3< T >::y, and VECTOR3< T >::z.
Referenced by AddComponent(), and getModelLabel().
|
private |
Definition at line 2307 of file step_pcb_model.cpp.
References BOARD_OFFSET, getBoardBodyZPlacement(), VECTOR2< T >::x, VECTOR3< T >::x, VECTOR2< T >::y, VECTOR3< T >::y, and VECTOR3< T >::z.
Referenced by AddComponent().
|
private |
|
private |
Referenced by CreatePCB(), getModelLabel(), MakeShapeAsThickSegment(), MakeShapes(), transferModel(), WriteBREP(), and WriteXAO().
|
private |
|
private |
Definition at line 940 of file step_pcb_model.cpp.
References m_pcb_labels.
Referenced by CreatePCB(), WriteBREP(), WriteGLTF(), and WriteSTEP().
bool STEP_PCB_MODEL::MakeShapeAsCylinder | ( | TopoDS_Shape & | aShape, |
const SHAPE_LINE_CHAIN & | aChain, | ||
double | aThickness, | ||
double | aZposition, | ||
const VECTOR2D & | aOrigin | ||
) |
Convert a SHAPE_LINE_CHAIN containing only one 360 deg arc to a TopoDS_Shape ( vertical cylinder) it is a specialized version of MakeShape()
aShape | is the TopoDS_Shape to initialize (must be empty) |
aChain | is a closed SHAPE_LINE_CHAIN, image of a circle: containing one 360 deg arc |
aThickness | is the height of the created cylinder |
aOrigin | is the origin of the coordinates |
Definition at line 968 of file step_pcb_model.cpp.
References SHAPE_LINE_CHAIN::CArcs(), SHAPE_ARC::GetCenter(), SHAPE_ARC::GetRadius(), SHAPE_LINE_CHAIN::IsClosed(), EDA_IU_SCALE::IUTomm(), pcbIUScale, ReportMessage(), VECTOR2< T >::x, and VECTOR2< T >::y.
bool STEP_PCB_MODEL::MakeShapeAsThickSegment | ( | TopoDS_Shape & | aShape, |
VECTOR2D | aStartPoint, | ||
VECTOR2D | aEndPoint, | ||
double | aWidth, | ||
double | aThickness, | ||
double | aZposition, | ||
const VECTOR2D & | aOrigin | ||
) |
Convert a SHAPE_LINE_CHAIN containing only one 360 deg arc to a TopoDS_Shape ( vertical cylinder) it is a specialized version of MakeShape()
aShape | is the TopoDS_Shape to initialize (must be empty) |
aStartPoint | is the start point of the segment |
aEndPoint | is the end point of the segment |
aWidth | is the width of the segment |
aThickness | is the height of the created cylinder |
aOrigin | is the origin of the coordinates |
Definition at line 1001 of file step_pcb_model.cpp.
References EuclideanNorm(), Handle(), EDA_IU_SCALE::IUTomm(), m_mergeOCCMaxDist, pcbIUScale, ReportMessage(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddPadHole(), AddPadShape(), and AddTrackSegment().
bool STEP_PCB_MODEL::MakeShapes | ( | std::vector< TopoDS_Shape > & | aShapes, |
const SHAPE_POLY_SET & | aPolySet, | ||
bool | aConvertToArcs, | ||
double | aThickness, | ||
double | aZposition, | ||
const VECTOR2D & | aOrigin | ||
) |
Convert a SHAPE_POLY_SET to TopoDS_Shape's (polygonal vertical prisms)
aShapes | is the TopoDS_Shape list to append to |
aPolySet | is a polygon set |
aConvertToArcs | set to approximate with arcs |
aThickness | is the height of the created prism |
aOrigin | is the origin of the coordinates |
Definition at line 1152 of file step_pcb_model.cpp.
References _, SEG::A, addSegment(), ANGLE_360, approximateLineChainWithArcs(), SHAPE_LINE_CHAIN::Arc(), SHAPE_LINE_CHAIN::ArcIndex(), SEG::B, SHAPE_LINE_CHAIN::CPoint(), SHAPE_POLY_SET::CPolygons(), SHAPE_LINE_CHAIN::CSegment(), formatBBox(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), Handle(), SHAPE_LINE_CHAIN::IsArcSegment(), SHAPE_LINE_CHAIN::IsArcStart(), EDA_IU_SCALE::IUTomm(), m_mergeOCCMaxDist, SHAPE_LINE_CHAIN::NextShape(), pcbIUScale, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, SHAPE_LINE_CHAIN::PointCount(), ReportMessage(), SHAPE_POLY_SET::Simplify(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddCopperPolygonShapes(), AddPadShape(), and CreatePCB().
void STEP_PCB_MODEL::OCCSetMergeMaxDistance | ( | double | aDistance = OCC_MAX_DISTANCE_TO_MERGE_POINTS | ) |
Definition at line 933 of file step_pcb_model.cpp.
References m_mergeOCCMaxDist.
|
private |
Definition at line 2370 of file step_pcb_model.cpp.
References USER_PREC.
Referenced by getModelLabel().
|
private |
Definition at line 2413 of file step_pcb_model.cpp.
References USER_PREC.
Referenced by getModelLabel().
void STEP_PCB_MODEL::SetBoardColor | ( | double | r, |
double | g, | ||
double | b | ||
) |
Definition at line 917 of file step_pcb_model.cpp.
References m_boardColor.
void STEP_PCB_MODEL::SetCopperColor | ( | double | r, |
double | g, | ||
double | b | ||
) |
Definition at line 925 of file step_pcb_model.cpp.
References m_copperColor.
void STEP_PCB_MODEL::SetEnabledLayers | ( | const LSET & | aLayers | ) |
Definition at line 893 of file step_pcb_model.cpp.
References m_enabledLayers.
void STEP_PCB_MODEL::SetFuseShapes | ( | bool | aValue | ) |
Definition at line 899 of file step_pcb_model.cpp.
References m_fuseShapes.
|
inline |
Definition at line 120 of file step_pcb_model.h.
References m_maxError.
void STEP_PCB_MODEL::SetNetFilter | ( | const wxString & | aFilter | ) |
Definition at line 911 of file step_pcb_model.cpp.
References m_netFilter.
void STEP_PCB_MODEL::SetStackup | ( | const BOARD_STACKUP & | aStackup | ) |
Definition at line 905 of file step_pcb_model.cpp.
References m_stackup.
|
private |
Definition at line 2455 of file step_pcb_model.cpp.
References Handle(), ReportMessage(), VECTOR3< T >::x, VECTOR3< T >::y, and VECTOR3< T >::z.
Referenced by getModelLabel().
bool STEP_PCB_MODEL::WriteBREP | ( | const wxString & | aFileName | ) |
Definition at line 1899 of file step_pcb_model.cpp.
References getOneShape(), Handle(), isBoardOutlineValid(), and ReportMessage().
bool STEP_PCB_MODEL::WriteGLTF | ( | const wxString & | aFileName | ) |
Write the assembly in binary GLTF Format.
We only support binary GLTF because GLTF is weird Officially, binary GLTF is actually json+binary in one file If we elected non-binary output with opecascade, it will generate that one file as two separate files, one containing json that references the binary Which is actually more annoying to deal with (to do the temp file rename, since we dont control the binary name) and silly when you can just have the one file.
aFileName | Output file path |
Definition at line 2594 of file step_pcb_model.cpp.
References KIPLATFORM::IO::DuplicatePermissions(), GetISO8601CurrentDateTime(), GetSemanticVersion(), isBoardOutlineValid(), and ReportMessage().
bool STEP_PCB_MODEL::WriteSTEP | ( | const wxString & | aFileName, |
bool | aOptimize | ||
) |
Definition at line 1820 of file step_pcb_model.cpp.
References KIPLATFORM::IO::DuplicatePermissions(), isBoardOutlineValid(), and ReportMessage().
bool STEP_PCB_MODEL::WriteXAO | ( | const wxString & | aFileName | ) |
Definition at line 1930 of file step_pcb_model.cpp.
References getOneShape(), Handle(), m_pad_points, name, and ReportMessage().
|
private |
Definition at line 243 of file step_pcb_model.h.
Referenced by STEP_PCB_MODEL().
|
private |
Definition at line 235 of file step_pcb_model.h.
Referenced by AddComponent(), CreatePCB(), and STEP_PCB_MODEL().
|
private |
Definition at line 263 of file step_pcb_model.h.
Referenced by CreatePCB().
|
private |
Definition at line 262 of file step_pcb_model.h.
Referenced by AddPadShape(), and CreatePCB().
|
private |
Definition at line 261 of file step_pcb_model.h.
Referenced by AddCopperPolygonShapes(), AddTrackSegment(), and CreatePCB().
|
private |
Definition at line 260 of file step_pcb_model.h.
Referenced by AddCopperPolygonShapes(), and CreatePCB().
|
private |
Definition at line 259 of file step_pcb_model.h.
Referenced by CreatePCB().
|
private |
Definition at line 244 of file step_pcb_model.h.
Referenced by CreatePCB(), and SetBoardColor().
|
private |
Definition at line 256 of file step_pcb_model.h.
Referenced by AddPadHole(), and CreatePCB().
|
private |
Definition at line 241 of file step_pcb_model.h.
Referenced by getModelLabel(), and STEP_PCB_MODEL().
|
private |
Definition at line 245 of file step_pcb_model.h.
Referenced by CreatePCB(), and SetCopperColor().
|
private |
Definition at line 255 of file step_pcb_model.h.
Referenced by AddPadHole(), and CreatePCB().
|
private |
Definition at line 247 of file step_pcb_model.h.
Referenced by AddCopperPolygonShapes(), AddPadShape(), AddTrackSegment(), and SetEnabledLayers().
|
private |
Definition at line 237 of file step_pcb_model.h.
Referenced by CreatePCB(), SetFuseShapes(), and STEP_PCB_MODEL().
|
private |
Definition at line 236 of file step_pcb_model.h.
Referenced by CreatePCB(), and STEP_PCB_MODEL().
|
private |
Definition at line 271 of file step_pcb_model.h.
Referenced by SetMaxError(), and STEP_PCB_MODEL().
|
private |
Definition at line 251 of file step_pcb_model.h.
Referenced by MakeShapeAsThickSegment(), MakeShapes(), OCCSetMergeMaxDistance(), and STEP_PCB_MODEL().
|
private |
Definition at line 250 of file step_pcb_model.h.
Referenced by STEP_PCB_MODEL().
|
private |
Definition at line 240 of file step_pcb_model.h.
Referenced by getModelLabel().
|
private |
Definition at line 248 of file step_pcb_model.h.
Referenced by SetNetFilter().
|
private |
Definition at line 266 of file step_pcb_model.h.
Referenced by AddPadShape(), and WriteXAO().
|
private |
Definition at line 239 of file step_pcb_model.h.
Referenced by CreatePCB(), and isBoardOutlineValid().
|
private |
Name of the PCB, which will most likely be the file name of the path.
Definition at line 269 of file step_pcb_model.h.
Referenced by CreatePCB(), and STEP_PCB_MODEL().
|
private |
Definition at line 238 of file step_pcb_model.h.
Referenced by AddPadHole(), and STEP_PCB_MODEL().
|
private |
Definition at line 242 of file step_pcb_model.h.
Referenced by STEP_PCB_MODEL().
|
private |
Definition at line 246 of file step_pcb_model.h.
Referenced by getLayerZPlacement(), and SetStackup().