Custom Mapping Object assignment

Hi,

i have a brep which uses a custom render mesh which i created. This mesh has texture coordinates. I’d like to use the custom render mesh and it’s texture coordinates when i use the UVEditor on the brep. Once i start the UVEditor, the custom mesh assignment is lost, even when i cancel the UVEditor, my mesh is replaced with a very coarse mesh.

I’ve found that when i assign the custom mesh as a custom mapping object, the UVEditor properly uses it and unwraps my own custom rendermesh with the custom mapping mesh coordinates. Is there a way to programmatically assign my mesh as the custom mapping object ?
_
c.

Hi @clement, UVEditor doesn’t show any custom render meshes. But as soon as you close UVEditor your custom render mesh should be shown again.

Are you using C++, C# or something else?

Hi @Jussi_Aaltonen, i am using Python. Is there a way to do what the ducky button (Custom Mapping) does in the object texture properties using RhinoCommon / Python ?

_
c.

Hi Clement,

I was curious and did some digging.
It’s not a solution, but maybe a solution to build upon. ( or a wild goose chase)

import rhinoscriptsyntax as rs
import Rhino

def do_ducky():
    
    brep_id = rs.GetObject('get brep')
    mesh_id = rs.GetObject('get mapping mesh')#THIS MESH NEEDS TO BE UNWRAPPED FIRST
    
    
    
    mesh_robj = rs.coercerhinoobject(mesh_id)
    mesh_texture_mapping = mesh_robj.GetTextureMapping(1)
    
    
    brep_robj = rs.coercerhinoobject(brep_id)
    brep_robj.SetTextureMapping(1,mesh_texture_mapping)
    


do_ducky()

Good luck
-Willem

1 Like

Thank you @Willem, i will try it. (rubber duck chasing) :slight_smile:

_
c.

It’s not possible using RhinoCommon. Added request to YT: https://mcneel.myjetbrains.com/youtrack/issue/RH-46112

@Willem, that looks like a valid workaround :+1: