Just an update - the crash actually happens whenever all the edges are added to ANY MSelectionList, not just the global selection.
Ie, this will crash: import maya.cmds as cmds import maya.OpenMaya as om polyCube = cmds.polyCube()[0] subd = cmds.polyToSubdiv(polyCube)[0] selList = om.MSelectionList() selList.add(subd + '.sme[*][*]') Also, I figured out why refresh would solve the crash sometimes, and not other times - depends on whether I'm testing in a full gui or not. (Sort of a 'Duh!' moment there...) - Paul On Mon, Jun 8, 2009 at 12:19 PM, John Creson<[email protected]> wrote: > don't know about the performance hit, but iterate through the edges adding > them to the selection list one at a time? > > On Mon, Jun 8, 2009 at 2:40 PM, Paul Molodowitch <[email protected]> wrote: >> >> Well... it's not really what I want to do. I need to be prepared >> (potentially) for anything an end user wants to do - if they create a >> component which has ALL of the subdiv's edges, they should be able to >> select it... >> >> - Paul >> >> On Mon, Jun 8, 2009 at 10:48 AM, John Creson<[email protected]> wrote: >> > If it's arbitrarily large, do you really want to select everything, or >> > do >> > you just want to iterate over each one? >> > >> > On Mon, Jun 8, 2009 at 1:11 PM, Paul Molodowitch <[email protected]> >> > wrote: >> >> >> >> Need to do something after... it's actually for pymel's new component >> >> implementation, so there may be an arbitrarily large amount of things >> >> that users might want to do after, and I don't think >> >> '.executeDeferred" will really work. =/ >> >> >> >> Thanks for the suggestion though... >> >> >> >> I think we'll just have to add some special case code to pymel's >> >> select command that checks for '.sme[*]' >> >> >> >> - Paul >> >> >> >> On Mon, Jun 8, 2009 at 7:52 AM, John Creson<[email protected]> >> >> wrote: >> >> > You might try piling up the refresh and the selection at the end of >> >> > whatever >> >> > is happening before with an executeDeferred. >> >> > >> >> > import maya.utils as utils >> >> > >> >> > utils.executeDeferred("cmds.refresh();cmds.select(subd + >> >> > '.sme[*][*]')") >> >> > >> >> > Are you trying to end what is happening at this selection, or is >> >> > there >> >> > something that you need to do with the selection after you've >> >> > selected >> >> > it? >> >> > >> >> > -JohnC >> >> > >> >> > On Mon, Jun 8, 2009 at 10:38 AM, Paul Molodowitch >> >> > <[email protected]> >> >> > wrote: >> >> >> >> >> >> I spoke too soon - still getting a crash when I'm selecting >> >> >> .sme[*][*] >> >> >> in my own code, even with a refresh. Unfortunately, I'm not sure >> >> >> what >> >> >> the key difference between it and the test case I already posted >> >> >> is... >> >> >> >> >> >> - Paul >> >> >> >> >> >> On Fri, Jun 5, 2009 at 9:20 PM, Paul Molodowitch<[email protected]> >> >> >> wrote: >> >> >> > Yup, no more crash. Thanks for the workaround! >> >> >> > >> >> >> > - Paul >> >> >> > >> >> >> > On Fri, Jun 5, 2009 at 4:39 PM, John Creson<[email protected]> >> >> >> > wrote: >> >> >> >> I just took another look at the initial construct with an >> >> >> >> emphasis >> >> >> >> on >> >> >> >> the >> >> >> >> "avoid" question... >> >> >> >> >> >> >> >> >> >> >> >> import maya.cmds as cmds >> >> >> >> import maya.utils as utils >> >> >> >> >> >> >> >> polyCube = cmds.polyCube()[0] >> >> >> >> subd = cmds.polyToSubdiv(polyCube)[0] >> >> >> >> cmds.refresh() >> >> >> >> cmds.select(subd + '.sme[*][*]') >> >> >> >> >> >> >> >> print(cmds.ls(sl=True)) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> the refresh seems to avoid this crash. >> >> >> >> >> >> >> >> Or in MEL (which also crashed without the refresh) >> >> >> >> >> >> >> >> string $polyCube[] = `polyCube`; >> >> >> >> string $subd[] = `polyToSubdiv $polyCube[0]`; >> >> >> >> refresh; >> >> >> >> select -r ($subd[0] + ".sme[*][*]") >> >> >> >> ls -sl >> >> >> >> >> >> >> >> Paul, is this acceptable to you for now? >> >> >> >> >> >> >> >> >> >> >> >> On Fri, Jun 5, 2009 at 5:18 AM, Dimitry >> >> >> >> <[email protected]> >> >> >> >> wrote: >> >> >> >>> >> >> >> >>> but if I trying to select unordered vertexes i got crash >> >> >> >>> >> >> >> >>> #unitMesh= ls(selection=True)[0] >> >> >> >>> mc.select(clear=True) >> >> >> >>> select (unitMesh.vtx[6422:6429], add=True) >> >> >> >>> select (unitMesh.vtx[3273:3275, 3278:3279, 3282:3283, 3285], >> >> >> >>> add=True) >> >> >> >>> >> >> >> >>> nows somebody how possible to avoid it? >> >> >> >>> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> > >> >> > >> >> > > >> >> > >> >> >> >> >> > >> > >> > > >> > >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
