I have used these scripts in the past. I am now getting an error with System.Drawing, possibly.
Code:
import rhinoscriptsyntax as rs
import System.Drawing as SD
filter = "PNG (*.png)|*.png|JPG (*.jpg)|*.jpg|TIF (*.tif)|*.tif|BMP (*.bmp)|*.bmp|All (*.*)|*.*||"
filename = rs.OpenFileName("Select image file", filter)
img = SD.Bitmap(filename)
# scripted rhino command pictureframe with width and height as calculated above
script = '_-PictureFrame "{0}" 0,0,0 {1},0,0'.format(filename, img.Width)
rs.Command(script)
img.Dispose()
obj = rs.GetObject("Select object")
if obj:
index = rs.ObjectMaterialIndex(obj)
if index>-1:
rs.MaterialTransparency( index, 0.60 )
obj = rs.GetObject("Select object to orient")
if obj:
reference = rs.GetPoints(message1="First reference point", message2="Second reference point")
if reference>0:
target = rs.GetPoints(message1="First target point", message2="Second target point")
if target>0:
rs.OrientObject( obj, reference, target, flags=2 )
I am running on OSX Rhino.
Thanks, Randy