Hey @HerrMay,
Thanks for reaching out. Nice catches. I was hoping chatGPT might be able to help out but it couldn't get me all the way there. I tried your script but found it only deposited a Null object at the top of the project manager but did not connect+delete the SDS objects. They do exist under a grouped null but as you mentioned searching through parents and children should resolve that. Any thoughts?
The Maxon SDK Team is currently short staffed due to the winter holidays. No forum support is being provided between 15/12/2025 and 5/1/2026. For details see Maxon SDK 2025 Winter Holidays.
D
Offline
Latest posts made by derekheisler
-
RE: Script: Connect + Delete all subdivision surface objects
-
Script: Connect + Delete all subdivision surface objects
Hi,
I'm trying to write a script that will scan the full c4d file and auto connect + delete all subd objects.
This is what I've written so far but it doesn't seem to find any subd objects, please help:
import c4d def main(): c4d.gui.MessageDialog("Running the main() function...") # Get the active document doc = c4d.documents.GetActiveDocument() # Initialize counters for number of Subdivision Surface objects and number of Subdivision Surface objects that were connected and deleted ss_count = 0 ss_cd_count = 0 # Get a list of all objects in the document objs = doc.GetObjects() # Loop through all objects in the document for obj in objs: # Check if the object is a Subdivision Surface object if obj.GetType() == c4d.Osubdiv: # Increment the Subdivision Surface count ss_count += 1 # Select the Subdivision Surface object doc.SetActiveObject(obj, c4d.SELECTION_NEW) # Connect and delete the object new_obj = c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT, [obj], c4d.MODELINGCOMMANDMODE_ALL, doc, c4d.BaseThread()) if new_obj is not None: # Increment the Subdivision Surface Connect and Delete count ss_cd_count += 1 doc.SetActiveObject(new_obj[0], c4d.SELECTION_NEW) c4d.CallCommand(12109) # Delete command ID doc.SetActiveObject(None, c4d.SELECTION_NEW) # Display the counts in message dialog boxes msg = "Found {} Subdivision Surface objects.".format(ss_count) c4d.gui.MessageDialog(msg) msg = "Connected and deleted {} Subdivision Surface objects.".format(ss_cd_count) c4d.gui.MessageDialog(msg) # Update the document c4d.EventAdd() if __name__=='__main__': main()I have 3 subd objects in my scene and it does not detect any of them. So I'm not sure where I'm going wrong. Thanks in advance!