2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model.roots import Interface
9 def addPartition(part, *args):
10 """Add an Partition feature to the Part and return Partition.
12 Pass all args to Partition __init__ function.
14 assert(len(args) > 0 and args[0] is not None)
15 feature = part.addFeature("Partition")
16 return Partition(feature, *args)
19 class Partition(Interface):
20 """Interface on an Partition feature."""
22 def __init__(self, feature, main_objects=None,
23 tool_objects=None, partition_combine=None):
24 """Initialize an Partition feature with given parameters.
27 feature -- an Partition feature
29 Expected arguments for initializing the feature:
30 main_objects -- list of solids.
31 tool_objects -- list of solids.
32 partition_combine -- boolean value.
34 Interface.__init__(self, feature)
35 assert(self._feature.getKind() == "Partition")
37 self._main_objects = self._feature.data().selectionList("main_objects")
38 self._tool_objects = self._feature.data().selectionList("tool_objects")
39 self._partition_combine = self._feature.data().boolean("partition_combine")
41 assert(self._main_objects)
42 assert(self._tool_objects)
43 assert(self._partition_combine)
45 if main_objects is None:
48 self._fill_attribute(self._main_objects, main_objects)
49 self._fill_attribute(self._tool_objects, tool_objects)
50 self._fill_attribute(self._partition_combine, partition_combine)
53 def setMainObjects(self, main_objects):
54 """Modify base attribute of the feature.
58 self._fill_attribute(self._main_objects, main_objects)
61 def setToolObjects(self, tool_objects):
62 """Modify the to_size, from_size attributes of the feature.
66 self._fill_attribute(self._tool_objects, tool_objects)
69 def setPartitionCombine(self, partition_combine):
70 """Modify planes and offsets attributes of the feature.
74 self._fill_attribute(self._partition_combine, partition_combine)