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

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

Constructor & Destructor Documentation

◆ HYPERLYNX_EXPORTER()

HYPERLYNX_EXPORTER::HYPERLYNX_EXPORTER ( )
inline

Definition at line 125 of file export_hyperlynx.cpp.

125 : m_polyId( 1 )
126 {
127 }

◆ ~HYPERLYNX_EXPORTER()

HYPERLYNX_EXPORTER::~HYPERLYNX_EXPORTER ( )
inline

Definition at line 129 of file export_hyperlynx.cpp.

129{};

Member Function Documentation

◆ addPadStack()

HYPERLYNX_PAD_STACK * HYPERLYNX_EXPORTER::addPadStack ( HYPERLYNX_PAD_STACK  stack)
inlineprivate

Definition at line 134 of file export_hyperlynx.cpp.

135 {
137 {
138 if( *p == stack )
139 return p;
140 }
141
142 stack.SetId( m_padStacks.size() );
143 m_padStacks.push_back( new HYPERLYNX_PAD_STACK( stack ) );
144
145 return m_padStacks.back();
146 }
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 560 of file export_hyperlynx.cpp.

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

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

149 {
150 int shapeId = 0;
151 char buf[1024];
152
153 switch( aStack.m_shape )
154 {
156 case PAD_SHAPE::OVAL:
157 shapeId = 0;
158 break;
159
161 shapeId = 2;
162 break;
163
164 case PAD_SHAPE::RECT:
165 shapeId = 1;
166 break;
167
168 default:
169 if( m_reporter )
170 {
171 m_reporter->Report( _( "File contains pad shapes that are not supported by the "
172 "Hyperlynx exporter (supported shapes are oval, rectangle, "
173 "rounded rectangle, and circle)." ),
175 m_reporter->Report( _( "They have been exported as oval pads." ),
177 }
178
179 shapeId = 0;
180 break;
181 }
182
183 snprintf( buf, sizeof( buf ), "%d, %.9f, %.9f, %.1f, M",
184 shapeId,
185 iu2hyp( aStack.m_sx ),
186 iu2hyp( aStack.m_sy ),
187 aStack.m_angle );
188
189 return buf;
190 }
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)
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_INFO

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

247{
248 m_out->Print( 0, "{VERSION=2.14}\n" );
249 m_out->Print( 0, "{UNITS=ENGLISH LENGTH}\n\n" );
250 return true;
251}
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 639 of file export_hyperlynx.cpp.

640{
641 LOCALE_IO toggle; // toggles on, then off, the C locale.
642
643 try
644 {
645 m_out.reset( new FILE_OUTPUTFORMATTER( m_outputFilePath.GetFullPath() ) );
646
650 writeDevices();
652 writeNets();
653 }
654 catch( IO_ERROR& )
655 {
656 return false;
657 }
658
659 return true;
660}
Used for text file output.
Definition: richio.h:457
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:41

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

283{
284 SHAPE_POLY_SET outlines;
285
286 m_out->Print( 0, "{BOARD \"%s\"\n", (const char*) m_board->GetFileName().c_str() );
287
288 if( !m_board->GetBoardPolygonOutlines( outlines ) )
289 {
290 wxLogError( _( "Board outline is malformed. Run DRC for a full analysis." ) );
291 return false;
292 }
293
294 for( int o = 0; o < outlines.OutlineCount(); o++ )
295 {
296 const SHAPE_LINE_CHAIN& outl = outlines.COutline( o );
297
298 for( int i = 0; i < outl.SegmentCount(); i++ )
299 {
300 const SEG& s = outl.CSegment( i );
301 m_out->Print( 1, "(PERIMETER_SEGMENT X1=%.9f Y1=%.9f X2=%.9f Y2=%.9f)\n",
302 iu2hyp( s.A.x ),
303 iu2hyp( s.A.y ),
304 iu2hyp( s.B.x ),
305 iu2hyp( s.B.y ) );
306 }
307 }
308
309 m_out->Print( 0, "}\n\n" );
310
311 return true;
312}
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:1950
const wxString & GetFileName() const
Definition: board.h:302
Definition: seg.h:42
VECTOR2I A
Definition: seg.h:49
VECTOR2I B
Definition: seg.h:50
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc 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 set of closed polygons.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const

References _, SEG::A, SEG::B, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CSegment(), BOARD::GetBoardPolygonOutlines(), BOARD::GetFileName(), iu2hyp(), BOARD_EXPORTER_BASE::m_board, m_out, SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::SegmentCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Run().

◆ writeDevices()

bool HYPERLYNX_EXPORTER::writeDevices ( )
private

Definition at line 375 of file export_hyperlynx.cpp.

376{
377 m_out->Print( 0, "{DEVICES\n" );
378
379 for( FOOTPRINT* footprint : m_board->Footprints() )
380 {
381 wxString ref = footprint->GetReference();
382 wxString layerName = m_board->GetLayerName( footprint->GetLayer() );
383
384 if( ref.IsEmpty() )
385 ref = wxT( "EMPTY" );
386
387 m_out->Print( 1, "(? REF=\"%s\" L=\"%s\")\n",
388 (const char*) ref.c_str(),
389 (const char*) layerName.c_str() );
390 }
391 m_out->Print( 0, "}\n\n" );
392
393 return true;
394}
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:452

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

425{
426 for( BOARD_ITEM* item : aObjects )
427 {
428 if( PAD* pad = dyn_cast<PAD*>( item ) )
429 {
430 auto pstackIter = m_padMap.find( pad );
431
432 if( pstackIter != m_padMap.end() )
433 {
434 wxString ref = pad->GetParent()->GetReference();
435
436 if( ref.IsEmpty() )
437 ref = wxT( "EMPTY" );
438
439 wxString padName = pad->GetNumber();
440
441 if( padName.IsEmpty() )
442 padName = wxT( "1" );
443
444
445 m_out->Print( 1, "(PIN X=%.10f Y=%.10f R=\"%s.%s\" P=%d)\n",
446 iu2hyp( pad->GetPosition().x ),
447 iu2hyp( pad->GetPosition().y ),
448 (const char*) ref.c_str(),
449 (const char*) padName.c_str(),
450 pstackIter->second->GetId() );
451 }
452 }
453 else if( PCB_VIA* via = dyn_cast<PCB_VIA*>( item ) )
454 {
455 auto pstackIter = m_padMap.find( via );
456
457 if( pstackIter != m_padMap.end() )
458 {
459 m_out->Print( 1, "(VIA X=%.10f Y=%.10f P=%d)\n",
460 iu2hyp( via->GetPosition().x ),
461 iu2hyp( via->GetPosition().y ),
462 pstackIter->second->GetId() );
463 }
464 }
465 else if( PCB_TRACK* track = dyn_cast<PCB_TRACK*>( item ) )
466 {
467 const wxString layerName = m_board->GetLayerName( track->GetLayer() );
468
469 m_out->Print( 1, "(SEG X1=%.10f Y1=%.10f X2=%.10f Y2=%.10f W=%.10f L=\"%s\")\n",
470 iu2hyp( track->GetStart().x ),
471 iu2hyp( track->GetStart().y ),
472 iu2hyp( track->GetEnd().x ),
473 iu2hyp( track->GetEnd().y ),
474 iu2hyp( track->GetWidth() ),
475 (const char*) layerName.c_str() );
476 }
477 else if( PCB_ARC* arc = dyn_cast<PCB_ARC*>( item ) )
478 {
479 const wxString layerName = m_board->GetLayerName( arc->GetLayer() );
480 VECTOR2I start = arc->GetStart();
481 VECTOR2I end = arc->GetEnd();
482
483 if( arc->IsCCW() )
484 std::swap( start, end );
485
486 m_out->Print( 1, "(ARC X1=%.10f Y1=%.10f X2=%.10f Y2=%.10f XC=%.10f YC=%.10f R=%.10f W=%.10f L=\"%s\")\n",
487 iu2hyp( start.x ),
488 iu2hyp( start.y ),
489 iu2hyp( end.x ),
490 iu2hyp( end.y ),
491 iu2hyp( arc->GetCenter().x ),
492 iu2hyp( arc->GetCenter().y ),
493 iu2hyp( arc->GetRadius() ),
494 iu2hyp( arc->GetWidth() ),
495 (const char*) layerName.c_str() );
496 }
497 else if( ZONE* zone = dyn_cast<ZONE*>( item ) )
498 {
499 for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
500 {
501 const wxString layerName = m_board->GetLayerName( layer );
502 SHAPE_POLY_SET fill = zone->GetFilledPolysList( layer )->CloneDropTriangulation();
503
505
506 for( int i = 0; i < fill.OutlineCount(); i++ )
507 {
508 const SHAPE_LINE_CHAIN& outl = fill.COutline( i );
509 const VECTOR2I p0 = outl.CPoint( 0 );
510
511 m_out->Print( 1, "{POLYGON T=POUR L=\"%s\" ID=%d X=%.10f Y=%.10f\n",
512 (const char*) layerName.c_str(),
513 m_polyId,
514 iu2hyp( p0.x ),
515 iu2hyp( p0.y ) );
516
517 for( int v = 0; v < outl.PointCount(); v++ )
518 {
519 m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n",
520 iu2hyp( outl.CPoint( v ).x ),
521 iu2hyp( outl.CPoint( v ).y ) );
522 }
523
524 m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n", iu2hyp( p0.x ), iu2hyp( p0.y ) );
525 m_out->Print( 1, "}\n" );
526
527 for( int h = 0; h < fill.HoleCount( i ); h++ )
528 {
529 const SHAPE_LINE_CHAIN& holeShape = fill.CHole( i, h );
530 const VECTOR2I ph0 = holeShape.CPoint( 0 );
531
532 m_out->Print( 1, "{POLYVOID ID=%d X=%.10f Y=%.10f\n",
533 m_polyId,
534 iu2hyp( ph0.x ),
535 iu2hyp( ph0.y ) );
536
537 for( int v = 0; v < holeShape.PointCount(); v++ )
538 {
539 m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n",
540 iu2hyp( holeShape.CPoint( v ).x ),
541 iu2hyp( holeShape.CPoint( v ).y ) );
542 }
543
544 m_out->Print( 2, "(LINE X=%.10f Y=%.10f)\n",
545 iu2hyp( ph0.x ),
546 iu2hyp( ph0.y ) );
547 m_out->Print( 1, "}\n" );
548 }
549
550 m_polyId++;
551 }
552 }
553 }
554 }
555
556 return true;
557}
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:58
std::map< BOARD_ITEM *, HYPERLYNX_PAD_STACK * > m_padMap
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.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
void Simplify(POLYGON_MODE aFastMode)
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
SHAPE_POLY_SET CloneDropTriangulation() const
Creates a new empty polygon in the set and returns its index.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:59

