KiCad PCB EDA Suite
EXPORTER_PCB_VRML Class Reference

#include <exporter_vrml.h>

Public Member Functions

 EXPORTER_PCB_VRML ()
 
 ~EXPORTER_PCB_VRML ()
 
VRML_COLORGetColor (VRML_COLOR_INDEX aIndex)
 
void SetOffset (double aXoff, double aYoff)
 
double GetLayerZ (LAYER_NUM aLayer)
 
void SetLayerZ (LAYER_NUM aLayer, double aValue)
 
bool SetScale (double aWorldScale)
 
void ExportVrmlSolderMask ()
 
void ExportStandardLayers ()
 
void ExportVrmlFootprint (FOOTPRINT *aFootprint, std::ostream *aOutputFile)
 
void ExportVrmlBoard ()
 
void ExportVrmlVia (const PCB_VIA *aVia)
 
void ExportVrmlViaHoles ()
 
void ExportFp3DModelsAsLinkedFile (const wxString &aFullFileName)
 
void ExportVrmlPadHole (PAD *aPad)
 
void ExportVrmlPolygonSet (VRML_LAYER *aVlayer, const SHAPE_POLY_SET &aOutlines)
 
void writeLayers (const char *aFileName, OSTREAM *aOutputFile)
 
bool GetLayer3D (LAYER_NUM layer, VRML_LAYER **vlayer)
 
void ComputeLayer3D_Zpos ()
 

Public Attributes

IFSG_TRANSFORM m_OutputPCB
 
VRML_LAYER m_holes
 
VRML_LAYER m_3D_board
 
VRML_LAYER m_top_copper
 
VRML_LAYER m_bot_copper
 
VRML_LAYER m_top_silk
 
VRML_LAYER m_bot_silk
 
VRML_LAYER m_top_soldermask
 
VRML_LAYER m_bot_soldermask
 
VRML_LAYER m_top_paste
 
VRML_LAYER m_bot_paste
 
VRML_LAYER m_plated_holes
 
std::list< SGNODE * > m_components
 
S3D_CACHEm_Cache3Dmodels
 
BOARDm_Pcb
 
bool m_UseInlineModelsInBrdfile
 
wxString m_Subdir3DFpModels
 
bool m_UseRelPathIn3DModelFilename
 
bool m_ReuseDef
 
double m_WorldScale = 1.0
 
double m_BoardToVrmlScale
 
double m_tx
 
double m_ty
 
double m_brd_thickness
 

Private Member Functions

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)
 
void create_vrml_shell (IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double top_z, double bottom_z)
 
void create_vrml_plane (IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double aHeight, bool aTopPlane)
 
SGNODEgetSGColor (VRML_COLOR_INDEX colorIdx)
 

Private Attributes

VRML_COLOR vrml_colors_list [VRML_COLOR_LAST]
 
double m_layer_z [PCB_LAYER_ID_COUNT]
 
SHAPE_POLY_SET m_pcbOutlines
 
int m_precision
 
SGNODEm_sgmaterial [VRML_COLOR_LAST]
 

Detailed Description

Definition at line 103 of file exporter_vrml.h.

Constructor & Destructor Documentation

◆ EXPORTER_PCB_VRML()

EXPORTER_PCB_VRML::EXPORTER_PCB_VRML ( )

Definition at line 58 of file export_vrml.cpp.

58  :
59  m_OutputPCB( nullptr )
60 {
61  m_ReuseDef = true;
62  m_precision = 6;
63  m_WorldScale = 1.0;
64  m_Cache3Dmodels = nullptr;
65  m_Pcb = nullptr;
68  m_BoardToVrmlScale = MM_PER_IU;
69 
70  for( int ii = 0; ii < VRML_COLOR_LAST; ++ii )
71  m_sgmaterial[ii] = nullptr;
72 
73  for( unsigned i = 0; i < arrayDim( m_layer_z ); ++i )
74  m_layer_z[i] = 0;
75 
76  // this default only makes sense if the output is in mm
77  m_brd_thickness = 1.6;
78 
79  // pcb green
81  0.12f, 0.20f, 0.19f, 0.01f, 0.03f, 0.01f, 0.0f, 0.0f, 0.0f, 0.8f, 0.0f, 0.02f );
82  // copper color
84  0.72f, 0.45f, 0.2f, 0.01f, 0.05f, 0.01f, 0.0f, 0.0f, 0.0f, 0.8f, 0.0f, 0.02f );
85  // silkscreen white
87  0.7f, 0.7f, 0.9f, 0.1f, 0.1f, 0.1f, 0.0f, 0.0f, 0.0f, 0.9f, 0.0f, 0.02f );
88  // solder paste silver (gray)
89  vrml_colors_list[VRML_COLOR_PASTE] = VRML_COLOR( 0.4f, 0.4f, 0.4f, 0.2f, 0.2f, 0.2f, 0.0f,
90  0.0f, 0.0f, 0.8f, 0.0f, 0.8f );
91  // solder mask green with transparency
93  0.07f, 0.3f, 0.12f, 0.01f, 0.03f, 0.01f, 0.0f, 0.0f, 0.0f, 0.8f, 0.25f, 0.02f );
94 
95  SetOffset( 0.0, 0.0 );
96 }
IFSG_TRANSFORM m_OutputPCB
VRML_COLOR vrml_colors_list[VRML_COLOR_LAST]
bool m_UseRelPathIn3DModelFilename
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
SGNODE * m_sgmaterial[VRML_COLOR_LAST]
S3D_CACHE * m_Cache3Dmodels
void SetOffset(double aXoff, double aYoff)
bool m_UseInlineModelsInBrdfile
double m_layer_z[PCB_LAYER_ID_COUNT]

References arrayDim(), m_BoardToVrmlScale, m_brd_thickness, m_Cache3Dmodels, m_layer_z, m_Pcb, m_precision, m_ReuseDef, m_sgmaterial, m_UseInlineModelsInBrdfile, m_UseRelPathIn3DModelFilename, m_WorldScale, SetOffset(), VRML_COLOR_COPPER, VRML_COLOR_LAST, VRML_COLOR_PASTE, VRML_COLOR_PCB, VRML_COLOR_SILK, VRML_COLOR_SOLDMASK, and vrml_colors_list.

◆ ~EXPORTER_PCB_VRML()

EXPORTER_PCB_VRML::~EXPORTER_PCB_VRML ( )

Definition at line 99 of file export_vrml.cpp.

100 {
101  // destroy any unassociated material appearances
102  for( int j = 0; j < VRML_COLOR_LAST; ++j )
103  {
104  if( m_sgmaterial[j] && nullptr == S3D::GetSGNodeParent( m_sgmaterial[j] ) )
106 
107  m_sgmaterial[j] = nullptr;
108  }
109 
110  if( !m_components.empty() )
111  {
112  IFSG_TRANSFORM tmp( false );
113 
114  for( auto i : m_components )
115  {
116  tmp.Attach( i );
117  tmp.SetParent( nullptr );
118  }
119 
120  m_components.clear();
122  }
123 }
IFSG_TRANSFORM m_OutputPCB
std::list< SGNODE * > m_components
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:492
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Function DestroyNode deletes the given SG* class node.
Definition: ifsg_api.cpp:148
SGNODE * m_sgmaterial[VRML_COLOR_LAST]
IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH.
void Destroy(void)
Function Destroy deletes the object held by this wrapper.
Definition: ifsg_node.cpp:55

References IFSG_TRANSFORM::Attach(), IFSG_NODE::Destroy(), S3D::DestroyNode(), S3D::GetSGNodeParent(), m_components, m_OutputPCB, m_sgmaterial, IFSG_NODE::SetParent(), and VRML_COLOR_LAST.

Member Function Documentation

◆ ComputeLayer3D_Zpos()

void EXPORTER_PCB_VRML::ComputeLayer3D_Zpos ( )

Definition at line 514 of file export_vrml.cpp.

