Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Awesuus
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    Awesuus

    @Awesuus

    0
    Reputation
    15
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Awesuus Unfollow Follow

    Latest posts made by Awesuus

    • RE: S22: c4d.MCOMMAND_SPLIT returns a Bool instead of a List, while it returned a list in R21 and earlier versions

      Thank you so much, this works like a charm!!!

      posted in Cinema 4D SDK
      AwesuusA
      Awesuus
    • RE: S22: c4d.MCOMMAND_SPLIT returns a Bool instead of a List, while it returned a list in R21 and earlier versions

      Hi Maxime,
      Thank you so much for your reply. I also work in S22.118.

      Here's the whole script that I'm trying to get to work:

      import c4d
      from c4d import gui,utils
      
      def main():
          if op.GetType() != c4d.Opolygon : return
          sel = op.GetPolygonS()
          polyCnt = op.GetPolygonCount()
          allPolys = range(polyCnt)
          doc.StartUndo()
          null = c4d.BaseObject(c4d.Onull)
          null[c4d.ID_BASELIST_NAME] = op[c4d.ID_BASELIST_NAME]+"_Segments"
          null.SetMg(op.GetMg())
          cntr = 0
          while allPolys:
              settings = c4d.BaseContainer()
              settings[c4d.MDATA_FILLSEL_START_POLY] = allPolys[0]
              utils.SendModelingCommand(command = c4d.ID_MODELING_FILL_SELECTION_TOOL,
                                          list = [op],
                                          mode = c4d.MODELINGCOMMANDMODE_EDGESELECTION,
                                          bc = settings,
                                          doc = doc)
              selId = []
              sel = op.GetPolygonS()
              for index, selected in enumerate(sel.GetAll(polyCnt)):
                  if not selected: continue
                  selId.append(index)
              allPolys = [n for n in allPolys if n not in selId]
              settings = c4d.BaseContainer()
              res = utils.SendModelingCommand(command = c4d.MCOMMAND_SPLIT,
                                          list = [op],
                                          mode = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION,
                                          bc = settings,
                                          doc = doc)
              
              res[0][c4d.ID_BASELIST_NAME] = op[c4d.ID_BASELIST_NAME]
              res[0].InsertUnderLast(null)
              res[0].SetMg(op.GetMg())
              sel.DeselectAll()
              cntr += 1
          doc.InsertObject(null)
          doc.AddUndo(c4d.UNDOTYPE_NEW, null)
          doc.EndUndo()
          c4d.EventAdd()
      
      
      if __name__=='__main__':
          main()
      

      What I'm trying to get it to do is explode the mesh by edge selection, so that it creates a new null with the separate objects. The c4d file below is just a scene with a sphere with edge selections.

      test.c4d

      posted in Cinema 4D SDK
      AwesuusA
      Awesuus
    • S22: c4d.MCOMMAND_SPLIT returns a Bool instead of a List, while it returned a list in R21 and earlier versions

      Hey guys, i have a script which uses the c4d.utils.SendModelingCommand until recently this returned a list to me. https://developers.MAXON.net/docs/Cinema4DPythonSDK/html/modules/c4d.utils/index.html#c4d.utils.SendModelingCommand

      This function either returns a boolean, or a list. Up until R21 the following code returned a list to me. But as of S22 i get returned the bool true, which signifies it ran succesfully, but i cant seem to retrieve the list.

      Any help on how i can get the list ( by passing a parameter or anything else ) would be appreciated.

      Heres the related snippet of my code

      selId = []
          sel = op.GetPolygonS()
          for index, selected in enumerate(sel.GetAll(polyCnt)):
              if not selected: continue
              selId.append(index)
          allPolys = [n for n in allPolys if n not in selId]
          settings = c4d.BaseContainer()
          res = utils.SendModelingCommand(command = c4d.MCOMMAND_SPLIT,
                                      list = [op],
                                      mode = c4d.MODELINGCOMMANDMODE_POLYGONSELECTION,
                                      bc = settings,
                                      doc = doc)
      

      after running this script, res is now true instead of a List

      many thanks in advance.

      posted in Cinema 4D SDK
      AwesuusA
      Awesuus