KiCad PCB EDA Suite
HYPERLYNX_EXPORTER Class Reference
Inheritance diagram for HYPERLYNX_EXPORTER:
BOARD_EXPORTER_BASE

Public Member Functions

 HYPERLYNX_EXPORTER ()
 
 ~HYPERLYNX_EXPORTER ()
 
virtual bool Run () override
 
void SetOutputFilename (const wxFileName &aPath)
 
void SetBoard (BOARD *aBoard)
 
void SetReporter (REPORTER *aReporter)
 
void SetProgressReporter (PROGRESS_REPORTER *aProgressReporter)
 

Protected Attributes

PROPERTIES m_properties
 
BOARDm_board = nullptr
 
wxFileName m_outputFilePath
 
REPORTERm_reporter = nullptr
 
PROGRESS_REPORTERm_progressReporter = nullptr
 

Private Member Functions

HYPERLYNX_PAD_STACKaddPadStack (HYPERLYNX_PAD_STACK stack)
 
const std::string formatPadShape (const HYPERLYNX_PAD_STACK &aStack)
 
bool generateHeaders ()
 
bool writeBoardInfo ()
 
bool writeStackupInfo ()
 
bool writeDevices ()
 
bool writePadStacks ()
 
bool writeNets ()
 
bool writeNetObjects (const std::vector< BOARD_ITEM * > &aObjects)
 
void writeSinglePadStack (HYPERLYNX_PAD_STACK &aStack)
 
const std::vector< BOARD_ITEM * > collectNetObjects (int netcode)
 

Private Attributes

std::vector< HYPERLYNX_PAD_STACK * > m_padStacks
 
std::map< BOARD_ITEM *, HYPERLYNX_PAD_STACK * > m_padMap
 
std::shared_ptr< FILE_OUTPUTFORMATTERm_out
 
int m_polyId
 

Detailed Description

Definition at line 148 of file export_hyperlynx.cpp.

Constructor & Destructor Documentation

◆ HYPERLYNX_EXPORTER()

HYPERLYNX_EXPORTER::HYPERLYNX_EXPORTER ( )
inline

Definition at line 151 of file export_hyperlynx.cpp.

151  : m_polyId( 1 )
152  {
153  }

◆ ~HYPERLYNX_EXPORTER()

HYPERLYNX_EXPORTER::~HYPERLYNX_EXPORTER ( )
inline

Definition at line 155 of file export_hyperlynx.cpp.

155 {};

Member Function Documentation

◆ addPadStack()

HYPERLYNX_PAD_STACK* HYPERLYNX_EXPORTER::addPadStack ( HYPERLYNX_PAD_STACK  stack)
inlineprivate

Definition at line 160 of file export_hyperlynx.cpp.

161  {
162  for( HYPERLYNX_PAD_STACK* p : m_padStacks )
163  {
164  if( *p == stack )
165  return p;
166  }
167 
168  stack.SetId( m_padStacks.size() );
169  m_padStacks.push_back( new HYPERLYNX_PAD_STACK( stack ) );
170 
171  return m_padStacks.back();
172  }
std::vector< HYPERLYNX_PAD_STACK * > m_padStacks

References m_padStacks, and HYPERLYNX_PAD_STACK::SetId().

Referenced by writePadStacks().

◆ collectNetObjects()

const std::vector< BOARD_ITEM * > HYPERLYNX_EXPORTER::collectNetObjects ( int  netcode)
private

Definition at line 539 of file export_hyperlynx.cpp.

