OakPDT Drawing

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
 
(18 intermediate revisions by one user not shown)
Line 48: Line 48:
 
| || Struct || Layer information
 
| || Struct || Layer information
 
|-
 
|-
| || Double || Dimension scale
+
| || Double || Dimension scale (only in v1.1 or later)
 
|-
 
|-
| || Integer || Number of functions (<code>n</code>)
+
| || Integer || Number of functions (<code>n</code>) (only in v1.2 or later)
 
|-
 
|-
| || Array || <code>n</code> function table entries
+
| || Array || <code>n</code> function table entries (only in v1.2 or later)
 
|-
 
|-
 
! colspan="3" | Symbol table entry
 
! colspan="3" | Symbol table entry
 
|-
 
|-
| 0 || Byte ||
+
| 0 || Byte || Data type
 
|-
 
|-
| 1 || Byte ||
+
| 1 || Byte || Pen colour
 +
* In v1.2 or later, the symbol is deleted if the pen colour has bit 5 set, and the lower four bits are ANDed with %1111.
 
|-
 
|-
| 2 || Byte ||
+
| 2 || Byte || Layer number
 +
* In v1.0 and v1.1, the symbol is deleted if the layer number is 16.
 
|-
 
|-
| 3 || Byte ||
+
| 3 || Byte || Line type
 
|-
 
|-
| 4 || Integer ||
+
| 4 || Integer || Address in drawing definition
 
|-
 
|-
| 8 || Integer ||
+
| 8 || Integer || Length in drawing definition (ignored in later versions)
 
|-
 
|-
 
! colspan="3" | Window definition
 
! colspan="3" | Window definition
 
|-
 
|-
| 0 || Double ||
+
| 0 || Double || Left X coordinate
 
|-
 
|-
| 8 || Double ||
+
| 8 || Double || Bottom Y coordinate
 
|-
 
|-
| 16 || Double ||
+
| 16 || Double || Right X coordinate
 
|-
 
|-
| 24 || Double ||
+
| 24 || Double || Top Y coordinate
 
|-
 
|-
 
! colspan="3" | Grid information
 
! colspan="3" | Grid information
 
|-
 
|-
| 0 || Double ||
+
| 0 || Double || X spacing
 
|-
 
|-
| 8 || Double ||
+
| 8 || Double || Y spacing
 
|-
 
|-
| 16 || Double ||
+
| 16 || Double || X angle
 
|-
 
|-
| 24 || Double ||
+
| 24 || Double || Y angle
 
|-
 
|-
| 32 || Integer ||
+
| 32 || Integer || Grid snap
 
|-
 
|-
| 36 || Integer ||
+
| 36 || Integer || Parametric grid snap
 
|-
 
|-
 
! colspan="3" | Text information
 
! colspan="3" | Text information
 
|-
 
|-
| 0 || Double ||
+
| 0 || Double || Text width
 
|-
 
|-
| 8 || Double ||
+
| 8 || Double || Text height
 
|-
 
|-
| 16 || Double ||
+
| 16 || Double || Butterfly limit
 
|-
 
|-
| 24 || Integer ||
+
| 24 || Integer || Text precision
 
|-
 
|-
 
! colspan="3" | Dimension information
 
! colspan="3" | Dimension information
 
|-
 
|-
| 0 || Double ||
+
| 0 || Double || The text width for dimensions.
 
|-
 
|-
| 8 || Double ||
+
| 8 || Double || The text height for dimensions.
 
|-
 
|-
| 16 || Double ||
+
| 16 || Double || The arrow head size.
 
|-
 
|-
| 24 || Double ||
+
| 24 || Double || Clearance gap
 
|-
 
|-
| 32 || Integer ||
+
| 32 || Integer || The current dimension style, which can be one of the following values:
 +
* 0 for internal dimensions.
 +
* 1 for external left dimensions.
 +
* 2 for external right dimensions.
 +
* 3 for external dimensions.
 
|-
 
|-
| 36 || Integer ||
+
| 36 || Integer || Use arrow heads for dimensions instead of slashes.
 
|-
 
|-
| 40 || Integer ||
+
| 40 || Integer || Are dimension tolerances enabled?
 
