OakPDT Drawing
From Just Solve the File Format Problem
(Difference between revisions)
Ccawley2011 (Talk | contribs) |
Ccawley2011 (Talk | contribs) |
||
| Line 190: | Line 190: | ||
{| class="wikitable" width="50%" | {| class="wikitable" width="50%" | ||
|- | |- | ||
| − | ! Code !! Description | + | ! Code !! Description !! Extra data |
|- | |- | ||
| − | | 0 || Push name | + | | 0 || Push name || Integer |
|- | |- | ||
| 1 | | 1 | ||
| Line 266: | Line 266: | ||
| 37 || radians | | 37 || radians | ||
|- | |- | ||
| − | | 38 || Push integer | + | | 38 || Push integer || Integer |
|- | |- | ||
| − | | 39 || Push real | + | | 39 || Push real || Double |
|- | |- | ||
| 40 || Eval ID | | 40 || Eval ID | ||
| Line 276: | Line 276: | ||
| 42 || Arc to | | 42 || Arc to | ||
|- | |- | ||
| − | | 43 || Push byte | + | | 43 || Push byte || Byte |
|- | |- | ||
| 44 || Line tangent to 2 circles | | 44 || Line tangent to 2 circles | ||
| Line 310: | Line 310: | ||
| 59 || Distance between 2 points | | 59 || Distance between 2 points | ||
|- | |- | ||
| − | | 61 || Push X coordinate | + | | 61 || Push X coordinate || Double |
|- | |- | ||
| − | | 62 || Push Y coordinate | + | | 62 || Push Y coordinate || Double |
|- | |- | ||
| 63 || Point at centre of construction circle | | 63 || Point at centre of construction circle | ||
| Line 384: | Line 384: | ||
| 97 || Push function parameter | | 97 || Push function parameter | ||
|- | |- | ||
| − | | 98 || Ignore string | + | | 98 || Ignore string || Null-terminated string |
|- | |- | ||
| − | | 99 || Push string | + | | 99 || Push string || Null-terminated string |
|- | |- | ||
| 100 || Random number | | 100 || Random number | ||
Revision as of 16:24, 8 November 2022
Overview
OakPDT is a 2D parametric CAD system for RISC OS. On RISC OS systems, files in this format typically have a filetype of CAD ("PDT Dwg").
Format details
| File Header | ||
|---|---|---|
| 0 | Byte | Major version number of the file format (always 1) |
| 1 | Byte | Minor version number of the format
|
| 2 | Null-terminated string | The_Design_System or Oak_P_D_T_Drawing
|
| 20 | Integer | Number of symbols (s)
|
| 24 | Array | s symbol table entries
|
| Integer | Size of drawing definition (v)
| |
| Array | v bytes
| |
| Byte | Paper size | |
| Struct | Window definition | |
| Struct | Grid information | |
| Struct | Text information | |
| Struct | Dimension information | |
| Struct | Line style information | |
| Integer | Number of scalars (n)
| |
| Array | n scalar table entries
| |
| Struct | Error information | |
| Struct | Layer information | |
| Double | Dimension scale (only in v1.1 or later) | |
| Integer | Number of functions (n) (only in v1.2 or later)
| |
| Array | n function table entries (only in v1.2 or later)
| |
| Symbol table entry | ||
| 0 | Byte | Data type |
| 1 | Byte | Pen colour
|
| 2 | Byte | Layer number
|
| 3 | Byte | Line type |
| 4 | Integer | Address in drawing definition |
| 8 | Integer | Length in drawing definition (ignored in later versions) |
| Window definition | ||
| 0 | Double | Left X coordinate |
| 8 | Double | Bottom Y coordinate |
| 16 | Double | Right X coordinate |
| 24 | Double | Top Y coordinate |
| Grid information | ||
| 0 | Double | X spacing |
| 8 | Double | Y spacing |
| 16 | Double | X angle |
| 24 | Double | Y angle |
| 32 | Integer | Grid snap |
| 36 | Integer | Parametric grid snap |
| Text information | ||
| 0 | Double | Text width |
| 8 | Double | Text height |
| 16 | Double | Butterfly limit |
| 24 | Integer | Text precision |
| Dimension information | ||
| 0 | Double | The text width for dimensions. |
| 8 | Double | The text height for dimensions. |
| 16 | Double | The arrow head size. |
| 24 | Double | Clearance gap |
| 32 | Integer | The current dimension style, which can be one of the following values:
|
| 36 | Integer | Use arrow heads for dimensions instead of slashes. |
| 40 | Integer | Are dimension tolerances enabled? |
| 44 | Integer | The dimension precision. |
| Line style information | ||
| 0 | Integer | Definition of user-defined line style 1. |
| 4 | Integer | Definition of user-defined line style 2. |
| 8 | Integer | Definition of user-defined line style 3. |
| 12 | Integer | Definition of user-defined line style 4. |
| Scalar table entry | ||
| 0 | Integer | The symbol number of the scalar. |
| 4 | Null-terminated string | The name of the scalar. |
| Error information | ||
| 0 | Integer | A value associated with the last error. The exact purpose depends on the identifier. |
| 4 | Null-terminated string | The identifier of the last error to occur. |
| Layer information (v1.0 and v1.1) | ||
| 0 | Array | 16 bytes containing the status of each layer.
|
| 16 | Array | 16 bytes containing the default pen colour for each layer. |
| 32 | Byte | The active current layer. |
| 33 | Array | 10 bytes mapping each pen colour to a 16 colour palette entry. |
| Layer information (v1.2) | ||
| 0 | Array | 64 bytes containing the status of each layer.
|
| 64 | Array | 64 bytes containing the default pen colour for each layer. |
| 128 | Byte | The active current layer. |
| 129 | Byte | The active points layer. |
| 130 | Byte | The active construction layer. |
| 131 | Array | 10 bytes mapping each pen colour to a 16 colour palette entry. |
| Function table entry (v1.2 or later) | ||
| 0 | Null-terminated string | The name of the function. |
| Integer | The number of parameters. | |
| Integer | The address of the function in the definition block. | |
Drawing definition
| Code | Description | Extra data |
|---|---|---|
| 0 | Push name | Integer |
| 1 | ||
| 2 | ||
| 3 | ||
| 5 | + | |
| 6 | - | |
| 7 | unary - | |
| 8 | Start | |
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | To | |
| 17 | ||
| 18 | Centre of | |
| 19 | Clockwise | |
| 20 | Anti-clockwise | |
| 21 | Radius | |
| 22 | ||
| 23 | ||
| 24 | * | |
| 25 | / | |
| 26 | ^ | |
| 27 | sqrt | |
| 28 | sin | |
| 29 | cos | |
| 30 | tan | |
| 31 | asin | |
| 32 | acos | |
| 33 | atan | |
| 34 | atan2 | |
| 35 | abs | |
| 36 | degrees | |
| 37 | radians | |
| 38 | Push integer | Integer |
| 39 | Push real | Double |
| 40 | Eval ID | |
| 41 | Arc from | |
| 42 | Arc to | |
| 43 | Push byte | Byte |
| 44 | Line tangent to 2 circles | |
| 45 | Intersection of 2 lines | |
| 46 | Intersection of line and circle | |
| 47 | Construction line from 2 points | |
| 48 | Angled construction line | |
| 49 | Construction line tangent to 2 circles | |
| 50 | Parallel construction line | |
| 51 | Perpendicular construction line | |
| 52 | Centre of construction circle | |
| 53 | Construction circle radius | |
| 54 | Construction circle diameter | |
| 55 | Intersection of 2 circles | |
| 56 | Circle tangent to 2 lines | |
| 57 | Line tangent from point to circle | |
| 58 | ||
| 59 | Distance between 2 points | |
| 61 | Push X coordinate | Double |
| 62 | Push Y coordinate | Double |
| 63 | Point at centre of construction circle | |
| 64 | Line normal from point to circle | |
| 65 | Point on line at distance | |
| 66 | Circle tangent to 2 circles | |
| 67 | Parallel construction line at distance | |
| 68 | Circle tangent to line and circle | |
| 69 | Line normal to 2 circles | |
| 70 | 3 point circle | |
| 71 | Circle tangent to line | |
| 72 | Line relative to line | |
| 73 | Polar line | |
| 74 | Point at end of line | |
| 75 | Line bisects 2 lines (mk1) | |
| 76 | Mid point | |
| 77 | Perpendicular bisector | |
| 78 | Point at start of line | |
| 79 | 3 point arc | |
| 80 | Point at centre of arc | |
| 81 | Angle dimension | |
| 82 | % | |
| 83 | Int/ | |
| 84 | trunc | |
| 85 | round | |
| 86 | log | |
| 87 | log10 | |
| 88 | exp | |
| 89 | Point at distance around circle | |
| 90 | Angle between 2 lines | |
| 91 | Line bisects 2 lines (mk2) | |
| 92 | angle from 3 points | |
| 93 | Circle info | |
| 94 | Relative point | |
| 95 | Call function | |
| 96 | Function return | |
| 97 | Push function parameter | |
| 98 | Ignore string | Null-terminated string |
| 99 | Push string | Null-terminated string |
| 100 | Random number | |
| 101 | Point distance on circle | |
| 102 | Point at end of text | |
| 103 | Polar point | |
| 104 | Point at start of arc | |
| 105 | Point at end of arc | |
| 106 | Angle from 2 points | |
| 107 | Point between 2 points | |
| 254 | Return | |
| 255 | End of symbol |