25#ifndef OCE_VIS_OCE_UTILS_H
26#define OCE_VIS_OCE_UTILS_H
34#include <Standard_Handle.hxx>
35#include <TDF_Label.hxx>
36#include <TopoDS_Shape.hxx>
69class TDocStd_Document;
70class XCAFApp_Application;
71class XCAFDoc_ShapeTool;
74typedef std::map< std::string, TDF_Label >
MODEL_MAP;
108 bool aVia,
const VECTOR2D& aOrigin );
115 bool AddComponent(
const std::string& aFileName,
const std::string& aRefDes,
bool aBottom,
148 bool aConvertToArcs,
double aThickness,
double aZposition,
164 double aWidth,
double aThickness,
double aZposition,
169 bool WriteIGES(
const wxString& aFileName );
173 bool WriteSTEP(
const wxString& aFileName,
bool aOptimize );
176 bool WriteBREP(
const wxString& aFileName );
179 bool WriteXAO(
const wxString& aFileName );
195 bool WriteGLTF(
const wxString& aFileName );
198 bool WritePLY(
const wxString& aFileName );
201 bool WriteSTL(
const wxString& aFileName );
228 bool aSubstituteModels, wxString* aErrorMessage =
nullptr );
231 VECTOR3D aOrientation, TopLoc_Location& aLocation );
233 bool readIGES(
Handle( TDocStd_Document ) & aDoc,
const char* aFname );
234 bool readSTEP(
Handle( TDocStd_Document ) & aDoc,
const char* aFname );
235 bool readVRML(
Handle( TDocStd_Document ) & aDoc,
const char* aFname );
Manage layers needed to make a physical board.
LSET is a set of PCB_LAYER_IDs.
Represent a set of closed polygons.
OUTPUT_FORMAT m_outFmt
The current output format for created file.
void SetCopperColor(double r, double g, double b)
bool isBoardOutlineValid()
std::vector< TopoDS_Shape > m_board_silkscreen
bool CreatePCB(SHAPE_POLY_SET &aOutline, VECTOR2D aOrigin, bool aPushBoardBody)
bool MakeShapeAsThickSegment(TopoDS_Shape &aShape, VECTOR2D aStartPoint, VECTOR2D aEndPoint, double aWidth, double aThickness, double aZposition, const VECTOR2D &aOrigin)
Make a segment shape based on start and end point.
bool WritePLY(const wxString &aFileName)
std::vector< TopoDS_Shape > m_board_copper_vias
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)
wxString m_pcbName
Name of the PCB, which will most likely be the file name of the path.
std::vector< TopoDS_Shape > m_boardCutouts
std::vector< TopoDS_Shape > m_board_soldermask
void getBoardBodyZPlacement(double &aZPos, double &aThickness)
std::vector< TopoDS_Shape > m_board_copper_fused
std::vector< TopoDS_Shape > m_board_copper
void SetFuseShapes(bool aValue)
bool WriteXAO(const wxString &aFileName)
bool WriteGLTF(const wxString &aFileName)
Write the assembly in binary GLTF Format.
Handle(XCAFDoc_ShapeTool) m_assy
std::vector< TDF_Label > m_pcb_labels
bool AddHole(const SHAPE_SEGMENT &aShape, int aPlatingThickness, PCB_LAYER_ID aLayerTop, PCB_LAYER_ID aLayerBot, bool aVia, const VECTOR2D &aOrigin)
void getLayerZPlacement(const PCB_LAYER_ID aLayer, double &aZPos, double &aThickness)
bool AddBarrel(const SHAPE_SEGMENT &aShape, PCB_LAYER_ID aLayerTop, PCB_LAYER_ID aLayerBot, bool aVia, const VECTOR2D &aOrigin)
std::vector< TopoDS_Shape > m_board_outlines
void SetSimplifyShapes(bool aValue)
bool readVRML(Handle(TDocStd_Document) &aDoc, const char *aFname)
void SetPadColor(double r, double g, double b)
void SetEnabledLayers(const LSET &aLayers)
bool performMeshing(Handle(XCAFDoc_ShapeTool) &aShapeTool)
bool readSTEP(Handle(TDocStd_Document) &aDoc, const char *aFname)
Handle(TDocStd_Document) m_doc
Handle(XCAFApp_Application) m_app
void SetMaxError(int aMaxError)
bool getModelLocation(bool aBottom, VECTOR2D aPosition, double aRotation, VECTOR3D aOffset, VECTOR3D aOrientation, TopLoc_Location &aLocation)
virtual ~STEP_PCB_MODEL()
bool WriteSTL(const wxString &aFileName)
void SetStackup(const BOARD_STACKUP &aStackup)
void SetNetFilter(const wxString &aFilter)
bool AddPadShape(const PAD *aPad, const VECTOR2D &aOrigin, bool aVia)
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, or flat faces)
bool getModelLabel(const std::string &aFileNameUTF8, VECTOR3D aScale, TDF_Label &aLabel, bool aSubstituteModels, wxString *aErrorMessage=nullptr)
Load a 3D model data.
bool readIGES(Handle(TDocStd_Document) &aDoc, const char *aFname)
bool AddPolygonShapes(const SHAPE_POLY_SET *aPolyShapes, PCB_LAYER_ID aLayer, const VECTOR2D &aOrigin)
bool WriteSTEP(const wxString &aFileName, bool aOptimize)
std::vector< TopoDS_Shape > m_copperCutouts
void SpecializeVariant(OUTPUT_FORMAT aVariant)
std::vector< TopoDS_Shape > m_board_copper_pads
std::map< wxString, std::pair< gp_Pnt, TopoDS_Shape > > m_pad_points
void SetAddVisMaterials(bool aValue)
void getCopperLayerZPlacement(const PCB_LAYER_ID aLayer, double &aZPos, double &aThickness)
TDF_Label transferModel(Handle(TDocStd_Document)&source, Handle(TDocStd_Document) &dest, VECTOR3D aScale)
void OCCSetMergeMaxDistance(double aDistance=OCC_MAX_DISTANCE_TO_MERGE_POINTS)
bool WriteBREP(const wxString &aFileName)
PCB_LAYER_ID
A quick note on layer IDs:
static constexpr double COPPER_THICKNESS_DEFAULT_MM
static constexpr double OCC_MAX_DISTANCE_TO_MERGE_POINTS
Default distance between points to treat them as separate ones (mm) 0.001 mm or less is a reasonable ...
std::map< std::string, TDF_Label > MODEL_MAP
static constexpr double BOARD_THICKNESS_DEFAULT_MM
std::pair< std::string, TDF_Label > MODEL_DATUM
static constexpr double ARC_TO_SEGMENT_MAX_ERROR_MM
static constexpr double BOARD_THICKNESS_MIN_MM
void ReportMessage(const wxString &aMessage)