THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/02/2004 at 19:10, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.100
Platform: Windows ;
Language(s) : C++ ;
---------
Hi all
I have a plane currently, have set its containers, Now i wanna get the point count of this object. So, i have to convert it into polygon object. I have read that the way to do that is by using the MCOMMAND_CURRENTSTATETOOBJECT. So i tried this way. My problem is, after i inserted the plane, I have to make it editable. So i have done this code:
BaseObject *ObjGrid = BaseObject::Alloc(Oplane);
BaseContainer *conGrid = ObjGrid->GetDataInstance();
conGrid->SetReal(PRIM_PLANE_SUBW, XNos);
conGrid->SetReal(PRIM_PLANE_SUBH, ZNos);
conGrid->SetReal(PRIM_PLANE_WIDTH, XWidth);
conGrid->SetReal(PRIM_PLANE_HEIGHT, ZWidth);
doc->InsertObject(ObjGrid,NULL,NULL,TRUE);
doc->StartUndo();
doc->AddUndo(UNDO_NEW, ObjGrid);
ObjGrid->SetRot(Vector(Rot_H, Rot_P, Rot_B));
ModelingCommandData cd;
cd.flags = MODELINGCOMMANDFLAG_CREATEUNDO;
cd.doc = doc;
cd.bc = conGrid;
cd.op = ObjGrid;
cd.mode = MODIFY_ALL;
if (!SendModelingCommand(MCOMMAND_MAKEEDITABLE,cd)) return NULL;
EventAdd(EVENT_FORCEREDRAW);
ObjGrid = doc->SearchObject(vGridName);
How can I convert it into polygon object. Is that by using this following code:
Modelingcommanddata cd2;
cd2.doc=doc;
cd2.op = ObjGrid;
if(!Sendmodelingcommand(MCOMMAND_CURRENTSTATETOOBJECT, cd2)) return FALSE;
I have tried this but it gave memory leak problem. Anyone has any idea how to solve this?
Thanks for any help
Regards