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 552 of file export_hyperlynx.cpp.

553 {
554  std::vector<BOARD_ITEM*> rv;
555 
556  auto check =
557  [&]( BOARD_CONNECTED_ITEM* item ) -> bool
558  {
559  if( ( item->GetLayerSet() & LSET::AllCuMask() ).none() )
560  return false;
561 
562  if( item->GetNetCode() == netcode || ( netcode < 0 && item->GetNetCode() <= 0 ) )
563  return true;
564 
565  return false;
566  };
567 
568  for( FOOTPRINT* footprint : m_board->Footprints() )
569  {
570  for( PAD* pad : footprint->Pads() )
571  {
572  if( check( pad ) )
573  rv.push_back( pad );
574  }
575  }
576 
577  for( PCB_TRACK* item : m_board->Tracks() )
578  {
579  if( check( item ) )
580  rv.push_back( item );
581  }
582 
583  for( ZONE* zone : m_board->Zones() )
584  {
585  if( check( zone ) )
586  rv.push_back( zone );
587  }
588 
589  return rv;
590 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
ZONES & Zones()
Definition: board.h:240
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
FOOTPRINTS & Footprints()
Definition: board.h:234
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:231

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:
183  shapeId = 0;
184  break;
185 
187  shapeId = 2;
188  break;
189 
190  case PAD_SHAPE::RECT:
191  shapeId = 1;
192  break;
193 
194  default:
195  if( m_reporter )
196  {
197  m_reporter->Report( _( "File contains pad shapes that are not supported by the "
198  "Hyperlynx exporter (supported shapes are oval, rectangle "
199  "and circle)." ),
201  m_reporter->Report( _( "They have been exported as oval pads." ),
203  }
204 
205  shapeId = 0;
206  break;
207  }
208 
209  snprintf( buf, sizeof( buf ), "%d, %.9f, %.9f, %.1f, M", shapeId,
210  iu2hyp( aStack.m_sx ),
211  iu2hyp( aStack.m_sy ),
212  aStack.m_angle );
213 
214  return buf;
215  }
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 273 of file export_hyperlynx.cpp.

274 {
275  m_out->Print( 0, "{VERSION=2.14}\n" );
276  m_out->Print( 0, "{UNITS=ENGLISH LENGTH}\n\n" );
277  return true;
278 }
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 631 of file export_hyperlynx.cpp.

632 {
633  LOCALE_IO toggle; // toggles on, then off, the C locale.
634 
635  try
636  {
637  m_out.reset( new FILE_OUTPUTFORMATTER( m_outputFilePath.GetFullPath() ) );
638 
639  generateHeaders();
640  writeBoardInfo();
642  writeDevices();
643  writePadStacks();
644  writeNets();
645  }
646  catch( IO_ERROR& )
647  {
648  return false;
649  }
650 
651  return true;
652 }
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 308 of file export_hyperlynx.cpp.

309 {
310  SHAPE_POLY_SET outlines;
311 
312  m_out->Print( 0, "{BOARD \"%s\"\n", (const char*) m_board->GetFileName().c_str() );
313 
314  if( !m_board->GetBoardPolygonOutlines( outlines ) )
315  {
316  wxLogError( _( "Board outline is malformed. Run DRC for a full analysis." ) );
317  return false;
318  }
319 
320  for( int o = 0; o < outlines.OutlineCount(); o++ )
321  {
322  const SHAPE_LINE_CHAIN& outl = outlines.COutline( o );
323 
324  for( int i = 0; i < outl.SegmentCount(); i++ )
325  {
326  const auto& s = outl.CSegment( i );
327  m_out->Print( 1, "(PERIMETER_SEGMENT X1=%.9f Y1=%.9f X2=%.9f Y2=%.9f)\n",
328  iu2hyp( s.A.x ), iu2hyp( s.A.y ), iu2hyp( s.B.x ), iu2hyp( s.B.y ) );
329  }
330  }
331 
332  m_out->Print( 0, "}\n\n" );
333 
334  return true;
335 }
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:1835
const wxString & GetFileName() const
Definition: board.h:229
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 containing arcs as well as line segments: A chain of connected line and/or arc s...
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 397 of file export_hyperlynx.cpp.

398 {
399  m_out->Print( 0, "{DEVICES\n" );
400 
401  for( FOOTPRINT* footprint : m_board->Footprints() )
402  {
403  wxString ref = footprint->GetReference();
404  wxString layerName = m_board->GetLayerName( footprint->GetLayer() );
405 
406  if( ref.IsEmpty() )
407  ref = wxT( "EMPTY" );
408 
409  m_out->Print( 1, "(? REF=\"%s\" L=\"%s\")\n", (const char*) ref.c_str(),
410  (const char*) layerName.c_str() );
411  }
412  m_out->Print( 0, "}\n\n" );
413 
414  return true;
415 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:362
FOOTPRINTS & Footprints()
Definition: board.h:234
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 445 of file export_hyperlynx.cpp.

446 {
447  for( BOARD_ITEM* item : aObjects )
448  {
449  if( PAD* pad = dyn_cast<PAD*>( item ) )
450  {
451  auto pstackIter = m_padMap.find( pad );
452 
453  if( pstackIter != m_padMap.end() )
454  {
455  wxString ref = pad->GetParent()->GetReference();
456 
457  if( ref.IsEmpty() )
458  ref = wxT( "EMPTY" );
459 
460  wxString padName = pad->GetNumber();
461 
462  if( padName.IsEmpty() )
463  padName = wxT( "1" );
464 
465 
466  m_out->Print( 1, "(PIN X=%.10f Y=%.10f R=\"%s.%s\" P=%d)\n",
467  iu2hyp( pad->GetPosition().x ), iu2hyp( pad->GetPosition().y ),
468  (const char*) ref.c_str(), (const char*) padName.c_str(),
469  pstackIter->second->GetId() );
470  }
471  }
472  else if( PCB_VIA* via = dyn_cast<PCB_VIA*>( item ) )
473  {
474  auto pstackIter = m_padMap.find( via );
475 
476  if( pstackIter != m_padMap.end() )
477  {
478  m_out->Print( 1, "(VIA X=%.10f Y=%.10f P=%d)\n", iu2hyp( via->GetPosition().x ),
479  iu2hyp( via->GetPosition().y ), pstackIter->second->GetId() );
480  }
481  }
482  else if( PCB_TRACK* track = dyn_cast<PCB_TRACK*>( item ) )
483  {
484  const wxString layerName = m_board->GetLayerName( track->GetLayer() );
485 
486  m_out->Print( 1, "(SEG X1=%.10f Y1=%.10f X2=%.10f Y2=%.10f W=%.10f L=\"%s\")\n",
487  iu2hyp( track->GetStart().x ), iu2hyp( track->GetStart().y ),
488  iu2hyp( track->GetEnd().x ), iu2hyp( track->GetEnd().y ),
489  iu2hyp( track->GetWidth() ), (const char*) layerName.c_str() );
490  }
491  else if( PCB_ARC* arc = dyn_cast<PCB_ARC*>( item ) )
492  {
493  // TODO!
494  }
495  else if( ZONE* zone = dyn_cast<ZONE*>( item ) )
496  {
497  for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
498  {
499  const wxString layerName = m_board->GetLayerName( layer );
500  SHAPE_POLY_SET filledShape = zone->GetFilledPolysList( layer );
501 
502  filledShape.Simplify( SHAPE_POLY_SET::PM_FAST );
503 
504  for( int i = 0; i < filledShape.OutlineCount(); i++ )
505  {
506  const SHAPE_LINE_CHAIN& outl = filledShape.COutline( i );
507 
508  auto p0 = outl.CPoint( 0 );
509  m_out->Print( 1, "{POLYGON T=POUR L=\"%s\" ID=%d X=%.10f Y=%.10f\n",
510  (const char*) layerName.c_str(), m_polyId, iu2hyp( p0.x ),
511  iu2hyp( p0.y ) );
512 
513  for( int v = 0; v < outl.PointCount(); v++ )
514  {
515  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n", iu2hyp( outl.CPoint( v ).x ),
516  iu2hyp( outl.CPoint( v ).y ) );
517  }
518 
519  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n", iu2hyp( p0.x ), iu2hyp( p0.y ) );
520  m_out->Print( 1, "}\n" );
521 
522  for( int h = 0; h < filledShape.HoleCount( i ); h++ )
523  {
524  const SHAPE_LINE_CHAIN& holeShape = filledShape.CHole( i, h );
525  VECTOR2I ph0 = holeShape.CPoint( 0 );
526 
527  m_out->Print( 1, "{POLYVOID ID=%d X=%.10f Y=%.10f\n", m_polyId,
528  iu2hyp( ph0.x ), iu2hyp( ph0.y ) );
529 
530  for( int v = 0; v < holeShape.PointCount(); v++ )
531  {
532  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n",
533  iu2hyp( holeShape.CPoint( v ).x ),
534  iu2hyp( holeShape.CPoint( v ).y ) );
535  }
536 
537  m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n",
538  iu2hyp( ph0.x ), iu2hyp( ph0.y ) );
539  m_out->Print( 1, "}\n" );
540  }
541 
542  m_polyId++;
543  }
544  }
545  }
546  }
547 
548  return true;
549 }
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 containing arcs as well as line segments: A chain of connected line and/or arc s...
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 593 of file export_hyperlynx.cpp.

