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_ColorTool;
72class XCAFDoc_ShapeTool;
75typedef std::map< std::string, TDF_Label >
MODEL_MAP;
115 bool aVia,
const VECTOR2D& aOrigin,
const wxString& aNetname );
147 bool aFrontSide,
const VECTOR2D& aOrigin );
165 bool aFrontSide,
const VECTOR2D& aOrigin );
181 int aAngle,
bool aFrontSide );
185 const VECTOR2D& aOrigin,
const wxString& aNetname );
188 bool AddComponent(
const wxString& aBaseName,
const wxString& aFileName,
189 const std::vector<wxString>& aAltFilenames,
const wxString& aRefDes,
220 bool aConvertToArcs,
double aThickness,
double aZposition,
const VECTOR2D& aOrigin );
234 const VECTOR2D& aEndPoint,
double aWidth,
double aThickness,
235 double aZposition,
const VECTOR2D& aOrigin );
248 double aZposition,
const VECTOR2D& aOrigin );
252 bool WriteIGES(
const wxString& aFileName );
256 bool WriteSTEP(
const wxString& aFileName,
bool aOptimize,
bool compress );
259 bool WriteBREP(
const wxString& aFileName );
262 bool WriteXAO(
const wxString& aFileName );
278 bool WriteGLTF(
const wxString& aFileName );
281 bool WritePLY(
const wxString& aFileName );
284 bool WriteSTL(
const wxString& aFileName );
287 bool WriteU3D(
const wxString& aFileName );
290 bool WritePDF(
const wxString& aFileName );
317 bool getModelLabel(
const wxString& aBaseName,
const wxString& aFileName,
318 const std::vector<wxString>& aAltFilenames,
VECTOR3D aScale,
319 TDF_Label& aLabel,
bool aSubstituteModels,
320 wxString* aErrorMessage =
nullptr );
323 const VECTOR3D& aOrientation, TopLoc_Location& aLocation );
325 bool readIGES(
Handle( TDocStd_Document ) & aDoc,
const char* aFname );
326 bool readSTEP(
Handle( TDocStd_Document ) & aDoc,
const char* aFname );
327 bool readVRML(
Handle( TDocStd_Document ) & aDoc,
const char* aFname );
342 Handle( XCAFDoc_ColorTool )& aSrcColorTool,
343 Handle( XCAFDoc_ShapeTool )& aDstShapeTool,
344 Handle( XCAFDoc_ColorTool )& aDstColorTool );
346 bool CompressSTEP( wxString& inputFile, wxString& outputFile );
391 std::map<wxString, std::vector<std::pair<gp_Pnt, TopoDS_Shape>>>
m_pad_points;
Manage layers needed to make a physical board.
LSET is a set of PCB_LAYER_IDs.
A pure virtual class used to derive REPORTER objects from.
Represent a set of closed polygons.
bool MakeShapeAsThickSegment(TopoDS_Shape &aShape, const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth, double aThickness, double aZposition, const VECTOR2D &aOrigin)
Make a segment shape based on start and end point.
OUTPUT_FORMAT m_outFmt
The current output format for created file.
void SetCopperColor(double r, double g, double b)
bool isBoardOutlineValid()
bool WritePLY(const wxString &aFileName)
bool AddCountersink(const VECTOR2I &aPosition, int aDiameter, int aDepth, int aAngle, bool aFrontSide, const VECTOR2D &aOrigin)
Add a countersink shape to remove board material from the top or bottom of a hole.
std::map< wxString, std::vector< TopoDS_Shape > > m_board_copper_vias
std::map< wxString, std::vector< TopoDS_Shape > > m_board_copper_pads
bool WriteSTEP(const wxString &aFileName, bool aOptimize, bool compress)
std::vector< TopoDS_Shape > m_board_back_mask
wxString m_pcbName
Name of the PCB, which will most likely be the file name of the path.
std::vector< TopoDS_Shape > m_boardCutouts
bool AddPolygonShapes(const SHAPE_POLY_SET *aPolyShapes, PCB_LAYER_ID aLayer, const VECTOR2D &aOrigin, const wxString &aNetname)
bool CreatePCB(SHAPE_POLY_SET &aOutline, const VECTOR2D &aOrigin, bool aPushBoardBody)
void getBoardBodyZPlacement(double &aZPos, double &aThickness)
TDF_Label transferModel(Handle(TDocStd_Document)&source, Handle(TDocStd_Document) &dest, const VECTOR3D &aScale)
bool getModelLocation(bool aBottom, const VECTOR2D &aPosition, double aRotation, const VECTOR3D &aOffset, const VECTOR3D &aOrientation, TopLoc_Location &aLocation)
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
STEP_PCB_MODEL(const wxString &aPcbName, REPORTER *aReporter)
void transferColors(Handle(XCAFDoc_ShapeTool)&aSrcShapeTool, Handle(XCAFDoc_ColorTool)&aSrcColorTool, Handle(XCAFDoc_ShapeTool)&aDstShapeTool, Handle(XCAFDoc_ColorTool)&aDstColorTool)
Transfer color information from source document to destination document.
bool AddBackdrill(const SHAPE_SEGMENT &aShape, PCB_LAYER_ID aLayerStart, PCB_LAYER_ID aLayerEnd, const VECTOR2D &aOrigin)
Add a backdrill hole shape to remove board material and copper plating.
void getLayerZPlacement(PCB_LAYER_ID aLayer, double &aZPos, double &aThickness)
std::vector< TopoDS_Shape > m_board_outlines
void SetSimplifyShapes(bool aValue)
bool WriteU3D(const wxString &aFileName)
bool getModelLabel(const wxString &aBaseName, const wxString &aFileName, const std::vector< wxString > &aAltFilenames, VECTOR3D aScale, TDF_Label &aLabel, bool aSubstituteModels, wxString *aErrorMessage=nullptr)
Load a 3D model data.
bool readVRML(Handle(TDocStd_Document) &aDoc, const char *aFname)
void SetPadColor(double r, double g, double b)
bool AddCounterbore(const VECTOR2I &aPosition, int aDiameter, int aDepth, bool aFrontSide, const VECTOR2D &aOrigin)
Add a counterbore shape to remove board material from the top or bottom of a hole.
void SetEnabledLayers(const LSET &aLayers)
void SetExtraPadThickness(bool aValue)
bool performMeshing(Handle(XCAFDoc_ShapeTool) &aShapeTool)
bool MakePolygonAsWall(TopoDS_Shape &aShape, SHAPE_POLY_SET &aPolySet, double aHeight, double aZposition, const VECTOR2D &aOrigin)
Make a polygonal shape to create a vertical wall.
bool readSTEP(Handle(TDocStd_Document) &aDoc, const char *aFname)
Handle(TDocStd_Document) m_doc
std::vector< TopoDS_Shape > m_board_front_silk
Handle(XCAFApp_Application) m_app
bool WritePDF(const wxString &aFileName)
virtual ~STEP_PCB_MODEL()
std::vector< TopoDS_Shape > m_board_front_mask
bool WriteSTL(const wxString &aFileName)
void SetStackup(const BOARD_STACKUP &aStackup)
void SetNetFilter(const wxString &aFilter)
std::map< wxString, std::vector< TopoDS_Shape > > m_board_copper
std::map< PCB_LAYER_ID, int > GetCopperLayerKnockouts(int aDiameter, int aDepth, int aAngle, bool aFrontSide)
Get the knockout diameters for copper layers that a counterbore or countersink crosses.
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 AddBarrel(const SHAPE_SEGMENT &aShape, PCB_LAYER_ID aLayerTop, PCB_LAYER_ID aLayerBot, bool aVia, const VECTOR2D &aOrigin, const wxString &aNetname)
bool readIGES(Handle(TDocStd_Document) &aDoc, const char *aFname)
bool AddHole(const SHAPE_SEGMENT &aShape, int aPlatingThickness, PCB_LAYER_ID aLayerTop, PCB_LAYER_ID aLayerBot, bool aVia, const VECTOR2D &aOrigin, bool aCutCopper, bool aCutBody)
std::vector< TopoDS_Shape > m_copperCutouts
void SpecializeVariant(OUTPUT_FORMAT aVariant)
bool CompressSTEP(wxString &inputFile, wxString &outputFile)
std::vector< TopoDS_Shape > m_board_back_silk
void getCopperLayerZPlacement(PCB_LAYER_ID aLayer, double &aZPos, double &aThickness)
bool AddComponent(const wxString &aBaseName, const wxString &aFileName, const std::vector< wxString > &aAltFilenames, const wxString &aRefDes, bool aBottom, VECTOR2D aPosition, double aRotation, VECTOR3D aOffset, VECTOR3D aOrientation, VECTOR3D aScale, bool aSubstituteModels=true)
std::map< wxString, std::vector< std::pair< gp_Pnt, TopoDS_Shape > > > m_pad_points
bool AddPadShape(const PAD *aPad, const VECTOR2D &aOrigin, bool aVia, SHAPE_POLY_SET *aClipPolygon=nullptr)
std::map< wxString, std::vector< TopoDS_Shape > > m_board_copper_fused
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
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
VECTOR3< double > VECTOR3D