Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi,
I understand that there is a working script from Donovan Keith in this thread.
In his script, he uses GetClone. I'm guessing to have another copy of the object. I'm trying to rewrite the script without using the GetClone method.
GetClone
Is this possible?
Here is my script so far:
import c4d from c4d import utils res = c4d.utils.SendModelingCommand( command = c4d.MCOMMAND_MAKEEDITABLE, list = op, mode = c4d.MODELINGCOMMANDMODE_ALL, doc = doc ) c4d.EventAdd()
With this script, it gives me an error of TypeError: GeListNode_mp_subscript expected Description identifier, not long
TypeError: GeListNode_mp_subscript expected Description identifier, not long
Did a google search but it doesn't give me any relevant hits.
Is there a way around this?
Thank you for looking at my problem
hello,
seem that you forgot brackets on your list of object.
list = [op]
watch out where you are running those command, some operation have to be executed in the main thread on a script it should look like this
import c4d from c4d import gui from c4d import utils # Welcome to the world of Python # Script state in the menu or the command palette # Return True or c4d.CMD_ENABLED to enable, False or 0 to disable # Alternatively return c4d.CMD_ENABLED|c4d.CMD_VALUE to enable and check/mark #def state(): # return True # Main function def main(): op = doc.GetActiveObject() if not op: raise TypeError("there's no object selected") res = utils.SendModelingCommand( command = c4d.MCOMMAND_MAKEEDITABLE, list = [op]) #check if res is a list if res is False: raise TypeError("make editable didn't worked") elif res is True: print "make editable should not return true" elif isinstance(res, list): doc.InsertObject(res[0]) c4d.EventAdd() # Execute main() if __name__=='__main__': main()
Cheers Manuel
@m_magalhaes
Thanks Manuel! Works as expected. Didn't expect that you had to add brackets. That was news to me.
Thanks again!
P.S. You also need to add brackets on your example.
Have a great day ahead!
i don't know what you are talking about
Just to add some side notes :
SendModelingCommand is waiting for a list of objects in case you want to execute that command on several objects.
In your case, you only got one element in your list.
You can have more informations about list here