KiCad PCB EDA Suite
APAD6 Struct Reference

#include <altium_parser_pcb.h>

Public Member Functions

 APAD6 (ALTIUM_PARSER &aReader)
 

Public Attributes

bool is_locked
 
bool is_tent_top
 
bool is_tent_bottom
 
bool is_test_fab_top
 
bool is_test_fab_bottom
 
wxString name
 
ALTIUM_LAYER layer
 
uint16_t net
 
uint16_t component
 
wxPoint position
 
wxSize topsize
 
wxSize midsize
 
wxSize botsize
 
uint32_t holesize
 
ALTIUM_PAD_SHAPE topshape
 
ALTIUM_PAD_SHAPE midshape
 
ALTIUM_PAD_SHAPE botshape
 
ALTIUM_PAD_MODE padmode
 
double direction
 
bool plated
 
ALTIUM_PAD_RULE pastemaskexpansionmode
 
int32_t pastemaskexpansionmanual
 
ALTIUM_PAD_RULE soldermaskexpansionmode
 
int32_t soldermaskexpansionmanual
 
double holerotation
 
ALTIUM_LAYER tolayer
 
ALTIUM_LAYER fromlayer
 
std::unique_ptr< APAD6_SIZE_AND_SHAPEsizeAndShape
 

Detailed Description

Definition at line 560 of file altium_parser_pcb.h.

Constructor & Destructor Documentation

◆ APAD6()

APAD6::APAD6 ( ALTIUM_PARSER aReader)
explicit

Definition at line 563 of file altium_parser_pcb.cpp.

