whats wrong with my split code ?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/10/2008 at 09:34, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    Hi,

    im having problems using the sendModellingCommand to split an object which has some poys selected.

    here's the code:

    > \>      ModelingCommandData md1; \>      // obj is a clone of the original object with the poy selection \>      md1.op = obj; md1.doc = doc; \>      //md1.mode = MODIFY_POLYGONSELECTION; \>      if(!SendModelingCommand(MCOMMAND_SPLIT, md1)) goto Error;      \>            \>      AtomArray::Free(md1.result); \>      AtomArray::Free(md1.arr);      \> \>      return; \> \> Error:      \>      GePrint("couldnt split it!");      \>      AtomArray::Free(md1.result); \>      AtomArray::Free(md1.arr); \>

    I cant really see whats wrong there.
    I always get 'couldnt split it'.

    AFAIK the result is stored in md1.op, and not in md1.result. Thats why 'obj' is a clone of the original object.

    in the end md1.op is just a copy, bc the split comand failed.

    Setting the md1.mode to polyselection doesnt change anything..

    anybody has some experience with the split comamnd ?

    im using alignnormals and reverse normals in a similar way, and they wotk just fine..

    thx,
    Daniel



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/10/2008 at 09:48, xxxxxxxx wrote:

    Is obj in the document? It may be that Split can't work with the object if not inserted. Also, I'm pretty certain that you will want MODIFY_POLYGONSELECTION (or similar) otherwise the default may be MODIFY_ALL which defeats the purpose of split probably.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/10/2008 at 10:39, xxxxxxxx wrote:

    if i insert obj into the doc and set the mode to polygonselection, the command doesnt return false anymore.

    But the object is not split, it's still the same as before..



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/10/2008 at 10:52, xxxxxxxx wrote:

    ok it works now, here's the code:

    > \> ModelingCommandData md1; \>      // obj is the original object with some selected polys \>      md1.op = obj; md1.doc = doc; \>      md1.mode = MODIFY_POLYGONSELECTION; \>      if(!SendModelingCommand(MCOMMAND_SPLIT, md1)) goto Error;           \>      // this is the split copy \>      BaseObject\* splitObj = static_cast<BaseObject\*>(md1.result->GetIndex(0)); \>      splitObj->SetName("objCopy"); \>      splitObj->InsertAfter(obj); \>            \>      AtomArray::Free(md1.arr); \>      return; \>

    looks like the obj to split must be in the doc, and mode must be set to POLYGONSELECTION.

    The split result is in md1.result and when i insert that into the doc, i have my copy of the original obj, that just consists of the selected polys.

    Thanks kuroyume for your hints.

    greetings,
    Daniel



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/10/2008 at 11:00, xxxxxxxx wrote:

    Glad that you have it working. :)


Log in to reply