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

Constructor & Destructor Documentation

◆ MODEL_VRML()

MODEL_VRML::MODEL_VRML ( )
inline

Definition at line 179 of file export_vrml.cpp.

179  : m_OutputPCB( (SGNODE*) NULL )
180  {
181  for( unsigned i = 0; i < arrayDim( m_layer_z ); ++i )
182  m_layer_z[i] = 0;
183 
184  m_holes.GetArcParams( m_iMaxSeg, m_arcMinLen, m_arcMaxLen );
185 
186  // this default only makes sense if the output is in mm
187  m_brd_thickness = 1.6;
188 
189  // pcb green
191  0.07f, 0.3f, 0.12f, 0.01f, 0.03f, 0.01f, 0.0f, 0.0f, 0.0f, 0.8f, 0.0f, 0.02f );
192  // track green
194  0.08f, 0.5f, 0.1f, 0.01f, 0.05f, 0.01f, 0.0f, 0.0f, 0.0f, 0.8f, 0.0f, 0.02f );
195  // silkscreen white
197  0.9f, 0.9f, 0.9f, 0.1f, 0.1f, 0.1f, 0.0f, 0.0f, 0.0f, 0.9f, 0.0f, 0.02f );
198  // pad silver
199  colors[VRML_COLOR_TIN] = VRML_COLOR( 0.749f, 0.756f, 0.761f, 0.749f, 0.756f, 0.761f, 0.0f,
200  0.0f, 0.0f, 0.8f, 0.0f, 0.8f );
201 
202  m_plainPCB = false;
203  SetOffset( 0.0, 0.0 );
204  m_text_layer = F_Cu;
205  m_text_width = 1;
207  }
VRML_LAYER m_holes
void SetOffset(double aXoff, double aYoff)
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 NULL
#define MIN_VRML_LINEWIDTH
Definition: export_vrml.cpp:58
LAYER_NUM m_text_layer
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:160
double m_arcMinLen
double m_arcMaxLen
double m_brd_thickness
double m_minLineWidth
static VRML_COLOR colors[VRML_COLOR_LAST]

References arrayDim(), colors, F_Cu, 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 209 of file export_vrml.cpp.

210  {
211  // destroy any unassociated material appearances
212  for( int j = 0; j < VRML_COLOR_LAST; ++j )
213  {
214  if( sgmaterial[j] && NULL == S3D::GetSGNodeParent( sgmaterial[j] ) )
216 
217  sgmaterial[j] = NULL;
218  }
219 
220  if( !m_components.empty() )
221  {
222  IFSG_TRANSFORM tmp( false );
223 
224  for( auto i : m_components )
225  {
226  tmp.Attach( i );
227  tmp.SetParent( NULL );
228  }
229 
230  m_components.clear();
232  }
233  }
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:636
static SGNODE * sgmaterial[VRML_COLOR_LAST]
IFSG_TRANSFORM m_OutputPCB
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Function DestroyNode deletes the given SG* class node.
Definition: ifsg_api.cpp:210
#define NULL
std::list< SGNODE * > m_components
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:54

References IFSG_TRANSFORM::Attach(), IFSG_NODE::Destroy(), S3D::DestroyNode(), S3D::GetSGNodeParent(), m_components, m_OutputPCB, NULL, 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 235 of file export_vrml.cpp.

236  {
237  return colors[aIndex];
238  }
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 256 of file export_vrml.cpp.

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

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

265  {
266  m_layer_z[aLayer] = aValue;
267  }
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 240 of file export_vrml.cpp.

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

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

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

Referenced by MODEL_VRML().

◆ m_arcMinLen

double MODEL_VRML::m_arcMinLen
private

Definition at line 151 of file export_vrml.cpp.

Referenced by MODEL_VRML().

◆ m_board

VRML_LAYER MODEL_VRML::m_board

Definition at line 156 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 160 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 162 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 174 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 165 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 150 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 148 of file export_vrml.cpp.

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

◆ m_minLineWidth

double MODEL_VRML::m_minLineWidth

Definition at line 169 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 154 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 163 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 159 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 161 of file export_vrml.cpp.

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

◆ m_tx

double MODEL_VRML::m_tx

Definition at line 171 of file export_vrml.cpp.

Referenced by export_vrml_module(), and SetOffset().

◆ m_ty

double MODEL_VRML::m_ty

Definition at line 172 of file export_vrml.cpp.

Referenced by export_vrml_module(), and SetOffset().


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