515 {
516  int copper_layers = m_Pcb->GetCopperLayerCount();
517 
518  // We call it 'layer' thickness, but it's the whole board thickness!
520  double half_thickness = m_brd_thickness / 2;
521 
522  // Compute each layer's Z value, more or less like the 3d view
523  for( LSEQ seq = LSET::AllCuMask().Seq(); seq; ++seq )
524  {
525  PCB_LAYER_ID i = *seq;
526 
527  if( i < copper_layers )
528  SetLayerZ( i, half_thickness - m_brd_thickness * i / (copper_layers - 1) );
529  else
530  SetLayerZ( i, - half_thickness ); // bottom layer
531  }
532 
533  // To avoid rounding interference, we apply an epsilon to each successive layer
534  double epsilon_z = Millimeter2iu( ART_OFFSET ) * m_BoardToVrmlScale;
535  SetLayerZ( B_Paste, -half_thickness - epsilon_z );
536  SetLayerZ( B_Adhes, -half_thickness - epsilon_z );
537  SetLayerZ( B_SilkS, -half_thickness - epsilon_z * 3 );
538  SetLayerZ( B_Mask, -half_thickness - epsilon_z * 2 );
539  SetLayerZ( F_Mask, half_thickness + epsilon_z * 2 );
540  SetLayerZ( F_SilkS, half_thickness + epsilon_z * 3 );
541  SetLayerZ( F_Adhes, half_thickness + epsilon_z );
542  SetLayerZ( F_Paste, half_thickness + epsilon_z );
543  SetLayerZ( Dwgs_User, half_thickness + epsilon_z * 5 );
544  SetLayerZ( Cmts_User, half_thickness + epsilon_z * 6 );
545  SetLayerZ( Eco1_User, half_thickness + epsilon_z * 7 );
546  SetLayerZ( Eco2_User, half_thickness + epsilon_z * 8 );
547  SetLayerZ( Edge_Cuts, 0 );
548 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
void SetLayerZ(LAYER_NUM aLayer, double aValue)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:465
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
int GetCopperLayerCount() const
Definition: board.cpp:455
static constexpr int Millimeter2iu(double mm)
#define ART_OFFSET
Definition: exporter_vrml.h:27

References LSET::AllCuMask(), ART_OFFSET, B_Adhes, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Mask, F_Paste, F_SilkS, BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetCopperLayerCount(), BOARD::GetDesignSettings(), m_BoardToVrmlScale, m_brd_thickness, m_Pcb, Millimeter2iu(), and SetLayerZ().

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

◆ create_vrml_plane()

void EXPORTER_PCB_VRML::create_vrml_plane ( IFSG_TRANSFORM PcbOutput,
VRML_COLOR_INDEX  colorID,
VRML_LAYER *  layer,
double  aHeight,
bool  aTopPlane 
)
private

Definition at line 1125 of file export_vrml.cpp.

1127 {
1128  std::vector< double > vertices;
1129  std::vector< int > idxPlane;
1130 
1131  if( !( *layer ).Get2DTriangles( vertices, idxPlane, top_z, aTopPlane ) )
1132  {
1133  return;
1134  }
1135 
1136  if( ( idxPlane.size() % 3 ) )
1137  {
1138  throw( std::runtime_error( "[BUG] index lists are not a multiple of 3 (not a triangle "
1139  "list)" ) );
1140  }
1141 
1142  std::vector< SGPOINT > vlist;
1143  size_t nvert = vertices.size() / 3;
1144  size_t j = 0;
1145 
1146  for( size_t i = 0; i < nvert; ++i, j+= 3 )
1147  vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
1148 
1149  // create the intermediate scenegraph
1150  IFSG_TRANSFORM tx0( PcbOutput.GetRawPtr() ); // tx0 = Transform for this outline
1151  IFSG_SHAPE shape( tx0 ); // shape will hold (a) all vertices and (b) a local list of normals
1152  IFSG_FACESET face( shape ); // this face shall represent the top and bottom planes
1153  IFSG_COORDS cp( face ); // coordinates for all faces
1154  cp.SetCoordsList( nvert, &vlist[0] );
1155  IFSG_COORDINDEX coordIdx( face ); // coordinate indices for top and bottom planes only
1156  coordIdx.SetIndices( idxPlane.size(), &idxPlane[0] );
1157  IFSG_NORMALS norms( face ); // normals for the top and bottom planes
1158 
1159  // set the normals
1160  if( aTopPlane )
1161  {
1162  for( size_t i = 0; i < nvert; ++i )
1163  norms.AddNormal( 0.0, 0.0, 1.0 );
1164  }
1165  else
1166  {
1167  for( size_t i = 0; i < nvert; ++i )
1168  norms.AddNormal( 0.0, 0.0, -1.0 );
1169  }
1170 
1171  // assign a color from the palette
1172  SGNODE* modelColor = getSGColor( colorID );
1173 
1174  if( nullptr != modelColor )
1175  {
1176  if( nullptr == S3D::GetSGNodeParent( modelColor ) )
1177  shape.AddChildNode( modelColor );
1178  else
1179  shape.AddRefNode( modelColor );
1180  }
1181 }
IFSG_COORDS is the wrapper for SGCOORDS.
Definition: ifsg_coords.h:40
IFSG_COORDINDEX is the wrapper for SGCOORDINDEX.
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:492
SGNODE * getSGColor(VRML_COLOR_INDEX colorIdx)
The base class of all Scene Graph nodes.
Definition: sg_node.h:74
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
Definition: ifsg_node.cpp:65
IFSG_NORMALS is the wrapper for the SGNORMALS class.
Definition: ifsg_normals.h:40
IFSG_FACESET is the wrapper for the SGFACESET class.
Definition: ifsg_faceset.h:40
IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH.
IFSG_SHAPE is the wrapper for the SGSHAPE class.
Definition: ifsg_shape.h:40

References IFSG_NORMALS::AddNormal(), IFSG_NODE::GetRawPtr(), getSGColor(), S3D::GetSGNodeParent(), IFSG_COORDS::SetCoordsList(), and IFSG_INDEX::SetIndices().

Referenced by writeLayers().

◆ create_vrml_shell()

void EXPORTER_PCB_VRML::create_vrml_shell ( IFSG_TRANSFORM PcbOutput,
VRML_COLOR_INDEX  colorID,
VRML_LAYER *  layer,
double  top_z,
double  bottom_z 
)
private

Definition at line 1184 of file export_vrml.cpp.

1186 {
1187  std::vector< double > vertices;
1188  std::vector< int > idxPlane;
1189  std::vector< int > idxSide;
1190 
1191  if( top_z < bottom_z )
1192  {
1193  double tmp = top_z;
1194  top_z = bottom_z;
1195  bottom_z = tmp;
1196  }
1197 
1198  if( !( *layer ).Get3DTriangles( vertices, idxPlane, idxSide, top_z, bottom_z )
1199  || idxPlane.empty() || idxSide.empty() )
1200  {
1201  return;
1202  }
1203 
1204  if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) )
1205  {
1206  throw( std::runtime_error( "[BUG] index lists are not a multiple of 3 (not a "
1207  "triangle list)" ) );
1208  }
1209 
1210  std::vector< SGPOINT > vlist;
1211  size_t nvert = vertices.size() / 3;
1212  size_t j = 0;
1213 
1214  for( size_t i = 0; i < nvert; ++i, j+= 3 )
1215  vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
1216 
1217  // create the intermediate scenegraph
1218  IFSG_TRANSFORM tx0( PcbOutput.GetRawPtr() ); // tx0 = Transform for this outline
1219  IFSG_SHAPE shape( tx0 ); // shape will hold (a) all vertices and (b) a local list of normals
1220  IFSG_FACESET face( shape ); // this face shall represent the top and bottom planes
1221  IFSG_COORDS cp( face ); // coordinates for all faces
1222  cp.SetCoordsList( nvert, &vlist[0] );
1223  IFSG_COORDINDEX coordIdx( face ); // coordinate indices for top and bottom planes only
1224  coordIdx.SetIndices( idxPlane.size(), &idxPlane[0] );
1225  IFSG_NORMALS norms( face ); // normals for the top and bottom planes
1226 
1227  // number of TOP (and bottom) vertices
1228  j = nvert / 2;
1229 
1230  // set the TOP normals
1231  for( size_t i = 0; i < j; ++i )
1232  norms.AddNormal( 0.0, 0.0, 1.0 );
1233 
1234  // set the BOTTOM normals
1235  for( size_t i = 0; i < j; ++i )
1236  norms.AddNormal( 0.0, 0.0, -1.0 );
1237 
1238  // assign a color from the palette
1239  SGNODE* modelColor = getSGColor( colorID );
1240 
1241  if( nullptr != modelColor )
1242  {
1243  if( nullptr == S3D::GetSGNodeParent( modelColor ) )
1244  shape.AddChildNode( modelColor );
1245  else
1246  shape.AddRefNode( modelColor );
1247  }
1248 
1249  // create a second shape describing the vertical walls of the extrusion
1250  // using per-vertex-per-face-normals
1251  shape.NewNode( tx0 );
1252  shape.AddRefNode( modelColor ); // set the color to be the same as the top/bottom
1253  face.NewNode( shape );
1254  cp.NewNode( face ); // new vertex list
1255  norms.NewNode( face ); // new normals list
1256  coordIdx.NewNode( face ); // new index list
1257 
1258  // populate the new per-face vertex list and its indices and normals
1259  std::vector< int >::iterator sI = idxSide.begin();
1260  std::vector< int >::iterator eI = idxSide.end();
1261 
1262  size_t sidx = 0; // index to the new coord set
1263  SGPOINT p1, p2, p3;
1264  SGVECTOR vnorm;
1265 
1266  while( sI != eI )
1267  {
1268  p1 = vlist[*sI];
1269  cp.AddCoord( p1 );
1270  ++sI;
1271 
1272  p2 = vlist[*sI];
1273  cp.AddCoord( p2 );
1274  ++sI;
1275 
1276  p3 = vlist[*sI];
1277  cp.AddCoord( p3 );
1278  ++sI;
1279 
1280  vnorm.SetVector( S3D::CalcTriNorm( p1, p2, p3 ) );
1281  norms.AddNormal( vnorm );
1282  norms.AddNormal( vnorm );
1283  norms.AddNormal( vnorm );
1284 
1285  coordIdx.AddIndex( (int)sidx );
1286  ++sidx;
1287  coordIdx.AddIndex( (int)sidx );
1288  ++sidx;
1289  coordIdx.AddIndex( (int)sidx );
1290  ++sidx;
1291  }
1292 }
IFSG_COORDS is the wrapper for SGCOORDS.
Definition: ifsg_coords.h:40
IFSG_COORDINDEX is the wrapper for SGCOORDINDEX.
void SetVector(double aXVal, double aYVal, double aZVal)
Definition: sg_base.cpp:233
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:492
SGNODE * getSGColor(VRML_COLOR_INDEX colorIdx)
The base class of all Scene Graph nodes.
Definition: sg_node.h:74
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
Definition: ifsg_node.cpp:65
IFSG_NORMALS is the wrapper for the SGNORMALS class.
Definition: ifsg_normals.h:40
SGLIB_API SGVECTOR CalcTriNorm(const SGPOINT &p1, const SGPOINT &p2, const SGPOINT &p3)
Function CalcTriNorm returns the normal vector of a triangle described by vertices p1,...
Definition: ifsg_api.cpp:462
IFSG_FACESET is the wrapper for the SGFACESET class.
Definition: ifsg_faceset.h:40
IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH.
IFSG_SHAPE is the wrapper for the SGSHAPE class.
Definition: ifsg_shape.h:40