References SHAPE_POLY_SET::CHole(), SHAPE_POLY_SET::CloneDropTriangulation(), 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 601 of file export_hyperlynx.cpp.

602{
603 m_polyId = 1;
604
605 for( const NETINFO_ITEM* netInfo : m_board->GetNetInfo() )
606 {
607 int netcode = netInfo->GetNetCode();
608 bool isNullNet = netInfo->GetNetCode() <= 0 || netInfo->GetNetname().IsEmpty();
609
610 if( isNullNet )
611 continue;
612
613 const std::vector<BOARD_ITEM*> netObjects = collectNetObjects( netcode );
614
615 if( netObjects.size() )
616 {
617 m_out->Print( 0, "{NET=\"%s\"\n", (const char*) netInfo->GetNetname().c_str() );
618 writeNetObjects( netObjects );
619 m_out->Print( 0, "}\n\n" );
620 }
621 }
622
623 const std::vector<BOARD_ITEM*> nullNetObjects = collectNetObjects( -1 );
624
625 int idx = 0;
626
627 for( BOARD_ITEM* item : nullNetObjects )
628 {
629 m_out->Print( 0, "{NET=\"EmptyNet%d\"\n", idx );
630 writeNetObjects( { item } );
631 m_out->Print( 0, "}\n\n" );
632 idx++;
633 }
634
635 return true;
636}
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:765
bool writeNetObjects(const std::vector< BOARD_ITEM * > &aObjects)
const std::vector< BOARD_ITEM * > collectNetObjects(int netcode)
Handle the data for a net.
Definition: netinfo.h:67

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

