示例#1
0
        self.group = group

    def __call__(self, skeleton, selection):
        members = skeleton.elementgroups.get_group(self.group)
        selection.start()
        selection.clear()
        selection.select(members)


registeredclass.Registration(
    'Select Group',
    ElementSelectionModifier,
    ElementSelectGroup,
    ordering=4,
    params=[
        skeletongroupparams.ElementGroupParameter('group',
                                                  tip="Name of the group.")
    ],
    tip='Select the members of a group, discarding the current selection.',
    discussion="""<para>
    Select all the &elems; in the given <link
    linkend='Section-Concepts-Skeleton-Groups'>group</link>.  The
    currently selected &elems; will first be deselected.  To select a
    group without first deselecting, use <xref
    linkend='MenuItem-OOF.ElementSelection.Add_Group'/>.
    </para>""")

#######################

# Unselect the indicated group.

示例#2
0
        for i, element in enumerate(elements):
            if element.active(skeleton) and criterion(skeleton, element):
                self.markElement(element, divisions, markedEdges)
            if prog.stopped():
                return
            prog.setFraction(1.0 * (i + 1) / n)
            prog.setMessage("checked %d/%d grouped elements" % (i + 1, n))


registeredclass.Registration('Elements In Group',
                             RefinementTarget,
                             CheckElementsInGroup,
                             ordering=1.5,
                             params=[
                                 skeletongroupparams.ElementGroupParameter(
                                     'group',
                                     tip='Refine the elements in this group.')
                             ],
                             tip="Refine elements in an element group.",
                             discussion="""<para>
    Refine all segments of the elements in the given element group.
    </para>""")

######################


class CheckHomogeneity(RefinementTarget):
    def __init__(self, threshold):
        self.threshold = threshold

    def __call__(self, skeleton, context, divisions, markedEdges, criterion):
示例#3
0
        self.group = group

    def __call__(self, skeleton, context, copy=None):
        elements = context.elementgroups.get_group(self.group)
        if copy:
            return elements[:]
        return elements


registeredclass.Registration('Elements In Group',
                             SkelModTargets,
                             ElementsInGroup,
                             ordering=2.5,
                             params=[
                                 skeletongroupparams.ElementGroupParameter(
                                     'group',
                                     tip='Choose the elements in this group')
                             ],
                             tip='Operate on an Element group',
                             discussion="""<para>

    <classname>ElementsInGroup</classname> is a <xref
    linkend='RegisteredClass-SkelModTargets'/> subclass, used as the
    <varname>targets</varname> parameter in <link
    linkend='RegisteredClass-SkeletonModifier'><classname>SkeletonModifiers</classname></link>. It
    specifies that only the &elems; in a particular &elemgroup; will
    be modified.

    </para>""")

#################################################
示例#4
0
                    for nd in element.nodes:
                        nodedict[nd] = 1
            self.nodes = [n for n in nodedict if n.movable()]
        return self.nodes

    def cleanUp(self):
        self.nodes = None


registeredclass.Registration(
    'Elements in Group',
    FiddleNodesTargets,
    FiddleElementsInGroup,
    ordering=2.5,
    params=[
        skeletongroupparams.ElementGroupParameter(
            'group', tip='Move the nodes belonging to elements in this group')
    ],
    tip="Move nodes of elements in a given element group",
    discussion="""<para>
    Apply a &node; motion <xref
    linkend='RegisteredClass-SkeletonModifier'/> (such as <xref
    linkend='RegisteredClass-Anneal'/>) to the &nodes; of the &elems;
    in a given &elem; group.
    </para>""")

#####################################################


class FiddleNodesMovePosition(registeredclass.RegisteredClass):
    # FiddleNodesMovePosition is a RegisteredClass because it's used
    # as an argument in the IPC menu for parallel node fiddling.