OakPDT Drawing
From Just Solve the File Format Problem
Revision as of 16:25, 9 November 2022 by Ccawley2011 (Talk | contribs)
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 | Parameters | Return value | Extra data |
---|---|---|---|---|
0 | Push name | None | Integer | Integer |
1 | ||||
2 | ||||
3 | ||||
5 | + | Double, Double | Double | |
6 | - | Double, Double | Double | |
7 | unary - | Double | Double | |
8 | Start | Double, Double | None | |
9 | ||||
10 | ||||
11 | ||||
12 | ||||
13 | ||||
14 | ||||
15 | ||||
16 | To | Double, Double | None | |
17 | ||||
18 | Centre of | Double, Double | None | |
19 | Clockwise | None | None | |
20 | Anti-clockwise | None | None | |
21 | Radius | Double | None | |
22 | ||||
23 | ||||
24 | * | Double, Double | Double | |
25 | / | Double, Double | Double | |
26 | ^ | Double, Double | Double | |
27 | sqrt | Double | Double | |
28 | sin | Double | Double | |
29 | cos | Double | Double | |
30 | tan | Double | Double | |
31 | asin | Double | Double | |
32 | acos | Double | Double | |
33 | atan | Double | Double | |
34 | atan2 | Double, Double | Double | |
35 | abs | Double | Double | |
36 | degrees | Double | Double | |
37 | radians | Double | Double | |
38 | Push integer | None | Integer | Integer |
39 | Push real | None | Double | Double |
40 | Eval ID | Integer | ||
41 | Arc from | Double, Double | None | |
42 | Arc to | Double, Double | None | |
43 | Push byte | None | 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 | None | Double | Double |
62 | Push Y coordinate | None | Double | 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 | % | Double, Double | Double | |
83 | Int/ | Double, Double | Double | |
84 | trunc | Double | Double | |
85 | round | Double | Double | |
86 | log | Double | Double | |
87 | log10 | Double | Double | |
88 | exp | Double | Double | |
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 | None | None | Null-terminated string |
99 | Push string | None | 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 | None | None | |
255 | End of symbol | None | None |