Skip to content

Commit 2e5d070

Browse files
committed
Fixed Solid inheritance issue
1 parent eec0d82 commit 2e5d070

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

OCCUtils/solid.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,20 @@
2222
from shell import Shell
2323

2424

25-
class Solid(KbeObject, TopoDS_Solid):
26-
27-
"""high level Solid Api"""
25+
class Solid(TopoDS_Solid, KbeObject):
2826
def __init__(self, solid):
29-
KbeObject.__init__(name='solid')
30-
TopoDS_Solid.__init__(self, solid)
27+
assert isinstance(solid, TopoDS_Solid), 'need a TopoDS_Solid, got a %s' % solid.__class__
28+
assert not solid.IsNull()
29+
super(Solid, self).__init__()
30+
KbeObject.__init__(self, 'solid')
31+
# we need to copy the base shape using the following three
32+
# lines
33+
assert self.IsNull()
34+
self.TShape(solid.TShape())
35+
self.Location(solid.Location())
36+
self.Orientation(solid.Orientation())
37+
assert not self.IsNull()
38+
3139
self.GlobalProperties = GlobalProperties(self)
3240

3341
#=======================================================================

0 commit comments

Comments
 (0)