altium: detect barcode objects, improve binary documentation for text objects

This commit is contained in:
Thomas Pointhuber 2020-05-10 20:11:24 +02:00 committed by Jon Evans
parent 5c02c951a9
commit 31fd3763d2
4 changed files with 54 additions and 6 deletions

View File

@ -461,18 +461,39 @@ types:
- id: is_inverted
type: u1
enum: boolean
- size: 21
- id: margin
type: s4
- id: use_offset # use margin otherwise
type: u1
enum: boolean
- size: 16
- id: position
type: u1
enum: text_position
- size: 27
- id: truetype
- id: offset
type: s4
- id: barcode_full_size # TODO: also for non-barcode?
type: xy
- id: barcode_margin # TODO: also for non-barcode?
type: xy
- size: 4
- id: barcode_type
type: u1
enum: text_barcode_type
- size: 1
- id: barcode_inverted
type: u1
enum: boolean
- id: font_type
type: u1
enum: text_font_type
- id: barcode_name
size: 64
type: str # TODO: terminates with [0, 0]
encoding: UTF-16
- id: barcode_show_text
type: u1
enum: boolean
text_sub2:
seq:
@ -684,6 +705,15 @@ enums:
8: right_center
9: right_bottom
text_font_type:
0: stroke
1: truetype
2: barcode
text_barcode_type:
0: code39
1: code128
layer:
1: f_cu
32: b_cu

View File

@ -905,7 +905,7 @@ ATEXT6::ATEXT6( ALTIUM_PARSER& aReader )
textposition = ALTIUM_TEXT_POSITION::LEFT_BOTTOM;
}
aReader.Skip( 27 );
isTruetype = aReader.Read<uint8_t>() != 0;
fonttype = static_cast<ALTIUM_TEXT_TYPE>( aReader.Read<uint8_t>() );
aReader.SkipSubrecord();

View File

@ -191,6 +191,15 @@ enum class ALTIUM_TEXT_POSITION
RIGHT_BOTTOM = 9
};
enum class ALTIUM_TEXT_TYPE
{
UNKNOWN = -1,
STROKE = 0,
TRUETYPE = 1,
BARCODE = 2
};
struct ALTIUM_VERTICE
{
const bool isRound;
@ -638,7 +647,8 @@ struct ATEXT6
bool isComment;
bool isDesignator;
bool isTruetype;
ALTIUM_TEXT_TYPE fonttype;
wxString text;

View File

@ -2222,6 +2222,14 @@ void ALTIUM_PCB::ParseTexts6Data(
{
ATEXT6 elem( reader );
if( elem.fonttype == ALTIUM_TEXT_TYPE::BARCODE )
{
wxLogWarning( wxString::Format(
_( "Ignore Barcode on Altium layer %d because it is not supported right now." ),
elem.layer ) );
continue;
}
// TODO: better approach to select if item belongs to a MODULE
EDA_TEXT* tx = nullptr;
BOARD_ITEM* itm = nullptr;
@ -2306,7 +2314,7 @@ void ALTIUM_PCB::ParseTexts6Data(
}
itm->SetLayer( klayer );
if( elem.isTruetype )
if( elem.fonttype == ALTIUM_TEXT_TYPE::TRUETYPE )
{
// TODO: why is this required? Somehow, truetype size is calculated differently
tx->SetTextSize( wxSize( elem.height / 2, elem.height / 2 ) );