References IFSG_COORDS::AddCoord(), IFSG_INDEX::AddIndex(), IFSG_NORMALS::AddNormal(), S3D::CalcTriNorm(), IFSG_NODE::GetRawPtr(), getSGColor(), S3D::GetSGNodeParent(), IFSG_COORDS::NewNode(), IFSG_NORMALS::NewNode(), IFSG_COORDINDEX::NewNode(), IFSG_FACESET::NewNode(), IFSG_COORDS::SetCoordsList(), IFSG_INDEX::SetIndices(), and SGVECTOR::SetVector().

Referenced by writeLayers().

◆ ExportFp3DModelsAsLinkedFile()

void EXPORTER_PCB_VRML::ExportFp3DModelsAsLinkedFile ( const wxString &  aFullFileName)

Definition at line 1049 of file export_vrml.cpp.

1050 {
1051  // check if the 3D Subdir exists - create if not
1052  wxFileName subdir( m_Subdir3DFpModels, "" );
1053 
1054  if( ! subdir.DirExists() )
1055  {
1056  if( !wxDir::Make( subdir.GetFullPath() ) )
1057  throw( std::runtime_error( "Could not create 3D model subdirectory" ) );
1058  }
1059 
1060  OPEN_OSTREAM( output_file, TO_UTF8( aFullFileName ) );
1061 
1062  if( output_file.fail() )
1063  {
1064  std::ostringstream ostr;
1065  ostr << "Could not open file '" << TO_UTF8( aFullFileName ) << "'";
1066  throw( std::runtime_error( ostr.str().c_str() ) );
1067  }
1068 
1069  output_file.imbue( std::locale::classic() );
1070 
1071  // Begin with the usual VRML boilerplate
1072  wxString fn = aFullFileName;
1073  fn.Replace( "\\" , "/" );
1074  output_file << "#VRML V2.0 utf8\n";
1075  output_file << "WorldInfo {\n";
1076  output_file << " title \"" << TO_UTF8( fn ) << " - Generated by Pcbnew\"\n";
1077  output_file << "}\n";
1078  output_file << "Transform {\n";
1079  output_file << " scale " << std::setprecision( m_precision );
1080  output_file << m_WorldScale << " ";
1081  output_file << m_WorldScale << " ";
1082  output_file << m_WorldScale << "\n";
1083  output_file << " children [\n";
1084 
1085  // Export footprints
1086  for( FOOTPRINT* footprint : m_Pcb->Footprints() )
1087  ExportVrmlFootprint( footprint, &output_file );
1088 
1089  // write out the board and all layers
1090  writeLayers( TO_UTF8( aFullFileName ), &output_file );
1091 
1092  // Close the outer 'transform' node
1093  output_file << "]\n}\n";
1094 
1095  CLOSE_STREAM( output_file );
1096 }
void ExportVrmlFootprint(FOOTPRINT *aFootprint, std::ostream *aOutputFile)
void writeLayers(const char *aFileName, OSTREAM *aOutputFile)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
wxString m_Subdir3DFpModels
FOOTPRINTS & Footprints()
Definition: board.h:234
#define OPEN_OSTREAM(var, name)
#define CLOSE_STREAM(var)

References CLOSE_STREAM, ExportVrmlFootprint(), BOARD::Footprints(), m_Pcb, m_precision, m_Subdir3DFpModels, m_WorldScale, OPEN_OSTREAM, TO_UTF8, and writeLayers().

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

◆ ExportStandardLayers()

void EXPORTER_PCB_VRML::ExportStandardLayers ( )

Definition at line 202 of file export_vrml.cpp.

203 {
204  SHAPE_POLY_SET outlines;
205 
206  PCB_LAYER_ID pcb_layer[] =
207  {
209  };
210 
211  VRML_LAYER* vrmllayer[] =
212  {
214  nullptr // Sentinel
215  };
216 
217  for( int lcnt = 0; ; lcnt++ )
218  {
219  if( vrmllayer[lcnt] == nullptr )
220  break;
221 
222  outlines.RemoveAllContours();
223  m_Pcb->ConvertBrdLayerToPolygonalContours( pcb_layer[lcnt], outlines );
225 
226  ExportVrmlPolygonSet( vrmllayer[lcnt], outlines );
227  }
228 }
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
Definition: board.cpp:2174
VRML_LAYER m_top_silk
VRML_LAYER m_top_copper
VRML_LAYER m_bot_silk
VRML_LAYER m_bot_copper
Represent a set of closed polygons.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Definition: layer_ids.h:71
VRML_LAYER m_bot_paste
VRML_LAYER m_top_paste
void ExportVrmlPolygonSet(VRML_LAYER *aVlayer, const SHAPE_POLY_SET &aOutlines)

References B_Cu, B_Paste, B_SilkS, BOARD::ConvertBrdLayerToPolygonalContours(), ExportVrmlPolygonSet(), F_Cu, F_Paste, F_SilkS, SHAPE_POLY_SET::Fracture(), m_bot_copper, m_bot_paste, m_bot_silk, m_Pcb, m_top_copper, m_top_paste, m_top_silk, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

◆ ExportVrmlBoard()

void EXPORTER_PCB_VRML::ExportVrmlBoard ( )

Definition at line 573 of file export_vrml.cpp.

574 {
576  {
577  wxLogWarning( _( "Board outline is malformed. Run DRC for a full analysis." ) );
578  }
579 
580  int seg;
581 
582  for( int cnt = 0; cnt < m_pcbOutlines.OutlineCount(); cnt++ )
583  {
584  const SHAPE_LINE_CHAIN& outline = m_pcbOutlines.COutline( cnt );
585 
586  seg = m_3D_board.NewContour();
587 
588  for( int j = 0; j < outline.PointCount(); j++ )
589  {
590  m_3D_board.AddVertex( seg, (double)outline.CPoint(j).x * m_BoardToVrmlScale,
591  -((double)outline.CPoint(j).y * m_BoardToVrmlScale ) );
592 
593  }
594 
595  m_3D_board.EnsureWinding( seg, false );
596 
597  // Generate board holes from outlines:
598  for( int ii = 0; ii < m_pcbOutlines.HoleCount( cnt ); ii++ )
599  {
600  const SHAPE_LINE_CHAIN& hole = m_pcbOutlines.Hole( cnt, ii );
601 
602  seg = m_holes.NewContour();
603 
604  if( seg < 0 )
605  {
606  wxLogError( _( "VRML Export Failed: Could not add holes to contours." ) );
607  return;
608  }
609 
610  for( int j = 0; j < hole.PointCount(); j++ )
611  {
612  m_holes.AddVertex( seg, (double) hole.CPoint(j).x * m_BoardToVrmlScale,
613  -( (double) hole.CPoint(j).y * m_BoardToVrmlScale ) );
614  }
615 
616  m_holes.EnsureWinding( seg, true );
617  }
618  }
619 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
Definition: board.cpp:1880
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
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.
#define _(s)
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
SHAPE_POLY_SET m_pcbOutlines
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
VRML_LAYER m_holes
VRML_LAYER m_3D_board

References _, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), BOARD::GetBoardPolygonOutlines(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), m_3D_board, m_BoardToVrmlScale, m_holes, m_Pcb, m_pcbOutlines, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

◆ ExportVrmlFootprint()

void EXPORTER_PCB_VRML::ExportVrmlFootprint ( FOOTPRINT aFootprint,
std::ostream *  aOutputFile 
)

