Brep.Split not preserving default texture mapping on RhinoCommon

Hi,

I have a feature implemented as reported in these 5 steps:
1’ the plugin creates a surface with the script _-PictureFrame on the plane WorldXY, to show a jpg image with aspect ratio 10:7 on the diagonal from (100,100,0) to (1100,800,0)
2’ the user decides to crop the image keeping its pixels where they were located, for example by drawing a rectangle with aspect ratio 2:1 on the diagonal from (200,200,0) to (400,300,0)
3’ the plugin crops the image created at 1’ with the rectangle defined in 2’. I have done this using public Brep[] Split(Brep cutter, double intersectionTolerance); on the Brep given by the RhinoObject created at step 1’
4’ the plugin copies the ObjectAttributes from the Brep created at 1 to the Brep created at 3’
5’ the plugin hides the layer of the RhinoObject created at 1’

After upgrading my plugin from Rhinoceros 5 to Rhinoceros 7, the picture is stretched on the new area. Before the absolute position of the picture was preserved by step 4’.

If I try to apply the texture mapping, I can’t preserve the absolute position of the picture. Which linear transformation should I input to Rhino.Render.TextureMapping.CreatePlaneMapping?

Thanks

Hi @cavalli.stefano,

Can you provide me a simple way to repeat what you are seeing?

– Dale

20220215 Rhinoceros7 rd3.zip (105.9 KB)
rhino5
rhino7

I have attached a VS2019 solution with the problem. The same code gives two different visual results as reported in the 2 print screen attached. In the production code the picture frame is created with the script but the problem is the same. Splitting with the Rhinoceros 7 UI gives the result as expected in the Rhinocceros 5 Rhinocommon, so maybe it’s a bug in Rhinoceros 7 Rhinocommon?

Hi @cavalli.stefano,

Using V7, I get this:

image

And if I UnTrimAll the trimmed surface, I get this:

image

What SR of V7 are you using?

– Dale

This problem occurs with version 7.5.21100.3001 and also with the actual version 7.12 as reported in the print screen

Have you created the trimmed rectangle with RhinoCommon, using the code of the sample I sent in my previous sample?

Hi @cavalli.stefano,

My screen shots are from your RHNCRS7Command command.

– Dale

Hi,

Is this version ok to grant this feature?

Is the fact that I’m in a virtual machine a problem?

I have tried in a widows 10 run directly from BIOS and the problem does not occur.

So it seems that my vmware virtual machine with hardware virtualization enabled has
some discrepancies.
This could be a problem, if you need more info let me know

thanks

Hi @cavalli.stefano,

Thanks for the update.

– Dale