I have a bunch of geometry (wooden planks) and a texture that fits them perfectly. Is there any way to automatically set the uv box mapping to a bounding box oriented to the geometry?
There’s tons of them and takes a while to go into each plank and orient the box properly.
I had a look at python but it was beyond me for the moment.
import rhinoscriptsyntax as rs
def BoxMapEach():
ids = rs.GetObjects("Select objects for BB box mapping.", filter = 8+16+32, preselect=True)
if not ids: return
rs.EnableRedraw(False)
for id in ids:
rs.UnselectAllObjects()
rs.SelectObject(id)
rs.Command("ApplyBoxMapping BoundingBox World Yes 1 ")
rs.SelectObjects(ids)
rs.EnableRedraw(True)
if __name__ == '__main__':BoxMapEach()
To use the Python script use RunPythonScript, or a macro:
_-RunPythonScript "Full path to py file inside double-quotes"