Extract texture to image

I´ve a BrepFace with texture from a file and I want to intersect this brepface with a Curve and extracting the texture of the intersection of two objects and to draw in a WPF window.

The picture is a example I want, in this example there are two curve over the brepface and in the right of the picture, these curve are a clone of the texture. This is I would like.

I can create a new brepface with the intersection, and this object has the correct texture.

But I do not know how to transfer this texture to an object in WPF, I was thinking to convert in .jpg and After I could use background = image.jpg or something similar.

Any Idea?

@andy is this something you can help with?

I’m sorry, but I don’t understand the request clearly.

You want to cut out a section of a brep with a rectangle, and then get some kind of representation of the texture on that particular part of the brep, convert it to a bitmap and transfer it to WPF?

If so, this is a complex problem - unless there are limitations on the curve geometry, the brep and the texture mapping and material assignment.

I´m going to try to explain a little better what I want.

I have a brepFace in Rhino, this brepface has a Texture, that I´ve chosen from .jpg file, this file contains a texture from a stone.

On the other hand, I´ve differents objects in a .3dm file, rectangle, circle or others, the shape is not important.

I import those objects and I draw it in a panel, the right panel, this panel is a Usercontrol of WPF. When I click one of these objects I clone the shape of the object over the brepFace.

All this, I known how to do it and I show in the picture, in this case there is only one object.

But I want to know is how to extract the texture that is inside of the object in Rhino and to draw in UserControl on the right panel, but the the same texture that is in this moment inside the shape.

I´ve tried to create a new brep with the same shape and texture, I can do it and I can to add in Rhino.Activedoc.Objects.add(), but I don´t known how to export it to draw in a object in Usercontrol WPF.

So all you need is a representation of the trimmed brep and trimmed texture? If you add the new trimmed brep, you could hide everything else and save the viewport as an image to use in your form. If this is what you are after, there could be several ways to do it:

Now, if you actually need the texture as a new trimmed image, I think this is trickier.

Thanks for the answer.

I´ve been looking this solution and I can capture the view and to delimit width and height, but my objects are irregulars. Maybe with square and rectangle it will be good, but for the shape in the above example doesn´t help me.

Maybe you can zoom in on the resulting trimmed object and deduce an aspect ratio that works or try to get the information from the object’s bounding box? The resulting bitmap is always rectangular no?

Again, if you are looking to get a texture from the trim (not a snapshot of the resulting shape) then this is trickier.