A lot of times when I’m modeling, I find myself using the Split command quite a bit. The Split command enables you to take a selection of polygons from an object and create a separate object based on your selection. A lot of times I end up deleting the old selected polygons from the original object, as it leaves them behind when creating the new object. When you delete polygons in Cinema 4D it leaves behind the points/vertices as well, making you perform an Optimize command to get rid of the stagnant points. With my experience, this ends up being a bit tedious when all I want to do is take one object and split it into two separate objects.
Cinema 4D Split + Delete + Optimize in one step
I did some digging and discovered the Script Manager in Cinema 4D. At first it scared me, as I thought I was going to have to learn how to program/script, and personally that’s just not my thing! Upon finding the Script Manager, I also found the Script Log. The Script Log basically records your actions every time you perform a new command, switch modeling tools, make selections, etc. It’s very similar to the way Macros in Microsoft Word and Actions in Adobe Photoshop work.
If you open up the Script Log, found in Extensions → Script Log…, you’ll see the above dialog. With this dialog open, select the different modeling modes (Model, Points, Edges, Polygons). You’ll notice that each time you select a new mode, it records the action in the script log. With these actions recorded, it’s very easy to create a new script. Myself for example wanted a quick way to split a selection of polygons, delete the old ones, select point mode, select all the points, perform an optimize command, and switch back to model mode. As you can see, this is a lot of steps to go through. As I went through the above steps, and watched the Script Log, it recorded the following:
c4d.CallCommand(14046) # Split
c4d.CallCommand(12109) # Delete
c4d.CallCommand(1011982) # Center Axis to
c4d.CallCommand(12298) # Model
At this point, the only thing you have to do is copy the above code from the Script Log, open the Script Manager found in Extensions → Script Manager… and paste it into a new script.
The above image shows that I have pasted the code into the manager, created a name for my script (Split + Delete), and inserted a custom icon. You can use a custom icon by going to File → Load Icon… Icons in Cinema 4D are 64×64 pixels. The icon I used is actually the split icon with a green X through the selected polygon:
From here, all you have to do is select your object, select your polygons that you want to separate, and execute the script. If you save the script, it will be added to the Customize Commands dialog, where you can then add it to your interface, or create a keyboard shortcut. The Customize Commands dialog is found under Window → Customization → Customize Commands. You can also click on the Shortcut button in the Script Manager to quickly open the Customize Commands dialog.
That’s pretty much all there is to it! It has sure saved me a few extra steps in the modeling process! If you have any questions, feel free to leave your comments below and I will try to answer them as quickly as I can!
Split + Delete + Select Next Object + Center Axis to
After doing a bit of research online, I made a small update to the Split+Delete script. The below code will now select the newly split object in the object manager and center its axis.
import c4d from c4d import gui # Welcome to the world of Python # Main function def main(): c4d.CallCommand(14046) # Split # Selects Previous object in Object Manager ActiveObject = doc.GetActiveObject() if ActiveObject == None: return PrevObject = ActiveObject.GetPred() if PrevObject == None: return doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_BITS, ActiveObject) ActiveObject.DelBit(c4d.BIT_ACTIVE) doc.AddUndo(c4d.UNDOTYPE_BITS, PrevObject) PrevObject.SetBit(c4d.BIT_ACTIVE) doc.EndUndo() c4d.CallCommand(12109) # Delete split polygon(s) # Selects Next object in Object Manager ActiveObject = doc.GetActiveObject() if ActiveObject == None: return NextObject = ActiveObject.GetNext() if NextObject == None: return doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_BITS, ActiveObject) ActiveObject.DelBit(c4d.BIT_ACTIVE) doc.AddUndo(c4d.UNDOTYPE_BITS, NextObject) NextObject.SetBit(c4d.BIT_ACTIVE) doc.EndUndo() c4d.CallCommand(1011982) # Center Axis to c4d.CallCommand(12298) # Model Mode c4d.EventAdd() # Execute main() if __name__=='__main__': main()