algorithmic modeling for Rhino
Rhino supports texture mapping projections per object (cubic, spherical, cylindrical, uv etc) but I have no idea how any of that works. It's also possible that those properties are stored on the attributes of Rhino objects, instead of on the geometry. I think you're better off asking on the discourse forum, that's where you'll find the programmers who made those features.
Thanks I found on the forum this :
private void RunScript(Guid x, Brep y, Plane p, ref object A)
{
Rhino.Render.TextureMapping textureMapping = Rhino.Render.TextureMapping.CreatePlaneMapping(p, new Interval(-400, 400), new Interval(-400, 400), new Interval(0, 1));
Rhino.DocObjects.Tables.ObjectTable.ModifyTextureMapping(x, 1, textureMapping);
}
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObject...
But I get error:
Error (CS0120): An object reference is required for the non-static field, method, or property 'Rhino.DocObjects.Tables.ObjectTable.ModifyTextureMapping(System.Guid, int, Rhino.Render.TextureMapping)' (line 74)
What does this error mean?
You're calling ModifyTextureMapping like it was a static method, you have to access the ObjectTable of the current document.
It should go like
Rhino.RhinoDoc.ActiveDoc.Objects.ModifyTextureMapping(...)
and you have
Rhino.DocObjects.Tables.ObjectTable.ModifyTextureMapping(...)
Mapping channel by default is 1.
If somebody needs this:
Rhino.Render.TextureMapping textureMapping = Rhino.Render.TextureMapping.CreatePlaneMapping(p, new Interval(-400, 400), new Interval(-400, 400), new Interval(0, 1));
Rhino.RhinoDoc.ActiveDoc.Objects.ModifyTextureMapping(x, 1, textureMapping);
Hi John!
I'm one of somebody needs this. But i 'm not a programmer and i don't understand how to use this code. COuld you seggest me how mapping brep in grasshopper in a more easy way..?
thanks,
Regards,
Roy
I'm attempting to make a C# component that allows for texture mapping meshes on multiple channels. Here is the code I have so far (M is a mesh, P is a plane, and X and Y are intervals):
Rhino.Render.TextureMapping textureMapping1 = Rhino.Render.TextureMapping.CreatePlaneMapping(P, X, Y, new Interval(0, 1));
Rhino.Render.TextureMapping textureMapping2 = Rhino.Render.TextureMapping.CreatePlaneMapping(P, new Interval(0, 1), new Interval(0, 1), new Interval(0, 1));
M.TextureCoordinates.SetTextureCoordinates(textureMapping2); //M.TextureCoordinates.SetTextureCoordinates(textureMapping2, 2)
M.TextureCoordinates.SetTextureCoordinates(textureMapping1); //
//M.TextureCoordinates.SetTextureCoordinates(textureMapping1, 1); //
It appears that texture mapping per channel isn't allowed on the mesh or am I missing something? If these attributes are on rhino objects instead of the geometry, does that mean 1) I have to bake the meshes and then run a secondary script which gives them their second texture mapping or 2) convert the meshes to surfaces in grasshopper and apply the mapping per channel as a rhino object? If 2, then how do I set the Guid x as the mesh? From my attempts I'm assuming I have to bake and then texture for the second channel, but wanted to check in case I'm missing something. (From the code above one channel is working completely correctly).
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by