Trying to assign a texture to a flat mesh object using
material = Rhino.AddMaterialToObject(strObject)
Rhino.MaterialColor material, RGB(255, 255, 255)
Rhino.MaterialTexture material, "c:\image.jpg"
Now I need to change the texture mapping to planar, but I can not find a command to do so.
According to the sdk some functionality exists since SR7:
Any status on the support of texture mapping in RhinoScript?
Looks like it would be possible with Python/RhinoCommon, but perhaps a bit complicated to figure out…
–Mitch
Hello,
trying to figure out RhinoCommon, but got stuck at basic problems.
My function should import a mesh from file, assign it to a global reference and assign material like
def ImportStl():
rs.Command("_-Import model.stl _Enter Weld=Yes WeldAngle=22.5 SplitDisjointMeshes=Yes ModelUnits=Millimeters _Enter")
objs = rs.LastCreatedObjects(False)
global meshObject
if objs:
meshObject= ??? how to get objRef from Guid in objs???
meshObject.Attributes.MaterialSource = Rhino.DocObjects.ObjectMaterialSource.MaterialFromObject
return Rhino.Commands.Result.Success
Now I get a missing objectRef error when trying to access the objects’ attributes. How can I get a handle to the mesh instance?
Thank you very much!
Got it, but is there a simpler access to the mesh possible?
meshObject=Rhino.DocObjects.ObjRef(objs[0]).Object()