Definition at line 776 of file export_vrml.cpp.

777 {
778  // Note: if m_UseInlineModelsInBrdfile is false, the 3D footprint shape is copied to
779  // the vrml board file, and aOutputFile is not used (can be nullptr)
780  // if m_UseInlineModelsInBrdfile is true, the 3D footprint shape is copied to
781  // aOutputFile (with the suitable rotation/translation/scale transform, and the vrml board
782  // file contains only the filename of 3D shapes to add to the full vrml scene
783  wxCHECK( aFootprint, /* void */ );
784 
785  // Export pad holes
786  for( PAD* pad : aFootprint->Pads() )
788 
789  bool isFlipped = aFootprint->GetLayer() == B_Cu;
790 
791  // Export the object VRML model(s)
792  auto sM = aFootprint->Models().begin();
793  auto eM = aFootprint->Models().end();
794 
795  wxFileName subdir( m_Subdir3DFpModels, "" );
796 
797  while( sM != eM )
798  {
799  if( !sM->m_Show )
800  {
801  ++sM;
802  continue;
803  }
804 
805  SGNODE* mod3d = (SGNODE*) m_Cache3Dmodels->Load( sM->m_Filename );
806 
807  if( nullptr == mod3d )
808  {
809  ++sM;
810  continue;
811  }
812 
813  /* Calculate 3D shape rotation:
814  * this is the rotation parameters, with an additional 180 deg rotation
815  * for footprints that are flipped
816  * When flipped, axis rotation is the horizontal axis (X axis)
817  */
818  double rotx = -sM->m_Rotation.x;
819  double roty = -sM->m_Rotation.y;
820  double rotz = -sM->m_Rotation.z;
821 
822  if( isFlipped )
823  {
824  rotx += 180.0;
825  roty = -roty;
826  rotz = -rotz;
827  }
828 
829  // Do some quaternion munching
830  double q1[4], q2[4], rot[4];
831  build_quat( 1, 0, 0, DEG2RAD( rotx ), q1 );
832  build_quat( 0, 1, 0, DEG2RAD( roty ), q2 );
833  compose_quat( q1, q2, q1 );
834  build_quat( 0, 0, 1, DEG2RAD( rotz ), q2 );
835  compose_quat( q1, q2, q1 );
836 
837  // Note here aFootprint->GetOrientation() is in 0.1 degrees, so footprint rotation
838  // has to be converted to radians
839  build_quat( 0, 0, 1, DECIDEG2RAD( aFootprint->GetOrientation() ), q2 );
840  compose_quat( q1, q2, q1 );
841  from_quat( q1, rot );
842 
843  double offsetFactor = 1000.0f * IU_PER_MILS / 25.4f;
844 
845  // adjust 3D shape local offset position
846  // they are given in mm, so they are converted in board IU.
847  double offsetx = sM->m_Offset.x * offsetFactor;
848  double offsety = sM->m_Offset.y * offsetFactor;
849  double offsetz = sM->m_Offset.z * offsetFactor;
850 
851  if( isFlipped )
852  offsetz = -offsetz;
853  else
854  offsety = -offsety; // In normal mode, Y axis is reversed in Pcbnew.
855 
856  RotatePoint( &offsetx, &offsety, aFootprint->GetOrientation() );
857 
858  SGPOINT trans;
859  trans.x = ( offsetx + aFootprint->GetPosition().x ) * m_BoardToVrmlScale + m_tx;
860  trans.y = -( offsety + aFootprint->GetPosition().y) * m_BoardToVrmlScale - m_ty;
861  trans.z = (offsetz * m_BoardToVrmlScale ) + GetLayerZ( aFootprint->GetLayer() );
862 
864  {
865  wxCHECK( aOutputFile, /* void */ );
866 
867  int old_precision = aOutputFile->precision();
868  aOutputFile->precision( m_precision );
869 
870  wxFileName srcFile = m_Cache3Dmodels->GetResolver()->ResolvePath( sM->m_Filename );
871  wxFileName dstFile;
872  dstFile.SetPath( m_Subdir3DFpModels );
873  dstFile.SetName( srcFile.GetName() );
874  dstFile.SetExt( "wrl" );
875 
876  // copy the file if necessary
877  wxDateTime srcModTime = srcFile.GetModificationTime();
878  wxDateTime destModTime = srcModTime;
879 
880  destModTime.SetToCurrent();
881 
882  if( dstFile.FileExists() )
883  destModTime = dstFile.GetModificationTime();
884 
885  if( srcModTime != destModTime )
886  {
887  wxString fileExt = srcFile.GetExt();
888  fileExt.LowerCase();
889 
890  // copy VRML models and use the scenegraph library to
891  // translate other model types
892  if( fileExt == "wrl" )
893  {
894  if( !wxCopyFile( srcFile.GetFullPath(), dstFile.GetFullPath() ) )
895  continue;
896  }
897  else
898  {
899  if( !S3D::WriteVRML( dstFile.GetFullPath().ToUTF8(), true, mod3d, m_ReuseDef,
900  true ) )
901  continue;
902  }
903  }
904 
905  (*aOutputFile) << "Transform {\n";
906 
907  // only write a rotation if it is >= 0.1 deg
908  if( std::abs( rot[3] ) > 0.0001745 )
909  {
910  (*aOutputFile) << " rotation ";
911  (*aOutputFile) << rot[0] << " " << rot[1] << " " << rot[2] << " " << rot[3] << "\n";
912  }
913 
914  (*aOutputFile) << " translation ";
915  (*aOutputFile) << trans.x << " ";
916  (*aOutputFile) << trans.y << " ";
917  (*aOutputFile) << trans.z << "\n";
918 
919  (*aOutputFile) << " scale ";
920  (*aOutputFile) << sM->m_Scale.x << " ";
921  (*aOutputFile) << sM->m_Scale.y << " ";
922  (*aOutputFile) << sM->m_Scale.z << "\n";
923 
924  (*aOutputFile) << " children [\n Inline {\n url \"";
925 
927  {
928  wxFileName tmp = dstFile;
929  tmp.SetExt( "" );
930  tmp.SetName( "" );
931  tmp.RemoveLastDir();
932  dstFile.MakeRelativeTo( tmp.GetPath() );
933  }
934 
935  wxString fn = dstFile.GetFullPath();
936  fn.Replace( "\\", "/" );
937  (*aOutputFile) << TO_UTF8( fn ) << "\"\n } ]\n";
938  (*aOutputFile) << " }\n";
939 
940  aOutputFile->precision( old_precision );
941  }
942  else
943  {
944  IFSG_TRANSFORM* modelShape = new IFSG_TRANSFORM( m_OutputPCB.GetRawPtr() );
945 
946  // only write a rotation if it is >= 0.1 deg
947  if( std::abs( rot[3] ) > 0.0001745 )
948  modelShape->SetRotation( SGVECTOR( rot[0], rot[1], rot[2] ), rot[3] );
949 
950  modelShape->SetTranslation( trans );
951  modelShape->SetScale( SGPOINT( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z ) );
952 
953  if( nullptr == S3D::GetSGNodeParent( mod3d ) )
954  {
955  m_components.push_back( mod3d );
956  modelShape->AddChildNode( mod3d );
957  }
958  else
959  {
960  modelShape->AddRefNode( mod3d );
961  }
962 
963  }
964 
965  ++sM;
966  }
967 }
IFSG_TRANSFORM m_OutputPCB
double GetLayerZ(LAYER_NUM aLayer)
double x
Definition: sg_base.h:70
std::list< FP_3DMODEL > & Models()
Definition: footprint.h:182
static void compose_quat(double q1[4], double q2[4], double qr[4])
std::list< SGNODE * > m_components
void ExportVrmlPadHole(PAD *aPad)
double GetOrientation() const
Definition: footprint.h:190
bool AddRefNode(SGNODE *aNode)
Function AddRefNode adds a reference to an existing node which is not owned by (not a child of) this ...
Definition: ifsg_node.cpp:128
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:492
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
The base class of all Scene Graph nodes.
Definition: sg_node.h:74
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
Definition: ifsg_node.cpp:65
bool AddChildNode(SGNODE *aNode)
Function AddChildNode adds a node as a child owned by this node.
Definition: ifsg_node.cpp:148
PADS & Pads()
Definition: footprint.h:168
SGLIB_API bool WriteVRML(const char *filename, bool overwrite, SGNODE *aTopNode, bool reuse, bool renameNodes)
Function WriteVRML writes out the given node and its subnodes to a VRML2 file.
Definition: ifsg_api.cpp:76
static void build_quat(double x, double y, double z, double a, double q[4])
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
wxString m_Subdir3DFpModels
bool m_UseRelPathIn3DModelFilename
bool SetRotation(const SGVECTOR &aRotationAxis, double aAngle)
wxString ResolvePath(const wxString &aFileName)
Determines the full path of the given file name.
double DEG2RAD(double deg)
Definition: trigo.h:229
FILENAME_RESOLVER * GetResolver() noexcept
Definition: 3d_cache.cpp:605
IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH.
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
static void from_quat(double q[4], double rot[4])
S3D_CACHE * m_Cache3Dmodels
#define IU_PER_MILS
Definition: plotter.cpp:136
bool SetTranslation(const SGPOINT &aTranslation) noexcept
wxPoint GetPosition() const override
Definition: footprint.h:186
bool SetScale(const SGPOINT &aScale) noexcept
SCENEGRAPH * Load(const wxString &aModelFile)
Attempt to load the scene data for a model.
Definition: 3d_cache.cpp:284
Definition: pad.h:57
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:142
bool m_UseInlineModelsInBrdfile