594 {
595  m_polyId = 1;
596 
597  for( const auto netInfo : m_board->GetNetInfo() )
598  {
599  int netcode = netInfo->GetNetCode();
600  bool isNullNet = netInfo->GetNetCode() <= 0 || netInfo->GetNetname().IsEmpty();
601 
602  if( isNullNet )
603  continue;
604 
605  auto netObjects = collectNetObjects( netcode );
606 
607  if( netObjects.size() )
608  {
609  m_out->Print( 0, "{NET=\"%s\"\n", (const char*) netInfo->GetNetname().c_str() );
610  writeNetObjects( netObjects );
611  m_out->Print( 0, "}\n\n" );
612  }
613  }
614 
615  auto nullNetObjects = collectNetObjects( -1 );
616 
617  int idx = 0;
618 
619  for( auto item : nullNetObjects )
620  {
621  m_out->Print( 0, "{NET=\"EmptyNet%d\"\n", idx );
622  writeNetObjects( { item } );
623  m_out->Print( 0, "}\n\n" );
624  idx++;
625  }
626 
627  return true;
628 }
bool writeNetObjects(const std::vector< BOARD_ITEM * > &aObjects)
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:680
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 418 of file export_hyperlynx.cpp.

419 {
420  for( FOOTPRINT* footprint : m_board->Footprints() )
421  {
422  for( PAD* pad : footprint->Pads() )
423  {
425  m_padMap[pad] = ps;
426  }
427  }
428 
429  for( PCB_TRACK* track : m_board->Tracks() )
430  {
431  if( PCB_VIA* via = dyn_cast<PCB_VIA*>( track ) )
432  {
434  m_padMap[via] = ps;
435  }
436  }
437 
438  for( HYPERLYNX_PAD_STACK* pstack : m_padStacks )
439  writeSinglePadStack( *pstack );
440 
441  return true;
442 }
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:234
void writeSinglePadStack(HYPERLYNX_PAD_STACK &aStack)
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:231

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 281 of file export_hyperlynx.cpp.

