Adding Option for _PictureFrame in GHpython

Hi everyone,

I was trying to create a this component using GHpython for creating a Picture Frame and I have met with a dead wall with some issues:

  1. If there is way to achieve the same result without the action of baking the image directly in Rhino?

  2. The AddPictureFrame requires a Plane where the image will be inserted, how to tell it that I need the XY Rhino World plane ?
    PS: I have already tried giving it a point and the WorldXYPlane.

Geometry Rhino - Python - (11.2 KB)

Thank you in advance

@Nader_Belal, have you tried the ImageSamplercomponent ?

you can set the rectangle in the image sampler. In python maybe this helps: (8.2 KB)


1 Like


Thank you for your quick responce

Image Sampler component is a good option, but it doesn’t serve the purpose I need.

Why I´m getting this error message ?

Runtime error (MissingMemberException): 'ObjectTable' object has no attribute 'FindId'
  line 19, in DoSomething, "<string>"
  line 26, in script

Probably because you’re not running it in Rhino 6. Rhino 5 does not know FindId method, you might exchange the following line:

rh_obj = Rhino.RhinoDoc.ActiveDoc.Objects.FindId(frame_id)

with this for Rhino 5:

rh_obj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(frame_id, True)


1 Like


I have learnt a lot with the example you have sent me, and I would like to know:

  1. Why did you use Bitmap & not Image Class ? (I´m asking cause I’ve checked them and couldn’t understand)

  2. What is the function of Rhino.RhinoDoc.ActiveDoc class?

I was just remembering that i could then get the width and height quickly. You can do the same using the image class of course:

image = System.Drawing.Image.FromFile(file_path)
w, h = image.Width, image.Height

If you’ve scripted using the python built in editor (_EditPythonScript) in the past, the method is used instead of scriptcontext.doc.

1 Like

thank you @clement for your script.

1 Like