algorithmic modeling for Rhino

I thought this may be the ticket to applying texture maps to some objects in GH using

Rhino.sdk in a Legacy component. The geometry component outs okay and I dont have any errors but it doesn't succeed in applying the custom texture map. Any help would be great.





Private Sub RunScript(ByVal x As OnBrep, ByVal y As Object, ByRef A As Object)
'Trying to apply some custom uvmapping but it's not working!

'Create a Box mapping
Dim ren As New OnTextureMapping

Dim pt1 As New On3dPoint(0, 0, 0)
Dim pt2 As New On3dPoint(5, 0, 0)
Dim pt3 As New On3dPoint(0, 5, 0)
Dim pl As New OnPlane(pt1, pt2, pt3)
Dim dx As New OnInterval(0, 56)

ren.SetBoxMapping(pl, dx, dx, dx, True)

'Add to Texture Map Table
Dim textu As MRhinoTextureMappingTable = doc.m_texture_mapping_table

'Merge with Geometry
Dim cyl As New MRhinoBrepObject

Dim ty As New onxform
Dim renmp As New onmeshparameters

cyl.CreateMeshes(ion.mesh_type.render_mesh, renmp)
cyl.SetTextureCoordinates(ren, ty)

'Abject failure

Views: 3396

Replies to This Discussion

Only 6 months late! I have figured this out in C#. If you need other languages I'm sure you can adapt it but the SDK has made this operation quite easy now

Rhino.Render.TextureMapping tex = Rhino.Render.TextureMapping.CreateBoxMapping(MyPlane, MyX, MyY, MyZ, true);

Rhino.RhinoDoc.ActiveDoc.Objects.ModifyTextureMapping(MyObjectGUID, MyMapChannel, tex);

Hi Mr VanMater.

Hope all is well, long time!

Just came across this. Do you, or anyone else know how to access the box mapping information of an object.

I got here:

But I don't know how to use it.

I know this post is 5 years old. But hey never too late.

Hope all is good in the states

Cracked it!

Rhino.DocObjects.RhinoObject obj = doc.Objects.Find(ID);

var txt = obj.GetTextureMapping(1);

var pln = new Plane();
var d1 = new Interval();
var d2 = new Interval();
var d3 = new Interval();

bool b = txt.TryGetMappingBox(out pln, out d1, out d2, out d3);

A = new Box(pln, d1, d2, d3);

Is it possible to create this definition below for a box mapping (human plug in) without grasshopper using python or rhinoscript so that I could input and output surfaces or polysurfaces and not only meshes. 






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service