Using the Send modeling command



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/06/2011 at 02:03, xxxxxxxx wrote:

    I'm starting to understand the usage of the send modelling command, but when i try to use it in a python object script it seems to crash c4d. below is the script that crashed c4d.

    import c4d
    #Welcome to the world of Python

    def main() :
    #define Bldg Variables
      bldgHgt = op[c4d.ID_USERDATA, 1]
      bldgWth = op[c4d.ID_USERDATA, 2]
      flrHgt = op[c4d.ID_USERDATA, 3]
      keepSqr = op[c4d.ID_USERDATA, 5]
      bldgDepth = op[c4d.ID_USERDATA, 6]
    #create Objects
      cube = c4d.BaseObject(c4d.Ocube)
      null = c4d.BaseObject(c4d.Onull)
    #set cube under null such that base is always at Zero
      axis = c4d.Vector(0,bldgHgt/2,0)
      cube.InsertUnder(null)
      cube.SetRelPos(axis)
    #Set the bldg Perameters

    cube[c4d.PRIM_CUBE_SUBY] = int(bldgHgt/flrHgt)
      if(keepSqr==True) :
          cube[c4d.PRIM_CUBE_LEN] = c4d.Vector(bldgWth,bldgHgt,bldgWth)
      else :
          cube[c4d.PRIM_CUBE_LEN] = c4d.Vector(bldgWth,bldgHgt,bldgDepth)
    #Begin Contructing Windows
      def MakeMulling(op,doc) :
          settings = c4d.BaseContainer()    # settings
          settings[2037] = 5
          doc.SetActiveObject(op)
          c4d.CallCommand(12236)
          c4d.CallCommand(12187)
          c4d.CallCommand(12112)
          c4d.utils.SendModelingCommand(command = c4d.ID_MODELING_EXTRUDE_INNER_TOOL,
                                        list=op,
                                        mode=c4d.MODELINGCOMMANDMODE_POLYGONSELECTION,
                                        bc = settings,
                                        doc = doc)
      MakeMulling(op,doc)
    #Pass the final object to document
      return null

    what is the correct usage for the send modelling command from within a python object?

     	function slideDown() { 	var dlt = document.getElementById("dllist"); 	dlt.setAttribute("style", "display:none;"); 	} 	function tB() { 	var tl = document.getElementById("linkbox"); 	var dl = document.getElementById("dltext"); 	if (tl.style.display=="none") { 	dl.style.display = "none"; 	tl.style.display = ""; 	} else { 	tl.style.display="none"; 	dl.style.display=""; 	} 	} 	
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/06/2011 at 06:21, xxxxxxxx wrote:

    It would be easier if you could upload the scene file, I don't know what userdata you used etc.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/06/2011 at 12:25, xxxxxxxx wrote:

    Sure thing. As soon as I can i will upload the scene file. Mostly though i was just wondering the proper usage of the send modelling command within a python object/tag vs. a script. If anyone has a working example of the SendModellingCcommand that would be a great help.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/06/2011 at 12:35, xxxxxxxx wrote:

    Ah, I see.
    the "list" argument must be a list or tuple or any iterateable object.

            c4d.utils.SendModelingCommand(command = c4d.ID_MODELING_EXTRUDE_INNER_TOOL,  
                                        list=[op],
    

    This should do it. Well, that's the first error i could spot. There may be others. ;-)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/06/2011 at 12:58, xxxxxxxx wrote:

    great! thanks ill try this out. your probably right, because it semed like everything else in the code was working. its always something really simple(like forgetting two brakets) that messes it up. well,  thanks again for the input. ill give this a shot as soon as i get home.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/06/2011 at 16:49, xxxxxxxx wrote:

    ok, so i have atried a number of different things but i still cant get this to work. i have simplified the idea drastically, but i still am not doing something right. Essentially, all i want to do right now, is create a beveled cube using a python object. here is my scene file. i got it to stop crashing, but it will not bevel.
    any help is greatly appreciated.

    here is a link ot download the c4d file
    http://www.sendspace.com/file/zsg754

    and here is the code within the python generator:

    import c4d
    #Welcome to hell

    def main() :
      doc = c4d.documents.GetActiveDocument
      cube = c4d.BaseObject(c4d.Ocube)
      null = c4d.BaseObject(c4d.Onull)
      cube1 = MakeEditable(cube)
      cube2 = Bevel(cube1,30)
      return cube2

    def ExtrudeInner(obj,offset,doc) :
      pass

    def Bevel(op,offset) :
      bc = c4d.BaseContainer()
      bc[2042] = offset
      if(not op) | op.CheckType(c4d.Opolygon) | op.CheckType(c4d.Ospline) : return op
      doc = c4d.documents.BaseDocument()
      doc.InsertObject(op[1], None, None)
      obj = c4d.utils.SendModelingCommand(
                                command = 450000005,#bevel
                                list = obj,
                                settings = bc,
                                doc = doc )
      return obj[1]

    def MakeEditable(op) :
      import c4d
      if (not op) | op.CheckType(c4d.Opolygon) | op.CheckType(c4d.Ospline) : return op

    op = [op.GetClone()]
      doc = c4d.documents.BaseDocument()
      doc.InsertObject(op[0],None,None)
      op = c4d.utils.SendModelingCommand(
                                command = c4d.MCOMMAND_MAKEEDITABLE,
                                list = op,
                                mode = c4d.MODELINGCOMMANDMODE_EDGESELECTION,
                                doc = doc )
      return op[0]


Log in to reply