540 {
541  std::vector<BOARD_ITEM*> rv;
542 
543  auto check =
544  [&]( BOARD_CONNECTED_ITEM* item ) -> bool
545  {
546  if( ( item->GetLayerSet() & LSET::AllCuMask() ).none() )
547  return false;
548 
549  if( item->GetNetCode() == netcode || ( netcode < 0 && item->GetNetCode() <= 0 ) )
550  return true;
551 
552  return false;
553  };
554 
555  for( FOOTPRINT* footprint : m_board->Footprints() )
556  {
557  for( PAD* pad : footprint->Pads() )
558  {
559  if( check( pad ) )
560  rv.push_back( pad );
561  }
562  }
563 
564  for( PCB_TRACK* item : m_board->Tracks() )
565  {
566  if( check( item ) )
567  rv.push_back( item );
568  }
569 
570  for( ZONE* zone : m_board->Zones() )
571  {
572  if( check( zone ) )
573  rv.push_back( zone );
574  }
575 
576  return rv;
577 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
ZONES & Zones()
Definition: board.h:239
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
FOOTPRINTS & Footprints()
Definition: board.h:233
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:230

References LSET::AllCuMask(), BOARD::Footprints(), BOARD_EXPORTER_BASE::m_board, pad, BOARD::Tracks(), and BOARD::Zones().

Referenced by writeNets().

◆ formatPadShape()

const std::string HYPERLYNX_EXPORTER::formatPadShape ( const HYPERLYNX_PAD_STACK aStack)
inlineprivate

Definition at line 174 of file export_hyperlynx.cpp.

175  {
176  int shapeId = 0;
177  char buf[1024];
178 
179  switch( aStack.m_shape )
180  {
181  case PAD_SHAPE::CIRCLE:
182  case PAD_SHAPE::OVAL: shapeId = 0; break;
183  case PAD_SHAPE::ROUNDRECT: shapeId = 2; break;
184  case PAD_SHAPE::RECT: shapeId = 1; break;
185  default:
186  shapeId = 0;
187 
188  if( m_reporter )
189  {
190  m_reporter->Report( _( "File contains pad shapes that are not supported by the "
191  "Hyperlynx exporter (supported shapes are oval, rectangle "
192  "and circle)." ),
194  m_reporter->Report( _( "They have been exported as oval pads." ),
196  }
197  break;
198  }
199 
200  snprintf( buf, sizeof( buf ), "%d, %.9f, %.9f, %.1f, M", shapeId,
201  iu2hyp( aStack.m_sx ),
202  iu2hyp( aStack.m_sy ),
203  aStack.m_angle );
204 
205  return buf;
206  }
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
#define _(s)
static double iu2hyp(double iu)

References _, CIRCLE, iu2hyp(), HYPERLYNX_PAD_STACK::m_angle, BOARD_EXPORTER_BASE::m_reporter, HYPERLYNX_PAD_STACK::m_shape, HYPERLYNX_PAD_STACK::m_sx, HYPERLYNX_PAD_STACK::m_sy, OVAL, RECT, REPORTER::Report(), ROUNDRECT, RPT_SEVERITY_INFO, and RPT_SEVERITY_WARNING.

Referenced by writeSinglePadStack().

◆ generateHeaders()

bool HYPERLYNX_EXPORTER::generateHeaders ( )
private

Definition at line 264 of file export_hyperlynx.cpp.

265 {
266  m_out->Print( 0, "{VERSION=2.14}\n" );
267  m_out->Print( 0, "{UNITS=ENGLISH LENGTH}\n\n" );
268  return true;
269 }
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out

References m_out.

Referenced by Run().

◆ Run()

bool HYPERLYNX_EXPORTER::Run ( )
overridevirtual

Implements BOARD_EXPORTER_BASE.

Definition at line 618 of file export_hyperlynx.cpp.

619 {
620  LOCALE_IO toggle; // toggles on, then off, the C locale.
621 
622  try
623  {
624  m_out.reset( new FILE_OUTPUTFORMATTER( m_outputFilePath.GetFullPath() ) );
625 
626  generateHeaders();
627  writeBoardInfo();
629  writeDevices();
630  writePadStacks();
631  writeNets();
632  }
633  catch( IO_ERROR& )
634  {
635  return false;
636  }
637 
638  return true;
639 }
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out
Used for text file output.
Definition: richio.h:456
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References generateHeaders(), m_out, BOARD_EXPORTER_BASE::m_outputFilePath, writeBoardInfo(), writeDevices(), writeNets(), writePadStacks(), and writeStackupInfo().

Referenced by ExportBoardToHyperlynx().

◆ SetBoard()

void BOARD_EXPORTER_BASE::SetBoard ( BOARD aBoard)
inlineinherited

Definition at line 52 of file board_exporter_base.h.

53  {
54  m_board = aBoard;
55  }

References BOARD_EXPORTER_BASE::m_board.

Referenced by ExportBoardToHyperlynx().

◆ SetOutputFilename()

void BOARD_EXPORTER_BASE::SetOutputFilename ( const wxFileName &  aPath)
inlineinherited

Definition at line 47 of file board_exporter_base.h.

48  {
49  m_outputFilePath = aPath;
50  }

References BOARD_EXPORTER_BASE::m_outputFilePath.

Referenced by ExportBoardToHyperlynx().

◆ SetProgressReporter()

void BOARD_EXPORTER_BASE::SetProgressReporter ( PROGRESS_REPORTER aProgressReporter)
inlineinherited

Definition at line 62 of file board_exporter_base.h.

63  {
64  m_progressReporter = aProgressReporter;
65  }
PROGRESS_REPORTER * m_progressReporter

References BOARD_EXPORTER_BASE::m_progressReporter.

◆ SetReporter()

void BOARD_EXPORTER_BASE::SetReporter ( REPORTER aReporter)
inlineinherited

Definition at line 57 of file board_exporter_base.h.

58  {
59  m_reporter = aReporter;
60  }

References BOARD_EXPORTER_BASE::m_reporter.

◆ writeBoardInfo()

bool HYPERLYNX_EXPORTER::writeBoardInfo ( )
private

Definition at line 299 of file export_hyperlynx.cpp.

300 {
301  SHAPE_POLY_SET outlines;
302 
303  m_out->Print( 0, "{BOARD \"%s\"\n", (const char*) m_board->GetFileName().c_str() );
304 
305  if( !m_board->GetBoardPolygonOutlines( outlines ) )
306  {
307  wxLogError( _( "Board outline is malformed. Run DRC for a full analysis." ) );
308  return false;
309  }
310 
311  for( int o = 0; o < outlines.OutlineCount(); o++ )
312  {
313  const SHAPE_LINE_CHAIN& outl = outlines.COutline( o );
314 
315  for( int i = 0; i < outl.SegmentCount(); i++ )
316  {
317  const auto& s = outl.CSegment( i );
318  m_out->Print( 1, "(PERIMETER_SEGMENT X1=%.9f Y1=%.9f X2=%.9f Y2=%.9f)\n",
319  iu2hyp( s.A.x ), iu2hyp( s.A.y ), iu2hyp( s.B.x ), iu2hyp( s.B.y ) );
320  }
321  }
322 
323  m_out->Print( 0, "}\n\n" );
324 
325  return true;
326 }
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
const wxString & GetFileName() const
Definition: board.h:228
Represent a set of closed polygons.
#define _(s)
int SegmentCount() const
Return the number of segments in this line chain.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
Represent a polyline (an zero-thickness chain of connected line segments).
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out
static double iu2hyp(double iu)

References _, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CSegment(), BOARD::GetBoardPolygonOutlines(), BOARD::GetFileName(), iu2hyp(), BOARD_EXPORTER_BASE::m_board, m_out, SHAPE_POLY_SET::OutlineCount(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by Run().

◆ writeDevices()

bool HYPERLYNX_EXPORTER::writeDevices ( )
private

Definition at line 388 of file export_hyperlynx.cpp.

389 {
390  m_out->Print( 0, "{DEVICES\n" );
391 
392  for( FOOTPRINT* footprint : m_board->Footprints() )
393  {
394  wxString ref = footprint->GetReference();
395  wxString layerName = m_board->GetLayerName( footprint->GetLayer() );
396 
397  if( ref.IsEmpty() )
398  ref = "EMPTY";
399 
400  m_out->Print( 1, "(? REF=\"%s\" L=\"%s\")\n", (const char*) ref.c_str(),
401  (const char*) layerName.c_str() );
402  }
403  m_out->Print( 0, "}\n\n" );
404 
405  return true;
406 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
FOOTPRINTS & Footprints()
Definition: board.h:233
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out

References BOARD::Footprints(), BOARD::GetLayerName(), BOARD_EXPORTER_BASE::m_board, and m_out.

Referenced by Run().

◆ writeNetObjects()

bool HYPERLYNX_EXPORTER::writeNetObjects ( const std::vector< BOARD_ITEM * > &  aObjects)
private

Definition at line 436 of file export_hyperlynx.cpp.

437 {
438  for( BOARD_ITEM* item : aObjects )
439  {
440  if( PAD* pad = dyn_cast<PAD*>( item ) )
441  {
442  auto pstackIter = m_padMap.find( pad );
443 
444  if( pstackIter != m_padMap.end() )
445  {
446  wxString ref = pad->GetParent()->GetReference();
447 
448  if( ref.IsEmpty() )
449  ref = "EMPTY";
450 
451  wxString padName = pad->GetNumber();
452 
453  if( padName.IsEmpty() )
454  padName = "1";
455 
456 
457  m_out->Print( 1, "(PIN X=%.10f Y=%.10f R=\"%s.%s\" P=%d)\n",
458  iu2hyp( pad->GetPosition().x ), iu2hyp( pad->GetPosition().y ),
459  (const char*) ref.c_str(), (const char*) padName.c_str(),
460  pstackIter->second->GetId() );
461  }
462  }
463  else if( PCB_VIA* via = dyn_cast<PCB_VIA*>( item ) )
464  {
465  auto pstackIter = m_padMap.find( via );
466 
467  if( pstackIter != m_padMap.end() )
468  {
469  m_out->Print( 1, "(VIA X=%.10f Y=%.10f P=%d)\n", iu2hyp( via->GetPosition().x ),
470  iu2hyp( via->GetPosition().y ), pstackIter->second->GetId() );
471  }
472  }
473  else if( PCB_TRACK* track = dyn_cast<PCB_TRACK*>( item ) )
474  {
475  const wxString layerName = m_board->GetLayerName( track->GetLayer() );
476 
477  m_out->Print( 1, "(SEG X1=%.10f Y1=%.10f X2=%.10f Y2=%.10f W=%.10f L=\"%s\")\n",
478  iu2hyp( track->GetStart().x ), iu2hyp( track->GetStart().y ),
479  iu2hyp( track->GetEnd().x ), iu2hyp( track->GetEnd().y ),
480  iu2hyp( track->GetWidth() ), (const char*) layerName.c_str() );
481  }
482  else if( ZONE* zone = dyn_cast<ZONE*>( item ) )
483  {
484  for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
485  {
486  const wxString layerName = m_board->GetLayerName( layer );
487  SHAPE_POLY_SET filledShape = zone->GetFilledPolysList( layer );
488 
489  filledShape.Simplify( SHAPE_POLY_SET::PM_FAST );
490 
491  for( int i = 0; i < filledShape.OutlineCount(); i++ )
492  {
493  const SHAPE_LINE_CHAIN& outl = filledShape.COutline( i );
494 
495  auto p0 = outl.CPoint( 0 );
496  m_out->Print( 1, "{POLYGON T=POUR L=\"%s\" ID=%d X=%.10f Y=%.10f\n",
497  (const char*) layerName.c_str(), m_polyId, iu2hyp( p0.x ),
498  iu2hyp( p0.y ) );
499 
500  for( int v = 0; v < outl.PointCount(); v++ )
501  {
502  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n", iu2hyp( outl.CPoint( v ).x ),
503  iu2hyp( outl.CPoint( v ).y ) );
504  }
505 
506  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n", iu2hyp( p0.x ), iu2hyp( p0.y ) );
507  m_out->Print( 1, "}\n" );
508 
509  for( int h = 0; h < filledShape.HoleCount( i ); h++ )
510  {
511  const SHAPE_LINE_CHAIN& holeShape = filledShape.CHole( i, h );
512  VECTOR2I ph0 = holeShape.CPoint( 0 );
513 
514  m_out->Print( 1, "{POLYVOID ID=%d X=%.10f Y=%.10f\n", m_polyId,
515  iu2hyp( ph0.x ), iu2hyp( ph0.y ) );
516 
517  for( int v = 0; v < holeShape.PointCount(); v++ )
518  {
519  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n",
520  iu2hyp( holeShape.CPoint( v ).x ),
521  iu2hyp( holeShape.CPoint( v ).y ) );
522  }
523 
524  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n",
525  iu2hyp( ph0.x ), iu2hyp( ph0.y ) );
526  m_out->Print( 1, "}\n" );
527  }
528 
529  m_polyId++;
530  }
531  }
532  }
533  }
534 
535  return true;
536 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
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 set of closed polygons.
std::map< BOARD_ITEM *, HYPERLYNX_PAD_STACK * > m_padMap
void Simplify(POLYGON_MODE aFastMode)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
Represent a polyline (an zero-thickness chain of connected line segments).
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out
Definition: pad.h:57
static double iu2hyp(double iu)

References SHAPE_POLY_SET::CHole(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoint(), BOARD::GetLayerName(), SHAPE_POLY_SET::HoleCount(), iu2hyp(), BOARD_EXPORTER_BASE::m_board, m_out, m_padMap, m_polyId, SHAPE_POLY_SET::OutlineCount(), pad, SHAPE_POLY_SET::PM_FAST, SHAPE_LINE_CHAIN::PointCount(), SHAPE_POLY_SET::Simplify(), via, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by writeNets().

◆ writeNets()

bool HYPERLYNX_EXPORTER::writeNets ( )
private

Definition at line 580 of file export_hyperlynx.cpp.

581 {
582  m_polyId = 1;
583 
584  for( const auto netInfo : m_board->GetNetInfo() )
585  {
586  int netcode = netInfo->GetNetCode();
587  bool isNullNet = netInfo->GetNetCode() <= 0 || netInfo->GetNetname().IsEmpty();
588 
589  if( isNullNet )
590  continue;
591 
592  auto netObjects = collectNetObjects( netcode );
593 
594  if( netObjects.size() )
595  {
596  m_out->Print( 0, "{NET=\"%s\"\n", (const char*) netInfo->GetNetname().c_str() );
597  writeNetObjects( netObjects );
598  m_out->Print( 0, "}\n\n" );
599  }
600  }
601 
602  auto nullNetObjects = collectNetObjects( -1 );
603 
604  int idx = 0;
605 
606  for( auto item : nullNetObjects )
607  {
608  m_out->Print( 0, "{NET=\"EmptyNet%d\"\n", idx );
609  writeNetObjects( { item } );
610  m_out->Print( 0, "}\n\n" );
611  idx++;
612  }
613 
614  return true;
615 }
bool writeNetObjects(const std::vector< BOARD_ITEM * > &aObjects)
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:679
const std::vector< BOARD_ITEM * > collectNetObjects(int netcode)
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out

References collectNetObjects(), BOARD::GetNetInfo(), BOARD_EXPORTER_BASE::m_board, m_out, m_polyId, and writeNetObjects().

Referenced by Run().

◆ writePadStacks()

bool HYPERLYNX_EXPORTER::writePadStacks ( )
private

Definition at line 409 of file export_hyperlynx.cpp.

410 {
411  for( FOOTPRINT* footprint : m_board->Footprints() )
412  {
413  for( PAD* pad : footprint->Pads() )
414  {
416  m_padMap[pad] = ps;
417  }
418  }
419 
420  for( PCB_TRACK* track : m_board->Tracks() )
421  {
422  if( PCB_VIA* via = dyn_cast<PCB_VIA*>( track ) )
423  {
425  m_padMap[via] = ps;
426  }
427  }
428 
429  for( HYPERLYNX_PAD_STACK* pstack : m_padStacks )
430  writeSinglePadStack( *pstack );
431 
432  return true;
433 }
std::vector< HYPERLYNX_PAD_STACK * > m_padStacks
HYPERLYNX_PAD_STACK * addPadStack(HYPERLYNX_PAD_STACK stack)
std::map< BOARD_ITEM *, HYPERLYNX_PAD_STACK * > m_padMap
FOOTPRINTS & Footprints()
Definition: board.h:233
void writeSinglePadStack(HYPERLYNX_PAD_STACK &aStack)
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:230

References addPadStack(), BOARD::Footprints(), BOARD_EXPORTER_BASE::m_board, m_padMap, m_padStacks, pad, BOARD::Tracks(), via, and writeSinglePadStack().

Referenced by Run().

◆ writeSinglePadStack()

void HYPERLYNX_EXPORTER::writeSinglePadStack ( HYPERLYNX_PAD_STACK aStack)
private

Definition at line 272 of file export_hyperlynx.cpp.

273 {
274  LSET layerMask = LSET::AllCuMask() & m_board->GetEnabledLayers();
275  LSET outLayers = aStack.m_layers & layerMask;
276 
277  if( outLayers.none() )
278  return;
279 
280  m_out->Print( 0, "{PADSTACK=%d, %.9f\n", aStack.m_id, iu2hyp( aStack.m_drill ) );
281 
282  if( outLayers == layerMask )
283  {
284  m_out->Print( 1, "(\"%s\", %s)\n", "MDEF", formatPadShape( aStack ).c_str() );
285  }
286  else
287  {
288  for( PCB_LAYER_ID l : outLayers.Seq() )
289  {
290  m_out->Print( 1, "(\"%s\", %s)\n", (const char*) m_board->GetLayerName( l ).c_str(),
291  formatPadShape( aStack ).c_str() );
292  }
293  }
294 
295  m_out->Print( 0, "}\n\n" );
296 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:467
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:504
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out
static double iu2hyp(double iu)
const std::string formatPadShape(const HYPERLYNX_PAD_STACK &aStack)

References LSET::AllCuMask(), formatPadShape(), BOARD::GetEnabledLayers(), BOARD::GetLayerName(), iu2hyp(), BOARD_EXPORTER_BASE::m_board, HYPERLYNX_PAD_STACK::m_drill, HYPERLYNX_PAD_STACK::m_id, HYPERLYNX_PAD_STACK::m_layers, m_out, and LSET::Seq().

Referenced by writePadStacks().

◆ writeStackupInfo()

bool HYPERLYNX_EXPORTER::writeStackupInfo ( )
private

Definition at line 329 of file export_hyperlynx.cpp.

330 {
331  /* Format:
332  * {STACKUP
333  * (SIGNAL T=thickness [P=plating_thickness] [C=constant] L=layer_name [M=material_name]) [comment]
334  * (DIELECTRIC T=thickness [C=constant] [L=layer_name] [M=material_name]) [comment]
335  * }
336  * name length is <= 20 chars
337  */
338 
340 
341  // Get the board physical stackup structure
343 
344  m_out->Print( 0, "{STACKUP\n" );
345 
346  wxString layer_name; // The last copper layer name used in stackup
347 
348  for( BOARD_STACKUP_ITEM* item: stackup.GetList() )
349  {
350  if( item->GetType() == BS_ITEM_TYPE_COPPER )
351  {
352  layer_name = m_board->GetLayerName( item->GetBrdLayerId() );
353  int plating_thickness = 0;
354  double resistivity = 1.724e-8; // Good for copper
355  m_out->Print( 1, "(SIGNAL T=%g P=%g C=%g L=\"%.20s\" M=COPPER)\n",
356  iu2hyp( item->GetThickness( 0 ) ),
357  iu2hyp( plating_thickness ),
358  resistivity,
359  TO_UTF8( layer_name ) );
360  }
361  else if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
362  {
363  if( item->GetSublayersCount() < 2 )
364  {
365  m_out->Print( 1, "(DIELECTRIC T=%g C=%g L=\"DE_%.17s\" M=\"%.20s\")\n",
366  iu2hyp( item->GetThickness( 0 ) ),
367  item->GetEpsilonR( 0 ),
368  TO_UTF8( layer_name ),
369  TO_UTF8( item->GetMaterial( 0 ) ) );
370  }
371  else for( int idx = 0; idx < item->GetSublayersCount(); idx++ )
372  {
373  m_out->Print( 1, "(DIELECTRIC T=%g C=%g L=\"DE%d_%.16s\" M=\"%.20s\")\n",
374  iu2hyp( item->GetThickness( idx ) ),
375  item->GetEpsilonR( idx ),
376  idx, TO_UTF8( layer_name ),
377  TO_UTF8( item->GetMaterial( idx ) ) );
378  }
379  }
380  }
381 
382  m_out->Print( 0, "}\n\n" );
383 
384  return true;
385 }
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition: lset.cpp:170
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
Manage layers needed to make a physical board.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:590
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
BOARD_STACKUP & GetStackupDescriptor()
Manage one layer needed to make a physical board.
Definition: board_stackup.h:89
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:465
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
std::shared_ptr< FILE_OUTPUTFORMATTER > m_out
static double iu2hyp(double iu)

References BS_ITEM_TYPE_COPPER, BS_ITEM_TYPE_DIELECTRIC, LSET::CuStack(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetEnabledLayers(), BOARD::GetLayerName(), BOARD_STACKUP::GetList(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), iu2hyp(), BOARD_EXPORTER_BASE::m_board, m_out, and TO_UTF8.

Referenced by Run().

Member Data Documentation

◆ m_board

◆ m_out

std::shared_ptr<FILE_OUTPUTFORMATTER> HYPERLYNX_EXPORTER::m_out
private

◆ m_outputFilePath

wxFileName BOARD_EXPORTER_BASE::m_outputFilePath
protectedinherited

Definition at line 72 of file board_exporter_base.h.

Referenced by Run(), and BOARD_EXPORTER_BASE::SetOutputFilename().

◆ m_padMap

std::map<BOARD_ITEM*, HYPERLYNX_PAD_STACK*> HYPERLYNX_EXPORTER::m_padMap
private

Definition at line 222 of file export_hyperlynx.cpp.

Referenced by writeNetObjects(), and writePadStacks().

◆ m_padStacks

std::vector<HYPERLYNX_PAD_STACK*> HYPERLYNX_EXPORTER::m_padStacks
private

Definition at line 221 of file export_hyperlynx.cpp.

Referenced by addPadStack(), and writePadStacks().

◆ m_polyId

int HYPERLYNX_EXPORTER::m_polyId
private

Definition at line 226 of file export_hyperlynx.cpp.

Referenced by writeNetObjects(), and writeNets().

◆ m_progressReporter

PROGRESS_REPORTER* BOARD_EXPORTER_BASE::m_progressReporter = nullptr
protectedinherited

Definition at line 74 of file board_exporter_base.h.

Referenced by BOARD_EXPORTER_BASE::SetProgressReporter().

◆ m_properties

PROPERTIES BOARD_EXPORTER_BASE::m_properties
protectedinherited

Definition at line 70 of file board_exporter_base.h.

◆ m_reporter

REPORTER* BOARD_EXPORTER_BASE::m_reporter = nullptr
protectedinherited

Definition at line 73 of file board_exporter_base.h.

Referenced by formatPadShape(), and BOARD_EXPORTER_BASE::SetReporter().


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