Texture Mapping out Geometry

hi i created script c# for set XYZ Size of Texture Material(and we can bake that object with Material in Rhino by siz) but output for bake only== Mesh ! and i need bake it for example Brep Surface ,…(According to the input geometry)
Any suggestions or any C# Api? Because I didn’t find any Api for Brep or Surface Like Mesh




 private void RunScript(Mesh mesh, Box box, string path, double tr, ref object MeshMap, ref object Material)
    Component.Name = "Texture Maping,Matrial";
    if(Component.Params.Input[1].VolatileDataCount != 0 && mesh != null){
      var textu = TextureMapping.CreateBoxMapping(box.Plane, box.X, box.Y, box.Z, true);
      MeshMap = mesh;}
    Material mat = new Material();
    if (path != null)
      mat.Transparency = tr;
    var m = RenderMaterial.CreateBasicMaterial(mat, RhinoDoc.ActiveDoc);
    Material = new GH_Material(m);

texture mapping.zip (205.0 KB)

Texture mapping is applied to a surface or polysurface’s render mesh during rendering. Brep doesn’t store texture mapping data. Howere you can bake a brep object and modify its texture like this:

private void RunScript(Brep brep, Box box, bool run)
  if (run)
    var mapping = TextureMapping.CreateBoxMapping(box.Plane, box.X, box.Y, box.Z, true);
    var id = RhinoDocument.Objects.AddBrep(brep);
    doc.Objects.ModifyTextureMapping(id, 1, mapping);

Ehsan.gh (6.3 KB)

1 Like