I would like to create simple script to work with texture which is used by face. So far I have found that
Class: Sketchup::UVHelpercontains methods allowing you to determine the location (UV coordinates) of a texture on a face.
Class: Sketchup::Face
back_material is used to retrieve the material assigned to the back side of the face.
back_material is used to set the material assigned to the back side of the face.
position_material(material, pt_array, o_front) is used to position a material on a face.
and Class: Sketchup::Texture contains methods for obtaining information about textures that are part of your materials in your model (within the In-Model section of the Materials Browser).
But still I cannot find out where are methods to work with scale, dimensions, rotation etc. of the texture used by face. Can someone clarify how Sketchup Rubi API works when you use material and apply it to face and then when you modify these texture - properties? Where are they saved? Is there any hidden storage of properties used by faces? In the Class: Sketchup::Face class I did not find any information for this subject.
UV coordinates are ‘saved’ with the face properties, and are accessible via the UVHelper methods.
You will notice that your skp file will increase in size after applying UV coordinates to a face.
To set the UV coordinates, pass an array of coordinates (pt_array) to face.position_material, where the array contains alternating positions (typically the positions of the face vertices, but that is not mandatory), followed by the UV coordinate as a Geom::Point3d.new(u,v,0)
So, to rotate or scale, you could rotate or scale the UV coordinates before applying to a face, and for that, use the basic geometry transformation classes, since UVs are stored as a Point3d.
.
I start to understand it. So UV coordinates are coordinates of the “pins” or corners of the image. So they define the scale, size, dimensions, position…