Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > PYTHON Development
  New Posts New Posts
  FAQ FAQ  Forum Search

Send Modeling Command with hierarchy

Author
Message
  Topic Search Topic Search
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Topic: Send Modeling Command with hierarchy
    Posted: 2011 Apr 14 at 9:34am
Hi there,

utils.SendModelingCommand() just returns a null, but it should return a hierarchy when converting a Cloner Object or Particle Geometry. Is this a bug or is thee a way to get the full converted hierarchy ?

thanks !
nux
Back to Top
s_rath View Drop Down
Member
Member


Joined: 2010 May 04
Location: Ne / Düsseldorf
Online Status: Offline
Posts: 319
Direct Link To This Post Posted: 2011 Apr 14 at 10:07am
Can you please post an example?
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2011 Apr 14 at 10:22am
I'm not able to go to my Pc for today, so i just wrote this code from scratch on my mobile device since I can remember that code.

def MakeEditable(op):

    import c4d
    from c4d.documents import BaseDocument
    from c4d.utils import SendModelingCommand as SMC

    op  = [op.GetClone()]
    doc = BaseDocument()
    doc.InsertObject(op[0])
    op  = SMC(command = c4d.MCOMMAND_MAKEEDITABLE, list = op, doc = doc)
    return op

def main():
    converted = MakeEditable(op)
    doc.InsertObject(converted)


if __name__ == '__main__':
    main()


If you convert a ClonerObject, the clones are usually grouped under a null. The same for Particle Geometry.
Executing this script does only insert the Top null, but not the children.

I do hope the code works, I'm sure it is exactly the same I used on my Pc.

Cheers, Niklas

Edited by nux95 - 2011 Apr 14 at 10:22am
Back to Top
ScottA View Drop Down
Member
Member


Joined: 2011 Jan 07
Online Status: Offline
Posts: 2288
Direct Link To This Post Posted: 2011 Apr 14 at 10:35am
Here's one way that works for me using current state to object:


import c4d
from c4d import gui,utils

def main():
 
  bc = c4d.BaseContainer() # Create a new Base Container 
  convert = utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT, list = [op], mode = c4d.MODIFY_ALL, bc = c4d.BaseContainer(), doc = doc)
  doc.InsertObject(convert[0]) #SMC uses a list.So we need to specify which list element to add to the OM
  c4d.EventAdd()

if __name__=='__main__':
    main()


-ScottA
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2011 Apr 14 at 10:52am
Oh that could have been the problem !

c4d.MODIFY_ALL


I'll check it out tomorrow, thanks. :)

Edited by nux95 - 2011 Apr 19 at 12:59am
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2011 Apr 19 at 1:01am
Unfortunately, it does not.
It just inserts the top Null Object. And in your example, the command automatically inserts the object. And I'd need it just internally. And best also all polygons merged together.

Thanks, nux
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.