# Update counters
geompy = geomBuilder.New()
- all_ids = geompy.SubShapeAllIDs(self._selected_object, self.get_selection_level())
+ total = geompy.NumberOfSubShapes(self._selected_object, self.get_selection_level())
selected_ids = self.get_local_selection()
- self.set_subshapes_counters(len(selected_ids), len(all_ids))
+ self.set_subshapes_counters(len(selected_ids), total)
# Update label
self.update_subshapes_label()
# Get all sub-shapes
geompy = geomBuilder.New()
selection_level = self.get_selection_level()
- subshapes_ids = geompy.SubShapeAllIDs(self._selected_object, selection_level)
+ subshapes = geompy.SubShapeAll(self._selected_object, selection_level)
# Iterate over ids to check if it fits to limits
- # TODO: implement selections
+ param_ids = { GEOM.EDGE : 0, GEOM.FACE : 1, GEOM.SOLID : 2 }
+ param_index = param_ids[selection_level]
+
limits = self.get_limits()
- for id in subshapes_ids:
- # Get a sub-shape by id
- pass
-
- # Get related parameter to check it later
- param = None
- if selection_level == GEOM.EDGE:
- # Get a lenght of an edge
- pass
- elif selection_level == GEOM.FACE:
- # Get an area of a face
- pass
- elif selection_level == GEOM.SOLID:
- # Get a volume of a solid
- pass
- else:
- # We shouldn't fall here
- QMessageBox.warning(
- None, 'Warning', 'Wrong selection level: %s!' % (selection_level))
- return
+ for shape in subshapes:
+ # Get properties as a list [theLength, theSurfArea, theVolume]
+ properties = geompy.BasicProperties(shape)
+ param = properties[param_index]
# Check if it fits to the limits
if param >= limits[0] and param <= limits[1]:
+ # TODO: implement selections with GEOM_Swig_LocalSelector or something...
# Select sub-shape
pass
else:
# Deselect sub-shape
pass
- # Update displayed info
- self.update_subshapes_info()
+ # Update displayed info
+ self.update_subshapes_info()
def on_limit_changed(self):