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

    How can I set the size of an object?

    SDK Help
    0
    16
    1.4k
    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

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

      On 08/06/2004 at 02:59, xxxxxxxx wrote:

      You can get the points from a BaseObject by using the ToPoint function.
       
      Example:

          
          
          
          
          BaseObject *op = GetActiveDocument()->GetActiveObject();
          
          
          
          
          Vector *v = ToPoint(op)->GetPoint();
          
          
          
      

      To your second reply, the GetPoint() method does not return 1 point. It infact returns an array of points.
      so what you should be doing is this

          
          
          
          
          Vector *v = po->GetPoint();
          
          
          
          
          // v is now pointing to an array of points
          
          
          
          
           
          
          
          
          
          // Loop through all the points
          
          
          
          
          for(LONG i=0; i < po->GetPointCount(); i++)
          
          
          
          
          {
          
          
          
          
            // do your scale
          
          
          
          
           v[i]->x*=scalex;
          
          
          
          
          }
          
          
          
          
           
          
          
          
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 08/06/2004 at 09:27, xxxxxxxx wrote:

        Hi,
        unfortunately this does not work with my objects. May it be the Problem that I use unmodified primitive Objects?
        Do I have to convert them into some special Type? I already casted them to PolygonObject, but this does not seem to help.
        Now I tried to convert it with SendModelingCommand(COMMAND_MAKEEDITABLE, md); to turn them into editable Polygon Objects
        But this unfortunately crashes Cinema. Here's the code:
        ModelingCommandData md;
        md.op = object;
        md.doc = GetActiveDocument();
        md.mode = MODIFY_ALL;
        md.bc = NULL;
        md.result1 = NULL;
        md.flags = MODELINGCOMMANDFLAG_CREATEUNDO;
        Bool test = SendModelingCommand(MCOMMAND_MAKEEDITABLE, md);
        it exactly crashes in the function call.
        My Object was previously created via

        PluginObject * object = ToPoly(BaseObject::Alloc(Onull));

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

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

          On 08/06/2004 at 10:25, xxxxxxxx wrote:

          1. ToPoint is a convenience function for casting. It´s the same as static_cast<PointObject*>(obj); But of course, this only works if the object actually is of type PointObject. The cast will not "convert" the primitive to a pointobject.
          2. You cannot cast a Null Object to a PolygonObject. See 1. And if you try to make it editable to receive a pointobject this does only work for these primitives that are converted to Polygonobjects in Cinema 4D too (with this command).

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

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

            On 08/06/2004 at 12:59, xxxxxxxx wrote:

            Hello,
            I excluded the case that null objects would be resized. Unfortunately it still doesn't work. Cinema crashes when executing the makeeditable command.
            Can anyone tell me how to really resize primitive objects?

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

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

              On 08/06/2004 at 14:36, xxxxxxxx wrote:

              I would use CurrentStateToObject instead of MakeEditable.
              Taken from the docs

                  
                  
                  
                  
                  ModelingCommandData cd;  
                    cd.doc = doc;  
                    cd.op = op;  
                    if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return FALSE;  
                    res = static_cast<BaseObject*>(cd.result1);  
                  
              

              res is then a BaseObject
              then you can cast it to a PointObject, then you can do your sizing

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

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

                On 09/06/2004 at 03:02, xxxxxxxx wrote:

                Yeah that worked. Now I have another problem:
                when doing
                LONG vnum = object->GetPointCount();
                Vector * v = object->GetPoint();
                for (LONG i; i < vnum-1; i++)
                {
                v->x = v->x *x;
                ... till z
                v += sizeof(Vector);
                }
                I get a stupid result where only some points are set to a new position and others are not. Also Cinema crashes when I set the factors of x y z to 10.0 or so.... what's happening here? any idea?

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

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

                  On 09/06/2004 at 03:08, xxxxxxxx wrote:

                  I have not tested this, but I see no reason why this code wont work

                      
                      
                      
                      
                      LONG vnum = object->GetPointCount();  
                      Vector * v = object->GetPoint();  
                      for (LONG i=0; i < vnum; i++)  
                      {  
                      v[i]->x *= x;  
                      v[i]->y *= y;
                      
                      
                      
                      
                      v[i]->z *= z;  
                      }
                      
                      
                      
                  
                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

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

                    On 09/06/2004 at 03:17, xxxxxxxx wrote:

                    trust me it doesnt 😉
                    here is a shot of the result of this operation:
                    home.arcor.de/lawnmower/1.jpg
                    Any Idea why this happens?

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

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

                      On 09/06/2004 at 03:33, xxxxxxxx wrote:

                      It must be something else in your code that causes that then.
                      I just tried it myself in my current plugin, and it worked fine.
                       
                      http://www.spot4d.co.uk/0x47/scale.jpg
                       
                      The cylinder on the left is the original, the one on the right is the result of the code in my previous post.

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

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

                        On 09/06/2004 at 12:28, xxxxxxxx wrote:

                        Hi
                        thank you that was it,
                        I used
                        Vector * v = ....
                        v-> *= x
                        ...
                        v += sizeof(Vector);
                        This obviously didnt work although it should have been.

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

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

                          On 10/06/2004 at 05:09, xxxxxxxx wrote:

                          v[i]- >x *= x;
                          ??? The compiler shouldn´t even compile this. it´s v[i].x *= X;
                          Samir

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

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

                            On 10/06/2004 at 05:26, xxxxxxxx wrote:

                            err yes sorry, it was that what you wrote, my fault...

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