THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/09/2011 at 19:42, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ; Mac ;
Language(s) : C++ ;
---------
Hey Everyone,
I have a sweep Nurbs under which place a cubic spline and a circle spline. Then, I make the sweep nurbs editable via SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, mcd);
The result is that the main object has two children object which are the caps that were created. What I woiuld like to do then , is connect the caps to the main body and then optimize that to connect the caps to the main body. This is of course all via code and not manually.
Could someone explain to me how I would do this?
I understand how to run optimize via SendModelingCOmmand.. and I have found that the Connect + Delete command can be called via CallCommand(16768); But I can't seem to make it work.. When I add the call command, c4d crashes.
Here is the code I am trying to use.
//CONVERT TO POLYGON OBJECT
//==========================================================//
ModelingCommandData mcd;
mcd.op = objsweep;
#ifdef C4D_R12
mcd.mode = MODELINGCOMMANDMODE_ALL;
#else
mcd.mode = MODIFY_ALL;
#endif
mcd.doc = doc;
SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, mcd);
BaseObject *res = static_cast<BaseObject*>(mcd.result->GetIndex(0));
PolygonObject *polyObj = (PolygonObject * )res;
if(!polyObj) return NULL;
//==========================================================//
CallCommand(16768); //Connect and Delete
// MESH OPTIMIZE
//==========================================================//
ModelingCommandData mcd3;
BaseContainer bc3;
bc3.SetReal(MDATA_OPTIMIZE_TOLERANCE, 0.01);
bc3.SetReal(MDATA_OPTIMIZE_POINTS, TRUE);
bc3.SetReal(MDATA_OPTIMIZE_POLYGONS, TRUE);
bc3.SetReal(MDATA_OPTIMIZE_UNUSEDPOINTS, TRUE);
mcd3.bc = &bc3;
mcd3.op = polyObj;
#ifdef C4D_R12
mcd3.mode = MODELINGCOMMANDMODE_ALL;
#else
mcd3.mode = MODIFY_ALL;
#endif
mcd3.doc = doc;
if(SendModelingCommand(MCOMMAND_OPTIMIZE, mcd3)){}
polyObj->Message(MSG_UPDATE);
//==========================================================//
Any help you could offer would be great.