Solved SendModelingCommand(MCOMMAND_SUBDIVIDE) broken in C4D 2023?


I have a function that looks like this:

Bool SubdividePolygonObject(PolygonObject* const objectPtr, const maxon::Int32 subdivisions, const maxon::Bool sds)
	// Parameters for the modeling command
	BaseContainer modelingCommandParameters;
	modelingCommandParameters.SetBool(MDATA_SUBDIVIDE_HYPER, sds);
	modelingCommandParameters.SetInt32(MDATA_SUBDIVIDE_SUB, subdivisions);

	// Execute modeling command
	ModelingCommandData modelingCommandData;
	modelingCommandData.op = objectPtr;
	modelingCommandData.bc = &modelingCommandParameters;
	if (!SendModelingCommand(MCOMMAND_SUBDIVIDE, modelingCommandData))
		return false;

	return true;

Example usage:

BaseContainer cubeData;
basicObjectData.SetVector(PRIM_CUBE_LEN, maxon::Vector(100.0));
cubeData.SetInt32(PRIM_CUBE_SUBX, 2);
cubeData.SetInt32(PRIM_CUBE_SUBY, 2);
cubeData.SetInt32(PRIM_CUBE_SUBZ, 2);

PolygonObject* const objectPtr = static_cast<PolygonObject*>(GeneratePrimitive(nullptr, Ocube, cubeData, 1.0, false, hh->GetThread()));
if (!SubdividePolygonObject(objectPtr, 5, true))
	GePrint("Something went wrong."_s);

This works fine in R20 - R25, but returns false in 2023.
What could be the reason?

Only asking personal code questions here.


If I put all code aside, simply start Cinema 4D 2023, and do the following:

  1. Create Cube
  2. Make Cube editable (with "c")
  3. Choose Mesh > Add > Subdivide (click the cogwheel icon)
  4. Set any settings, or don't change anything
  5. Click OK

--> The cube does not change at all.

Is MCOMMAND_SUBDIVIDE maybe completely broken?

Only asking personal code questions here.

Hi Franck,

You are right, the UI command is not working if the document is on object mode; there is already a bug report open for that one. I do not know if both issues are related and if the fix will also modify the API behavior but for now you can change the mode to the ModelingCommandData like so.


If specifying the mode becomes mandatory i will update the documentation.


MAXON SDK Specialist

MAXON Registered Developer

Thank you, that fixed it.
Only asking personal code questions here.