Looking for view port tools - scale / set attributes

I have a large set of objects to capture from a view port as PNG files. Is anyone aware of GH components that help with:

  1. Scale a baked GEO object to the view port extend
  2. Set the view port attributes from GH e.g. set view port to artistic style



that seems the opposite of “zoom extents” rhino command… scale (and move) the geometry to fit the viewport(?)
Is this really what you want?

You say “a large set of objects”… but this would mean that after moving each object to viewport the old one should be removed, or they would overlap…
Could you explain better, in detail, how you imagined the whole process?

It shouldn’t be to hard to do this with script/c#/gh but it’s better to understand well what you have in mind before putting anything down.

Riccardo, thank you for your response.

The envisioned process is:

  1. Cycle through a set of GH objects of various sizes as follows
  2. Bake a single object from the set
  3. Scale it to view port boundary - the part I have not figured out
  4. Capture the view port - I’m using a view port to PNG capture component
  5. Delete the object - using a component that deletes all object on the default layer
  6. Next object in the list

The part I’m wrestling with is how to get an object to fill the view port. Maybe I need to just scale all objects to the same size before baking it. I was hoping there is a command or component that would show the object in a view port to fill the full view port. I’m not a python or C# guy I mostly use components to create the GH scripts.

I hope this helps explaining what I’m trying to do.


The attached definition is pretty small.
It could have been done entirely in c#, but for the sake of understanding (mine and others), and to keeping it simple, I’ve done half the work in c# and the other half in gh.

The c# component just get camera viewport properties to output:

  • a point, intersection of camera>target vector to world XY plane
    (i couldn’t use cameratarget point because it would move to the preview brep itself; if wired instead of shaded preview that could be still an alternative)
  • a number, radius of the largest sphere that could fit inside active viewport (centered on previous point)
    (To “refresh” the c# component I used a timer; you can disable it and trigger it manually…)

Then in gh i scaled and moved the breps accordingly to that virtual sphere.

move_to_viewport.gh (234.1 KB)

In rendered mode you can already see your preview.
Instead of baking/deleting every time, you can again use c# to make the bake refresh/move as a preview.

Sorry for the late reply, getting back to this now. Thanks you so much for this. I will try it out and see how it was done.

It works great.