564 {
565  ALTIUM_RECORD recordtype = static_cast<ALTIUM_RECORD>( aReader.Read<uint8_t>() );
566 
567  if( recordtype != ALTIUM_RECORD::PAD )
568  THROW_IO_ERROR( "Pads6 stream has invalid recordtype" );
569 
570  // Subrecord 1
571  size_t subrecord1 = aReader.ReadAndSetSubrecordLength();
572 
573  if( subrecord1 == 0 )
574  THROW_IO_ERROR( "Pads6 stream has no subrecord1 data" );
575 
576  name = aReader.ReadWxString();
577 
578  if( aReader.GetRemainingSubrecordBytes() != 0 )
579  THROW_IO_ERROR( "Pads6 stream has invalid subrecord1 length" );
580 
581  aReader.SkipSubrecord();
582 
583  // Subrecord 2
584  aReader.ReadAndSetSubrecordLength();
585  aReader.SkipSubrecord();
586 
587  // Subrecord 3
588  aReader.ReadAndSetSubrecordLength();
589  aReader.SkipSubrecord();
590 
591  // Subrecord 4
592  aReader.ReadAndSetSubrecordLength();
593  aReader.SkipSubrecord();
594 
595  // Subrecord 5
596  size_t subrecord5 = aReader.ReadAndSetSubrecordLength();
597 
598  if( subrecord5 < 114 )
599  THROW_IO_ERROR( "Pads6 stream subrecord has length < 114, which is unexpected" );
600 
601  layer = static_cast<ALTIUM_LAYER>( aReader.Read<uint8_t>() );
604 
605  uint8_t flags1 = aReader.Read<uint8_t>();
606  is_test_fab_top = ( flags1 & 0x80 ) != 0;
607  is_tent_bottom = ( flags1 & 0x40 ) != 0;
608  is_tent_top = ( flags1 & 0x20 ) != 0;
609  is_locked = ( flags1 & 0x04 ) == 0;
610 
611  uint8_t flags2 = aReader.Read<uint8_t>();
612  is_test_fab_bottom = ( flags2 & 0x01 ) != 0;
613 
614  net = aReader.Read<uint16_t>();
615  aReader.Skip( 2 );
616  component = aReader.Read<uint16_t>();
617  aReader.Skip( 4 );
618 
619  position = aReader.ReadWxPoint();
620  topsize = aReader.ReadWxSize();
621  midsize = aReader.ReadWxSize();
622  botsize = aReader.ReadWxSize();
623  holesize = aReader.ReadKicadUnit();
624 
625  topshape = static_cast<ALTIUM_PAD_SHAPE>( aReader.Read<uint8_t>() );
626  midshape = static_cast<ALTIUM_PAD_SHAPE>( aReader.Read<uint8_t>() );
627  botshape = static_cast<ALTIUM_PAD_SHAPE>( aReader.Read<uint8_t>() );
628 
629  direction = aReader.Read<double>();
630  plated = aReader.Read<uint8_t>() != 0;
631  aReader.Skip( 1 );
632  padmode = static_cast<ALTIUM_PAD_MODE>( aReader.Read<uint8_t>() );
633  aReader.Skip( 23 );
636  aReader.Skip( 7 );
637  pastemaskexpansionmode = static_cast<ALTIUM_PAD_RULE>( aReader.Read<uint8_t>() );
638  soldermaskexpansionmode = static_cast<ALTIUM_PAD_RULE>( aReader.Read<uint8_t>() );
639  aReader.Skip( 3 );
640  holerotation = aReader.Read<double>();
641 
642  if( subrecord5 >= 120 )
643  {
644  tolayer = static_cast<ALTIUM_LAYER>( aReader.Read<uint8_t>() );
645  aReader.Skip( 2 );
646  fromlayer = static_cast<ALTIUM_LAYER>( aReader.Read<uint8_t>() );
647  //aReader.skip( 2 );
648  }
649  else if( subrecord5 == 171 )
650  {
651  }
652 
653  aReader.SkipSubrecord();
654 
655  // Subrecord 6
656  size_t subrecord6 = aReader.ReadAndSetSubrecordLength();
657  // Known lengths: 596, 628, 651
658  // 596 is the number of bytes read in this code-block
659  if( subrecord6 >= 596 )
660  { // TODO: detect type from something else than the size?
661  sizeAndShape = std::make_unique<APAD6_SIZE_AND_SHAPE>();
662 
663  for( wxSize& size : sizeAndShape->inner_size )
664  size.x = aReader.ReadKicadUnitX();
665 
666  for( wxSize& size : sizeAndShape->inner_size )
667  size.y = aReader.ReadKicadUnitY();
668 
669  for( ALTIUM_PAD_SHAPE& shape : sizeAndShape->inner_shape )
670  shape = static_cast<ALTIUM_PAD_SHAPE>( aReader.Read<uint8_t>() );
671 
672  aReader.Skip( 1 );
673 
674  sizeAndShape->holeshape = static_cast<ALTIUM_PAD_HOLE_SHAPE>( aReader.Read<uint8_t>() );
675  sizeAndShape->slotsize = aReader.ReadKicadUnit();
676  sizeAndShape->slotrotation = aReader.Read<double>();
677 
678  for( wxPoint& pt : sizeAndShape->holeoffset )
679  pt.x = aReader.ReadKicadUnitX();
680 
681  for( wxPoint& pt : sizeAndShape->holeoffset )
682  pt.y = aReader.ReadKicadUnitY();
683 
684  aReader.Skip( 1 );
685 
686  for( ALTIUM_PAD_SHAPE_ALT& shape : sizeAndShape->alt_shape )
687  shape = static_cast<ALTIUM_PAD_SHAPE_ALT>( aReader.Read<uint8_t>() );
688 
689  for( uint8_t& radius : sizeAndShape->cornerradius )
690  radius = aReader.Read<uint8_t>();
691  }
692  else if( subrecord6 != 0 )
693  {
694  wxLogError( _( "Pads6 stream has unexpected length for subrecord 6: %d." ), subrecord6 );
695  }
696 
697  aReader.SkipSubrecord();
698 
699  if( aReader.HasParsingError() )
700  THROW_IO_ERROR( "Pads6 stream was not parsed correctly" );
701 }
ALTIUM_LAYER tolayer
int32_t soldermaskexpansionmanual
ALTIUM_PAD_SHAPE topshape
wxSize topsize
uint16_t component
bool is_test_fab_bottom
ALTIUM_RECORD
ALTIUM_PAD_SHAPE
ALTIUM_PAD_RULE soldermaskexpansionmode
wxString name
ALTIUM_PAD_SHAPE_ALT
void Skip(size_t aLength)
size_t GetRemainingSubrecordBytes() const
wxSize ReadWxSize()
size_t ReadAndSetSubrecordLength()
wxSize botsize
ALTIUM_PAD_RULE pastemaskexpansionmode
double direction
wxPoint ReadWxPoint()
wxSize midsize
#define _(s)
uint32_t holesize
bool is_test_fab_top
int32_t ReadKicadUnit()
bool is_locked
bool is_tent_bottom
ALTIUM_PAD_SHAPE botshape
ALTIUM_LAYER layer
wxPoint position
wxString ReadWxString()
Definition: altium_parser.h:69
int32_t pastemaskexpansionmanual
ALTIUM_PAD_MODE padmode
std::unique_ptr< APAD6_SIZE_AND_SHAPE > sizeAndShape
int32_t ReadKicadUnitX()
void SkipSubrecord()
ALTIUM_PAD_SHAPE midshape
bool is_tent_top
int32_t ReadKicadUnitY()
#define THROW_IO_ERROR(msg)
Definition: ki_exception.h:38
bool HasParsingError()
double holerotation
ALTIUM_LAYER fromlayer
uint16_t net