References IFSG_NODE::AddChildNode(), IFSG_NODE::AddRefNode(), B_Cu, build_quat(), compose_quat(), DECIDEG2RAD(), DEG2RAD(), ExportVrmlPadHole(), from_quat(), BOARD_ITEM::GetLayer(), GetLayerZ(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), IFSG_NODE::GetRawPtr(), S3D_CACHE::GetResolver(), S3D::GetSGNodeParent(), IU_PER_MILS, S3D_CACHE::Load(), m_BoardToVrmlScale, m_Cache3Dmodels, m_components, m_OutputPCB, m_precision, m_ReuseDef, m_Subdir3DFpModels, m_tx, m_ty, m_UseInlineModelsInBrdfile, m_UseRelPathIn3DModelFilename, FOOTPRINT::Models(), pad, FOOTPRINT::Pads(), FILENAME_RESOLVER::ResolvePath(), RotatePoint(), IFSG_TRANSFORM::SetRotation(), IFSG_TRANSFORM::SetScale(), IFSG_TRANSFORM::SetTranslation(), TO_UTF8, S3D::WriteVRML(), and SGPOINT::x.

Referenced by ExportFp3DModelsAsLinkedFile(), and PCB_EDIT_FRAME::ExportVRML_File().

◆ ExportVrmlPadHole()

void EXPORTER_PCB_VRML::ExportVrmlPadHole ( PAD aPad)

Definition at line 671 of file export_vrml.cpp.

672 {
673  double hole_drill_w = (double) aPad->GetDrillSize().x * m_BoardToVrmlScale / 2.0;
674  double hole_drill_h = (double) aPad->GetDrillSize().y * m_BoardToVrmlScale / 2.0;
675  double hole_drill = std::min( hole_drill_w, hole_drill_h );
676  double hole_x = aPad->GetPosition().x * m_BoardToVrmlScale;
677  double hole_y = aPad->GetPosition().y * m_BoardToVrmlScale;
678 
679  // Export the hole on the edge layer
680  if( hole_drill > 0 )
681  {
682  int nsides = GetArcToSegmentCount( hole_drill,
683  Millimeter2iu( err_approx_max ), 360.0 );
684  double minSegLength = M_PI * hole_drill / nsides;
685  double maxSegLength = minSegLength*2.0;
686 
687  m_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
688  m_plated_holes.SetArcParams( nsides, minSegLength, maxSegLength );
689 
690  bool pth = false;
691 
692  if( ( aPad->GetAttribute() != PAD_ATTRIB::NPTH ) )
693  pth = true;
694 
695  if( aPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG )
696  {
697  // Oblong hole (slot)
698 
699  if( pth )
700  {
701  m_holes.AddSlot( hole_x, -hole_y, hole_drill_w * 2.0 + PLATE_OFFSET,
702  hole_drill_h * 2.0 + PLATE_OFFSET,
703  aPad->GetOrientation()/10.0, true, true );
704 
705  m_plated_holes.AddSlot( hole_x, -hole_y,
706  hole_drill_w * 2.0, hole_drill_h * 2.0,
707  aPad->GetOrientation()/10.0, true, false );
708  }
709  else
710  {
711  m_holes.AddSlot( hole_x, -hole_y, hole_drill_w * 2.0, hole_drill_h * 2.0,
712  aPad->GetOrientation()/10.0, true, false );
713 
714  }
715  }
716  else
717  {
718  // Drill a round hole
719  if( pth )
720  {
721  m_holes.AddCircle( hole_x, -hole_y, hole_drill + PLATE_OFFSET, true, true );
722  m_plated_holes.AddCircle( hole_x, -hole_y, hole_drill, true, false );
723  }
724  else
725  {
726  m_holes.AddCircle( hole_x, -hole_y, hole_drill, true, false );
727  }
728 
729  }
730 
731  m_holes.ResetArcParams();
732  m_plated_holes.ResetArcParams();
733  }
734 }
#define PLATE_OFFSET
Definition: exporter_vrml.h:29
VRML_LAYER m_plated_holes
static const double err_approx_max
const wxSize & GetDrillSize() const
Definition: pad.h:243
like PAD_PTH, but not plated
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
Definition: pad.h:349
wxPoint GetPosition() const override
Definition: pad.h:178
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354
PAD_ATTRIB GetAttribute() const
Definition: pad.h:371
VRML_LAYER m_holes
static constexpr int Millimeter2iu(double mm)
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)

References err_approx_max, GetArcToSegmentCount(), PAD::GetAttribute(), PAD::GetDrillShape(), PAD::GetDrillSize(), PAD::GetOrientation(), PAD::GetPosition(), m_BoardToVrmlScale, m_holes, m_plated_holes, Millimeter2iu(), NPTH, PAD_DRILL_SHAPE_OBLONG, and PLATE_OFFSET.

Referenced by ExportVrmlFootprint().

◆ ExportVrmlPolygonSet()

void EXPORTER_PCB_VRML::ExportVrmlPolygonSet ( VRML_LAYER *  aVlayer,
const SHAPE_POLY_SET aOutlines 
)

Definition at line 551 of file export_vrml.cpp.

552 {
553  // Polygons in SHAPE_POLY_SET must be without hole, i.e. holes must be linked
554  // previously to their main outline.
555  for( int icnt = 0; icnt < aOutlines.OutlineCount(); icnt++ )
556  {
557  const SHAPE_LINE_CHAIN& outline = aOutlines.COutline( icnt );
558 
559  int seg = aVlayer->NewContour();
560 
561  for( int jj = 0; jj < outline.PointCount(); jj++ )
562  {
563  if( !aVlayer->AddVertex( seg, outline.CPoint( jj ).x * m_BoardToVrmlScale,
564  -outline.CPoint( jj ).y * m_BoardToVrmlScale ) )
565  throw( std::runtime_error( aVlayer->GetError() ) );
566  }
567 
568  aVlayer->EnsureWinding( seg, false );
569  }
570 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
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 polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SHAPE_LINE_CHAIN & COutline(int aIndex) const

References SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), m_BoardToVrmlScale, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by ExportStandardLayers(), and ExportVrmlSolderMask().

◆ ExportVrmlSolderMask()

void EXPORTER_PCB_VRML::ExportVrmlSolderMask ( )

Definition at line 176 of file export_vrml.cpp.

177 {
178  SHAPE_POLY_SET holes, outlines = m_pcbOutlines;
179 
180  // holes is the solder mask opening.
181  // the actual shape is the negative shape of mask opening.
182  PCB_LAYER_ID pcb_layer = F_Mask;
183  VRML_LAYER* vrmllayer = &m_top_soldermask;
184 
185  for( int lcnt = 0; lcnt < 2; lcnt++ )
186  {
187  holes.RemoveAllContours();
188  outlines.RemoveAllContours();
189  outlines = m_pcbOutlines;
190  m_Pcb->ConvertBrdLayerToPolygonalContours( pcb_layer, holes );
191 
194  ExportVrmlPolygonSet( vrmllayer, outlines );
195 
196  pcb_layer = B_Mask;
197  vrmllayer = &m_bot_soldermask;
198  }
199 }
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
Definition: board.cpp:2174
VRML_LAYER m_bot_soldermask
Represent a set of closed polygons.
VRML_LAYER m_top_soldermask
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
SHAPE_POLY_SET m_pcbOutlines
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
void ExportVrmlPolygonSet(VRML_LAYER *aVlayer, const SHAPE_POLY_SET &aOutlines)

References B_Mask, SHAPE_POLY_SET::BooleanSubtract(), BOARD::ConvertBrdLayerToPolygonalContours(), ExportVrmlPolygonSet(), F_Mask, SHAPE_POLY_SET::Fracture(), m_bot_soldermask, m_Pcb, m_pcbOutlines, m_top_soldermask, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, and SHAPE_POLY_SET::RemoveAllContours().

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

◆ ExportVrmlVia()

void EXPORTER_PCB_VRML::ExportVrmlVia ( const PCB_VIA aVia)

◆ ExportVrmlViaHoles()

void EXPORTER_PCB_VRML::ExportVrmlViaHoles ( )

Definition at line 625 of file export_vrml.cpp.

626 {
627  PCB_LAYER_ID top_layer, bottom_layer;
628 
629  for( PCB_TRACK* track : m_Pcb->Tracks() )
630  {
631  if( track->Type() != PCB_VIA_T )
632  continue;
633 
634  const PCB_VIA* via = static_cast<const PCB_VIA*>( track );
635 
636  via->LayerPair( &top_layer, &bottom_layer );
637 
638  // do not render a buried via
639  if( top_layer != F_Cu && bottom_layer != B_Cu )
640  continue;
641 
642  // Export all via holes to m_holes
643  double hole_radius = via->GetDrillValue() * m_BoardToVrmlScale / 2.0;
644 
645  if( hole_radius <= 0 )
646  continue;
647 
648  double x = via->GetStart().x * m_BoardToVrmlScale;
649  double y = via->GetStart().y * m_BoardToVrmlScale;
650 
651  // Set the optimal number of segments to approximate a circle.
652  // SetArcParams needs a count max, and the minimal and maximal length
653  // of segments
654  int nsides = GetArcToSegmentCount( via->GetDrillValue(),
655  Millimeter2iu( err_approx_max ), 360.0 );
656  double minSegLength = M_PI * 2.0 * hole_radius / nsides;
657  double maxSegLength = minSegLength*2.0;
658 
659  m_holes.SetArcParams( nsides*2, minSegLength, maxSegLength );
660  m_plated_holes.SetArcParams( nsides, minSegLength, maxSegLength );
661 
662  m_holes.AddCircle( x, -y, hole_radius, true, true );
663  m_plated_holes.AddCircle( x, -y, hole_radius, true, false );
664 
665  m_holes.ResetArcParams();
666  m_plated_holes.ResetArcParams();
667  }
668 }
VRML_LAYER m_plated_holes
static const double err_approx_max
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
Definition: layer_ids.h:71
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
VRML_LAYER m_holes
static constexpr int Millimeter2iu(double mm)
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
TRACKS & Tracks()
Definition: board.h:231

References B_Cu, err_approx_max, F_Cu, GetArcToSegmentCount(), m_BoardToVrmlScale, m_holes, m_Pcb, m_plated_holes, Millimeter2iu(), PCB_VIA_T, BOARD::Tracks(), and via.

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

◆ GetColor()

VRML_COLOR& EXPORTER_PCB_VRML::GetColor ( VRML_COLOR_INDEX  aIndex)
inline

Definition at line 109 of file exporter_vrml.h.

110  {
111  return vrml_colors_list[aIndex];
112  }
VRML_COLOR vrml_colors_list[VRML_COLOR_LAST]

References vrml_colors_list.

Referenced by writeLayers().

◆ GetLayer3D()

bool EXPORTER_PCB_VRML::GetLayer3D ( LAYER_NUM  layer,
VRML_LAYER **  vlayer 
)

Definition at line 158 of file export_vrml.cpp.

159 {
160  // select the VRML layer object to draw on; return true if
161  // a layer has been selected.
162  switch( layer )
163  {
164  case B_Cu: *vlayer = &m_bot_copper; return true;
165  case F_Cu: *vlayer = &m_top_copper; return true;
166  case B_SilkS: *vlayer = &m_bot_silk; return true;
167  case F_SilkS: *vlayer = &m_top_silk; return true;
168  case B_Mask: *vlayer = &m_bot_soldermask; return true;
169  case F_Mask: *vlayer = &m_top_soldermask; return true;
170  case B_Paste: *vlayer = &m_bot_paste; return true;
171  case F_Paste: *vlayer = &m_top_paste; return true;
172  default: return false;
173  }
174 }
VRML_LAYER m_top_silk
VRML_LAYER m_top_copper
VRML_LAYER m_bot_silk
VRML_LAYER m_bot_soldermask
VRML_LAYER m_bot_copper
VRML_LAYER m_top_soldermask
Definition: layer_ids.h:71
VRML_LAYER m_bot_paste
VRML_LAYER m_top_paste

References B_Cu, B_Mask, B_Paste, B_SilkS, F_Cu, F_Mask, F_Paste, F_SilkS, m_bot_copper, m_bot_paste, m_bot_silk, m_bot_soldermask, m_top_copper, m_top_paste, m_top_silk, and m_top_soldermask.

◆ GetLayerZ()

double EXPORTER_PCB_VRML::GetLayerZ ( LAYER_NUM  aLayer)
inline

Definition at line 116 of file exporter_vrml.h.

117  {
118  if( unsigned( aLayer ) >= arrayDim( m_layer_z ) )
119  return 0;
120 
121  return m_layer_z[ aLayer ];
122  }
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
double m_layer_z[PCB_LAYER_ID_COUNT]

References arrayDim(), and m_layer_z.

Referenced by ExportVrmlFootprint(), and writeLayers().

◆ getSGColor()

SGNODE * EXPORTER_PCB_VRML::getSGColor ( VRML_COLOR_INDEX  colorIdx)
private

Definition at line 1098 of file export_vrml.cpp.

1099 {
1100  if( colorIdx == -1 )
1101  colorIdx = VRML_COLOR_PCB;
1102  else if( colorIdx == VRML_COLOR_LAST )
1103  return nullptr;
1104 
1105  if( m_sgmaterial[colorIdx] )
1106  return m_sgmaterial[colorIdx];
1107 
1108  IFSG_APPEARANCE vcolor( (SGNODE*) nullptr );
1109  VRML_COLOR* cp = &vrml_colors_list[colorIdx];
1110 
1111  vcolor.SetSpecular( cp->spec_red, cp->spec_grn, cp->spec_blu );
1112  vcolor.SetDiffuse( cp->diffuse_red, cp->diffuse_grn, cp->diffuse_blu );
1113  vcolor.SetShininess( cp->shiny );
1114  // NOTE: XXX - replace with a better equation; using this definition
1115  // of ambient will not yield the best results
1116  vcolor.SetAmbient( cp->ambient, cp->ambient, cp->ambient );
1117  vcolor.SetTransparency( cp->transp );
1118 
1119  m_sgmaterial[colorIdx] = vcolor.GetRawPtr();
1120 
1121  return m_sgmaterial[colorIdx];
1122 }
float transp
Definition: exporter_vrml.h:59
VRML_COLOR vrml_colors_list[VRML_COLOR_LAST]
The base class of all Scene Graph nodes.
Definition: sg_node.h:74
float spec_blu
Definition: exporter_vrml.h:52
float ambient
Definition: exporter_vrml.h:58
float diffuse_grn
Definition: exporter_vrml.h:47
float spec_red
Definition: exporter_vrml.h:50
SGNODE * m_sgmaterial[VRML_COLOR_LAST]
float spec_grn
Definition: exporter_vrml.h:51
float diffuse_red
Definition: exporter_vrml.h:46
float diffuse_blu
Definition: exporter_vrml.h:48

References VRML_COLOR::ambient, VRML_COLOR::diffuse_blu, VRML_COLOR::diffuse_grn, VRML_COLOR::diffuse_red, IFSG_NODE::GetRawPtr(), m_sgmaterial, IFSG_APPEARANCE::SetAmbient(), IFSG_APPEARANCE::SetDiffuse(), IFSG_APPEARANCE::SetShininess(), IFSG_APPEARANCE::SetSpecular(), IFSG_APPEARANCE::SetTransparency(), VRML_COLOR::shiny, VRML_COLOR::spec_blu, VRML_COLOR::spec_grn, VRML_COLOR::spec_red, VRML_COLOR::transp, VRML_COLOR_LAST, VRML_COLOR_PCB, and vrml_colors_list.

Referenced by create_vrml_plane(), and create_vrml_shell().

◆ SetLayerZ()

void EXPORTER_PCB_VRML::SetLayerZ ( LAYER_NUM  aLayer,
double  aValue 
)
inline

Definition at line 124 of file exporter_vrml.h.

125  {
126  m_layer_z[aLayer] = aValue;
127  }
double m_layer_z[PCB_LAYER_ID_COUNT]

References m_layer_z.

Referenced by ComputeLayer3D_Zpos().

◆ SetOffset()

void EXPORTER_PCB_VRML::SetOffset ( double  aXoff,
double  aYoff 
)

Definition at line 139 of file export_vrml.cpp.

140 {
141  m_tx = aXoff;
142  m_ty = -aYoff;
143 
144  m_holes.SetVertexOffsets( aXoff, aYoff );
145  m_3D_board.SetVertexOffsets( aXoff, aYoff );
146  m_top_copper.SetVertexOffsets( aXoff, aYoff );
147  m_bot_copper.SetVertexOffsets( aXoff, aYoff );
148  m_top_silk.SetVertexOffsets( aXoff, aYoff );
149  m_bot_silk.SetVertexOffsets( aXoff, aYoff );
150  m_top_paste.SetVertexOffsets( aXoff, aYoff );
151  m_bot_paste.SetVertexOffsets( aXoff, aYoff );
152  m_top_soldermask.SetVertexOffsets( aXoff, aYoff );
153  m_bot_soldermask.SetVertexOffsets( aXoff, aYoff );
154  m_plated_holes.SetVertexOffsets( aXoff, aYoff );
155 }
VRML_LAYER m_plated_holes
VRML_LAYER m_top_silk
VRML_LAYER m_top_copper
VRML_LAYER m_bot_silk
VRML_LAYER m_bot_soldermask
VRML_LAYER m_bot_copper
VRML_LAYER m_top_soldermask
VRML_LAYER m_bot_paste
VRML_LAYER m_holes
VRML_LAYER m_top_paste
VRML_LAYER m_3D_board

