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.
Thanks
Sam
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
textu.AddTextureMapping(ren)
'Merge with Geometry
Dim cyl As New MRhinoBrepObject
Dim ty As New onxform
ty.IsZero
Dim renmp As New onmeshparameters
renmp.Default
cyl.SetBrep(x)
cyl.CreateMeshes(ion.mesh_type.render_mesh, renmp)
cyl.SetTextureCoordinates(ren, ty)
'Abject failure
doc.AddObject(cyl)
Tags:
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:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Render_T...https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Render_T...
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);
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by