Current State To Object in Python
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2011 at 09:15, xxxxxxxx wrote:
Hey there!
Bit stuck on how to execute this in order to bake something with a mograph displacer on it into geometry.
Here's what I've got thus far. It mentions something in the docs about potentially needing to act on a duplicate of the object but then doesn't really elaborate. Any help much appreciated!
Cheers, sCam
import c4d from c4d import gui from c4d import utils from c4d import documents def main() : document = documents.GetActiveDocument() settings = c4d.BaseContainer() obj = document.SearchObject("picture source") return_value = utils.SendModelingCommand( command = c4d.MCOMMAND_CURRENTSTATETOOBJECT, list = [obj], mode=c4d.MODELINGCOMMANDMODE_ALL, bc=settings, doc = document) print return_value if __name__=='__main__': main()
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2011 at 12:10, xxxxxxxx wrote:
Hi, I assume this is a standard script and not part of a Python Generator, correct?
The code you posted works fine. Just insert the returned object in the document and update it:import c4d from c4d import gui from c4d import utils from c4d import documents def main() : document = documents.GetActiveDocument() settings = c4d.BaseContainer() obj = document.SearchObject("picture source") return_value = utils.SendModelingCommand( command = c4d.MCOMMAND_CURRENTSTATETOOBJECT, list = [obj], mode=c4d.MODELINGCOMMANDMODE_ALL, bc=settings, doc = document) #NEW---- if return_value: doc.InsertObject(return_value[0]) #return_value is a list in this case c4d.EventAdd() #NEW---- if __name__=='__main__': main()
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/11/2011 at 00:26, xxxxxxxx wrote:
Worked great! Thanks for your help - much appreciated!
Cheers, sCam