for element in skel.element_iterator(): matl = element.material(skeleton) if matl is not None and matl.name() == self.material: selected.append(element) selection.start() selection.clear() selection.select(selected) registeredclass.Registration( 'Select by Material', ElementSelectionModifier, ByElementMaterial, ordering=1.5, params=[ materialparameter.AnyMaterialParameter( 'material', tip="Select elements with this material.") ], tip="Select all Elements with a given Material.", discussion=xmlmenudump.loadFile('DISCUSSIONS/engine/menu/bymaterial.xml')) ####################### class ElementHomogeneity(ElementSelectionModifier): def __init__(self, threshold=0.9): self.threshold = threshold def __call__(self, skeleton, selection): selected = [] skel = skeleton.getObject() for element in skel.element_iterator():
if self.material == '<Any>': selection.select(AnyMaterialSelection(ms)) elif self.material == '<None>': courier = NoMaterialSelection(ms) selection.select(courier) else: selection.select(MaterialSelection( ms, materialmanager.getMaterial(self.material))) registeredclass.Registration( 'Select Material', registeredclass=pixelselectionmod.SelectionModifier, subclass=SelectMaterialPixels, ordering=110, params=[materialparameter.AnyMaterialParameter('material', tip='The name of a material, or \'None\'.' ) ], tip="Select pixels to which a given Material has been assigned.", discussion=""" <para> Select all pixels to which the given <varname>material</varname> has been assigned. If <varname>material</varname> is"<None>", only pixels without an assigned &material; will be selected. If <varname>material</varname> is "<Any>", pixels with any assigned &material; will be selected. </para> """ )