Faces in SketchUp are flat, 2-sided polygons with 3 or more sides.
The all_connected method retrieves all of the entities connected to a face.
Returns:
depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts # Assuming nothing else was in the model, first entity should be an Edge. entity1 = entities[0] if entity1.typename == "Edge" connected = entity1.all_connected end if (connected) UI.messagebox connected else UI.messagebox "Failure" end
The area method is used to retrieve the area of a face in current units.
You can pass in an optional Transformation (or an array that can represent a
transformation), to correct for a parent group's transformation. For example,
if a face is inside of a group that is scaled to 200%, the area method will
return the unscaled area of the face. So by passing a 200% transformation
object to this method, you can account for that to get the "visual" area
of the face.
Arguments:
Returns:
depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts area = face.area
The back_material method is used to retrieve the material assigned to the back side of the face.
Returns:
depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts area = face.area back = face.back_material
The back_material= method is used to set the material assigned to the back side of the face.
Arguments:
Returns:
depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts status = face.back_material="red"
The classify_point method is used to determine if a given Point3d is on your
face. The return value will be from this list:
Arguments:
Returns:
model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [9, 0, 0] pts[2] = [9, 9, 0] pts[3] = [0, 9, 0] # Add the face to the entities in the model face = entities.add_face pts test_point = Geom::Point3d.new(50,50,0) # Find out how the point relates to the face. result = face.classify_point(test_point)
The edges method is used to get an array of edges that bound the face.
Returns:
depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts edges = face.edges
The followme method is used creating a shape by making the face follow along an array of edges.
Arguments:
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts line = entities.add_line point1, point2 begin status = face.followme line rescue UI.messagebox $!.message end
The get_UVHelper object is used to retrieve a UVHelper object for use in texture manipulation on a face.
Arguments:
Returns:
model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [9, 0, 0] pts[2] = [9, 9, 0] pts[3] = [0, 9, 0] # Add the face to the entities in the model face = entities.add_face pts tw = Sketchup.create_texture_writer uvHelp = face.get_UVHelper true, true, tw
The get_glued_instances method returns an Array any ComponentInstances that are glued to the face.
Arguments:
Returns:
# Create a series of points that define a new face. model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [9, 0, 0] pts[2] = [9, 9, 0] pts[3] = [0, 9, 0] # Add the face to the entities in the model face = entities.add_face pts glued_array = face.get_glued_instances
The loops method is used to get an array of all of the loops that bound the face.
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts loops = face.loops
The material method is used to retrieve the material assigned to the front of the face. (This method is inherited from the Drawingelement parent class.)
Returns:
depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts mat = face.material
The material= method is used to set the material assigned to the front side of the face. (This method is inherited from the Drawingelement parent class.)
Arguments:
Returns:
depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts status = face.material = "red"
The mesh method creates a polygon mesh that represents the face. See the
PolygonMesh class for more information.
Valid flags are:
Arguments:
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts mesh = face.mesh 7
The normal method is used to retrieve the 3D vector normal to the face in the front direction.
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts normal = face.normal
This method is used to retrieve the outer loop that bounds the face.
Returns:
# Create a series of points that define a new face. model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [9, 0, 0] pts[2] = [9, 9, 0] pts[3] = [0, 9, 0] # Add the face to the entities in the model face = entities.add_face pts loop = face.outer_loop
The plane method is used to retrieve the plane of the face. See the Array class for information on how planes are stored.
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts plane = face.plane
The position_material method is used to position a material on a face.
The 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.
Arguments:
Returns:
model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [9, 0, 0] pts[2] = [9, 9, 0] pts[3] = [0, 9, 0] # Add the face to the entities in the model face = entities.add_face pts material = model.materials[0] 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
The pushpull method is used to perform a push/pull on a face.
The distance is measured in the direction that the face normal is pointing.
Arguments:
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts status = face.pushpull 100, true
The reverse! method is used to reverse the face's orientation, meaning the front becomes the back.
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts status = face.reverse!
The vertices method is used to get an array of all of the vertices that bound the face.
Returns:
point1 = Geom::Point3d.new (0,0,0) point2 = Geom::Point3d.new (0,0,100) depth = 100 width = 100 model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [width, 0, 0] pts[2] = [width, depth, 0] pts[3] = [0, depth, 0] # Add the face to the entities in the model face = entities.add_face pts vertices = face.vertices