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
    • Recent
    • Tags
    • Users
    • Login

    MCOMMAND_OPTIMIZE issues

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 414 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 18/01/2009 at 10:49, xxxxxxxx wrote:

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

      ---------
      Hey there everybody,
      This is my first post on these forums. I'm a frequenter of C4DCafe but I've only recently started developing plugins.

      Right now I'm having some issues invoking the Optimize command in Cinema4D. Here's the piece of code where I'm having trouble:

      > \> //Optimize points on the objects \> //Create new Modeling Command Data \> ModelingCommandData cd_3; \> cd_3.doc = doc; \> //Also need a base container to pass Optimize command data \> BaseContainer bc; \> bc.SetReal(MDATA_OPTIMIZE_TOLERANCE, 0.01); \> bc.SetReal(MDATA_OPTIMIZE_POINTS, TRUE); \> bc.SetReal(MDATA_OPTIMIZE_POLYGONS, TRUE); \> bc.SetReal(MDATA_OPTIMIZE_UNUSEDPOINTS, TRUE); \> //Set the objects to be changed \> cd_3.op = (BaseObject\* ) cd_2.result->GetIndex(0); \> GePrint(((BaseObject\* ) cd_2.result->GetIndex(0))->GetName()); \> if(SendModelingCommand(MCOMMAND_OPTIMIZE, cd_3)) \> { \>      cd_3.op->Message(MSG_UPDATE, NULL); \>      //Optimize command doesn't return anything. \> } else { \>      //Command failed \>      return FALSE; \> } \>

      When I do this, the object that I run the optimize command on doesn't actually get optimized. I tried this on a cylinder and my code did not result in the cap and the body points merging.

      Any ideas?

      Thank you,
      Yilmaz Kiymaz

      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 18/01/2009 at 11:24, xxxxxxxx wrote:

        1. Optimize may work 'directly' on the original object in the document. If you set 'op' to the result of another SendModelingCommmand() then it is not the original object that is being optimized.

        2. If you really want to optimize the original object, set cd_3.op to it or you'll otherwise need to insert the new object into the document before optimizing and possibly replacing the original with the new object.

        This will all depend upon your sequence of SendModelingCommand()s which looks to be two previous ones before arriving at the optimize. Unfortunately, this function either modifies the original object in the document directly (there is nothing useful in result) or puts it into the result array.

        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 28/01/2009 at 15:59, xxxxxxxx wrote:

          Wow, ok, turns out I never linked the BaseContainer to the ModelingCommandData using cd_3.bc = &bc;

          Now it works just fine. Thanks kuroyume.

          Yilmaz Kiymaz

          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 29/01/2009 at 02:57, xxxxxxxx wrote:

            Merhaba, Yilmaz.

            Cok güzel, yavas yavas örenyorsun 🙂

            Greetings from Izmir,
            Frank

            P.S. @ others: Sorry, couldn't resist 😉

            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 29/01/2009 at 23:43, xxxxxxxx wrote:

              Hey, thanks Frank 🙂
              Yes, looks like C4D plugin development is a bumpy and dangerous road but I'm not about to give up. Glad to see you're active on these forums.

              Yilmaz Kiymaz

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