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

    set size for Ocube?

    SDK Help
    0
    8
    699
    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
      Helper
      last edited by

      On 06/05/2013 at 18:40, xxxxxxxx wrote:

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

      ---------
      Is there a way to set the size of a primitive (Ocube)? I can't find any info. The code below will create a cube with default XYZ.

      op = BaseObject::Alloc(Ocube);
      op->SetName("name"));
      doc->InsertObject(op, NULL, NULL);

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

        On 06/05/2013 at 19:05, xxxxxxxx wrote:

        and more questions...
        when I make a Oplane how can I have control over its parameters (segments)?

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

          On 06/05/2013 at 19:31, xxxxxxxx wrote:

          This is how to change the some of the various options on a cube primitive:

              BaseDocument *doc = GetActiveDocument();  
            BaseObject *op = BaseObject::Alloc(Ocube);  
            op->SetName("My Cube");  
            op->SetParameter(DescID(PRIM_CUBE_LEN), GeData(Vector(100,50,200)), DESCFLAGS_SET_0);  //Sets the X, Y, Z values for the cube's size  
            
            op->SetParameter(DescID(PRIM_CUBE_SUBX), GeData(2), DESCFLAGS_SET_0);           // number of segments is 2  
            op->SetParameter(DescID(PRIM_CUBE_SUBY), GeData(5), DESCFLAGS_SET_0);           // number of segments is 5  
            op->SetParameter(DescID(PRIM_CUBE_SUBZ), GeData(3), DESCFLAGS_SET_0);           // number of segments is 3   
            
            doc->InsertObject(op, NULL, NULL);
          

          For other options. Drag them from the AM into the bottom of the Console window to get their ID's. Then plugin them into a SetParameter() function in the same manner.
          The other primitives work the same way.

          -ScottA

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

            On 06/05/2013 at 19:40, xxxxxxxx wrote:

            Yeah! Thanks.

            I just found out about some SetParameter() stuff. But this helps tremendously.

            Peter

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

              On 06/05/2013 at 20:12, xxxxxxxx wrote:

              The one's that are the most complicated looking are the ones for setting position, scale, and rotation.
              They are quite ugly and scary looking when you see them for the first time.
              But once you get used to them. They become less scary.

                  BaseObject *obj = doc->GetActiveObject();  
                
                GeData d;   //Used to store the values gotten from obj->GetParameter() below  
                obj->GetParameter(DescID(ID_BASEOBJECT_REL_POSITION, VECTOR_X), d, (DTYPE_VECTOR, DESCFLAGS_GET_0)); //Gets the object's X position  
                
                obj->SetParameter(DescID(ID_BASEOBJECT_REL_POSITION, VECTOR_X), GeData(120.0), DESCFLAGS_SET_0);       //Sets the object's X position to 120
              

              -ScottA

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

                On 07/05/2013 at 00:02, xxxxxxxx wrote:

                Or use BaseObject::GetMg() / BaseObject::SetMg().

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

                  On 08/05/2013 at 13:00, xxxxxxxx wrote:

                  Thanks so much for the help. Totally forgot about GetMg().

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

                    On 08/05/2013 at 23:46, xxxxxxxx wrote:

                    GetMg() was related to the position, not the size of the cube.

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