def ask1(self): """Select a single object from the list. Returns the object, not its name! """ if self.ask('single'): return named(self.names[0]) else: return None
def append(self,name,value=None): """Add a name,value to a selection. If no value is given, its current value is used. If a value is given, it is exported. """ self.names.append(name) if value is None: value = named(name) else: export({name:value}) self.values.append(value)
def append(self, name, value=None): """Add a name,value to a selection. If no value is given, its current value is used. If a value is given, it is exported. """ self.names.append(name) if value is None: value = named(name) else: export({name: value}) self.values.append(value)
def check(self,single=False,warn=True): """Check that we have a current selection. Returns the list of Objects corresponding to the current selection. If single==True, the selection should hold exactly one Object name and a single Object instance is returned. If there is no selection, or more than one in case of single==True, an error message is displayed and None is returned """ if len(self.names) == 0: if warn: warning("No %sobjects were selected" % self.object_type()) return None if single and len(self.names) > 1: if warn: warning("You should select exactly one %sobject" % self.object_type()) return None if single: return named(self.names[0]) else: return map(named,self.names)
def check(self, single=False, warn=True): """Check that we have a current selection. Returns the list of Objects corresponding to the current selection. If single==True, the selection should hold exactly one Object name and a single Object instance is returned. If there is no selection, or more than one in case of single==True, an error message is displayed and None is returned """ self.names = [n for n in self.names if n in pf.PF] if len(self.names) == 0: if warn: warning("No %sobjects were selected" % self.object_type()) return None if single and len(self.names) > 1: if warn: warning("You should select exactly one %sobject" % self.object_type()) return None if single: return named(self.names[0]) else: return map(named, self.names)
def draw_nodes(n): """Draw the numbers of an object's nodes.""" return draw(named(n).coords,flat=True,wait=False)
def draw_bbox(n): """Draw the bbox of an object.""" return drawBbox(named(n))
def draw_free_edges(n): """Draw the feature edges of an object.""" return drawFreeEdges(named(n), color='black')
def draw_node_numbers(n): """Draw the numbers of an object's nodes.""" return drawNumbers(named(n).coords, color='red')
def draw_nodes(n): """Draw the nodes of an object.""" return draw(named(n).coords, nolight=True, wait=False)
def draw_elem_numbers(n): """Draw the numbers of an object's elements.""" return drawNumbers(named(n), color='blue')
def draw_object_name(n): """Draw the name of an object at its center.""" return drawText3D(named(n).center(), n)
def draw_object_name(n): """Draw the name of an object at its center.""" return drawText3D(named(n).center(),n)
def draw_free_edges(n): """Draw the feature edges of an object.""" return drawFreeEdges(named(n),color='black')
def draw_node_numbers(n): """Draw the numbers of an object's nodes.""" return drawNumbers(named(n).coords,color='red')
def draw_nodes(n): """Draw the nodes of an object.""" return draw(named(n).coords,nolight=True,wait=False)
def draw_elem_numbers(n): """Draw the numbers of an object's elements.""" return drawNumbers(named(n),color='blue')