Skip to main content

Module container

Module container 

Source
Expand description

The container of PTC Creo part files (.prt.N): a text header, a table of contents in fixed-width text records and named sections, some of them compressed with Unix compress (LZW).

#UGC:2 PART … <base> \        base (hex) is added to every section offset
#- VERS … / #- CMNM name \     more header lines
#-END_OF_UGC_HEADER
#Creo  TM  10.0 …
#UGC_TOC 2 <n> <entry size> <x>####…
<name> <off> <size> <usize> <ver> <kind> <x> <crc> <crc>   (hex; n entries, '#'-padded)
NEXT_TOC_ENTRY <off> …                                      (chain to the next table)

A section starts with the line #<name> at base + off and holds size bytes. Kind 9 is the tagged plain format (tagged.rs), a and 12 are LZW-compressed tagged data (1f 9d), 11 is binary (JPEG previews), b is scrambled.

Structs§

Entry
One table-of-contents entry.

Functions§

is_creo
Is this a Creo file (#UGC:2 PART … or #UGC:2 ASSEMBLY …)?
section
The bytes of a section (inflated when it is LZW-compressed), without the #name line. None when the file has no such section.
toc
The table of contents of a Creo file.
unlzw
Unix compress (LZW, 1f 9d), as the Creo sections use it: codes of 9 to maxbits bits, little-endian bit packing, the code width grows in groups of eight codes (the rest of a group is skipped on a width change).