Crash when converting objects in bulk
-
When converting objects in bulk, i run into a problem with R23.
The Code in which it crashes:
for objectList in objectLists: try: commandCount += 1 result = c4d.utils.SendModelingCommand( command = c4d.MCOMMAND_MAKEEDITABLE,##CMD.MAKE_EDITABLE list = objectList, mode = c4d.MODELINGCOMMANDMODE_ALL, doc = doc, flags = c4d.MODELINGCOMMANDFLAGS_CREATEUNDO # if this flag is not set the method will delete all affected objects from the list and return them ) LogWithTimestamp(commandCount * objectsPerCommand, " items of ",len(allObjects)," made editable", LogLvl.DEBUG) etc.
I add the crash report zipfile. I have no idea how to fix it, though it seems to be a kind of stackoverflow..
I reduced the number of objects converte to narrow down what crashes the script. It blows up during the conversion of a Circular Object called "Kreis" which is a inner Object of a oSweep Object.
[2022-11-17 17:11:36.519321] 8 items of 56 made editable [2022-11-17 17:11:36.529534] ObjectName:Kreis [2022-11-17 17:11:36.529534] ObjectName:Innenschirm [2022-11-17 17:11:36.539614] <c4d.documents.BaseDocument object called with ID 110059 at 2240546111104> [2022-11-17 17:11:36.549779] [<c4d.SplineObject object called Kreis/Spline-Objekt with ID 5101 at 2240546107136>, <c4d.PolygonObject object called Innenschirm/Polygon-Objekt with ID 5100 at 2240546108160>] Traceback (most recent call last): File "C:\Program Files\Maxon Cinema 4D 2023\plugins\vuframe-aura-commandline.pyp", line 267, in ValidateModelSizeMakeEditable result = c4d.utils.SendModelingCommand( AssertionError: the passed document must match the object's document. During handling of the above exception, another exception occurred:
I tried to work around the problem, by preconverting all oSweeps and oLathes, but even then once the script hit the circle Spline Object, it errored out in send Modelling command.
If i convert a complex object, i guess i must clean up below.
Still should just convert to a polygon circle then.Have a nice evening.
-
Same problem encountered with Ocasurface.
-
Hi,
we are missing a crucial point here, or at least it is not clear. What objects are in your objectLists.
If you want to make an oSweep editable and after want to make editable a spline object that is a child of it, it is quite logical that it crashes. If you make the oSweep editable, the spine object will be deleted so the oSpline object is not alive anymore.You can avoid that by checking if the object is alive or but adding just the parent object in your objectslist. You can also use the Current State to Object because this will create new object and will not touch the old one.
But this is a bit of speculation without code or knowing what exactly you have on this object list and your scene.
Cheers,
Manuel -
Hi manuel, thanks for the quick reply.
It seems thats the source of most of my probelms. I tried to solve it with preconversion, that picks out specific objects and applies a conversion strategy, but this will become lots of boiler plate busy work, though it may be worth it for performance reasons.
Trying the isAliveApproach now. -
You can also filter your objects. Using GetInfo for example, you can check if the current object is a generator or not. If you make a generator editable, the generator will/should handle the children itself. The only exception are primitives. Primitives are generators but they do not care about their children.
Cheers,
Manuel