Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/03/2004 at 11:49, xxxxxxxx wrote:
User Information: Cinema 4D Version: 8.206 Platform: Language(s) : C++ ;
--------- I want to be able to set the size of an object, but I can't seem to see a method to do this. The only thing I have found is BaseObject::SetScale(), but this sets the scale (obviously) and not the size.
Is it even possible to do this?
On 18/03/2004 at 00:44, xxxxxxxx wrote:
Not directly. To set the size you'll have to modify the actual points yourself. (I.e. points[i] *= scale for i = 0 to point count - 1.)
On 08/06/2004 at 00:15, xxxxxxxx wrote:
Hi, so if you modify the points directly how do you receive points of a BaseObject? PointObjects are no problem but BaseObjects unfortunately have no point accessor....?
On 08/06/2004 at 00:53, xxxxxxxx wrote:
Addition: I now use PointObjects to try to modify the points but the problems are:
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; }
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));
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).
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?
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
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?
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; }
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?
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.
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.
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
On 10/06/2004 at 05:26, xxxxxxxx wrote:
err yes sorry, it was that what you wrote, my fault...