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;
 
  114                    bool aVia, 
const VECTOR2D& aOrigin, 
const wxString& aNetname );
 
  118                           const VECTOR2D& aOrigin, 
const wxString& aNetname );
 
  121    bool AddComponent( 
const std::string& aFileName, 
const std::string& aRefDes, 
bool aBottom,
 
  123                       const VECTOR3D& aOrientation, 
const VECTOR3D& aScale, 
bool aSubstituteModels = 
true );
 
  151                     bool aConvertToArcs, 
double aThickness, 
double aZposition, 
const VECTOR2D& aOrigin );
 
  165                                  const VECTOR2D& aEndPoint, 
double aWidth, 
double aThickness,
 
  166                                  double aZposition, 
const VECTOR2D& aOrigin );
 
  179                            double aZposition, 
const VECTOR2D& aOrigin );
 
  183    bool WriteIGES( 
const wxString& aFileName );
 
  187    bool WriteSTEP( 
const wxString& aFileName, 
bool aOptimize, 
bool compress );
 
  190    bool WriteBREP( 
const wxString& aFileName );
 
  193    bool WriteXAO( 
const wxString& aFileName );
 
  209    bool WriteGLTF( 
const wxString& aFileName );
 
  212    bool WritePLY( 
const wxString& aFileName );
 
  215    bool WriteSTL( 
const wxString& aFileName );
 
  218    bool WriteU3D( 
const wxString& aFileName );
 
  221    bool WritePDF( 
const wxString& aFileName );
 
  247                        bool aSubstituteModels, wxString* aErrorMessage = 
nullptr );
 
  250                           const VECTOR3D& aOrientation, TopLoc_Location& aLocation );
 
  252    bool readIGES( 
Handle( TDocStd_Document ) & aDoc, 
const char* aFname );
 
  253    bool readSTEP( 
Handle( TDocStd_Document ) & aDoc, 
const char* aFname );
 
  254    bool readVRML( 
Handle( TDocStd_Document ) & aDoc, 
const char* aFname );
 
  261    bool CompressSTEP( wxString& inputFile, wxString& outputFile );
 
  305    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)
 
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 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 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 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
 
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)
 
bool getModelLabel(const std::string &aFileNameUTF8, const VECTOR3D &aScale, TDF_Label &aLabel, bool aSubstituteModels, wxString *aErrorMessage=nullptr)
Load a 3D model data.
 
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)
 
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)
 
bool AddComponent(const std::string &aFileName, const std::string &aRefDes, bool aBottom, const VECTOR2D &aPosition, double aRotation, const VECTOR3D &aOffset, const VECTOR3D &aOrientation, const VECTOR3D &aScale, bool aSubstituteModels=true)
 
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< double > VECTOR2D
 
VECTOR3< double > VECTOR3D