addUndo in CallCommand?



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

    On 20/11/2012 at 15:41, xxxxxxxx wrote:

    This is my script... but not work...

    main(doc,op)
    {
    doc->StartUndo();
    CallCommand(1011183); // Estrudi
    tool()#MDATA_EXTRUDE_OFFSET=100;
    tool()#MDATA_EXTRUDE_CREATECAPS=TRUE;
    CallButton(tool(), MDATA_APPLY); // Esegue il Comando
    doc->AddUndo(MDATA_EXTRUDE_OFFSET, doc);

    CallCommand(450000004); // Estrudi Internamente
    tool()#MDATA_EXTRUDEINNER_OFFSET=10;
    tool()#MDATA_EXTRUDEINNER_ANGLE=1.571;
    CallButton(tool(), MDATA_APPLY); // Esegue il Comando
    doc->EndUndo();

    }



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

    On 21/11/2012 at 00:34, xxxxxxxx wrote:

    doc->AddUndo(MDATA_EXTRUDE_OFFSET, doc);
    

    Should be changed with:

    doc->AddUndo(UNDOTYPE_CHANGE, op);
    


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

    On 21/11/2012 at 04:44, xxxxxxxx wrote:

    not work... not undo...



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

    On 21/11/2012 at 04:52, xxxxxxxx wrote:

    Your code only add an undo on the Extrude Inner changes.

    EDIT: Ok, I see what you want to do.
    AddUndo() always has to be called before a change is made.
    So if you want to be able to undo extrude changes, your code should be:

    main(doc,op)
    {
    doc->StartUndo();
      
    doc->AddUndo(UNDOTYPE_CHANGE, op);
    CallCommand(1011183);
    tool()#MDATA_EXTRUDE_OFFSET=100;
    tool()#MDATA_EXTRUDE_CREATECAPS=TRUE;
    CallButton(tool(), MDATA_APPLY);
      
    doc->AddUndo(UNDOTYPE_CHANGE, op);
    CallCommand(450000004);
    tool()#MDATA_EXTRUDEINNER_OFFSET=10;
    tool()#MDATA_EXTRUDEINNER_ANGLE=1.571;
    CallButton(tool(), MDATA_APPLY);
      
    doc->EndUndo();
    }
    

    This script adds 2 undo: one for the Extrude and another for the Extrude Inner.



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

    On 23/11/2012 at 09:32, xxxxxxxx wrote:

    Yannick Puech, in possible to annull in one undo click, 2 callcommand?
    Extrude and Extrude Inner? thanks :)



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

    On 24/11/2012 at 11:03, xxxxxxxx wrote:

    Up



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

    On 24/11/2012 at 16:35, xxxxxxxx wrote:

    To the best of my knowledge, CallCommand() can't be included in your own
    Undo stack. They always follow the document itself.
    But most CallCommand()'s can be executed as SendModellingCommand()'s instead
    and thus can be controlled by your own Undo stack.

    Cheers
    Lennart



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

    On 25/11/2012 at 06:48, xxxxxxxx wrote:

    tcastudio, how is this code, with SendModellingCommand() ?
    Thanks! 
    smain(doc,op)
    {
    doc->StartUndo();

    doc->AddUndo(UNDOTYPE_CHANGE, op);
    CallCommand(1011183);
    tool()#MDATA_EXTRUDE_OFFSET=100;
    tool()#MDATA_EXTRUDE_CREATECAPS=TRUE;
    CallButton(tool(), MDATA_APPLY);

    doc->AddUndo(UNDOTYPE_CHANGE, op);
    CallCommand(450000004);
    tool()#MDATA_EXTRUDEINNER_OFFSET=10;
    tool()#MDATA_EXTRUDEINNER_ANGLE=1.571;
    CallButton(tool(), MDATA_APPLY);

    doc->EndUndo();
    }

    Sorry for my bad English



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

    On 25/11/2012 at 09:35, xxxxxxxx wrote:

    You call the tool you want in the SendModelingCommand()
    Before that you make a BaseContainer setting the values
    you want (you can select the tool and from its AM, drag and
    drop the parameters you want into the scripts manager).

    In the SendModelingCommand, you pass doc as NULL and
    you have control over your own Undo stack.

    Any particular reason why you don't want to use Python?

    Cheers
    Lennart

      
    main(doc,op)   
    {   
    doc->StartUndo();   
    doc->AddUndo(UNDO_OBJECT,op);   
      
    var bc_A = new(BaseContainer);   
    bc_A->SetData(MDATA_EXTRUDE_OFFSET,100.0);   
    bc_A->SetData(MDATA_EXTRUDE_CREATECAPS,TRUE);   
    SendModelingCommand(   
    ID_MODELING_EXTRUDE_TOOL,   
    NULL,   
    op,   
    bc_A,   
    MODELINGCOMMANDMODE_POLYGONSELECTION);   
      
    var bc_B = new(BaseContainer);   
    bc_B->SetData(MDATA_EXTRUDEINNER_OFFSET,10.0);   
    bc_B->SetData(MDATA_EXTRUDEINNER_ANGLE,Degree(90.0) );   
    SendModelingCommand(ID_MODELING_EXTRUDE_INNER_TOOL,   
    NULL,   
    op,   
    bc_B,   
    MODELINGCOMMANDMODE_POLYGONSELECTION);   
      
    op->Message(MSG_UPDATE);   
    doc->EndUndo();   
      
    }
    


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

    On 25/11/2012 at 09:54, xxxxxxxx wrote:

    Thank you very much, for your courtesy :)

    don't use Python because I did not find many documentations with examples...
    hopefully soon switched to python


Log in to reply