SketchUp API docs
-
Hi
I've just begun to look at the Ruby part of SketchUp.
But I'm wondering, where do you go for your references?From this page: http://code.google.com/apis/sketchup/ it links to "reference documentation" (http://code.google.com/apis/sketchup/docs/developers_guide/index.html) and "wiki-style documentation" (http://groups.google.com/group/SketchUp-Plugins-Dev/web/google-sketchup-ruby-api)
The wiki appear to contain more info.For instance, the Face object:
The wiki page (http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-Face.html) list these methodsall_connected,area, back_material, back_material= , classify_point, edges, followme, get_UVHelper, loops, mesh, normal, outer_loop, plane, position_material, pushpull, reverse!, verticeswhile the "reference documentation" only lists these:
area, edges, followme, loops, mesh, normal, outer_loop, plane, pushpull, reverse!, verticesAnd none of them mention that you can use .material on the face. (just guessed it'd be there since I noticed there was an back_material.)
And yet, on some topics I feels there's much missing. Such as position_material:
@unknownuser said:
position_material
The position_material method is used to position a material on a face.
Syntaxface.position_material material, pt_array, on_front
Arguments
material - a Material object
pt_array - an array of Point3d objects used to position the material
o_front - true to position the texture on the front of the Face or false to position it on the back of the Face.
CommentsThe pt_array must contain 2, 4, 6 or 8 points. The points are used in pairs to tell where a point in the texture image is positioned on the Face. The first point in each pair is a 3D point in the model. It should be a point on the Face. The second point in each pair of points is a 2D point that gives the (u,v) coordinates of a point in the image to match up with the 3D point.
In this case, it doesn't explain what the difference between using 2,4,6 or 8 points is.
So my question is: is there a different source of documentation? Is it just me that feel that the documentation is a bit sparse? From other types of scripting I'm used to more information than what I can find on the SU API.
-
I'm also following this with interest. I often pretend that I will Ruby someday, but now that DC's are out, I have taken to them rather quickly and I am quickly seeing things I would like to do that is well out of their current abilities. Enter Ruby....but I also get lost in the docs as they stand currently.
Is there supposed to be better, newer, shinier docs coming out for SU7 soon?
Chris
(Hi Rick, Todd, and Tavi! I don't get into this forum to say hi to you guys very often...)
-
bump?
-
Yes, the documentation on this method is sparse, yet self-contradictory.
From the explanation:
"The second point in each pair of points is a >>> 2D <<< point that gives the (u,v) coordinates"
From the example code:
pt_array[1] = Geom:: >>> Point3d <<< .new(0,0,0)This is the point array I used in a call to position_material
pt_array = []
pt_array[0] = face.vertices[0]
pt_array[1] = Geom::Point3d.new(0,0,0)
pt_array[2] = face.vertices[1]
pt_array[3] = Geom::Point3d.new(1,0,1)
Apparently, the first two points set the location of the red pin, the next two
set the green pin. I'm still working out the other two.This is the result I get from using the point array above...

-
The effect of how many sets you use are as following:
1 set: The origin of the texture, width and height is taken from the material width and height
2 sets: Origin and scale+alignment
3 sets: Origin, scale+alignment, Skew
4 sets: Origin, scale+alignment, Skew, Distortion
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement