How to get info from a face
-
Hi wanted to learn about making plugins and ran into a problem
How would i get information from a selected face? I want to use the X,Y,Z of a face inside a component.
somehow I can't get for the life of me get anything to work
-
@d0n said:
Hi wanted to learn about making plugins and ran into a problem
How would i get information from a selected face? I want to use the X,Y,Z of a face inside a component.
somehow I can't get for the life of me get anything to work
Please provide more info about what you are trying to do. A Face is a planar surface bounded by a collection of Edges. Each Edge has two end Vertex3d locations, which have x,y,z positions, but there is no single x,y,z associated with a Face.
-
@d0n said:
Hi wanted to learn about making plugins and ran into a problem ...
... somehow I can't get for the life of me get anything to workYou should read my Ruby Newbie's Guide (link in signature.)
You need to learn standard Ruby. Then you can apply the SketchUp API extensions (which SketchUp loads automatically after loading the Ruby interpreter.)
I always recommend reading the good old "Pick-Axe" book (posted in the Ruby Resources sticky topic!) from cover to cover.@d0n said:
How would i get information from a selected face?
You first get a reference to the selected face from the selection collection:
face = Sketchup::active_model.selection.grep(Sketchup::Face).first
@d0n said:
I want to use the X,Y,Z of a face inside a component.
Assuming you want the first vertex in the face's vertices collection:
pos = face.vertices.first.position
pos
should be aGeom::Point3d
class object. -
Thanks
which function should i look at if i want to get all the vertices of the face?
-
@d0n said:
Thanks
which function should i look at if i want to get all the vertices of the face?
http://www.sketchup.com/intl/en/developer/docs/ourdoc/face.php#vertices
Advertisement