References m_3D_board, m_bot_copper, m_bot_paste, m_bot_silk, m_bot_soldermask, m_holes, m_plated_holes, m_top_copper, m_top_paste, m_top_silk, m_top_soldermask, m_tx, and m_ty.

Referenced by EXPORTER_PCB_VRML(), and PCB_EDIT_FRAME::ExportVRML_File().

◆ SetScale()

bool EXPORTER_PCB_VRML::SetScale ( double  aWorldScale)

Definition at line 126 of file export_vrml.cpp.

127 {
128  // set the scaling of the VRML world
129  if( aWorldScale < 0.001 || aWorldScale > 10.0 )
130  throw( std::runtime_error( "WorldScale out of range (valid range is 0.001 to 10.0)" ) );
131 
132  m_OutputPCB.SetScale( aWorldScale * 2.54 );
133  m_WorldScale = aWorldScale * 2.54;
134 
135  return true;
136 }
IFSG_TRANSFORM m_OutputPCB
bool SetScale(const SGPOINT &aScale) noexcept

References m_OutputPCB, m_WorldScale, and IFSG_TRANSFORM::SetScale().

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

◆ write_triangle_bag()

void EXPORTER_PCB_VRML::write_triangle_bag ( std::ostream &  aOut_file,
const VRML_COLOR aColor,
VRML_LAYER *  aLayer,
bool  aPlane,
bool  aTop,
double  aTop_z,
double  aBottom_z 
)
private

Definition at line 234 of file export_vrml.cpp.

237 {
238  // A lot of nodes are not required, but blender sometimes chokes without them.
239  static const char* shape_boiler[] =
240  {
241  "Transform {\n",
242  " children [\n",
243  " Group {\n",
244  " children [\n",
245  " Shape {\n",
246  " appearance Appearance {\n",
247  " material Material {\n",
248  0, // Material marker
249  " }\n",
250  " }\n",
251  " geometry IndexedFaceSet {\n",
252  " solid TRUE\n",
253  " coord Coordinate {\n",
254  " point [\n",
255  0, // Coordinates marker
256  " ]\n",
257  " }\n",
258  " coordIndex [\n",
259  0, // Index marker
260  " ]\n",
261  " }\n",
262  " }\n",
263  " ]\n",
264  " }\n",
265  " ]\n",
266  "}\n",
267  0 // End marker
268  };
269 
270  int marker_found = 0, lineno = 0;
271 
272  while( marker_found < 4 )
273  {
274  if( shape_boiler[lineno] )
275  {
276  aOut_file << shape_boiler[lineno];
277  }
278  else
279  {
280  marker_found++;
281 
282  switch( marker_found )
283  {
284  case 1: // Material marker
285  {
286  std::streamsize lastPrecision = aOut_file.precision();
287  aOut_file << " diffuseColor " << std::setprecision(3);
288  aOut_file << aColor.diffuse_red << " ";
289  aOut_file << aColor.diffuse_grn << " ";
290  aOut_file << aColor.diffuse_blu << "\n";
291 
292  aOut_file << " specularColor ";
293  aOut_file << aColor.spec_red << " ";
294  aOut_file << aColor.spec_grn << " ";
295  aOut_file << aColor.spec_blu << "\n";
296 
297  aOut_file << " emissiveColor ";
298  aOut_file << aColor.emit_red << " ";
299  aOut_file << aColor.emit_grn << " ";
300  aOut_file << aColor.emit_blu << "\n";
301 
302  aOut_file << " ambientIntensity " << aColor.ambient << "\n";
303  aOut_file << " transparency " << aColor.transp << "\n";
304  aOut_file << " shininess " << aColor.shiny << "\n";
305  aOut_file.precision( lastPrecision );
306  }
307  break;
308 
309  case 2:
310 
311  if( aPlane )
312  aLayer->WriteVertices( aTop_z, aOut_file, m_precision );
313  else
314  aLayer->Write3DVertices( aTop_z, aBottom_z, aOut_file, m_precision );
315 
316  aOut_file << "\n";
317  break;
318 
319  case 3:
320 
321  if( aPlane )
322  aLayer->WriteIndices( aTop, aOut_file );
323  else
324  aLayer->Write3DIndices( aOut_file );
325 
326  aOut_file << "\n";
327  break;
328 
329  default:
330  break;
331  }
332  }
333 
334  lineno++;
335  }
336 }
float transp
Definition: exporter_vrml.h:59
float spec_blu
Definition: exporter_vrml.h:52
float ambient
Definition: exporter_vrml.h:58
float diffuse_grn
Definition: exporter_vrml.h:47
float spec_red
Definition: exporter_vrml.h:50
float spec_grn
Definition: exporter_vrml.h:51
float emit_grn
Definition: exporter_vrml.h:55
float emit_blu
Definition: exporter_vrml.h:56
float diffuse_red
Definition: exporter_vrml.h:46
float emit_red
Definition: exporter_vrml.h:54
float diffuse_blu
Definition: exporter_vrml.h:48

References VRML_COLOR::ambient, VRML_COLOR::diffuse_blu, VRML_COLOR::diffuse_grn, VRML_COLOR::diffuse_red, VRML_COLOR::emit_blu, VRML_COLOR::emit_grn, VRML_COLOR::emit_red, m_precision, VRML_COLOR::shiny, VRML_COLOR::spec_blu, VRML_COLOR::spec_grn, VRML_COLOR::spec_red, and VRML_COLOR::transp.

Referenced by writeLayers().

◆ writeLayers()

void EXPORTER_PCB_VRML::writeLayers ( const char *  aFileName,
OSTREAM aOutputFile 
)

Definition at line 339 of file export_vrml.cpp.

340 {
341  // VRML_LAYER board;
342  m_3D_board.Tesselate( &m_holes );
343  double brdz = m_brd_thickness / 2.0
345 
347  {
348  write_triangle_bag( *aOutputFile, GetColor( VRML_COLOR_PCB ),
349  &m_3D_board, false, false, brdz, -brdz );
350  }
351  else
352  {
354  }
355 
356  // VRML_LAYER m_top_copper;
357  m_top_copper.Tesselate( &m_holes );
358 
360  {
362  &m_top_copper, true, true, GetLayerZ( F_Cu ), 0 );
363  }
364  else
365  {
367  GetLayerZ( F_Cu ), true );
368  }
369 
370  // VRML_LAYER m_top_paste;
371  m_top_paste.Tesselate( &m_holes );
372 
374  {
375  write_triangle_bag( *aOutputFile, GetColor( VRML_COLOR_PASTE ),
376  &m_top_paste, true, true,
377  GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) *
379  0 );
380  }
381  else
382  {
384  GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) *
386  true );
387  }
388 
389  // VRML_LAYER m_top_soldermask;
390  m_top_soldermask.Tesselate( &m_holes );
391 
393  {
395  &m_top_soldermask, true, true,
396  GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) *
398  0 );
399  }
400  else
401  {
403  GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) *
405  true );
406  }
407 
408  // VRML_LAYER m_bot_copper;
409  m_bot_copper.Tesselate( &m_holes );
410 
412  {
414  &m_bot_copper, true, false, GetLayerZ( B_Cu ), 0 );
415  }
416  else
417  {
419  GetLayerZ( B_Cu ), false );
420  }
421 
422  // VRML_LAYER m_bot_paste;
423  m_bot_paste.Tesselate( &m_holes );
424 
426  {
427  write_triangle_bag( *aOutputFile, GetColor( VRML_COLOR_PASTE ),
428  &m_bot_paste, true, false,
429  GetLayerZ( B_Cu )
431  0 );
432  }
433  else
434  {
436  GetLayerZ( B_Cu ) - Millimeter2iu( ART_OFFSET / 2.0 ) *
438  false );
439  }
440 
441  // VRML_LAYER m_bot_mask:
442  m_bot_soldermask.Tesselate( &m_holes );
443 
445  {
447  &m_bot_soldermask, true, false,
448  GetLayerZ( B_Cu ) - Millimeter2iu( ART_OFFSET / 2.0 ) *
450  0 );
451  }
452  else
453  {
455  GetLayerZ( B_Cu ) - Millimeter2iu( ART_OFFSET / 2.0 ) *
457  false );
458  }
459 
460  // VRML_LAYER PTH;
461  m_plated_holes.Tesselate( nullptr, true );
462 
464  {
465  write_triangle_bag( *aOutputFile, GetColor( VRML_COLOR_PASTE ),
466  &m_plated_holes, false, false,
467  GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) *
469  GetLayerZ( B_Cu ) - Millimeter2iu( ART_OFFSET / 2.0 ) *
471  }
472  else
473  {
475  GetLayerZ( F_Cu ) + Millimeter2iu( ART_OFFSET / 2.0 ) *
477  GetLayerZ( B_Cu ) - Millimeter2iu( ART_OFFSET / 2.0 ) *
479  }
480 
481  // VRML_LAYER m_top_silk;
482  m_top_silk.Tesselate( &m_holes );
483 
485  {
487  true, true, GetLayerZ( F_SilkS ), 0 );
488  }
489  else
490  {
492  GetLayerZ( F_SilkS ), true );
493  }
494 
495  // VRML_LAYER m_bot_silk;
496  m_bot_silk.Tesselate( &m_holes );
497 
499  {
501  true, false, GetLayerZ( B_SilkS ), 0 );
502  }
503  else
504  {
506  GetLayerZ( B_SilkS ), false );
507  }
508 
510  S3D::WriteVRML( aFileName, true, m_OutputPCB.GetRawPtr(), true, true );
511 }
IFSG_TRANSFORM m_OutputPCB
VRML_LAYER m_plated_holes
double GetLayerZ(LAYER_NUM aLayer)
SGNODE * GetRawPtr(void) noexcept
Function GetRawPtr() returns the raw internal SGNODE pointer.
Definition: ifsg_node.cpp:65
VRML_LAYER m_top_silk
VRML_LAYER m_top_copper
VRML_LAYER m_bot_silk
VRML_LAYER m_bot_soldermask
SGLIB_API bool WriteVRML(const char *filename, bool overwrite, SGNODE *aTopNode, bool reuse, bool renameNodes)
Function WriteVRML writes out the given node and its subnodes to a VRML2 file.
Definition: ifsg_api.cpp:76
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)
VRML_LAYER m_bot_copper
VRML_LAYER m_top_soldermask
VRML_COLOR & GetColor(VRML_COLOR_INDEX aIndex)
void create_vrml_shell(IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double top_z, double bottom_z)
void create_vrml_plane(IFSG_TRANSFORM &PcbOutput, VRML_COLOR_INDEX colorID, VRML_LAYER *layer, double aHeight, bool aTopPlane)
Definition: layer_ids.h:71
VRML_LAYER m_bot_paste
VRML_LAYER m_holes
VRML_LAYER m_top_paste
static constexpr int Millimeter2iu(double mm)
VRML_LAYER m_3D_board
#define ART_OFFSET
Definition: exporter_vrml.h:27
bool m_UseInlineModelsInBrdfile