References _, botshape, botsize, component, direction, fromlayer, ALTIUM_PARSER::GetRemainingSubrecordBytes(), ALTIUM_PARSER::HasParsingError(), holerotation, holesize, is_locked, is_tent_bottom, is_tent_top, is_test_fab_bottom, is_test_fab_top, layer, midshape, midsize, name, net, PAD, padmode, pastemaskexpansionmanual, pastemaskexpansionmode, plated, position, ALTIUM_PARSER::Read(), ALTIUM_PARSER::ReadAndSetSubrecordLength(), ALTIUM_PARSER::ReadKicadUnit(), ALTIUM_PARSER::ReadKicadUnitX(), ALTIUM_PARSER::ReadKicadUnitY(), ALTIUM_PARSER::ReadWxPoint(), ALTIUM_PARSER::ReadWxSize(), ALTIUM_PARSER::ReadWxString(), sizeAndShape, ALTIUM_PARSER::Skip(), ALTIUM_PARSER::SkipSubrecord(), soldermaskexpansionmanual, soldermaskexpansionmode, THROW_IO_ERROR, tolayer, topshape, topsize, and UNKNOWN.

Member Data Documentation

◆ botshape

ALTIUM_PAD_SHAPE APAD6::botshape

Definition at line 582 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ botsize

wxSize APAD6::botsize

Definition at line 577 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ component

uint16_t APAD6::component

◆ direction

double APAD6::direction

◆ fromlayer

ALTIUM_LAYER APAD6::fromlayer

Definition at line 595 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ holerotation

double APAD6::holerotation

Definition at line 592 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ holesize

uint32_t APAD6::holesize

◆ is_locked

bool APAD6::is_locked

Definition at line 562 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ is_tent_bottom

bool APAD6::is_tent_bottom

Definition at line 564 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ is_tent_top

bool APAD6::is_tent_top

Definition at line 563 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ is_test_fab_bottom

bool APAD6::is_test_fab_bottom

Definition at line 566 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ is_test_fab_top

bool APAD6::is_test_fab_top

Definition at line 565 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ layer

◆ midshape

ALTIUM_PAD_SHAPE APAD6::midshape

Definition at line 581 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ midsize

wxSize APAD6::midsize

Definition at line 576 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ name

wxString APAD6::name

◆ net

uint16_t APAD6::net

◆ padmode

◆ pastemaskexpansionmanual

int32_t APAD6::pastemaskexpansionmanual

Definition at line 589 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ pastemaskexpansionmode

ALTIUM_PAD_RULE APAD6::pastemaskexpansionmode

Definition at line 588 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ plated

bool APAD6::plated

Definition at line 587 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ position

wxPoint APAD6::position

◆ sizeAndShape

std::unique_ptr<APAD6_SIZE_AND_SHAPE> APAD6::sizeAndShape

◆ soldermaskexpansionmanual

int32_t APAD6::soldermaskexpansionmanual

Definition at line 591 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ soldermaskexpansionmode

ALTIUM_PAD_RULE APAD6::soldermaskexpansionmode

Definition at line 590 of file altium_parser_pcb.h.

Referenced by APAD6(), and ALTIUM_PCB::ParsePads6Data().

◆ tolayer

ALTIUM_LAYER APAD6::tolayer

Definition at line 594 of file altium_parser_pcb.h.

Referenced by APAD6().

◆ topshape

◆ topsize

wxSize APAD6::topsize

The documentation for this struct was generated from the following files: