Skip to content

Commit 45a4f30

Browse files
committed
Return TDF_Label from _toCAF
1 parent 01b4820 commit 45a4f30

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

cadquery/occ_impl/assembly.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
from OCP.TDF import TDF_Label
1111
from OCP.TopLoc import TopLoc_Location
1212
from OCP.Quantity import Quantity_ColorRGBA
13-
from OCP.XCAFPrs import (
14-
XCAFPrs_DocumentExplorer,
15-
XCAFPrs_DocumentExplorerFlags_None,
16-
XCAFPrs_Style,
17-
)
1813

1914
from vtkmodules.vtkRenderingCore import (
2015
vtkActor,
@@ -162,7 +157,7 @@ def toCAF(
162157
# used to cache unique, possibly meshed, compounds; allows to avoid redundant meshing operations if same object is referenced multiple times in an assy
163158
compounds: Dict[AssemblyObjects, Compound] = {}
164159

165-
def _toCAF(el, ancestor, color):
160+
def _toCAF(el, ancestor, color) -> TDF_Label:
166161

167162
# create a subassy
168163
subassy = tool.NewShape()
@@ -212,18 +207,14 @@ def _toCAF(el, ancestor, color):
212207
# add the current subassy to the higher level assy
213208
tool.AddComponent(ancestor, subassy, el.loc.wrapped)
214209

210+
return subassy
211+
215212
# process the whole assy recursively
216-
_toCAF(assy, None, None)
213+
top = _toCAF(assy, None, None)
217214

218215
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
227218

228219

229220
def toVTK(

0 commit comments

Comments
 (0)