SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

UVHelper class

The UV Helper class contains methods allowing you to determine the location (UV coordinates) of a texture on a face. This class is particularly useful in determining how textures that have been manipulated using the Texture Tweaker should appear when exported to another file type.

Parent: Object 

Methods: get_front_UVQ, get_back_UVQ

Example Code: TextureWriter.rb 

Instance Methods


get_front_UVQ 

The get_front_UVQ method is used to get the UV coordinates for a front of a face.

Syntax

point = uvhelper.get_front_UVQ point

Arguments

point - a Point3D object containing one of the 3D vertexes of the face.

Return Value

point - a Point3D containing the UV coordinates where the X value is the U value, the Y value is the V value and the Z value is a Q value (which is not used).

Example

ent.outer_loop.vertices.each do |vert| 
uvq = uvHelp.get_front_UVQ(vert.position)
puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s

 

 


get_back_UVQ 

The get_back_UVQ method is used to get the UV coordinates for a back of a face.

Syntax

point = uvhelper.get_back_UVQ point

Arguments

point - a Point3D object containing one of the 3D vertexes of the face.

Return Value

point - a Point3D containing the UV coordinates where the X value is the U value, the Y value is the V value and the Z value is a Q value (which is not used).

Example 

ent.outer_loop.vertices.each do |vert| 
uvq = uvHelp.get_back_UVQ(vert.position)
puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s

 

SketchUp  Ruby API Reference: UVHelper

© Google Inc. 2007 sketchup.google.com