Picture frame


(Ricardo) #1

Hello ,

I need to insert a photo (Pictureframe) from python script, but I need to insert attributes for the size.

Anything like, get image and first point 0.0.0 and length 20.0.0?
Any idea?


#2

You might want to check the online help for rs.AddPictureFrame() here:

http://developer.rhino3d.com/api/RhinoScriptSyntax/#geometry-AddPictureFrame

All the parameters you need to supply are listed…


(Ricardo) #3

Thank you,

For some reason dont work for me.

import rhinoscriptsyntax as rs

plane=rs.WorldXYPlane
rs.AddPictureFrame(plane,“Halo.jpg”, width=3000, height=1500, self_illumination=True, embed=False, use_alpha=False, make_mesh=False)

Any error??


#4

Just off the top of my head, I think maybe you need to put in the full path to the picture file… don’t forget to consider the backslash escape character problem in Python, for constructed file paths either you need double backslashes or use raw strings…

You could also try using rs.OpenfileName() to have a dialog to get your file, that should return a good path you can feed directly to AddPictureFrame().

Also: plane=rs.WorldXYPlane() - don’t forget the ()…

Any better?

–Mitch


(Ricardo) #5

This is my code

plane=rs.WorldXYPlane()
path=""“C:\Users\Ricardo Eira\Desktop\Test.jpeg”""
rs.AddPictureFrame(plane,path, width=3000, height=1500, self_illumination=True, embed=False, use_alpha=False, make_mesh=False)

Error:

Message: ‘module’ object has no attribute ‘AddPictureFrame’

I think this means that there is no function in this module ??


(Dale Fugier) #6

Hi @ricardo.eira,

If you are still using Rhino 5, then you will need to script the PictureFrame command, as rhinoscriptsyntax in V5 does not have a AddPictureFrame method.

Rhino 6, however, does have the method that @Helvetosaur mentioned.

– Dale


#7

Yeah, I kinda suspected that might be the case…


(Ricardo) #8

Sorry late,

Yes, I am using Rhino5.