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 140 of file export_vrml.cpp.

Constructor & Destructor Documentation

MODEL_VRML::MODEL_VRML ( )
inline

Definition at line 174 of file export_vrml.cpp.

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

174  : m_OutputPCB( (SGNODE*) NULL )
175  {
176  for( unsigned i = 0; i < DIM( m_layer_z ); ++i )
177  m_layer_z[i] = 0;
178 
179  m_holes.GetArcParams( m_iMaxSeg, m_arcMinLen, m_arcMaxLen );
180 
181  // this default only makes sense if the output is in mm
182  m_brd_thickness = 1.6;
183 
184  // pcb green
185  colors[ VRML_COLOR_PCB ] = VRML_COLOR( .07, .3, .12, .01, .03, .01,
186  0, 0, 0, 0.8, 0, 0.02 );
187  // track green
188  colors[ VRML_COLOR_TRACK ] = VRML_COLOR( .08, .5, .1, .01, .05, .01,
189  0, 0, 0, 0.8, 0, 0.02 );
190  // silkscreen white
191  colors[ VRML_COLOR_SILK ] = VRML_COLOR( .9, .9, .9, .1, .1, .1,
192  0, 0, 0, 0.9, 0, 0.02 );
193  // pad silver
194  colors[ VRML_COLOR_TIN ] = VRML_COLOR( .749, .756, .761, .749, .756, .761,
195  0, 0, 0, 0.8, 0, 0.8 );
196 
197  m_plainPCB = false;
198  SetOffset( 0.0, 0.0 );
199  m_text_layer = F_Cu;
200  m_text_width = 1;
202  }
#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:53
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 204 of file export_vrml.cpp.

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

205  {
206  // destroy any unassociated material appearances
207  for( int j = 0; j < VRML_COLOR_LAST; ++j )
208  {
209  if( sgmaterial[j] && NULL == S3D::GetSGNodeParent( sgmaterial[j] ) )
211 
212  sgmaterial[j] = NULL;
213  }
214 
215  if( !m_components.empty() )
216  {
217  IFSG_TRANSFORM tmp( false );
218 
219  for( auto i : m_components )
220  {
221  tmp.Attach( i );
222  tmp.SetParent( NULL );
223  }
224 
225  m_components.clear();
227  }
228  }
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:643
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:214
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 230 of file export_vrml.cpp.

Referenced by write_layers().

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

Definition at line 251 of file export_vrml.cpp.

References DIM.

Referenced by export_vrml_module(), and write_layers().

252  {
253  if( unsigned( aLayer ) >= DIM( m_layer_z ) )
254  return 0;
255 
256  return m_layer_z[ aLayer ];
257  }
#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 259 of file export_vrml.cpp.

Referenced by compute_layer_Zs().

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

Definition at line 235 of file export_vrml.cpp.

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

236  {
237  m_tx = aXoff;
238  m_ty = -aYoff;
239 
240  m_holes.SetVertexOffsets( aXoff, aYoff );
241  m_board.SetVertexOffsets( aXoff, aYoff );
242  m_top_copper.SetVertexOffsets( aXoff, aYoff );
243  m_bot_copper.SetVertexOffsets( aXoff, aYoff );
244  m_top_silk.SetVertexOffsets( aXoff, aYoff );
245  m_bot_silk.SetVertexOffsets( aXoff, aYoff );
246  m_top_tin.SetVertexOffsets( aXoff, aYoff );
247  m_bot_tin.SetVertexOffsets( aXoff, aYoff );
248  m_plated_holes.SetVertexOffsets( aXoff, aYoff );
249  }
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 265 of file export_vrml.cpp.

References IFSG_TRANSFORM::SetScale(), and WORLD_SCALE.

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

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

Member Data Documentation

double MODEL_VRML::m_arcMaxLen
private

Definition at line 146 of file export_vrml.cpp.

double MODEL_VRML::m_arcMinLen
private

Definition at line 146 of file export_vrml.cpp.

VRML_LAYER MODEL_VRML::m_board

Definition at line 151 of file export_vrml.cpp.

Referenced by export_vrml_board(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_copper

Definition at line 153 of file export_vrml.cpp.

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

VRML_LAYER MODEL_VRML::m_bot_silk

Definition at line 155 of file export_vrml.cpp.

Referenced by GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_tin

Definition at line 157 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

double MODEL_VRML::m_brd_thickness

Definition at line 169 of file export_vrml.cpp.

Referenced by compute_layer_Zs(), and write_layers().

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

Definition at line 160 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 145 of file export_vrml.cpp.

double MODEL_VRML::m_layer_z[PCB_LAYER_ID_COUNT]
private

Definition at line 143 of file export_vrml.cpp.

double MODEL_VRML::m_minLineWidth

Definition at line 164 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 149 of file export_vrml.cpp.

Referenced by export_vrml_module(), and write_layers().

VRML_LAYER MODEL_VRML::m_plated_holes

Definition at line 158 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 152 of file export_vrml.cpp.

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

VRML_LAYER MODEL_VRML::m_top_silk

Definition at line 154 of file export_vrml.cpp.

Referenced by GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_top_tin

Definition at line 156 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

double MODEL_VRML::m_tx

Definition at line 166 of file export_vrml.cpp.

Referenced by export_vrml_module().

double MODEL_VRML::m_ty

Definition at line 167 of file export_vrml.cpp.

Referenced by export_vrml_module().


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