References ART_OFFSET, B_Cu, B_SilkS, create_vrml_plane(), create_vrml_shell(), F_Cu, F_SilkS, GetColor(), GetLayerZ(), IFSG_NODE::GetRawPtr(), m_3D_board, m_BoardToVrmlScale, m_bot_copper, m_bot_paste, m_bot_silk, m_bot_soldermask, m_brd_thickness, m_holes, m_OutputPCB, m_plated_holes, m_top_copper, m_top_paste, m_top_silk, m_top_soldermask, m_UseInlineModelsInBrdfile, Millimeter2iu(), VRML_COLOR_COPPER, VRML_COLOR_PASTE, VRML_COLOR_PCB, VRML_COLOR_SILK, VRML_COLOR_SOLDMASK, write_triangle_bag(), and S3D::WriteVRML().

Referenced by ExportFp3DModelsAsLinkedFile(), and PCB_EDIT_FRAME::ExportVRML_File().

Member Data Documentation

◆ m_3D_board

VRML_LAYER EXPORTER_PCB_VRML::m_3D_board

Definition at line 182 of file exporter_vrml.h.

Referenced by ExportVrmlBoard(), SetOffset(), and writeLayers().

◆ m_BoardToVrmlScale

◆ m_bot_copper

VRML_LAYER EXPORTER_PCB_VRML::m_bot_copper

Definition at line 184 of file exporter_vrml.h.

Referenced by ExportStandardLayers(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_bot_paste

VRML_LAYER EXPORTER_PCB_VRML::m_bot_paste

Definition at line 190 of file exporter_vrml.h.

Referenced by ExportStandardLayers(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_bot_silk

VRML_LAYER EXPORTER_PCB_VRML::m_bot_silk

Definition at line 186 of file exporter_vrml.h.

Referenced by ExportStandardLayers(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_bot_soldermask

VRML_LAYER EXPORTER_PCB_VRML::m_bot_soldermask

Definition at line 188 of file exporter_vrml.h.

Referenced by ExportVrmlSolderMask(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_brd_thickness

double EXPORTER_PCB_VRML::m_brd_thickness

Definition at line 222 of file exporter_vrml.h.

Referenced by ComputeLayer3D_Zpos(), EXPORTER_PCB_VRML(), and writeLayers().

◆ m_Cache3Dmodels

S3D_CACHE* EXPORTER_PCB_VRML::m_Cache3Dmodels

◆ m_components

std::list< SGNODE* > EXPORTER_PCB_VRML::m_components

Definition at line 193 of file exporter_vrml.h.

Referenced by ExportVrmlFootprint(), and ~EXPORTER_PCB_VRML().

◆ m_holes

VRML_LAYER EXPORTER_PCB_VRML::m_holes

◆ m_layer_z

double EXPORTER_PCB_VRML::m_layer_z[PCB_LAYER_ID_COUNT]
private

Definition at line 226 of file exporter_vrml.h.

Referenced by EXPORTER_PCB_VRML(), GetLayerZ(), and SetLayerZ().

◆ m_OutputPCB

IFSG_TRANSFORM EXPORTER_PCB_VRML::m_OutputPCB

Definition at line 180 of file exporter_vrml.h.

Referenced by ExportVrmlFootprint(), SetScale(), writeLayers(), and ~EXPORTER_PCB_VRML().

◆ m_Pcb

◆ m_pcbOutlines

SHAPE_POLY_SET EXPORTER_PCB_VRML::m_pcbOutlines
private

Definition at line 227 of file exporter_vrml.h.

Referenced by ExportVrmlBoard(), and ExportVrmlSolderMask().

◆ m_plated_holes

VRML_LAYER EXPORTER_PCB_VRML::m_plated_holes

Definition at line 191 of file exporter_vrml.h.

Referenced by ExportVrmlPadHole(), ExportVrmlViaHoles(), SetOffset(), and writeLayers().

◆ m_precision

int EXPORTER_PCB_VRML::m_precision
private

◆ m_ReuseDef

bool EXPORTER_PCB_VRML::m_ReuseDef

Definition at line 211 of file exporter_vrml.h.

Referenced by EXPORTER_PCB_VRML(), and ExportVrmlFootprint().

◆ m_sgmaterial

SGNODE* EXPORTER_PCB_VRML::m_sgmaterial[VRML_COLOR_LAST]
private

Definition at line 231 of file exporter_vrml.h.

Referenced by EXPORTER_PCB_VRML(), getSGColor(), and ~EXPORTER_PCB_VRML().

◆ m_Subdir3DFpModels

wxString EXPORTER_PCB_VRML::m_Subdir3DFpModels

◆ m_top_copper

VRML_LAYER EXPORTER_PCB_VRML::m_top_copper

Definition at line 183 of file exporter_vrml.h.

Referenced by ExportStandardLayers(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_top_paste

VRML_LAYER EXPORTER_PCB_VRML::m_top_paste

Definition at line 189 of file exporter_vrml.h.

Referenced by ExportStandardLayers(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_top_silk

VRML_LAYER EXPORTER_PCB_VRML::m_top_silk

Definition at line 185 of file exporter_vrml.h.

Referenced by ExportStandardLayers(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_top_soldermask

VRML_LAYER EXPORTER_PCB_VRML::m_top_soldermask

Definition at line 187 of file exporter_vrml.h.

Referenced by ExportVrmlSolderMask(), GetLayer3D(), SetOffset(), and writeLayers().

◆ m_tx

double EXPORTER_PCB_VRML::m_tx

Definition at line 219 of file exporter_vrml.h.

Referenced by ExportVrmlFootprint(), and SetOffset().

◆ m_ty

double EXPORTER_PCB_VRML::m_ty

Definition at line 220 of file exporter_vrml.h.

Referenced by ExportVrmlFootprint(), and SetOffset().

◆ m_UseInlineModelsInBrdfile

bool EXPORTER_PCB_VRML::m_UseInlineModelsInBrdfile

◆ m_UseRelPathIn3DModelFilename

bool EXPORTER_PCB_VRML::m_UseRelPathIn3DModelFilename

◆ m_WorldScale

double EXPORTER_PCB_VRML::m_WorldScale = 1.0

Definition at line 214 of file exporter_vrml.h.

Referenced by EXPORTER_PCB_VRML(), ExportFp3DModelsAsLinkedFile(), and SetScale().

◆ vrml_colors_list

VRML_COLOR EXPORTER_PCB_VRML::vrml_colors_list[VRML_COLOR_LAST]
private

Definition at line 225 of file exporter_vrml.h.

Referenced by EXPORTER_PCB_VRML(), GetColor(), and getSGColor().


The documentation for this class was generated from the following files: