SimulatedTexture Overload Error

I keep getting an issue with the Overloads in both C# and Python for: Rhino.Render.RenderTexture.NewBitmapTexture() and Rhino.Render.SimulatedTexture()

“Error (CS1502): The best overloaded method match for ‘Rhino.Render.RenderTexture.NewBitmapTexture(Rhino.Render.SimulatedTexture, Rhino.RhinoDoc)’ has some invalid arguments (line 94)
Error (CS1503): Argument 1: cannot convert from ‘System.Drawing.Bitmap’ to ‘Rhino.Render.SimulatedTexture’ (line 94)”

Anyone with more experience working with texture mapping who can help? Happy to add more info as needed.

RenderTexture.NewBitmapTexture Method (Bitmap, RhinoDoc) was added for Rhino 7. It does not exist in Rhino 6.

If you save out your System.Drawing.Bitmap to disk then you can create a Texture Class, set your saved file to the Texture.FileName Property . From that Texture you can get a SimulatedTexture using the SimulatedTexture Constructor (RhinoDoc, Texture). This you can pass on to the RenderTexture.NewBitmapTexture Method (SimulatedTexture, RhinoDoc) .

Nathan, thanks for the reply! I guess this may just be an issue with using Rhino 6 then, but I have already done what you’re recommending but it throws this error: Runtime error (ArgumentTypeException): SimulatedTexture() takes no arguments (2 given)

Which seems to be an issue with the Overloads, right? I am not that familiar with them

Ah sorry. I gave you the wrong signature. You need the one that takes only the SimulatedTexture and you should be good to go.

I think I am missing something, so please forgive my limited understanding, but using only the SimulatedTexture just throws: Error (CS1729): ‘Rhino.Render.SimulatedTexture’ does not contain a constructor that takes 1 arguments (line 91)
Warning (CS0612): ‘Rhino.Render.RenderTexture.NewBitmapTexture(Rhino.Render.SimulatedTexture)’ is obsolete (line 94)

How can I even change which constructor I am using, shouldn’t it do this automatically based on the inputs?

C# code snippet:
var tex = new Rhino.DocObjects.Texture
FileName = bitmap_filename
var sim = new Rhino.Render.SimulatedTexture(tex);
var render_texture = Rhino.Render.RenderTexture.NewBitmapTexture(sim);

Apparently our API has changed quite a bit here. I haven’t tested, but maybe you can try creating a SimulatedTexture with the default constructor and set the Filename for it directly SimulatedTexture.Filename Property. Maybe that works instead of first doing the Texture?

I’ll try it, thanks so much for your time!