Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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. arsen
    3. Posts
    A
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 10
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by arsen

    • RE: ID_MODELING_LOOP_TOOL still broken ?

      @m_adam
      Anyway, thanks for your time!

      posted in Cinema 4D SDK
      A
      arsen
    • RE: AddUndo() for MergeDocument() ?

      @zipit @m_magalhaes
      Thanks for the answers! I figured out how to solve the problem.

      posted in Cinema 4D SDK
      A
      arsen
    • RE: AddUndo() for MergeDocument() ?

      @zipit
      Hi
      I use thread to track the external file. When a file is changed, it is imported.
      When using c4d.threading, subprocess.Popen() / time.sleep() freezes C4D ( until the process is complete )

      posted in Cinema 4D SDK
      A
      arsen
    • RE: AddUndo() for MergeDocument() ?

      @m_magalhaes @zipit
      I use thread to manipulate external pipes(subprocess etc).

      posted in Cinema 4D SDK
      A
      arsen
    • ID_MODELING_LOOP_TOOL still broken ?

      Hi.
      MODELING_LOOP_TOOL still broken or am I doing something wrong?

      import c4d
      from c4d import gui, utils
      
      doc = c4d.documents.GetActiveDocument()
      obj = doc.GetActiveObject()
      
      bc = c4d.BaseContainer()
      bc.SetData(c4d.MDATA_LOOP_SEL_STOP_AT_BOUNDS, True)
      bc.SetData(c4d.MDATA_LOOP_SEL_SELECT_BOUNDS, False)
      bc.SetData(c4d.MDATA_LOOP_SEL_GREEDY_SEARCH, False)
      
      bc.SetData(c4d.MDATA_LOOP_SELECTION, c4d.SELECTION_NEW)
      bc.SetData(c4d.MDATA_LOOP_LOOP_EDGE, 1)  # ? index or ..
      
      utils.SendModelingCommand(command=c4d.ID_MODELING_LOOP_TOOL,
                                list=[obj],
                                mode=c4d.MODELINGCOMMANDMODE_EDGESELECTION,
                                bc=bc,
                                doc=doc,
                                flags=c4d.MODELINGCOMMANDFLAGS_0)
      
      c4d.EventAdd()
      
      

      Different values ​​give the same loop selection.
      Thanks!

      posted in Cinema 4D SDK r20
      A
      arsen
    • RE: AddUndo() for MergeDocument() ?

      @m_magalhaes

      here is my code

      import c4d
      from c4d import utils, documents, plugins
      
      import time
      from threading import Thread
      
      
      class WatchThread(Thread):
          def __init__(self, name, doc):
              Thread.__init__(self, name=name)
              self.doc = doc
      
          def run(self):
              while True:
                  time.sleep(2.5)
                  obj_importer(self.doc, r'f:\01.obj')
                  print 'Loaded.',
                  break
      
      
      def obj_importer(doc, obj_path):
          if obj_path is None:
              return
      
          plug = plugins.FindPlugin(1030177, c4d.PLUGINTYPE_SCENELOADER)
          if plug is None:
              return
      
          op = {}
          if plug.Message(c4d.MSG_RETRIEVEPRIVATEDATA, op):
      
              if "imexporter" not in op:
                  return
      
              obj_import = op["imexporter"]
              if obj_import is None:
                  return
      
              # Parameters
              obj_import[c4d.OBJIMPORTOPTIONS_POINTTRANSFORM_SWAPXY] = False
              obj_import[c4d.OBJIMPORTOPTIONS_POINTTRANSFORM_SWAPXZ] = False
              obj_import[c4d.OBJIMPORTOPTIONS_POINTTRANSFORM_SWAPYZ] = True
      
              doc.StartUndo()
              doc.AddUndo(c4d.UNDOTYPE_CHANGE, doc)
      
              # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      
              c4d.documents.MergeDocument(doc, obj_path,
                                          c4d.SCENEFILTER_OBJECTS |
                                          c4d.SCENEFILTER_MATERIALS |
                                          c4d.SCENEFILTER_MERGESCENE, None)
      
              # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      
              doc.EndUndo()
      
              obj_import[c4d.OBJIMPORTOPTIONS_PRESETS] = 0
      
          c4d.StatusClear()
          c4d.EventAdd()
      
      
      if __name__ == '__main__':
          doc = c4d.documents.GetActiveDocument()
          wt = WatchThread('ht', doc)
          wt.start()
      
      
      posted in Cinema 4D SDK
      A
      arsen
    • RE: AddUndo() for MergeDocument() ?

      @m_magalhaes
      No, this solution does not work for me. I am trying to add UNDO when importing an OBJ file.

      posted in Cinema 4D SDK
      A
      arsen
    • AddUndo() for MergeDocument() ?

      Hi.
      Is it possible to add UNDO for documents.MergeDocument() operation?
      I tried this code but it does not work:

      doc.StartUndo()
      
      c4d.documents.MergeDocument(doc, obj_path,
                                  c4d.SCENEFILTER_OBJECTS |
                                  c4d.SCENEFILTER_MATERIALS |
                                  c4d.SCENEFILTER_MERGESCENE, None)
      
      c4d.StatusClear()
      c4d.EventAdd()
      
      obj = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)[0]
      while obj:
          obj = get_next_object(obj)
          doc.AddUndo(c4d.UNDOTYPE_NEW, obj)
      
      doc.EndUndo()
      
      

      Thanks!

      posted in Cinema 4D SDK
      A
      arsen
    • SendModelingCommand \ LOOP_TOOL

      Hi!
      Is there any news about SendModelingCommand \ LOOP_TOOL? Still broken?

      I asked this question a year ago.
      I tried this code, but always got False:

      bc = c4d.BaseContainer()
      bc[c4d.MDATA_LOOP_SEL_STOP_AT_BOUNDS] = False
      bc[c4d.MDATA_LOOP_SEL_SELECT_BOUNDS] = False
      bc[c4d.MDATA_LOOP_SEL_GREEDY_SEARCH] = False
      bc[c4d.MDATA_LOOP_LOOP_EDGE] = 1 # edge index
      bc[c4d.MDATA_LOOP_SELECTION] = c4d.SELECTION_ADD
      
      utils.SendModelingCommand(command=c4d.ID_MODELING_LOOP_TOOL,
                                list=[op],
                                mode=c4d.MODELINGCOMMANDMODE_EDGESELECTION,
                                bc=bc,
                                doc=doc,
                                flags=c4d.MODELINGCOMMANDFLAGS_0)
      
      posted in Cinema 4D SDK
      A
      arsen