Frame all

  • Hi folks,

    how can I frame all objects in a document in memory (like command id 12148)?


  • AFAIK, frame all requires the document to be displayed in the editor.

    With some maths and iteration over potentially a lot of vertices in the document, building a scene bounding box, you might be able to come up with your own.

  • Global Moderator

    Hi WickedP, thanks for reaching us.

    Can you please better explain the final intent of your request? Is the document displayed in viewport (which means it's the active document)? Or is it just a cloned document being hold in "memory"?

    That said, supposing that you've your document displayed in the editor, beside the option to invoke CallCommand, there's no built-in function or method to invoke, but rather, as already depicted by @fwilleke80 you can think of doing something like:

    for each object in all objects:
      get object bounding box center and radius
      evalute the bbox max and min and update the overall bbox
    reposition the editor camera target in the center of the overall bbox 
    for each overall bbox vertex:
      convert from world to screen space
      verify that's inside the frame of the editing camera 
      if not in frame:
       zoom out a little and recheck if vertex is now in frame

  • Apologies, thought I had left a response but I didn't hit submit!!

    Thanks fwilleke80, I was hoping to avoid writing my own, but I might have to.

    Hi r_gigante, it's a doc in memory (not a clone, but in memory none-the-less) and can't be in the active viewport. It's rendered to bitmap, sometimes very frequently. So I can't be switching to it in the viewport for one command on each frame. Is there no way to piggyback off the underlying CallCommand() functions for this? No messages I could send to try and invoke it?


  • Global Moderator

    Hi WickedP,

    sorry for no bringing good news, but the architecture of the CommandData doesn't allow to "piggyback" off the "Frame All" command nor I've evidences of messages being sent around to have the "Frame All" to take place.

    The only, but maybe non-trivial, way to go is to write your own function based on the currently active rendering-camera in your "in-memory" document.

    Cheers, Riccardo