|-
 
|-
| 44 || Integer ||
+
| 44 || Integer || The dimension precision.
 
|-
 
|-
 
! colspan="3" | Line style information
 
! colspan="3" | Line style information
 
|-
 
|-
| 0 || Integer ||
+
| 0 || Integer || Definition of user-defined line style 1.
 
|-
 
|-
| 4 || Integer ||
+
| 4 || Integer || Definition of user-defined line style 2.
 
|-
 
|-
| 8 || Integer ||
+
| 8 || Integer || Definition of user-defined line style 3.
 
|-
 
|-
| 12 || Integer ||
+
| 12 || Integer || Definition of user-defined line style 4.
 
|-
 
|-
 
! colspan="3" | Scalar table entry
 
! colspan="3" | Scalar table entry
 
|-
 
|-
| 0 || Integer ||
+
| 0 || Integer || The symbol number of the scalar.
 
|-
 
|-
| 4 || Null-terminated string ||
+
| 4 || Null-terminated string || The name of the scalar.
 
|-
 
|-
 
! colspan="3" | Error information
 
! colspan="3" | Error information
 
|-
 
|-
| 0 || Integer ||
+
| 0 || Integer || A value associated with the last error. The exact purpose depends on the identifier.
 
|-
 
|-
| 4 || Null-terminated string ||
+
| 4 || Null-terminated string || The identifier of the last error to occur.
 
|-
 
|-
! colspan="3" | Layer information
+
! colspan="3" | Layer information (v1.0 and v1.1)
 
|-
 
|-
| 0 || Array || 64 bytes
+
| 0 || Array || 16 bytes containing the status of each layer.
 +
* If bit 0 is set then the layer is on.
 +
* If bit 1 is set then the layer is locked.
 
|-
 
|-
| 64 || Array || 64 bytes
+
| 16 || Array || 16 bytes containing the default pen colour for each layer.
 
|-
 
|-
| 128 || Byte ||
+
| 32 || Byte || The active current layer.
 
|-
 
|-
| 129 || Byte ||
+
| 33 || Array || 10 bytes mapping each pen colour to a 16 colour palette entry.
 
|-
 
|-
| 130 || Byte ||
+
! colspan="3" | Layer information (v1.2)
 
|-
 
|-
| 131 || Array || 10 bytes
+
| 0 || Array || 64 bytes containing the status of each layer.
 +
* If bit 0 is set then the layer is on.
 +
* If bit 1 is set then the layer is locked.
 
|-
 
|-
! colspan="3" | Function table entry
+
| 64 || Array || 64 bytes containing the default pen colour for each layer.
 
|-
 
|-
| 0 || Null-terminated string||
+
| 128 || Byte || The active current layer.
 
|-
 
|-
| || Integer ||
+
| 129 || Byte || The active points layer.
 
|-
 
|-
| || Integer ||
+
| 130 || Byte || The active construction layer.
 +
|-
 +
| 131 || Array || 10 bytes mapping each pen colour to a 16 colour palette entry.
 +
|-
 +
! colspan="3" | 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 ==
 +