398{
399 for( FOOTPRINT* footprint : m_board->Footprints() )
400 {
401 for( PAD* pad : footprint->Pads() )
402 {
404 m_padMap[pad] = ps;
405 }
406 }
407
408 for( PCB_TRACK* track : m_board->Tracks() )
409 {
410 if( PCB_VIA* via = dyn_cast<PCB_VIA*>( track ) )
411 {
413 m_padMap[via] = ps;
414 }
415 }
416
417 for( HYPERLYNX_PAD_STACK* pstack : m_padStacks )
418 writeSinglePadStack( *pstack );
419
420 return true;
421}
void writeSinglePadStack(HYPERLYNX_PAD_STACK &aStack)
HYPERLYNX_PAD_STACK * addPadStack(HYPERLYNX_PAD_STACK stack)

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

255{
256 LSET layerMask = LSET::AllCuMask() & m_board->GetEnabledLayers();
257 LSET outLayers = aStack.m_layers & layerMask;
258
259 if( outLayers.none() )
260 return;
261
262 m_out->Print( 0, "{PADSTACK=%d, %.9f\n", aStack.m_id, iu2hyp( aStack.m_drill ) );
263
264 if( outLayers == layerMask )
265 {
266 m_out->Print( 1, "(\"MDEF\", %s)\n", formatPadShape( aStack ).c_str() );
267 }
268 else
269 {
270 for( PCB_LAYER_ID l : outLayers.Seq() )
271 {
272 m_out->Print( 1, "(\"%s\", %s)\n",
273 (const char*) m_board->GetLayerName( l ).c_str(),
274 formatPadShape( aStack ).c_str() );
275 }
276 }
277
278 m_out->Print( 0, "}\n\n" );
279}
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:565
const std::string formatPadShape(const HYPERLYNX_PAD_STACK &aStack)
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
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

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

