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

Constructor & Destructor Documentation

◆ MODEL_VRML()

MODEL_VRML::MODEL_VRML ( )
inline

Definition at line 178 of file export_vrml.cpp.

178  : m_OutputPCB( (SGNODE*) NULL )
179  {
180  for( unsigned i = 0; i < arrayDim( m_layer_z ); ++i )
181  m_layer_z[i] = 0;
182 
183  m_holes.GetArcParams( m_iMaxSeg, m_arcMinLen, m_arcMaxLen );
184 
185  // this default only makes sense if the output is in mm
186  m_brd_thickness = 1.6;
187 
188  // pcb green
189  colors[ VRML_COLOR_PCB ] = VRML_COLOR( .07, .3, .12, .01, .03, .01,
190  0, 0, 0, 0.8, 0, 0.02 );
191  // track green
192  colors[ VRML_COLOR_TRACK ] = VRML_COLOR( .08, .5, .1, .01, .05, .01,
193  0, 0, 0, 0.8, 0, 0.02 );
194  // silkscreen white
195  colors[ VRML_COLOR_SILK ] = VRML_COLOR( .9, .9, .9, .1, .1, .1,
196  0, 0, 0, 0.9, 0, 0.02 );
197  // pad silver
198  colors[ VRML_COLOR_TIN ] = VRML_COLOR( .749, .756, .761, .749, .756, .761,
199  0, 0, 0, 0.8, 0, 0.8 );
200 
201  m_plainPCB = false;
202  SetOffset( 0.0, 0.0 );
203  m_text_layer = F_Cu;
204  m_text_width = 1;
206  }
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:57
LAYER_NUM m_text_layer
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:99
double m_arcMinLen
double m_arcMaxLen
size_t i
Definition: json11.cpp:597
double m_brd_thickness
double m_minLineWidth
static VRML_COLOR colors[VRML_COLOR_LAST]

References arrayDim(), colors, F_Cu, i, m_arcMaxLen, m_arcMinLen, m_brd_thickness, m_holes, m_iMaxSeg, m_layer_z, m_minLineWidth, m_plainPCB, m_text_layer, m_text_width, MIN_VRML_LINEWIDTH, SetOffset(), VRML_COLOR_PCB, VRML_COLOR_SILK, VRML_COLOR_TIN, and VRML_COLOR_TRACK.

◆ ~MODEL_VRML()

MODEL_VRML::~MODEL_VRML ( )
inline

Definition at line 208 of file export_vrml.cpp.

209  {
210  // destroy any unassociated material appearances
211  for( int j = 0; j < VRML_COLOR_LAST; ++j )
212  {
213  if( sgmaterial[j] && NULL == S3D::GetSGNodeParent( sgmaterial[j] ) )
215 
216  sgmaterial[j] = NULL;
217  }
218 
219  if( !m_components.empty() )
220  {
221  IFSG_TRANSFORM tmp( false );
222 
223  for( auto i : m_components )
224  {
225  tmp.Attach( i );
226  tmp.SetParent( NULL );
227  }
228 
229  m_components.clear();
231  }
232  }
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.
size_t i
Definition: json11.cpp:597
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

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

Member Function Documentation

◆ GetColor()

VRML_COLOR& MODEL_VRML::GetColor ( VRML_COLOR_INDEX  aIndex)
inline

Definition at line 234 of file export_vrml.cpp.

235  {
236  return colors[aIndex];
237  }
static VRML_COLOR colors[VRML_COLOR_LAST]

References colors.

Referenced by write_layers().

◆ GetLayerZ()

double MODEL_VRML::GetLayerZ ( LAYER_NUM  aLayer)
inline

Definition at line 255 of file export_vrml.cpp.

256  {
257  if( unsigned( aLayer ) >= arrayDim( m_layer_z ) )
258  return 0;
259 
260  return m_layer_z[ aLayer ];
261  }
double m_layer_z[PCB_LAYER_ID_COUNT]
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:99

References arrayDim(), and m_layer_z.

Referenced by export_vrml_module(), and write_layers().

◆ SetLayerZ()

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

Definition at line 263 of file export_vrml.cpp.

264  {
265  m_layer_z[aLayer] = aValue;
266  }
double m_layer_z[PCB_LAYER_ID_COUNT]

References m_layer_z.

Referenced by compute_layer_Zs().

◆ SetOffset()

void MODEL_VRML::SetOffset ( double  aXoff,
double  aYoff 
)
inline

Definition at line 239 of file export_vrml.cpp.

