Capture and Crop Image

capture-view

#1

Hi all,

I tried to improve upon the Capture Image component so that it crops the final image to a bounding box (Top view only). This is useful for generating multiple properly-sized images automatically from a single run. It also turns off the grid and sets the background color so the user isn’t required to set that manually. See attached.

I learned a lot about rhinocommon from the LB Capture View and Orient-To-Camera components, but it’s still a bit buggy.

  • The sc.doc.Views.ActiveView.ActiveViewport.ZoomBoundingBox(box) command appears to automatically give a 10% buffer zone and I can’t figure out how to scale the box within rhinocommon.

  • if I scale the pixel size past my window screen extents it throws off the zoom. I’ve googled this one to death and just can’t figure it out.

Anyone have any ideas?capture and crop image.gh (14.0 KB)


#2

Hi @LelandCurtis,

Are you looking for this? scale.gh (5.3 KB)

If yes, then I did this like so

import Rhino as rc
center = poly.CenterPoint()
curve = curve.ToNurbsCurve()
new_curve = curve.Duplicate()
xform = rc.Geometry.Transform.Scale(center, scale)
new_curve.Transform(xform)
a = new_curve

#3

I followed

I can’t figure out how to scale the box within rhinocommon.

Hope I am not wrong :neutral_face: