KiCad PCB EDA Suite
Loading...
Searching...
No Matches
step_pcb_model.cpp File Reference
#include <algorithm>
#include <cmath>
#include <sstream>
#include <string>
#include <utility>
#include <wx/filename.h>
#include <wx/filefn.h>
#include <wx/stdpaths.h>
#include <wx/wfstream.h>
#include <wx/zipstrm.h>
#include <wx/stdstream.h>
#include <decompress.hpp>
#include <footprint.h>
#include <pad.h>
#include <pcb_track.h>
#include <kiplatform/io.h>
#include <string_utils.h>
#include <build_version.h>
#include <geometry/shape_segment.h>
#include <geometry/shape_circle.h>
#include <board_stackup_manager/board_stackup.h>
#include <board_stackup_manager/stackup_predefined_prms.h>
#include "step_pcb_model.h"
#include "streamwrapper.h"
#include <IGESCAFControl_Reader.hxx>
#include <IGESCAFControl_Writer.hxx>
#include <IGESControl_Controller.hxx>
#include <IGESData_GlobalSection.hxx>
#include <IGESData_IGESModel.hxx>
#include <Interface_Static.hxx>
#include <Quantity_Color.hxx>
#include <STEPCAFControl_Reader.hxx>
#include <STEPCAFControl_Writer.hxx>
#include <APIHeaderSection_MakeHeader.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Version.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TDocStd_Document.hxx>
#include <TDocStd_XLinkTool.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDF_LabelSequence.hxx>
#include <TDF_Tool.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <XCAFApp_Application.hxx>
#include <XCAFDoc.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_VisMaterialTool.hxx>
#include <XCAFDoc_Area.hxx>
#include <XCAFDoc_Centroid.hxx>
#include <XCAFDoc_Location.hxx>
#include <XCAFDoc_Volume.hxx>
#include "KI_XCAFDoc_AssemblyGraph.hxx"
#include <BRep_Tool.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRepBuilderAPI_GTransform.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepTools.hxx>
#include <BRepLib_MakeWire.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgoAPI_Check.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <BRepBndLib.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <GProp_GProps.hxx>
#include <BRepGProp.hxx>
#include <Geom_Curve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <gp_Ax2.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeCircle.hxx>
#include <RWGltf_CafWriter.hxx>
#include <StlAPI_Writer.hxx>
#include <macros.h>

Go to the source code of this file.

Macros

#define APPROX_DBG(stmt)
 

Enumerations

enum  MODEL3D_FORMAT_TYPE {
  FMT_NONE , FMT_STEP , FMT_STEPZ , FMT_IGES ,
  FMT_EMN , FMT_IDF , FMT_WRL , FMT_WRZ
}
 

Functions

MODEL3D_FORMAT_TYPE fileType (const char *aFileName)
 
static VECTOR2D CircleCenterFrom3Points (const VECTOR2D &p1, const VECTOR2D &p2, const VECTOR2D &p3)
 
static SHAPE_LINE_CHAIN approximateLineChainWithArcs (const SHAPE_LINE_CHAIN &aSrc)
 
static TopoDS_Shape getOneShape (Handle(XCAFDoc_ShapeTool) aShapeTool)
 
static Standard_Boolean rescaleShapes (const TDF_Label &theLabel, const gp_XYZ &aScale)
 
static bool fuseShapes (auto &aInputShapes, TopoDS_Shape &aOutShape)
 
static TopoDS_Compound makeCompound (auto &aInputShapes)
 
static TopoDS_Shape fuseShapesOrCompound (TopTools_ListOfShape &aInputShapes)
 
static Standard_Boolean prefixNames (const TDF_Label &aLabel, const TCollection_ExtendedString &aPrefix)
 
static wxString formatBBox (const BOX2I &aBBox)
 
static bool makeWireFromChain (BRepLib_MakeWire &aMkWire, const SHAPE_LINE_CHAIN &aChain, double aMergeOCCMaxDist, double aZposition, const VECTOR2D &aOrigin)
 
static bool colorFromStackup (BOARD_STACKUP_ITEM_TYPE aType, const wxString &aColorStr, COLOR4D &aColorOut)
 

Variables

static constexpr double USER_PREC = 1e-4
 
static constexpr double USER_ANGLE_PREC = 1e-6
 
static constexpr double BOARD_OFFSET = 0.05
 
static std::vector< FAB_LAYER_COLORs_soldermaskColors
 

Macro Definition Documentation

◆ APPROX_DBG