282 {
283  LSET layerMask = LSET::AllCuMask() & m_board->GetEnabledLayers();
284  LSET outLayers = aStack.m_layers & layerMask;
285 
286  if( outLayers.none() )
287  return;
288 
289  m_out->Print( 0, "{PADSTACK=%d, %.9f\n", aStack.m_id, iu2hyp( aStack.m_drill ) );
290 
291  if( outLayers == layerMask )
292  {
293  m_out->Print( 1, "(\"%s\", %s)\n", "MDEF", formatPadShape( aStack ).c_str() );
294  }
295  else
296  {
297  for( PCB_LAYER_ID l : outLayers.Seq() )
298  {
299  m_out->Print( 1, "(\"%s\", %s)\n", (const char*) m_board->GetLayerName( l ).c_str(),
300  formatPadShape( aStack ).c_str() );
301  }
302  }
303 
304  m_out->Print( 0, "}\n\n" );
305 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:759
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:516
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 338 of file export_hyperlynx.cpp.

339 {
340  /* Format:
341  * {STACKUP
342  * (SIGNAL T=thickness [P=plating_thickness] [C=constant] L=layer_name [M=material_name]) [comment]
343  * (DIELECTRIC T=thickness [C=constant] [L=layer_name] [M=material_name]) [comment]
344  * }
345  * name length is <= 20 chars
346  */
347 
349 
350  // Get the board physical stackup structure
352 
353  m_out->Print( 0, "{STACKUP\n" );
354 
355  wxString layer_name; // The last copper layer name used in stackup
356 
357  for( BOARD_STACKUP_ITEM* item: stackup.GetList() )
358  {
359  if( item->GetType() == BS_ITEM_TYPE_COPPER )
360  {
361  layer_name = m_board->GetLayerName( item->GetBrdLayerId() );
362  int plating_thickness = 0;
363  double resistivity = 1.724e-8; // Good for copper
364  m_out->Print( 1, "(SIGNAL T=%g P=%g C=%g L=\"%.20s\" M=COPPER)\n",
365  iu2hyp( item->GetThickness( 0 ) ),
366  iu2hyp( plating_thickness ),
367  resistivity,
368  TO_UTF8( layer_name ) );
369  }
370  else if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
371  {
372  if( item->GetSublayersCount() < 2 )
373  {
374  m_out->Print( 1, "(DIELECTRIC T=%g C=%g L=\"DE_%.17s\" M=\"%.20s\")\n",
375  iu2hyp( item->GetThickness( 0 ) ),
376  item->GetEpsilonR( 0 ),
377  TO_UTF8( layer_name ),
378  TO_UTF8( item->GetMaterial( 0 ) ) );
379  }
380  else for( int idx = 0; idx < item->GetSublayersCount(); idx++ )
381  {
382  m_out->Print( 1, "(DIELECTRIC T=%g C=%g L=\"DE%d_%.16s\" M=\"%.20s\")\n",
383  iu2hyp( item->GetThickness( idx ) ),
384  item->GetEpsilonR( idx ),
385  idx, TO_UTF8( layer_name ),
386  TO_UTF8( item->GetMaterial( idx ) ) );
387  }
388  }
389  }
390 
391  m_out->Print( 0, "}\n\n" );
392 
393  return true;
394 }
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:477
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 231 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 230 of file export_hyperlynx.cpp.

Referenced by addPadStack(), and writePadStacks().

◆ m_polyId

int HYPERLYNX_EXPORTER::m_polyId
private

Definition at line 235 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: