Move texture image with ruby

Hello, tips for placing a texture image with the Ruby, thank you.
Joseph.

I would like to have the image of the tiles 10x10 cm already positioned correctly, when you insert the top for tiled kitchen, coming from a ruby code script in which you have to enter at will the length of the top, the depth is fixed to 71,5 cm, only the length is required…

Original texture image used…

See:

The best “tip” is to search this category for past topics …

https://forums.sketchup.com/search?q=position%20material%20category%3A13

To search, you enter this category and then type search terms in the magnifying glass menu at top right.

Thanks for the answer… I read all…

I was only able to do this… more advice…thanks

model = Sketchup.active_model
entities = model.active_entities

# Input.....
larghTop = 52.cm
altTop = 71.5.cm
spessTop = 2.cm

# Create "layer"..."piano"...
layerPianoTop = model.layers.add("Piano Top")
model.active_layer = layerPianoTop

# Create "group"...
group_pianoTop = entities.add_group
group_pianoTop.name = 'pianoTop'

# Create a face and add it to the model entities
ptTop = []
ptTop[0] = [0, 0, spessTop]
ptTop[1] = [larghTop, 0, spessTop]
ptTop[2] = [larghTop, altTop, spessTop]
ptTop[3] = [0, altTop, spessTop]
face_top = group_pianoTop.entities.add_face(ptTop)
face_top.pushpull(-spessTop)

# Create a material and assign the texture to it
mat_TileA = model.materials.add("TileA")
fileName_TileA = File.join('Texture', 'TileA_10x10.png')
mat_TileA.texture = fileName_TileA
mat_TileA.texture.size = [19.685, 19.685] # Image(texture 'TileA_10x10.png') size in inches

# Assign the new material to our face we created
face_top.material = mat_TileA

# Move Texture....'TileA_10x10.png'....
pt_array = []
pt_array[0] = Geom::Point3d.new(larghTop,0,0)
pt_array[1] = Geom::Point3d.new(0,0,0)
on_front = true
face_top.position_material(mat_TileA, pt_array, on_front)

I wanted to upload a video file by shutting down the simple code I attached… I used video formats . avi, . mp4, and . mov, size from 6 to 10 Mb, nothing to do, no load anything… some advice… thanks.

Use an MP4. But size needs to be under 5MB I think.

:ok_hand: :ok_hand: :ok_hand: :ok_hand:

Not sure if it’s the same for video, but SKP and image files seem to be ok up to about 15MB now, though it used to be a much smaller size limit.

:ok_hand: :ok_hand: :ok_hand: :ok_hand:

I leave it behind, file . mp4, size 4.89 Mb…but it does not load…