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.