#define APPROX_DBG (   stmt)

Definition at line 260 of file step_pcb_model.cpp.

Enumeration Type Documentation

◆ MODEL3D_FORMAT_TYPE

Enumerator
FMT_NONE 
FMT_STEP 
FMT_STEPZ 
FMT_IGES 
FMT_EMN 
FMT_IDF 
FMT_WRL 
FMT_WRZ 

Definition at line 136 of file step_pcb_model.cpp.

Function Documentation

◆ approximateLineChainWithArcs()

◆ CircleCenterFrom3Points()

static VECTOR2D CircleCenterFrom3Points ( const VECTOR2D p1,
const VECTOR2D p2,
const VECTOR2D p3 
)
static

Definition at line 238 of file step_pcb_model.cpp.

References VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by approximateLineChainWithArcs(), and CalcArcCenter().

◆ colorFromStackup()

static bool colorFromStackup ( BOARD_STACKUP_ITEM_TYPE  aType,
const wxString &  aColorStr,
COLOR4D aColorOut 
)
static

◆ fileType()

◆ formatBBox()

static wxString formatBBox ( const BOX2I aBBox)
static

◆ fuseShapes()

static bool fuseShapes ( auto &  aInputShapes,
TopoDS_Shape &  aOutShape 
)
static

Definition at line 625 of file step_pcb_model.cpp.

References _, and ReportMessage().

Referenced by fuseShapesOrCompound().

◆ fuseShapesOrCompound()

static TopoDS_Shape fuseShapesOrCompound ( TopTools_ListOfShape &  aInputShapes)
static

Definition at line 705 of file step_pcb_model.cpp.

References fuseShapes(), and makeCompound().

Referenced by STEP_PCB_MODEL::AddPadShape(), and STEP_PCB_MODEL::CreatePCB().

◆ getOneShape()

static TopoDS_Shape getOneShape ( Handle(XCAFDoc_ShapeTool)  aShapeTool)
static

◆ makeCompound()

static TopoDS_Compound makeCompound ( auto &  aInputShapes)
static

Definition at line 691 of file step_pcb_model.cpp.

Referenced by STEP_PCB_MODEL::CreatePCB(), and fuseShapesOrCompound().

◆ makeWireFromChain()

◆ prefixNames()

static Standard_Boolean prefixNames ( const TDF_Label &  aLabel,
const TCollection_ExtendedString &  aPrefix 
)
static

Definition at line 720 of file step_pcb_model.cpp.

References name.

Referenced by STEP_PCB_MODEL::getModelLabel().

◆ rescaleShapes()

static Standard_Boolean rescaleShapes ( const TDF_Label &  theLabel,
const gp_XYZ &  aScale 
)
static

Definition at line 520 of file step_pcb_model.cpp.

Referenced by STEP_PCB_MODEL::transferModel().

Variable Documentation

◆ BOARD_OFFSET

constexpr double BOARD_OFFSET = 0.05
staticconstexpr

Definition at line 133 of file step_pcb_model.cpp.

Referenced by STEP_PCB_MODEL::getModelLocation().

◆ s_soldermaskColors

std::vector<FAB_LAYER_COLOR> s_soldermaskColors
static
Initial value:
= {
{ NotSpecifiedPrm(), wxColor( 20, 51, 36 ) },
{ _HKI( "Green" ), wxColor( 20, 51, 36 ) },
{ _HKI( "Red" ), wxColor( 181, 19, 21 ) },
{ _HKI( "Blue" ), wxColor( 2, 59, 162 ) },
{ _HKI( "Purple" ), wxColor( 32, 2, 53 ) },
{ _HKI( "Black" ), wxColor( 11, 11, 11 ) },
{ _HKI( "White" ), wxColor( 245, 245, 245 ) },
{ _HKI( "Yellow" ), wxColor( 194, 195, 0 ) },
{ _HKI( "User defined" ), wxColor( 128, 128, 128 ) }
}
#define _HKI(x)
wxString NotSpecifiedPrm()

Definition at line 1748 of file step_pcb_model.cpp.

Referenced by colorFromStackup().

◆ USER_ANGLE_PREC

constexpr double USER_ANGLE_PREC = 1e-6
staticconstexpr

Definition at line 130 of file step_pcb_model.cpp.

Referenced by STEP_PCB_MODEL::STEP_PCB_MODEL().

◆ USER_PREC

constexpr double USER_PREC = 1e-4
staticconstexpr

Definition at line 129 of file step_pcb_model.cpp.