Texture Position Tool not appearing

I am trying the face.position_material method to set a texture on a face, using the example provided on the method documentation.
The problem is the texture does not appear and when right clicking on the face the Texture Position tool does not turn up either. The face Entity Info though shows the texture image for the face. The only way the texture appear on the face is to click on the front face texture on the Entity Info tray and click OK. It then apply the texture and the “Texture Position” turns up when right clicking.

Here is an snapshot: you can see the texture position tool is not there but the Entity info shows the texture.

Here is the model.

Standard Example.skp (86.6 KB)

Try this code on the Ruby console:

model = Sketchup.active_model
entities = model.active_entities

# Create a face and add it to the model entities
pts = []
pts[0] = [0, 0, 1]
pts[1] = [9, 0, 1]
pts[2] = [9, 9, 1]
pts[3] = [0, 9, 1]
face = entities.add_face(pts)

# Export an image to use as a texture
path = Sketchup.temp_dir
full_name = File.join(path, "temp_image.jpg")
model.active_view.write_image(full_name, 500, 500, false, 0.0)

# Create a material and assign the texture to it
material = model.materials.add("Test Material")
material.texture = full_name

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

pt_array = []
pt_array[0] = Geom::Point3d.new(3,0,0)
pt_array[1] = Geom::Point3d.new(0,0,0)
on_front = true
face.position_material(material, pt_array, on_front)
1 Like

The Face Style must be Shaded With Texture. Please check if it is set to any other option.
Manually applying the texture may be setting it accordingly causing it to work.

That was it. Perfect :slight_smile: