Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    DoCommand() not working

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 290 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 16/06/2012 at 13:38, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   12 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I'm having problems with the DoCommand() method in my tool plugin.
      All I want to do is use the SendModelingCommand to delete the selected polygon in my tool.

      I select the polygon in my MouseInput() method.
      Then I call to the DoCommand() to execute it and delete the polygon. But it doesn't do anything.

      The MouseInput code :

          BaseContainer state;  
        while (GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSELEFT, state)) //While the LMB is down   
        {  
          if (state.GetLong(BFM_INPUT_VALUE) == 0) break; //If the state value is 0. The LMB is no longer down..so don't enter the loop   
          
          LONG x = state.GetLong(BFM_INPUT_X); //Get the cursor's X screen coordinates  
          LONG y = state.GetLong(BFM_INPUT_Y); //Get the cursor's Y screen coordinates  
        
          GeShowMouse(MOUSE_POINT_HAND);       //Change the cursor's apperance when the mouse button is down  
          
          //Check if there is a valid poly id, otherwise deselect all polygons  
          if(polygonid>-1)   
          {  
              bs->Select(polygonid);           //Select the polygon that's currently highlighted  
        
              ModelingCommandData mdat;  
              BaseContainer bc;  
              mdat.bc = &bc;  
              DoCommand(mdat);                //Call to the DoCommand and execute it  
          }  
          else bs->DeselectAll();  
        }
      

      The DoCommand code :

      Bool PolygonTool::DoCommand(ModelingCommandData &mdat)  
      {  
        BaseObject *op = mdat.doc->GetActiveObject();  
        PolygonObject *objPoly=(PolygonObject* )op;  
        
        mdat.mode = MODELINGCOMMANDMODE_POLYGONSELECTION; //Use this for dealing with polygon selections  
        mdat.flags = MODELINGCOMMANDFLAGS_CREATEUNDO;  
        GePrint("Am I working?");                                                        //This prints fine  
        if (!SendModelingCommand(MCOMMAND_DELETE, mdat)) return FALSE;  
        GePrint("Am I still working?");                                                 //<-----------Does not print!!  
        
        EventAdd();//Update all the changes   
        
        return TRUE;  
      }
      

      Notice that after the SendModelingCommand() code. Something bad happens and the last print does not work. I don't know if that has anything to do with the problem or not.

      What am I doing wrong?

      -ScottA

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 17/06/2012 at 08:51, xxxxxxxx wrote:

        You've not set the mdat.doc and mdat.op (at least not with what you have shown for the code).

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

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

          Thanks Robert.
          That got it working.

          -ScottA

          1 Reply Last reply Reply Quote 0
          • First post
            Last post