|
10 | 10 | from OCP.TDF import TDF_Label |
11 | 11 | from OCP.TopLoc import TopLoc_Location |
12 | 12 | from OCP.Quantity import Quantity_ColorRGBA |
13 | | -from OCP.XCAFPrs import ( |
14 | | - XCAFPrs_DocumentExplorer, |
15 | | - XCAFPrs_DocumentExplorerFlags_None, |
16 | | - XCAFPrs_Style, |
17 | | -) |
18 | 13 |
|
19 | 14 | from vtkmodules.vtkRenderingCore import ( |
20 | 15 | vtkActor, |
@@ -162,7 +157,7 @@ def toCAF( |
162 | 157 | # used to cache unique, possibly meshed, compounds; allows to avoid redundant meshing operations if same object is referenced multiple times in an assy |
163 | 158 | compounds: Dict[AssemblyObjects, Compound] = {} |
164 | 159 |
|
165 | | - def _toCAF(el, ancestor, color): |
| 160 | + def _toCAF(el, ancestor, color) -> TDF_Label: |
166 | 161 |
|
167 | 162 | # create a subassy |
168 | 163 | subassy = tool.NewShape() |
@@ -212,18 +207,14 @@ def _toCAF(el, ancestor, color): |
212 | 207 | # add the current subassy to the higher level assy |
213 | 208 | tool.AddComponent(ancestor, subassy, el.loc.wrapped) |
214 | 209 |
|
| 210 | + return subassy |
| 211 | + |
215 | 212 | # process the whole assy recursively |
216 | | - _toCAF(assy, None, None) |
| 213 | + top = _toCAF(assy, None, None) |
217 | 214 |
|
218 | 215 | tool.UpdateAssemblies() |
219 | | - return ( |
220 | | - XCAFPrs_DocumentExplorer( |
221 | | - doc, XCAFPrs_DocumentExplorerFlags_None, XCAFPrs_Style() |
222 | | - ) |
223 | | - .Current() |
224 | | - .Label, |
225 | | - doc, |
226 | | - ) |
| 216 | + |
| 217 | + return top, doc |
227 | 218 |
|
228 | 219 |
|
229 | 220 | def toVTK( |
|
0 commit comments