THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/11/2009 at 14:52, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 11
Platform: Windows ;
Language(s) :
---------
I am trying to use SendModelingCommand() to call the split command in C4D.
This is the code I am using.
PolygonObject* objPoly;
objPoly=(PolygonObject* )obj;
if (!objPoly->IsInstanceOf(Opolygon))
return false;
LONG id = dc->id[0].id;
ModelingCommandData mdat;
BaseSelect *selected = objPoly->GetPolygonS();
if (!selected) return FALSE;
BaseDocument * doc=obj->GetDocument();
BaseSelect * backupSel=NULL;
LONG lngI=0;
LONG lngPolygonCount=objPoly->GetPolygonCount();
LONG lngSymPlane = data->GetReal(SYMMETRY_PLANE);
LONG lngMirroredSide = data->GetReal(MIRRORED_SIDE);
Vector * arrPoints=objPoly->GetPointW();
CPolygon * arrPolygons=objPoly->GetPolygonW();
CPolygon * hiddenPolygons=objPoly->GetPolygonW();
mdat.mode = MODIFY_POLYGONSELECTION;
mdat.doc = doc;
mdat.bc = data;
mdat.op = objPoly;
backupSel =BaseSelect::Alloc();
if (!backupSel)return FALSE;
selected->CopyTo(backupSel);
blnSymmetryEnabled=FALSE;
if (id == DELETE)
{
if (data->GetLong(SIDE_CHOOSER)==CHOOSE_A)
{ //Check to see which polys will be hidden
selected->DeselectAll();
for (lngI=0;lngI<lngPolygonCount;lngI++)
{ if (PolyOnEditableSide(arrPoints, arrPolygons, lngI, lngSymPlane, lngMirroredSide, lngOldPointCount, lngOldPolygonCount))
selected->Select(lngI);
}
SendModelingCommand(MCOMMAND_DELETE, mdat);
EventAdd(EVENT_FORCEREDRAW);
}
else if (data->GetLong(SIDE_CHOOSER)==CHOOSE_B)
{ //Check to see which polys will be hidden
selected->DeselectAll();
for (lngI=0;lngI<lngPolygonCount;lngI++)
{ if (!PolyOnEditableSide(arrPoints, arrPolygons, lngI, lngSymPlane, lngMirroredSide, lngOldPointCount, lngOldPolygonCount))
selected->Select(lngI);
}
SendModelingCommand(MCOMMAND_DELETE, mdat);
EventAdd(EVENT_FORCEREDRAW);
}
}
if (id == SPLIT)
{
if (data->GetLong(SIDE_CHOOSER)==CHOOSE_A)
{ //Check to see which polys will be hidden
selected->DeselectAll();
for (lngI=0;lngI<lngPolygonCount;lngI++)
{ if (PolyOnEditableSide(arrPoints, arrPolygons, lngI, lngSymPlane, lngMirroredSide, lngOldPointCount, lngOldPolygonCount))
selected->Select(lngI);
}
SendModelingCommand(MCOMMAND_SPLIT, mdat);
GePrint("Splitting A");
EventAdd(EVENT_FORCEREDRAW);
}
if (data->GetLong(SIDE_CHOOSER)==CHOOSE_B)
{ //Check to see which polys will be hidden
selected->DeselectAll();
for (lngI=0;lngI<lngPolygonCount;lngI++)
{ if (!PolyOnEditableSide(arrPoints, arrPolygons, lngI, lngSymPlane, lngMirroredSide, lngOldPointCount, lngOldPolygonCount))
selected->Select(lngI);
}
SendModelingCommand(MCOMMAND_SPLIT, mdat);
GePrint("Splitting B");
EventAdd(EVENT_FORCEREDRAW);
}
}
backupSel->CopyTo(selected);
BaseSelect::Free(backupSel);
blnSymmetryEnabled=TRUE;
return TRUE;
For some reason, the MCOMMAND_SPLIT is not doing anything. It selects all polygons on a certain side of the object and then runs the MCOMMAND_SPLIT but it's not doing anything.. Does anyone see a problem here?
Thanks,
~Shawn