240  {
241  m_tx = aXoff;
242  m_ty = -aYoff;
243 
244  m_holes.SetVertexOffsets( aXoff, aYoff );
245  m_board.SetVertexOffsets( aXoff, aYoff );
246  m_top_copper.SetVertexOffsets( aXoff, aYoff );
247  m_bot_copper.SetVertexOffsets( aXoff, aYoff );
248  m_top_silk.SetVertexOffsets( aXoff, aYoff );
249  m_bot_silk.SetVertexOffsets( aXoff, aYoff );
250  m_top_tin.SetVertexOffsets( aXoff, aYoff );
251  m_bot_tin.SetVertexOffsets( aXoff, aYoff );
252  m_plated_holes.SetVertexOffsets( aXoff, aYoff );
253  }
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

References m_board, m_bot_copper, m_bot_silk, m_bot_tin, m_holes, m_plated_holes, m_top_copper, m_top_silk, m_top_tin, m_tx, and m_ty.

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

◆ SetScale()

bool MODEL_VRML::SetScale ( double  aWorldScale)
inline

Definition at line 269 of file export_vrml.cpp.

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

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

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

Member Data Documentation

◆ m_arcMaxLen

double MODEL_VRML::m_arcMaxLen
private

Definition at line 150 of file export_vrml.cpp.

Referenced by MODEL_VRML().

◆ m_arcMinLen

double MODEL_VRML::m_arcMinLen
private

Definition at line 150 of file export_vrml.cpp.

Referenced by MODEL_VRML().

◆ m_board

VRML_LAYER MODEL_VRML::m_board

Definition at line 155 of file export_vrml.cpp.

Referenced by export_vrml_board(), SetOffset(), and write_layers().

◆ m_bot_copper

VRML_LAYER MODEL_VRML::m_bot_copper

◆ m_bot_silk

VRML_LAYER MODEL_VRML::m_bot_silk

Definition at line 159 of file export_vrml.cpp.

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

◆ m_bot_tin

VRML_LAYER MODEL_VRML::m_bot_tin

Definition at line 161 of file export_vrml.cpp.

Referenced by export_vrml_pad(), SetOffset(), and write_layers().

◆ m_brd_thickness

double MODEL_VRML::m_brd_thickness

Definition at line 173 of file export_vrml.cpp.

Referenced by compute_layer_Zs(), MODEL_VRML(), and write_layers().

◆ m_components

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

Definition at line 164 of file export_vrml.cpp.

Referenced by export_vrml_module(), and ~MODEL_VRML().

◆ m_holes

VRML_LAYER MODEL_VRML::m_holes

◆ m_iMaxSeg

int MODEL_VRML::m_iMaxSeg
private

Definition at line 149 of file export_vrml.cpp.

Referenced by MODEL_VRML().

◆ m_layer_z

double MODEL_VRML::m_layer_z[PCB_LAYER_ID_COUNT]
private

Definition at line 147 of file export_vrml.cpp.

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

◆ m_minLineWidth

double MODEL_VRML::m_minLineWidth

Definition at line 168 of file export_vrml.cpp.

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

◆ m_OutputPCB

IFSG_TRANSFORM MODEL_VRML::m_OutputPCB

Definition at line 153 of file export_vrml.cpp.

Referenced by export_vrml_module(), SetScale(), write_layers(), and ~MODEL_VRML().

◆ m_plainPCB

◆ m_plated_holes

VRML_LAYER MODEL_VRML::m_plated_holes

Definition at line 162 of file export_vrml.cpp.

Referenced by export_vrml_pad(), SetOffset(), and write_layers().

◆ m_text_layer

LAYER_NUM MODEL_VRML::m_text_layer

◆ m_text_width

int MODEL_VRML::m_text_width

◆ m_top_copper

VRML_LAYER MODEL_VRML::m_top_copper

◆ m_top_silk

VRML_LAYER MODEL_VRML::m_top_silk

Definition at line 158 of file export_vrml.cpp.

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

◆ m_top_tin

VRML_LAYER MODEL_VRML::m_top_tin

Definition at line 160 of file export_vrml.cpp.

Referenced by export_vrml_pad(), SetOffset(), and write_layers().

◆ m_tx

double MODEL_VRML::m_tx

Definition at line 170 of file export_vrml.cpp.

Referenced by export_vrml_module(), and SetOffset().

◆ m_ty

double MODEL_VRML::m_ty

Definition at line 171 of file export_vrml.cpp.

Referenced by export_vrml_module(), and SetOffset().


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