KiCad PCB EDA Suite
MODEL_VRML Class Reference

Public Member Functions

 MODEL_VRML ()
 
 ~MODEL_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)
 

Public Attributes

IFSG_TRANSFORM m_OutputPCB
 
VRML_LAYER m_holes
 
VRML_LAYER m_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_tin
 
VRML_LAYER m_bot_tin
 
VRML_LAYER m_plated_holes
 
std::list< SGNODE * > m_components
 
bool m_plainPCB
 
double m_minLineWidth
 
double m_tx
 
double m_ty
 
double m_brd_thickness
 
LAYER_NUM m_text_layer
 
int m_text_width
 

Private Attributes

double m_layer_z [PCB_LAYER_ID_COUNT]
 
int m_iMaxSeg
 
double m_arcMinLen
 
double m_arcMaxLen
 

Detailed Description

Definition at line 142 of file export_vrml.cpp.

Constructor & Destructor Documentation

MODEL_VRML::MODEL_VRML ( )
inline

Definition at line 176 of file export_vrml.cpp.

References DIM, F_Cu, MIN_VRML_LINEWIDTH, VRML_COLOR::VRML_COLOR(), VRML_COLOR_PCB, VRML_COLOR_SILK, VRML_COLOR_TIN, and VRML_COLOR_TRACK.

176  : m_OutputPCB( (SGNODE*) NULL )
177  {
178  for( unsigned i = 0; i < DIM( m_layer_z ); ++i )
179  m_layer_z[i] = 0;
180 
181  m_holes.GetArcParams( m_iMaxSeg, m_arcMinLen, m_arcMaxLen );
182 
183  // this default only makes sense if the output is in mm
184  m_brd_thickness = 1.6;
185 
186  // pcb green
187  colors[ VRML_COLOR_PCB ] = VRML_COLOR( .07, .3, .12, .01, .03, .01,
188  0, 0, 0, 0.8, 0, 0.02 );
189  // track green
190  colors[ VRML_COLOR_TRACK ] = VRML_COLOR( .08, .5, .1, .01, .05, .01,
191  0, 0, 0, 0.8, 0, 0.02 );
192  // silkscreen white
193  colors[ VRML_COLOR_SILK ] = VRML_COLOR( .9, .9, .9, .1, .1, .1,
194  0, 0, 0, 0.9, 0, 0.02 );
195  // pad silver
196  colors[ VRML_COLOR_TIN ] = VRML_COLOR( .749, .756, .761, .749, .756, .761,
197  0, 0, 0, 0.8, 0, 0.8 );
198 
199  m_plainPCB = false;
200  SetOffset( 0.0, 0.0 );
201  m_text_layer = F_Cu;
202  m_text_width = 1;
204  }
#define DIM(x)
of elements in an array
Definition: macros.h:98
VRML_LAYER m_holes
void SetOffset(double aXoff, double aYoff)
Class SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
IFSG_TRANSFORM m_OutputPCB
double m_layer_z[PCB_LAYER_ID_COUNT]
#define MIN_VRML_LINEWIDTH
Definition: export_vrml.cpp:55
LAYER_NUM m_text_layer
double m_arcMinLen
double m_arcMaxLen
double m_brd_thickness
double m_minLineWidth
static VRML_COLOR colors[VRML_COLOR_LAST]
MODEL_VRML::~MODEL_VRML ( )
inline

Definition at line 206 of file export_vrml.cpp.

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

207  {
208  // destroy any unassociated material appearances
209  for( int j = 0; j < VRML_COLOR_LAST; ++j )
210  {
211  if( sgmaterial[j] && NULL == S3D::GetSGNodeParent( sgmaterial[j] ) )
213 
214  sgmaterial[j] = NULL;
215  }
216 
217  if( !m_components.empty() )
218  {
219  IFSG_TRANSFORM tmp( false );
220 
221  for( auto i : m_components )
222  {
223  tmp.Attach( i );
224  tmp.SetParent( NULL );
225  }
226 
227  m_components.clear();
229  }
230  }
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:636
static SGNODE * sgmaterial[VRML_COLOR_LAST]
IFSG_TRANSFORM m_OutputPCB
std::list< SGNODE * > m_components
Class IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH...
SGLIB_API void DestroyNode(SGNODE *aNode)
Function DestroyNode deletes the given SG* class node.
Definition: ifsg_api.cpp:210
void Destroy(void)
Function Destroy deletes the object held by this wrapper.
Definition: ifsg_node.cpp:54

Member Function Documentation

VRML_COLOR& MODEL_VRML::GetColor ( VRML_COLOR_INDEX  aIndex)
inline

Definition at line 232 of file export_vrml.cpp.

Referenced by write_layers().

233  {
234  return colors[aIndex];
235  }
static VRML_COLOR colors[VRML_COLOR_LAST]
double MODEL_VRML::GetLayerZ ( LAYER_NUM  aLayer)
inline

Definition at line 253 of file export_vrml.cpp.

References DIM.

