The stringArrayIntersector command creates and edits an object which is able to efficiently intersect large string arrays. The intersector object maintains a sense of the intersection so far, and updates the intersection when new string arrays are provided using the -i/intersect flag. Note that the string intersector object may be deleted using the deleteUI command.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
allowDuplicates (ad) | bool | ||
Should the intersector allow duplicates in the input arrays (true), or combine all duplicate entries into a single, unique entry (false). This flag must be used when initially creating the intersector. Default is ‘false’. |
|||
defineTemplate (dt) | unicode | ||
Puts a command in a mode where any other flags and args are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template. |
|||
exists (ex) | bool | ||
|
|||
intersect (i) | <type ‘unicode’>, ... | ||
|
|||
reset (r) | bool | ||
|
|||
useTemplate (ut) | unicode | ||
|
Derived from mel command maya.cmds.stringArrayIntersector
Example:
import pymel.core as pm
# Create an intersector
#
myIntersector = pm.stringArrayIntersector('stringArrayIntersector')
# Intersect some string arrays using the intersector
#
initialArray = ['Excellent', 'Smithers', 'doh']
pm.stringArrayIntersector( myIntersector, edit=True, intersect=initialArray )
# Result: u'stringArrayIntersector' #
pm.stringArrayIntersector( myIntersector, edit=True, intersect=['Smithers', 'Homer'] )
# Result: u'stringArrayIntersector' #
# Query the intersector to see what the intersection is so far
#
pm.stringArrayIntersector( myIntersector, query=True )
# Result: [u'Smithers'] #
# Reset the intersector so that you can use it again with new string
# arrays
#
pm.stringArrayIntersector( myIntersector, edit=True, reset=True )
# Result: u'stringArrayIntersector' #
# Delete the intersector as we are now done with it
#
pm.deleteUI( myIntersector )
# Result: u'' #