The drawing definition is an array of opcodes. The return values are pushed in order to a stack, and the parameters are popped in reverse order. Some opcodes have extra data that is read in from the drawing definition and is used as the return value.
 +
 +
{| class="wikitable" width="50%"
 +
|-
 +
! 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 || Byte, Integer, Byte, Integer || None
 +
|-
 +
| 45 || Intersection of 2 lines || Integer, Integer || Double, Double
 +
|-
 +
| 46 || Intersection of line and circle || Byte, Integer, Integer || Double, Double
 +
|-
 +
| 47 || Construction line from 2 points || Double, Double, Double, Double || None
 +
|-
 +
| 48 || Angled construction line || Double, Double, Double || None
 +
|-
 +
| 49 || Construction line tangent to 2 circles || Byte, Integer, Byte, Integer || None
 +
|-
 +
| 50 || Parallel construction line || Integer, Double, Double || None
 +
|-
 +
| 51 || Perpendicular construction line || Integer, Double, Double || None
 +
|-
 +
| 52 || Centre of construction circle || Double, Double || None
 +
|-
 +
| 53 || Construction circle radius || Double || None
 +
|-
 +
| 54 || Construction circle diameter || Double || None
 +
|-
 +
| 55 || Intersection of 2 circles || Byte, Integer, Integer || Double, Double
 +
|-
 +
| 56 || Circle tangent to 2 lines || Byte, Integer, Integer, Double || None
 +
|-
 +
| 57 || Line tangent from point to circle || Double, Double, Byte, Byte, Integer || None
 +
|-
 +
| 58
 +
|-
 +
| 59 || Distance between 2 points || Double, Double, Double, Double || Double
 +
|-
 +
| 61 || Push X coordinate || None || Double || Double
 +
|-
 +
| 62 || Push Y coordinate || None || Double || Double
 +
|-
 +
| 63 || Point at centre of construction circle || Integer || Double, Double
 +
|-
 +
| 64 || Line normal from point to circle || Byte, Integer, Double, Double || None
 +
|-
 +
| 65 || Point on line at distance || Double, Double, Double, Integer, Byte || Double, Double
 +
|-
 +
| 66 || Circle tangent to 2 circles || Double, Byte, Integer, Integer || None
 +
|-
 +
| 67 || Parallel construction line at distance || Double, Integer, Byte || None
 +
|-
 +
| 68 || Circle tangent to line and circle || Double, Byte, Integer, Integer || None
 +
|-
 +
| 69 || Line normal to 2 circles || Integer, Integer, Byte || None
 +
|-
 +
| 70 || 3 point circle || Double, Double, Double, Double, Double, Double || None
 +
|-
 +
| 71 || Circle tangent to line || Double, Double, Integer || None
 +
|-
 +
| 72 || Line relative to line || Double, Double, Double, Integer || None
 +
|-
 +
| 73 || Polar line || Double, Double, Double, Double || None
 +
|-
 +
| 74 || Point at end of line || None || Double, Double
 +
|-
 +
| 75 || Line bisects 2 lines (mk1) || Integer, Integer, Byte || None
 +
|-
 +
| 76 || Mid point || Double, Double, Double, Double || Double, Double
 +
|-
 +
| 77 || Perpendicular bisector || Double, Double, Double, Double || None
 +
|-
 +
| 78 || Point at start of line || None || Double, Double
 +
|-
 +
| 79 || 3 point arc || Double, Double, Double, Double, Double, Double || None
 +
|-
 +
| 80 || Point at centre of arc || Integer || Double, Double
 +
|-
 +
| 81 || Angle dimension || Integer, Integer || Double, Double, Double, Double, Double, Double, Double, Double
 +
|-
 +
| 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 || Double, Double, Double, Double, Integer || Double
 +
|-
 +
| 90 || Angle between 2 lines || Integer, Integer, Byte || Double
 +
|-
 +
| 91 || Line bisects 2 lines (mk2) || Integer, Integer, Byte || None
 +
|-
 +
| 92 || angle from 3 points || Double, Double, Double, Double, Double, Double || Double
 +
|-
 +
| 93 || Circle info || Byte, Integer || Double
 +
|-
 +
| 94 || Relative point || Double, Double, Double, Double || Double, Double
 +
|-
 +
| 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 || Double || Double
 +
|-
 +
| 101 || Point distance on circle || Double, Double, Double, Integer || Double, Double
 +
|-
 +
| 102 || Point at end of text || Double, Double, Double, Double, Double, Integer || Double, Double
 +
|-
 +
| 103 || Polar point || Double, Double, Double, Double || Double, Double
 +
|-
 +
| 104 || Point at start of arc || None || Double, Double
 +
|-
 +
| 105 || Point at end of arc || None || Double, Double
 +
|-
 +
| 106 || Angle from 2 points || Double, Double, Double, Double || Double
 +
|-
 +
| 107 || Point between 2 points || Double, Double, Double, Double, Double || Double, Double
 +
|-
 +
| 254 || Return || None || None
 +
|-
 +
| 255 || End of symbol || None || None
 +
|-
 +
|}
  
 
[[Category:RISC OS]]
 
