-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathimporterDesignView.py
182 lines (158 loc) · 5.06 KB
/
importerDesignView.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# -*- coding: utf-8 -*-
'''
importerDesignView.py:
Simple approach to read/analyse Autodesk (R) Invetor (R) part file's (IPT) browser view data.
The importer can read files from Autodesk (R) Invetor (R) Inventro V2010 on. Older versions will fail!
TODO:
'''
from importerConstants import VAL_REF
from importerSegment import SegmentReader
from importerUtils import *
from importerSegNode import _TYP_NODE_REF_, _TYP_UINT32_, _TYP_LIST_UINT32_A_, _TYP_NODE_REF_
__author__ = 'Jens M. Plonka'
__copyright__ = 'Copyright 2017, Germany'
__status__ = 'In-Development'
class DesignViewReader(SegmentReader):
def __init__(self, segment):
super(DesignViewReader, self).__init__(segment)
def Read_08823621(self, node):
i = node.Read_Header0('Camera')
i = self.skipBlockSize(i)
i = node.ReadFloat64_3D(i, 'target')
i = node.ReadFloat64_3D(i, 'eye')
i = node.ReadFloat64_3D(i, 'a0')
i = node.ReadFloat64(i, 'angle')
i = node.ReadFloat64(i, 'f64_0')
i = node.ReadFloat64_3D(i, 'up')
return i
def Read_216B3A55(self, node):
i = node.Read_Header0()
i = node.ReadList2(i, _TYP_UINT32_, 'lst0')
i = self.ReadTransformation3D(node, i)
return i
def Read_328FC2EA(self, node): # ViewDirectionCollection
i = node.Read_Header0('ViewDirectionCollection')
i = node.ReadList2(i, _TYP_NODE_REF_, 'lst0')
i = node.ReadLen32Text16(i)
return i
def Read_301D4138(self, node): # member of ViewDirection.lst0
i = node.Read_Header0()
i = node.ReadUInt32(i, 'u32_0')
i = node.ReadLen32Text16(i)
i = node.ReadUInt32(i, 'u32_1')
i = node.ReadUInt8A(i, 2, 'a0')
i = node.ReadUInt32A(i, 2, 'a1')
return i
def Read_47C98A81(self, node):
i = node.Read_Header0()
i = self.skipBlockSize(i)
i = node.ReadChildRef(i, 'ref0')
i = self.skipBlockSize(i)
i = node.ReadBoolean(i, 'b0')
return i
def Read_71C22321(self, node):
i = node.Read_Header0()
i = self.skipBlockSize(i)
i = node.ReadChildRef(i, 'ref0')
i = self.skipBlockSize(i)
i = node.ReadBoolean(i, 'b0')
return i
def Read_9B043321(self, node):
i = node.Read_Header0()
if (self.version < 2025):
i = self.skipBlockSize(i)
i = node.ReadChildRef(i, 'ref0')
i = self.skipBlockSize(i)
if (self.version < 2020):
i = node.ReadLen32Text16(i)
else:
i = node.ReadUInt32(i, 'u32_1')
if (self.version > 2012): i += 4 # skip ?? ?? ?? ??
else:
i = node.ReadList2(i, _TYP_NODE_REF_, 'lst0')
i = node.ReadUInt32(i, 'u32_1')
i = node.ReadUInt32(i, 'u32_2')
return i
def Read_551FB1BF(self, node):
i = node.Read_Header0('ViewScale')
i = node.ReadFloat64(i, 'scale')
i = node.ReadUInt32(i, 'u32_0')
return i
def Read_8902B593(self, node): # member of ViewDirection.lst0
i = node.Read_Header0()
i = node.ReadUInt32(i, 'flags')
return i
def Read_987C5D0F(self, node):
i = node.ReadUInt16A(0, 3, 'a0')
i = self.skipBlockSize(i, 2)
i = node.ReadUUID(i, 'uid0')
i = node.ReadList2(i, _TYP_LIST_UINT32_A_, 'lst0')
return i
def Read_9DC2A241(self, node): # ViewDirection
i = node.Read_Header0('ViewDirection')
i = node.ReadLen32Text16(i)
i = node.ReadList2(i, _TYP_NODE_REF_, 'lst0')
i = node.ReadUInt32(i, 'flags')
i = node.ReadUInt16(i, 'CodePage')
# list2 of what?
return i
def Read_6E2FE45A(self, node):
i = node.Read_Header0()
return i
def Read_BDA7138D(self, node):
i = node.Read_Header0()
return i
def Read_D4DDE1F5(self, node): # member of ViewDirection.lst0
i = node.Read_Header0()
i = node.ReadChildRef(i, 'ref_0')
i = node.ReadLen32Text16(i)
return i
def Read_D8B8F230(self, node):
i = node.Read_Header0()
i = self.skipBlockSize(i)
i = node.ReadChildRef(i, 'ref0')
i = self.skipBlockSize(i)
i = node.ReadBoolean(i, 'b0')
i = self.skipBlockSize(i)
i = node.ReadUInt32(i, 'u32_0')
return i
def Read_D9980532(self, node):
i = node.Read_Header0()
i = self.skipBlockSize(i)
if (self.version < 2024):
i = node.ReadChildRef(i, 'ref0')
ref0 = node.get('ref0')
node.delete('ref0')
node.set('lst0', (ref0,), VAL_REF)
else:
i = node.ReadList2(i, _TYP_NODE_REF_, 'lst0')
i = self.skipBlockSize(i)
i = node.ReadBoolean(i, 'b0')
i = self.skipBlockSize(i)
if (self.version > 2011):
b, i = getBoolean(node.data, i)
i = node.ReadUInt32(i, 'u32_0')
i = node.ReadUInt8(i, 'u8_1')
if (not b):
i = node.ReadLen32Text16(i, 'txt0')
i = node.ReadLen32Text16(i, 'txt1')
i = node.ReadUInt16(i, 'u16_0')
i = node.ReadUInt32(i, 'u32_1')
if (self.version > 2017): i += 4
return i
def Read_E3684E1C(self, node):
i = node.Read_Header0()
i = self.ReadTransformation3D(node, i)
return i
def Read_EBA31E2E(self, node):
i = node.Read_Header0()
i = self.skipBlockSize(i)
i = node.ReadUInt32(i, 'u32_0')
n, i = getUInt32(node.data, i)
i = node.ReadUInt16A(i, n, 'a0')
return i
def Read_F2E6BC0B(self, node):
i = node.Read_Header0()
i = node.ReadChildRef(i, 'ref_0')
i = node.ReadBoolean(i, 'b0')
return i