Referenced by export_vrml_module(), and write_layers().

254  {
255  if( unsigned( aLayer ) >= DIM( m_layer_z ) )
256  return 0;
257 
258  return m_layer_z[ aLayer ];
259  }
#define DIM(x)
of elements in an array
Definition: macros.h:98
double m_layer_z[PCB_LAYER_ID_COUNT]
void MODEL_VRML::SetLayerZ ( LAYER_NUM  aLayer,
double  aValue 
)
inline

Definition at line 261 of file export_vrml.cpp.

Referenced by compute_layer_Zs().

262  {
263  m_layer_z[aLayer] = aValue;
264  }
double m_layer_z[PCB_LAYER_ID_COUNT]
void MODEL_VRML::SetOffset ( double  aXoff,
double  aYoff 
)
inline

Definition at line 237 of file export_vrml.cpp.

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

238  {
239  m_tx = aXoff;
240  m_ty = -aYoff;
241 
242  m_holes.SetVertexOffsets( aXoff, aYoff );
243  m_board.SetVertexOffsets( aXoff, aYoff );
244  m_top_copper.SetVertexOffsets( aXoff, aYoff );
245  m_bot_copper.SetVertexOffsets( aXoff, aYoff );
246  m_top_silk.SetVertexOffsets( aXoff, aYoff );
247  m_bot_silk.SetVertexOffsets( aXoff, aYoff );
248  m_top_tin.SetVertexOffsets( aXoff, aYoff );
249  m_bot_tin.SetVertexOffsets( aXoff, aYoff );
250  m_plated_holes.SetVertexOffsets( aXoff, aYoff );
251  }
VRML_LAYER m_bot_tin
VRML_LAYER m_plated_holes
VRML_LAYER m_holes
VRML_LAYER m_bot_silk
VRML_LAYER m_top_silk
VRML_LAYER m_board
VRML_LAYER m_bot_copper
VRML_LAYER m_top_copper
VRML_LAYER m_top_tin
bool MODEL_VRML::SetScale ( double  aWorldScale)
inline

Definition at line 267 of file export_vrml.cpp.

References IFSG_TRANSFORM::SetScale(), and WORLD_SCALE.

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

268  {
269  if( aWorldScale < 0.001 || aWorldScale > 10.0 )
270  throw( std::runtime_error( "WorldScale out of range (valid range is 0.001 to 10.0)" ) );
271 
272  m_OutputPCB.SetScale( aWorldScale * 2.54 );
273  WORLD_SCALE = aWorldScale * 2.54;
274 
275  return true;
276  }
static double WORLD_SCALE
Definition: export_vrml.cpp:66
bool SetScale(const SGPOINT &aScale)
IFSG_TRANSFORM m_OutputPCB

Member Data Documentation

double MODEL_VRML::m_arcMaxLen
private

Definition at line 148 of file export_vrml.cpp.

double MODEL_VRML::m_arcMinLen
private

Definition at line 148 of file export_vrml.cpp.

VRML_LAYER MODEL_VRML::m_board

Definition at line 153 of file export_vrml.cpp.

Referenced by export_vrml_board(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_copper

Definition at line 155 of file export_vrml.cpp.

Referenced by export_round_padstack(), GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_silk

Definition at line 157 of file export_vrml.cpp.

Referenced by GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_tin

Definition at line 159 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

double MODEL_VRML::m_brd_thickness

Definition at line 171 of file export_vrml.cpp.

Referenced by compute_layer_Zs(), and write_layers().

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

Definition at line 162 of file export_vrml.cpp.

Referenced by export_vrml_module().

VRML_LAYER MODEL_VRML::m_holes
int MODEL_VRML::m_iMaxSeg
private

Definition at line 147 of file export_vrml.cpp.

double MODEL_VRML::m_layer_z[PCB_LAYER_ID_COUNT]
private

Definition at line 145 of file export_vrml.cpp.

double MODEL_VRML::m_minLineWidth

Definition at line 166 of file export_vrml.cpp.

Referenced by export_vrml_arc(), export_vrml_circle(), and export_vrml_line().

IFSG_TRANSFORM MODEL_VRML::m_OutputPCB

Definition at line 151 of file export_vrml.cpp.

Referenced by export_vrml_module(), and write_layers().

VRML_LAYER MODEL_VRML::m_plated_holes

Definition at line 160 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

LAYER_NUM MODEL_VRML::m_text_layer
int MODEL_VRML::m_text_width
VRML_LAYER MODEL_VRML::m_top_copper

Definition at line 154 of file export_vrml.cpp.

Referenced by export_round_padstack(), GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_top_silk

Definition at line 156 of file export_vrml.cpp.

Referenced by GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_top_tin

Definition at line 158 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

double MODEL_VRML::m_tx

Definition at line 168 of file export_vrml.cpp.

Referenced by export_vrml_module().

double MODEL_VRML::m_ty

Definition at line 169 of file export_vrml.cpp.

Referenced by export_vrml_module().


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