def __init__(self, position, **kwargs): self.max_object = mxs.box(length=0.08, width=0.08, height=0.08) mxs.centerpivot(self.max_object) self.max_object.pos=position.to_point3() for key, value in kwargs.items(): setattr(self.max_object, key, value)
def rigidity_node_number(self): all_objects = blur3d.api.Scene().objects() required_name = "rigidity_node_" + self.max_object.name rigidity_nodes = filter(lambda obj: obj.name() == required_name,all_objects) if rigidity_nodes: chosen_node = rigidity_nodes[0].nativePointer() mxs.centerpivot(chosen_node) the_node = Node.Node(chosen_node.pos) return str(self.nodes.index(self.nearest_node(the_node))) return "9999"
def _separation_boxes(self): """Gets all the separation boxes in the scene as a list of Nodes""" if not hasattr(self, "_internal_separation_boxes"): sep_boxes = filter(lambda obj: obj.name().lower().startswith("separation_node"), Scene.instance().objects()) map(lambda box: mxs.centerpivot(box._nativePointer), sep_boxes) self._internal_separation_boxes = map(lambda obj: Node.Node(obj._nativePointer.pos), sep_boxes) return self._internal_separation_boxes
def render(self): mxs.centerpivot(self.max_object) return str(self.nodes.index(self.nearest_node(self.max_object.pos))) + "\n"