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
    • Recent
    • Tags
    • Users
    • Login

    Frame selected object/Geometry not working

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 396 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 09/04/2014 at 14:20, xxxxxxxx wrote:

      Hi,

      For my script purpose i need to frame the first object  that i have merged in my scene before rendering.

      this 2 commands c4d.CallCommand(12148) # Frame Geometry c4d.CallCommand(13038) # Frame Selected Elements  do not frame the object in the viewport. It seem over-zoomed on the object...

      If i paste one of these command in the console , there it frame wellthe object...

      Any idea how to make it works?

      for infile in glob.glob(scenesPath+"\*.c4d") :
                  fname, ext = os.path.splitext(infile)
                  c4d.documents.LoadFile(refPath+'\param.c4d')
                  doc = c4d.documents.GetActiveDocument()
                  docview=doc.GetActiveBaseDraw()
                  
                  c4d.documents.MergeDocument(doc,infile,c4d.SCENEFILTER_OBJECTS|c4d.SCENEFILTER_MATERIALS|c4d.SCENEFILTER_DIALOGSALLOWED|c4d.SCENEFILTER_MERGESCENE) 
                  mycam=docview.GetSceneCamera(doc)
                  mycam.SetFocus(35)
                  obj=doc.GetFirstObject()
                  doc.SetActiveObject(obj)
                  
                  obj.Message(c4d.MSG_UPDATE)

      c4d.CallCommand(12148) # Frame Geometry
                  c4d.CallCommand(13038) # Frame Selected Elements
                  macam.SetFocus(25)
                  c4d.EventAdd()
                  return

      ...

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 17/04/2014 at 12:33, xxxxxxxx wrote:

        It is not clear to me what your problem is. Could you narrow your problem down and provide
        a script that can be pasted into the script manager that will demonstrate the problem?

        Best,
        -Niklas

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 18/04/2014 at 13:06, xxxxxxxx wrote:

          i think i've found why it does not works properly. In fact when i load scene and merge with my python script, the viewport is "empty" untill my function finish. So the command "Frame selected object" apply to nothing. I should find a way to force the viewport to refresh and then call this command. I'm searching to make this not a dirty way... i will let you know if i find the solution, excetp if you tell me it before 😄

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 21/04/2014 at 09:04, xxxxxxxx wrote:

            Simple refresh is c4d.EventAdd()

            1 Reply Last reply Reply Quote 0
            • First post
              Last post