altium: detect barcode objects, improve binary documentation for text objects
This commit is contained in:
parent
5c02c951a9
commit
31fd3763d2
|
@ -461,18 +461,39 @@ types:
|
||||||
- id: is_inverted
|
- id: is_inverted
|
||||||
type: u1
|
type: u1
|
||||||
enum: boolean
|
enum: boolean
|
||||||
- size: 21
|
- id: margin
|
||||||
|
type: s4
|
||||||
|
- id: use_offset # use margin otherwise
|
||||||
|
type: u1
|
||||||
|
enum: boolean
|
||||||
|
- size: 16
|
||||||
- id: position
|
- id: position
|
||||||
type: u1
|
type: u1
|
||||||
enum: text_position
|
enum: text_position
|
||||||
- size: 27
|
- id: offset
|
||||||
- id: truetype
|
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
|
type: u1
|
||||||
enum: boolean
|
enum: boolean
|
||||||
|
- id: font_type
|
||||||
|
type: u1
|
||||||
|
enum: text_font_type
|
||||||
- id: barcode_name
|
- id: barcode_name
|
||||||
size: 64
|
size: 64
|
||||||
type: str # TODO: terminates with [0, 0]
|
type: str # TODO: terminates with [0, 0]
|
||||||
encoding: UTF-16
|
encoding: UTF-16
|
||||||
|
- id: barcode_show_text
|
||||||
|
type: u1
|
||||||
|
enum: boolean
|
||||||
|
|
||||||
text_sub2:
|
text_sub2:
|
||||||
seq:
|
seq:
|
||||||
|
@ -684,6 +705,15 @@ enums:
|
||||||
8: right_center
|
8: right_center
|
||||||
9: right_bottom
|
9: right_bottom
|
||||||
|
|
||||||
|
text_font_type:
|
||||||
|
0: stroke
|
||||||
|
1: truetype
|
||||||
|
2: barcode
|
||||||
|
|
||||||
|
text_barcode_type:
|
||||||
|
0: code39
|
||||||
|
1: code128
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
1: f_cu
|
1: f_cu
|
||||||
32: b_cu
|
32: b_cu
|
||||||
|
|
|
@ -905,7 +905,7 @@ ATEXT6::ATEXT6( ALTIUM_PARSER& aReader )
|
||||||
textposition = ALTIUM_TEXT_POSITION::LEFT_BOTTOM;
|
textposition = ALTIUM_TEXT_POSITION::LEFT_BOTTOM;
|
||||||
}
|
}
|
||||||
aReader.Skip( 27 );
|
aReader.Skip( 27 );
|
||||||
isTruetype = aReader.Read<uint8_t>() != 0;
|
fonttype = static_cast<ALTIUM_TEXT_TYPE>( aReader.Read<uint8_t>() );
|
||||||
|
|
||||||
aReader.SkipSubrecord();
|
aReader.SkipSubrecord();
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,15 @@ enum class ALTIUM_TEXT_POSITION
|
||||||
RIGHT_BOTTOM = 9
|
RIGHT_BOTTOM = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class ALTIUM_TEXT_TYPE
|
||||||
|
{
|
||||||
|
UNKNOWN = -1,
|
||||||
|
|
||||||
|
STROKE = 0,
|
||||||
|
TRUETYPE = 1,
|
||||||
|
BARCODE = 2
|
||||||
|
};
|
||||||
|
|
||||||
struct ALTIUM_VERTICE
|
struct ALTIUM_VERTICE
|
||||||
{
|
{
|
||||||
const bool isRound;
|
const bool isRound;
|
||||||
|
@ -638,7 +647,8 @@ struct ATEXT6
|
||||||
|
|
||||||
bool isComment;
|
bool isComment;
|
||||||
bool isDesignator;
|
bool isDesignator;
|
||||||
bool isTruetype;
|
|
||||||
|
ALTIUM_TEXT_TYPE fonttype;
|
||||||
|
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
|
|
|
@ -2222,6 +2222,14 @@ void ALTIUM_PCB::ParseTexts6Data(
|
||||||
{
|
{
|
||||||
ATEXT6 elem( reader );
|
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
|
// TODO: better approach to select if item belongs to a MODULE
|
||||||
EDA_TEXT* tx = nullptr;
|
EDA_TEXT* tx = nullptr;
|
||||||
BOARD_ITEM* itm = nullptr;
|
BOARD_ITEM* itm = nullptr;
|
||||||
|
@ -2306,7 +2314,7 @@ void ALTIUM_PCB::ParseTexts6Data(
|
||||||
}
|
}
|
||||||
itm->SetLayer( klayer );
|
itm->SetLayer( klayer );
|
||||||
|
|
||||||
if( elem.isTruetype )
|
if( elem.fonttype == ALTIUM_TEXT_TYPE::TRUETYPE )
|
||||||
{
|
{
|
||||||
// TODO: why is this required? Somehow, truetype size is calculated differently
|
// TODO: why is this required? Somehow, truetype size is calculated differently
|
||||||
tx->SetTextSize( wxSize( elem.height / 2, elem.height / 2 ) );
|
tx->SetTextSize( wxSize( elem.height / 2, elem.height / 2 ) );
|
||||||
|
|
Loading…
Reference in New Issue