コード例 #1
0
    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
コード例 #2
0
    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
コード例 #3
0
    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)
コード例 #4
0
    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)
コード例 #5
0
    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)
コード例 #6
0
    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)
コード例 #7
0
def draw_nodes(n):
    """Draw the numbers of an object's nodes."""
    return draw(named(n).coords,flat=True,wait=False)
コード例 #8
0
def draw_bbox(n):
    """Draw the bbox of an object."""
    return drawBbox(named(n))
コード例 #9
0
def draw_free_edges(n):
    """Draw the feature edges of an object."""
    return drawFreeEdges(named(n), color='black')
コード例 #10
0
def draw_node_numbers(n):
    """Draw the numbers of an object's nodes."""
    return drawNumbers(named(n).coords, color='red')
コード例 #11
0
def draw_nodes(n):
    """Draw the nodes of an object."""
    return draw(named(n).coords, nolight=True, wait=False)
コード例 #12
0
def draw_elem_numbers(n):
    """Draw the numbers of an object's elements."""
    return drawNumbers(named(n), color='blue')
コード例 #13
0
def draw_object_name(n):
    """Draw the name of an object at its center."""
    return drawText3D(named(n).center(), n)
コード例 #14
0
def draw_object_name(n):
    """Draw the name of an object at its center."""
    return drawText3D(named(n).center(),n)
コード例 #15
0
def draw_bbox(n):
    """Draw the bbox of an object."""
    return drawBbox(named(n))
コード例 #16
0
def draw_free_edges(n):
    """Draw the feature edges of an object."""
    return drawFreeEdges(named(n),color='black')
コード例 #17
0
def draw_node_numbers(n):
    """Draw the numbers of an object's nodes."""
    return drawNumbers(named(n).coords,color='red')
コード例 #18
0
def draw_nodes(n):
    """Draw the nodes of an object."""
    return draw(named(n).coords,nolight=True,wait=False)
コード例 #19
0
def draw_elem_numbers(n):
    """Draw the numbers of an object's elements."""
    return drawNumbers(named(n),color='blue')