[[Category:RISC OS]]

Latest revision as of 16:27, 22 November 2022

File Format
Name OakPDT Drawing
Ontology

[edit] 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").

[edit] Format details

File Header
0 Byte Major version number of the file format (always 1)
1 Byte Minor version number of the format
  • 2 corresponds to OakPDT v2.50 (17 November 1990)
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
  • In v1.2 or later, the symbol is deleted if the pen colour has bit 5 set, and the lower four bits are ANDed with %1111.
2 Byte Layer number
  • In v1.0 and v1.1, the symbol is deleted if the layer number is 16.
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:
  • 0 for internal dimensions.
  • 1 for external left dimensions.
  • 2 for external right dimensions.
  • 3 for external dimensions.
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.
  • If bit 0 is set then the layer is on.
  • If bit 1 is set then the layer is locked.
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.
  • If bit 0 is set then the layer is on.
  • If bit 1 is set then the layer is locked.
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.


[edit] Drawing definition

The drawing definition is an array of opcodes. The return values are pushed in order to a stack, and the parameters are popped in reverse order. Some opcodes have extra data that is read in from the drawing definition and is used as the return value.

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 Byte, Integer, Byte, Integer None
45 Intersection of 2 lines Integer, Integer Double, Double
46 Intersection of line and circle Byte, Integer, Integer Double, Double
47 Construction line from 2 points Double, Double, Double, Double None
48 Angled construction line Double, Double, Double None
49 Construction line tangent to 2 circles Byte, Integer, Byte, Integer None
50 Parallel construction line Integer, Double, Double None
51 Perpendicular construction line Integer, Double, Double None
52 Centre of construction circle Double, Double None
53 Construction circle radius Double None
54 Construction circle diameter Double None
55 Intersection of 2 circles Byte, Integer, Integer Double, Double
56 Circle tangent to 2 lines Byte, Integer, Integer, Double None
57 Line tangent from point to circle Double, Double, Byte, Byte, Integer None
58
59 Distance between 2 points Double, Double, Double, Double Double
61 Push X coordinate None Double Double
62 Push Y coordinate None Double Double
63 Point at centre of construction circle Integer Double, Double
64 Line normal from point to circle Byte, Integer, Double, Double None
65 Point on line at distance Double, Double, Double, Integer, Byte Double, Double
66 Circle tangent to 2 circles Double, Byte, Integer, Integer None
67 Parallel construction line at distance Double, Integer, Byte None
68 Circle tangent to line and circle Double, Byte, Integer, Integer None
69 Line normal to 2 circles Integer, Integer, Byte None
70 3 point circle Double, Double, Double, Double, Double, Double None
71 Circle tangent to line Double, Double, Integer None
72 Line relative to line Double, Double, Double, Integer None
73 Polar line Double, Double, Double, Double None
74 Point at end of line None Double, Double
75 Line bisects 2 lines (mk1) Integer, Integer, Byte None
76 Mid point Double, Double, Double, Double Double, Double
77 Perpendicular bisector Double, Double, Double, Double None
78 Point at start of line None Double, Double
79 3 point arc Double, Double, Double, Double, Double, Double None
80 Point at centre of arc Integer Double, Double
81 Angle dimension Integer, Integer Double, Double, Double, Double, Double, Double, Double, Double
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 Double, Double, Double, Double, Integer Double
90 Angle between 2 lines Integer, Integer, Byte Double
91 Line bisects 2 lines (mk2) Integer, Integer, Byte None
92 angle from 3 points Double, Double, Double, Double, Double, Double Double
93 Circle info Byte, Integer Double
94 Relative point Double, Double, Double, Double Double, Double
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 Double Double
101 Point distance on circle Double, Double, Double, Integer Double, Double
102 Point at end of text Double, Double, Double, Double, Double, Integer Double, Double
103 Polar point Double, Double, Double, Double Double, Double
104 Point at start of arc None Double, Double
105 Point at end of arc None Double, Double
106 Angle from 2 points Double, Double, Double, Double Double
107 Point between 2 points Double, Double, Double, Double, Double Double, Double
254 Return None None
255 End of symbol None None
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox