29#include <wx/wfstream.h>
30#include <wx/zstream.h>
46#include "vrml_layer.h"
62 double aMMtoWRMLunit,
bool aIncludeUnspecified,
bool aIncludeDNP,
63 bool aExport3DFiles,
bool aUseRelativePaths,
const wxString& a3D_Subdir,
64 double aXRef,
double aYRef )
66 return pcb_exporter->ExportVRML_File( aProject, aMessages, aFullFileName, aMMtoWRMLunit, aIncludeUnspecified,
67 aIncludeDNP, aExport3DFiles, aUseRelativePaths, a3D_Subdir, aXRef, aYRef );
78#define ERR_APPROX_MAX_MM 0.005
125 COLOR4D boardBody( 0, 0, 0, 0 );
131 [](
const wxString& aColorName,
const std::vector<CUSTOM_COLOR_ITEM>& aColorSet ) ->
const KIGFX::COLOR4D
133 if( aColorName.StartsWith( wxT(
"#" ) ) )
141 if( color.m_ColorName == aColorName )
142 return color.m_Color;
151 wxString colorName = stackupItem->GetColor();
153 switch( stackupItem->GetType() )
156 if( stackupItem->GetBrdLayerId() ==
F_SilkS )
163 if( stackupItem->GetBrdLayerId() ==
F_Mask )
174 if( boardBody ==
COLOR4D( 0, 0, 0, 0 ) )
175 boardBody = layerColor;
177 boardBody = boardBody.
Mix( layerColor, 1.0 - layerColor.
a );
179 boardBody.
a += ( 1.0 - boardBody.
a ) * layerColor.
a / 2;
188 if( boardBody ==
COLOR4D( 0, 0, 0, 0 ) )
193 if( finishName.EndsWith( wxT(
"OSP" ) ) )
197 else if( finishName.EndsWith( wxT(
"IG" ) )
198 || finishName.EndsWith( wxT(
"gold" ) ) )
202 else if( finishName.StartsWith( wxT(
"HAL" ) )
203 || finishName.StartsWith( wxT(
"HASL" ) )
204 || finishName.EndsWith( wxT(
"tin" ) )
205 || finishName.EndsWith( wxT(
"nickel" ) ) )
209 else if( finishName.EndsWith( wxT(
"silver" ) ) )
215 [](
const COLOR4D& aColor,
double aSpecular,
double aAmbient,
double aShiny )
221 spec.
r, spec.
g, spec.
b,
222 aAmbient, 1.0 - aColor.
a, aShiny );
270#define ADD_COLOR( list, r, g, b, a, name ) \
271 list.emplace_back( r/255.0, g/255.0, b/255.0, a, name )
332 if( aWorldScale < 0.001 || aWorldScale > 10.0 )
333 throw( std::runtime_error(
"WorldScale out of range (valid range is 0.001 to 10.0)" ) );
347 m_holes.SetVertexOffsets( aXoff, aYoff );
375 default:
return false;
388 for(
int lcnt = 0; lcnt < 2; lcnt++ )
393 m_board->ConvertBrdLayerToPolygonalContours( pcb_layer, holes );
414 VRML_LAYER* vrmllayer[] =
420 for(
int lcnt = 0; ; lcnt++ )
422 if( vrmllayer[lcnt] ==
nullptr )
426 m_board->ConvertBrdLayerToPolygonalContours( pcb_layer[lcnt], outlines );
436 VRML_LAYER* aLayer,
bool aPlane,
bool aTop,
437 double aTop_z,
double aBottom_z )
440 static const char* shape_boiler[] =
447 " appearance Appearance {\n",
448 " material Material {\n",
452 " geometry IndexedFaceSet {\n",
454 " coord Coordinate {\n",
471 int marker_found = 0, lineno = 0;
473 while( marker_found < 4 )
475 if( shape_boiler[lineno] )
477 aOut_file << shape_boiler[lineno];
483 switch( marker_found )
487 std::streamsize lastPrecision = aOut_file.precision();
488 aOut_file <<
" diffuseColor " << std::setprecision(3);
493 aOut_file <<
" specularColor ";
494 aOut_file << aColor.
spec_red <<
" ";
495 aOut_file << aColor.
spec_grn <<
" ";
496 aOut_file << aColor.
spec_blu <<
"\n";
498 aOut_file <<
" emissiveColor ";
499 aOut_file << aColor.
emit_red <<
" ";
500 aOut_file << aColor.
emit_grn <<
" ";
501 aOut_file << aColor.
emit_blu <<
"\n";
503 aOut_file <<
" ambientIntensity " << aColor.
ambient <<
"\n";
504 aOut_file <<
" transparency " << aColor.
transp <<
"\n";
505 aOut_file <<
" shininess " << aColor.
shiny <<
"\n";
506 aOut_file.precision( lastPrecision );
513 aLayer->WriteVertices( aTop_z, aOut_file,
m_precision );
515 aLayer->Write3DVertices( aTop_z, aBottom_z, aOut_file,
m_precision );
523 aLayer->WriteIndices( aTop, aOut_file );
525 aLayer->Write3DIndices( aOut_file );
717 int copper_layers =
m_board->GetCopperLayerCount();
724 int orderFromTop = 0;
754 for(
int icnt = 0; icnt < aOutlines.
OutlineCount(); icnt++ )
758 int seg = aVlayer->NewContour();
760 for(
int jj = 0; jj < outline.
PointCount(); jj++ )
764 throw( std::runtime_error( aVlayer->GetError() ) );
767 aVlayer->EnsureWinding( seg,
false );
776 wxLogWarning(
_(
"Board outline is malformed. Run DRC for a full analysis." ) );
781 for(
int cnt = 0; cnt <
m_pcbOutlines.OutlineCount(); cnt++ )
787 for(
int j = 0; j < outline.
PointCount(); j++ )
805 wxLogError(
_(
"VRML Export Failed: Could not add holes to contours." ) );
815 m_holes.EnsureWinding( seg,
true );
833 via->LayerPair( &top_layer, &bottom_layer );
836 if( top_layer !=
F_Cu && bottom_layer !=
B_Cu )
842 if( hole_radius <= 0 )
859 double minSegLength =
M_PI * 2.0 * hole_radius / nsides;
860 double maxSegLength = minSegLength*2.0;
862 m_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
863 m_plated_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
865 m_holes.AddCircle( x, -y, hole_radius,
true,
true );
878 double hole_drill = std::min( hole_drill_w, hole_drill_h );
892 double minSegLength =
M_PI * hole_drill / nsides;
893 double maxSegLength = minSegLength*2.0;
895 m_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
896 m_plated_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
914 hole_drill_w * 2.0, hole_drill_h * 2.0,
919 m_holes.AddSlot( hole_x, -hole_y, hole_drill_w * 2.0, hole_drill_h * 2.0,
930 m_plated_holes.AddCircle( hole_x, -hole_y, hole_drill,
true,
false );
934 m_holes.AddCircle( hole_x, -hole_y, hole_drill,
true,
false );
946static void build_quat(
double x,
double y,
double z,
double a,
double q[4] )
948 double sina = sin( a / 2 );
960 rot[3] = acos( q[3] ) * 2;
962 for(
int i = 0; i < 3; i++ )
963 rot[i] = q[i] / sin( rot[3] / 2 );
972 tmp[0] = q2[3] * q1[0] + q2[0] * q1[3] + q2[1] * q1[2] - q2[2] * q1[1];
973 tmp[1] = q2[3] * q1[1] + q2[1] * q1[3] + q2[2] * q1[0] - q2[0] * q1[2];
974 tmp[2] = q2[3] * q1[2] + q2[2] * q1[3] + q2[0] * q1[1] - q2[1] * q1[0];
975 tmp[3] = q2[3] * q1[3] - q2[0] * q1[0] - q2[1] * q1[1] - q2[2] * q1[2];
991 wxCHECK( aFootprint, );
994 wxString footprintBasePath = wxEmptyString;
998 std::optional<LIBRARY_TABLE_ROW*> fpRow =
1019 std::vector<const EMBEDDED_FILES*> embeddedFilesStack;
1023 auto sM = aFootprint->
Models().begin();
1024 auto eM = aFootprint->
Models().end();
1035 embeddedFilesStack.clear();
1037 embeddedFilesStack.push_back(
m_board->GetEmbeddedFiles() );
1040 std::move( embeddedFilesStack ) );
1047 double rotx = -sM->m_Rotation.x;
1048 double roty = -sM->m_Rotation.y;
1049 double rotz = -sM->m_Rotation.z;
1059 double q1[4], q2[4], rot[4];
1072 double offsetFactor = 1000.0f *
pcbIUScale.IU_PER_MILS / 25.4f;
1076 double offsetx = sM->m_Offset.x * offsetFactor;
1077 double offsety = sM->m_Offset.y * offsetFactor;
1078 double offsetz = sM->m_Offset.z * offsetFactor;
1094 wxCHECK( aOutputFile, );
1096 int old_precision = aOutputFile->precision();
1099 embeddedFilesStack.clear();
1101 embeddedFilesStack.push_back(
m_board->GetEmbeddedFiles() );
1103 wxFileName srcFile =
m_Cache3Dmodels->GetResolver()->ResolvePath( sM->m_Filename, footprintBasePath,
1104 std::move( embeddedFilesStack ) );
1105 if( !srcFile.FileExists() ) {
1113 dstFile.SetName( srcFile.GetName() );
1114 dstFile.SetExt( wxT(
"wrl" ) );
1117 wxDateTime srcModTime = srcFile.GetModificationTime();
1118 wxDateTime destModTime = wxDateTime();
1120 if( dstFile.FileExists() )
1121 destModTime = dstFile.GetModificationTime();
1123 if( srcModTime != destModTime )
1125 wxString fileExt = srcFile.GetExt();
1126 fileExt.LowerCase();
1130 if( fileExt == wxT(
"wrl" ) )
1132 if( !wxCopyFile( srcFile.GetFullPath(), dstFile.GetFullPath() ) )
1138 else if( fileExt == wxT(
"wrz" ) )
1140 wxFileInputStream input_file_stream( srcFile.GetFullPath() );
1141 if( !input_file_stream.IsOk() || input_file_stream.GetSize() == wxInvalidSize )
1147 wxZlibInputStream zlib_input_stream( input_file_stream, wxZLIB_GZIP );
1148 wxFFileOutputStream output_file_stream( dstFile.GetFullPath() );
1149 if( !zlib_input_stream.IsOk() || !output_file_stream.IsOk() )
1151 output_file_stream.Close();
1156 output_file_stream.Write( zlib_input_stream );
1157 output_file_stream.Close();
1162 if( (
nullptr == mod3d) ||
1172 (*aOutputFile) <<
"Transform {\n";
1175 if(
std::abs( rot[3] ) > 0.0001745 )
1177 (*aOutputFile) <<
" rotation ";
1178 (*aOutputFile) << rot[0] <<
" " << rot[1] <<
" " << rot[2] <<
" " << rot[3] <<
"\n";
1181 (*aOutputFile) <<
" translation ";
1182 (*aOutputFile) << trans.
x <<
" ";
1183 (*aOutputFile) << trans.
y <<
" ";
1184 (*aOutputFile) << trans.
z <<
"\n";
1186 (*aOutputFile) <<
" scale ";
1187 (*aOutputFile) << sM->m_Scale.x <<
" ";
1188 (*aOutputFile) << sM->m_Scale.y <<
" ";
1189 (*aOutputFile) << sM->m_Scale.z <<
"\n";
1191 (*aOutputFile) <<
" children [\n Inline {\n url \"";
1195 wxFileName tmp = dstFile;
1196 tmp.SetExt( wxT(
"" ) );
1197 tmp.SetName( wxT(
"" ) );
1198 tmp.RemoveLastDir();
1199 dstFile.MakeRelativeTo( tmp.GetPath() );
1202 wxString fn = dstFile.GetFullPath();
1203 fn.Replace( wxT(
"\\" ), wxT(
"/" ) );
1204 (*aOutputFile) <<
TO_UTF8( fn ) <<
"\"\n } ]\n";
1205 (*aOutputFile) <<
" }\n";
1207 aOutputFile->precision( old_precision );
1211 if(
nullptr == mod3d )
1221 if(
std::abs( rot[3] ) > 0.0001745 )
1225 modelShape.
SetScale(
SGPOINT( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z ) );
1246 const wxString& aFullFileName,
double aMMtoWRMLunit,
1247 bool aIncludeUnspecified,
bool aIncludeDNP,
1248 bool aExport3DFiles,
bool aUseRelativePaths,
1249 const wxString& a3D_Subdir,
1250 double aXRef,
double aYRef )
1252 if( aProject ==
nullptr )
1255 *aMessages =
_(
"No project when exporting the VRML file");
1263 wxFileName subdir( a3D_Subdir, wxT(
"" ) );
1265 m_Subdir3DFpModels = subdir.GetAbsolutePath( wxFileName( aFullFileName ).GetPath() );
1279 SetOffset( -aXRef / 2.54, aYRef / 2.54 );
1287 bool success =
true;
1318 catch(
const std::exception& e )
1321 *aMessages <<
_(
"VRML Export Failed:\n" ) <<
From_UTF8( e.what() );
1330 bool aIncludeUnspecified,
bool aIncludeDNP,
1331 bool aExport3DFiles,
bool aUseRelativePaths,
1332 const wxString& a3D_Subdir,
1333 double aXRef,
double aYRef )
1340 aIncludeUnspecified, aIncludeDNP,
1341 aExport3DFiles, aUseRelativePaths,
1342 a3D_Subdir, aXRef, aYRef );
1344 if( !msgs.IsEmpty() )
1345 wxMessageBox( msgs );
1357 throw( std::runtime_error(
"Could not create 3D model subdirectory" ) );
1362 if( output_file.fail() )
1364 std::ostringstream ostr;
1365 ostr <<
"Could not open file '" <<
TO_UTF8( aFullFileName ) <<
"'";
1366 throw( std::runtime_error( ostr.str().c_str() ) );
1369 output_file.imbue( std::locale::classic() );
1372 wxString fn = aFullFileName;
1373 fn.Replace( wxT(
"\\" ) , wxT(
"/" ) );
1374 output_file <<
"#VRML V2.0 utf8\n";
1375 output_file <<
"WorldInfo {\n";
1376 output_file <<
" title \"" <<
TO_UTF8( fn ) <<
" - Generated by Pcbnew\"\n";
1377 output_file <<
"}\n";
1378 output_file <<
"Transform {\n";
1379 output_file <<
" scale " << std::setprecision(
m_precision );
1383 output_file <<
" children [\n";
1393 output_file <<
"]\n}\n";
1400 if( colorIdx == -1 )
1426 VRML_LAYER* layer,
double top_z,
bool aTopPlane )
1428 std::vector< double > vertices;
1429 std::vector< int > idxPlane;
1431 if( !( *layer ).Get2DTriangles( vertices, idxPlane, top_z, aTopPlane ) )
1436 if( ( idxPlane.size() % 3 ) )
1438 throw( std::runtime_error(
"[BUG] index lists are not a multiple of 3 (not a triangle "
1442 std::vector< SGPOINT > vlist;
1443 size_t nvert = vertices.size() / 3;
1446 for(
size_t i = 0; i < nvert; ++i, j+= 3 )
1447 vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
1456 coordIdx.
SetIndices( idxPlane.size(), &idxPlane[0] );
1462 for(
size_t i = 0; i < nvert; ++i )
1467 for(
size_t i = 0; i < nvert; ++i )
1474 if(
nullptr != modelColor )
1485 VRML_LAYER* layer,
double top_z,
double bottom_z )
1487 std::vector< double > vertices;
1488 std::vector< int > idxPlane;
1489 std::vector< int > idxSide;
1491 if( top_z < bottom_z )
1498 if( !( *layer ).Get3DTriangles( vertices, idxPlane, idxSide, top_z, bottom_z )
1499 || idxPlane.empty() || idxSide.empty() )
1504 if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) )
1506 throw( std::runtime_error(
"[BUG] index lists are not a multiple of 3 (not a "
1507 "triangle list)" ) );
1510 std::vector< SGPOINT > vlist;
1511 size_t nvert = vertices.size() / 3;
1514 for(
size_t i = 0; i < nvert; ++i, j+= 3 )
1515 vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
1524 coordIdx.
SetIndices( idxPlane.size(), &idxPlane[0] );
1531 for(
size_t i = 0; i < j; ++i )
1535 for(
size_t i = 0; i < j; ++i )
1541 if(
nullptr != modelColor )
1559 std::vector< int >::iterator sI = idxSide.begin();
1560 std::vector< int >::iterator eI = idxSide.end();
defines the basic data associated with a single 3D model.
constexpr EDA_IU_SCALE pcbIUScale
#define ADD_COLOR(list, r, g, b, a, name)
static bool g_ColorsLoaded
@ BS_ITEM_TYPE_SILKSCREEN
@ BS_ITEM_TYPE_DIELECTRIC
@ BS_ITEM_TYPE_SOLDERMASK
Manage one layer needed to make a physical board.
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
wxString m_FinishType
The name of external copper finish.
Information pertinent to a Pcbnew printed circuit board.
VRML_COLOR & GetColor(VRML_COLOR_INDEX aIndex)
SGNODE * m_sgmaterial[VRML_COLOR_LAST]
static KIGFX::COLOR4D m_DefaultSolderPaste
VRML_LAYER m_top_soldermask
bool GetLayer3D(int layer, VRML_LAYER **vlayer)
bool SetScale(double aWorldScale)
SGNODE * getSGColor(VRML_COLOR_INDEX colorIdx)
static std::vector< CUSTOM_COLOR_ITEM > m_SilkscreenColors
void ComputeLayer3D_Zpos()
EXPORTER_PCB_VRML(BOARD *aBoard)
SHAPE_POLY_SET m_pcbOutlines
static std::vector< CUSTOM_COLOR_ITEM > m_MaskColors
VRML_LAYER m_plated_holes
void SetLayerZ(int aLayer, double aValue)
static std::vector< CUSTOM_COLOR_ITEM > m_PasteColors
void ExportVrmlPolygonSet(VRML_LAYER *aVlayer, const SHAPE_POLY_SET &aOutlines)
void create_vrml_shell(IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double top_z, double bottom_z)
void write_triangle_bag(std::ostream &aOut_file, const VRML_COLOR &aColor, VRML_LAYER *aLayer, bool aPlane, bool aTop, double aTop_z, double aBottom_z)
bool m_includeUnspecified
void initStaticColorList()
std::list< SGNODE * > m_components
static KIGFX::COLOR4D m_DefaultSilkscreen
void SetOffset(double aXoff, double aYoff)
double GetLayerZ(int aLayer)
bool ExportVRML_File(PROJECT *aProject, wxString *aMessages, const wxString &aFullFileName, double aMMtoWRMLunit, bool aIncludeUnspecified, bool aIncludeDNP, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Export a VRML file image of the board.
static std::vector< CUSTOM_COLOR_ITEM > m_BoardColors
void ExportVrmlPadHole(PAD *aPad)
void create_vrml_plane(IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double aHeight, bool aTopPlane)
bool m_UseInlineModelsInBrdfile
wxString m_Subdir3DFpModels
static KIGFX::COLOR4D m_DefaultBoardBody
static KIGFX::COLOR4D m_DefaultSolderMask
bool m_UseRelPathIn3DModelFilename
void ExportVrmlFootprint(FOOTPRINT *aFootprint, std::ostream *aOutputFile)
void ExportFp3DModelsAsLinkedFile(const wxString &aFullFileName)
VRML_LAYER m_bot_soldermask
static std::vector< CUSTOM_COLOR_ITEM > m_FinishColors
VRML_COLOR vrml_colors_list[VRML_COLOR_LAST]
void ExportVrmlSolderMask()
void writeLayers(const char *aFileName, OSTREAM *aOutputFile)
void ExportStandardLayers()
static KIGFX::COLOR4D m_DefaultSurfaceFinish
double m_BoardToVrmlScale
IFSG_TRANSFORM m_OutputPCB
void ExportVrmlViaHoles()
S3D_CACHE * m_Cache3Dmodels
Wrapper to expose an API for writing VRML files, without exposing all the many structures used in the...
EXPORTER_VRML(BOARD *aBoard)
EXPORTER_PCB_VRML * pcb_exporter
bool ExportVRML_File(PROJECT *aProject, wxString *aMessages, const wxString &aFullFileName, double aMMtoWRMLunit, bool aIncludeUnspecified, bool aIncludeDNP, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Exports the board and its footprint shapes 3D (vrml files only) as a vrml file.
bool SetDiffuse(float aRVal, float aGVal, float aBVal)
bool SetSpecular(float aRVal, float aGVal, float aBVal)
bool SetShininess(float aShininess) noexcept
bool SetAmbient(float aRVal, float aGVal, float aBVal)
bool SetTransparency(float aTransparency) noexcept
The wrapper for SGCOORDINDEX.
bool NewNode(SGNODE *aParent) override
Create a new node to associate with this wrapper.
The wrapper for SGCOORDS.
bool NewNode(SGNODE *aParent) override
Create a new node to associate with this wrapper.
bool SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
bool AddCoord(double aXValue, double aYValue, double aZValue)
The wrapper for the SGFACESET class.
bool NewNode(SGNODE *aParent) override
Create a new node to associate with this wrapper.
bool AddIndex(int aIndex)
Add a single index to the list.
bool SetIndices(size_t nIndices, int *aIndexList)
Set the number of indices and creates a copy of the given index data.
bool SetParent(SGNODE *aParent)
Set the parent SGNODE of this object.
SGNODE * GetRawPtr(void) noexcept
Return the raw internal SGNODE pointer.
bool AddChildNode(SGNODE *aNode)
Add a node as a child owned by this node.
bool AddRefNode(SGNODE *aNode)
Add a reference to an existing node which is not owned by (not a child of) this node.
The wrapper for the SGNORMALS class.
bool NewNode(SGNODE *aParent) override
Create a new node to associate with this wrapper.
bool AddNormal(double aXValue, double aYValue, double aZValue)
The wrapper for the SGSHAPE class.
bool NewNode(SGNODE *aParent) override
Create a new node to associate with this wrapper.
A color representation with 4 components: red, green, blue, alpha.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
std::optional< LIBRARY_TABLE_ROW * > GetRow(const wxString &aNickname, LIBRARY_TABLE_SCOPE aScope=LIBRARY_TABLE_SCOPE::BOTH) const
Like LIBRARY_MANAGER::GetRow but filtered to the LIBRARY_TABLE_TYPE of this adapter.
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false)
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
PAD_ATTRIB GetAttribute() const
VECTOR2I GetPosition() const override
VECTOR2I GetDrillSize() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
PAD_DRILL_SHAPE GetDrillShape() const
bool ExportVRML_File(const wxString &aFullFileName, double aMMtoWRMLunit, bool aIncludeUnspecified, bool aIncludeDNP, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Create the file(s) exporting current BOARD to a VRML file.
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
Container for project specific data.
The base class of all Scene Graph nodes.
void SetVector(double aXVal, double aYVal, double aZVal)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
void RemoveAllContours()
Remove all outlines & holes (clears) the polygon set.
void BooleanIntersection(const SHAPE_POLY_SET &b)
Perform boolean polyset intersection.
int OutlineCount() const
Return the number of outlines in the set.
void Fracture(bool aSimplify=true)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
static constexpr EDA_ANGLE FULL_CIRCLE
static void build_quat(double x, double y, double z, double a, double q[4])
static void compose_quat(double q1[4], double q2[4], double qr[4])
static void from_quat(double q[4], double rot[4])
#define ERR_APPROX_MAX_MM
@ VRML_COLOR_TOP_SOLDMASK
@ VRML_COLOR_BOT_SOLDMASK
a few functions useful in geometry calculations.
int GetArcToSegmentCount(int aRadius, int aErrorMax, const EDA_ANGLE &aArcAngle)
collects header files for all SG* wrappers and the API
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
SGLIB_API bool WriteVRML(const char *filename, bool overwrite, SGNODE *aTopNode, bool reuse, bool renameNodes)
Write out the given node and its subnodes to a VRML2 file.
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
SGLIB_API SGVECTOR CalcTriNorm(const SGPOINT &p1, const SGPOINT &p2, const SGPOINT &p3)
Return the normal vector of a triangle described by vertices p1, p2, p3.
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Delete the given SG* class node.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
#define OPEN_OSTREAM(var, name)
#define CLOSE_STREAM(var)
wxString From_UTF8(const char *cstring)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
A class to handle a custom color (predefined color) for the color picker dialog.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
double DEG2RAD(double deg)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)