316{
317 /* Format:
318 * {STACKUP
319 * (SIGNAL T=thickness [P=plating_thickness] [C=constant] L=layer_name [M=material_name]) [comment]
320 * (DIELECTRIC T=thickness [C=constant] [L=layer_name] [M=material_name]) [comment]
321 * }
322 * name length is <= 20 chars
323 */
324
326
327 // Get the board physical stackup structure
329
330 m_out->Print( 0, "{STACKUP\n" );
331
332 wxString layer_name; // The last copper layer name used in stackup
333
334 for( BOARD_STACKUP_ITEM* item: stackup.GetList() )
335 {
336 if( item->GetType() == BS_ITEM_TYPE_COPPER )
337 {
338 layer_name = m_board->GetLayerName( item->GetBrdLayerId() );
339 int plating_thickness = 0;
340 double resistivity = 1.724e-8; // Good for copper
341 m_out->Print( 1, "(SIGNAL T=%g P=%g C=%g L=\"%.20s\" M=COPPER)\n",
342 iu2hyp( item->GetThickness( 0 ) ),
343 iu2hyp( plating_thickness ),
344 resistivity,
345 TO_UTF8( layer_name ) );
346 }
347 else if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC )
348 {
349 if( item->GetSublayersCount() < 2 )
350 {
351 m_out->Print( 1, "(DIELECTRIC T=%g C=%g L=\"DE_%.17s\" M=\"%.20s\")\n",
352 iu2hyp( item->GetThickness( 0 ) ),
353 item->GetEpsilonR( 0 ),
354 TO_UTF8( layer_name ),
355 TO_UTF8( item->GetMaterial( 0 ) ) );
356 }
357 else for( int idx = 0; idx < item->GetSublayersCount(); idx++ )
358 {
359 m_out->Print( 1, "(DIELECTRIC T=%g C=%g L=\"DE%d_%.16s\" M=\"%.20s\")\n",
360 iu2hyp( item->GetThickness( idx ) ),
361 item->GetEpsilonR( idx ),
362 idx,
363 TO_UTF8( layer_name ),
364 TO_UTF8( item->GetMaterial( idx ) ) );
365 }
366 }
367 }
368
369 m_out->Print( 0, "}\n\n" );
370
371 return true;
372}
@ BS_ITEM_TYPE_COPPER
Definition: board_stackup.h:43
@ BS_ITEM_TYPE_DIELECTRIC
Definition: board_stackup.h:44
LSET GetEnabledLayers() const
Return a bit-mask of all the layers that are enabled.
BOARD_STACKUP & GetStackupDescriptor()
Manage one layer needed to make a physical board.
Definition: board_stackup.h:91
Manage layers needed to make a physical board.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:682
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition: layer_ids.h:491
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
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96

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

Referenced by addPadStack(), and writePadStacks().

◆ m_polyId

int HYPERLYNX_EXPORTER::m_polyId
private

Definition at line 210 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

STRING_UTF8_MAP 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: