Class: Sketchup::Face
Relationships | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Drawingelement ,
Entity
|
|
Instance Chain:
self,
Drawingelement ,
Entity
|
|
Inherits: |
Sketchup::Drawingelement
|
Overview
Faces in SketchUp are flat, 2-sided polygons with 3 or more sides.
Constant Summary
-
PointInside =
Constants
nil
-
PointNotOnPlane =
Stub value.
nil
-
PointOnEdge =
Stub value.
nil
-
PointOnFace =
Stub value.
nil
-
PointOnVertex =
Stub value.
nil
-
PointOutside =
Stub value.
nil
-
PointUnknown =
Stub value.
nil
Instance Attribute Summary
-
#back_material ⇒ Sketchup::Material?
rw
The back_material method is used to retrieve the material assigned to the back side of the face.
-
#back_material=(material) ⇒ Sketchup::Material
rw
The back_material= method is used to set the material assigned to the back side of the face.
-
#material ⇒ Sketchup::Material?
rw
The material method is used to retrieve the material assigned to the front of the face.
-
#material=(material) ⇒ Sketchup::Material
rw
The material= method is used to set the material assigned to the front side of the face.
Drawingelement
- Inherited
#casts_shadows= | The casts_shadows= method is used to set the |
#casts_shadows? | The casts_shadows? method is used to determine if the |
#hidden= | The hidden= method is used to set the hidden status for an element. |
#hidden? | The hidden? method is used to determine if the element is hidden. |
#layer | The layer method is used to retrieve the |
#layer= | The layer= method is used to set the layer for the drawing element. |
#material | The material method is used to retrieve the material for the drawing element. |
#material= | The material= method is used to set the material for the drawing element. |
#receives_shadows= | The receive_shadows= method is used to set the |
#receives_shadows? | The receive_shadows? method is used to determine if the |
#visible= | The visible= method is used to set the visible status for an element. |
#visible? | The visible? method is used to get the visible status for an element. |
Entity
- Inherited
Instance Method Summary
-
#all_connected ⇒ Array<Sketchup::Entity>
The all_connected method retrieves all of the entities connected to a face.
-
#area ⇒ Float
The area method is used to retrieve the area of a face.
-
#classify_point(point) ⇒ Integer
The classify_point method is used to determine if a given Point3d is on the referenced
Face
. -
#clear_texture_position(front)
The #clear_texture_position method is used to remove any explicit texture positioning for a face and have SketchUp display it with the default texture positioning.
-
#clear_texture_projection(frontside)
The #clear_texture_projection method is used to clear the texture projection.
-
#edges ⇒ Array<Sketchup::Edge>
The edges method is used to get an array of edges that bound the face.
-
#followme(edges) ⇒ Boolean
The #followme method is used to create a shape by making the face follow along an array of edges.
-
#get_glued_instances ⇒ Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>
The get_glued_instances method returns an
::Array
any ComponentInstances that are glued to the face. -
#get_texture_projection(frontside) ⇒ Geom::Vector3d?
The #get_texture_projection method will return a vector representing the projection for either the front or back side of the face.
-
#get_UVHelper(front = true, back = true) ⇒ Sketchup::UVHelper
The get_UVHelper object is used to retrieve a
UVHelper
object for use in texture manipulation on a face. -
#loops ⇒ Array<Sketchup::Loop>
The loops method is used to get an array of all of the loops that bound the face.
-
#mesh(flags = 0) ⇒ Geom::PolygonMesh
The mesh method creates a polygon mesh that represents the face.
-
#normal ⇒ Geom::Vector3d
The normal method is used to retrieve the 3D vector normal to the face in the front direction.
-
#outer_loop ⇒ Sketchup::Loop
This method is used to retrieve the outer loop that bounds the face.
-
#plane ⇒ Array(Float, Float, Float, Float)
The plane method is used to retrieve the plane of the face.
-
#position_material(material, points, on_front) ⇒ Sketchup::Face, false
The #position_material method is used to position a material on a face.
-
#pushpull(distance, copy = false) ⇒ nil
The pushpull method is used to perform a push/pull on a face.
-
#reverse! ⇒ Sketchup::Face, false
The reverse! method is used to reverse the face’s orientation, meaning the front becomes the back.
-
#set_texture_projection(vector, frontside) ⇒ Boolean
deprecated
Deprecated.
This function never worked correctly. It’s not capable of controlling the position and orientation of the texture. In some cases it produced an invalid model. As of SketchUp 2021.1 the method simply raises
NotImplementedError
. -
#texture_positioned?(front) ⇒ Boolean
The #texture_positioned? method is used to check if the face has a texture that is positioned.
-
#texture_projected?(front) ⇒ Boolean
The #texture_projected? method is used to check if the face has a texture that is projected.
-
#uv_tile_at(position, front) ⇒ Array<Geom::Point3d>?
The #uv_tile_at method is used to get the corner positions (model and UV) of a UV tile.
-
#vertices ⇒ Array<Sketchup::Vertex>
The vertices method is used to get an array of all of the vertices that bound the face.
Drawingelement
- Inherited
#bounds | The |
#erase! | The |
Entity
- Inherited
#add_observer | The add_observer method is used to add an observer to the current object. |
#attribute_dictionaries | The attribute_dictionaries method is used to retrieve the |
#attribute_dictionary | The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an |
#delete_attribute | The |
#entityID | The entityID method is used to retrieve a unique ID assigned to an entity. |
#get_attribute | The |
#inspect | The |
#model | The model method is used to retrieve the model for the entity. |
#parent | The parent method is used to retrieve the parent of the entity. |
#persistent_id | The |
#remove_observer | The remove_observer method is used to remove an observer from the current object. |
#set_attribute | The set attribute is used to set the value of an attribute in an attribute dictionary with the given name. |
#to_s | The |
#typename | The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”. |
Instance Attribute Details
#back_material ⇒ Sketchup::Material? (rw)
The back_material method is used to retrieve the material assigned to the back side of the face.
#back_material=(material) ⇒ Sketchup::Material (rw)
The back_material= method is used to set the material assigned to the back side of the face.
#material ⇒ Sketchup::Material? (rw)
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.)
#material=(material) ⇒ Sketchup::Material (rw)
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.)
Instance Method Details
#all_connected ⇒ Array<Sketchup::Entity>
The all_connected method retrieves all of the entities connected to a face.
#area ⇒ Float
#area(transform) ⇒ Float
Float
#area(transform) ⇒ Float
The area method is used to retrieve the area of a face.
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.
#classify_point(point) ⇒ Integer
The classify_point method is used to determine if a given Point3d is on the referenced Face
.
It is important that return value comparisons be made against the symbolic constants (i.e. PointUnknown, PointInside, PointOnVertex, etc.) rather than the absolute integer values as these values may change from one release to the next.
#clear_texture_position(front)
The #clear_texture_position
method is used to remove any explicit texture positioning for a face and have SketchUp display it with the default texture positioning.
#clear_texture_projection(frontside)
#edges ⇒ Array<Sketchup::Edge>
The edges method is used to get an array of edges that bound the face.
#followme(edges) ⇒ Boolean
#followme(edge) ⇒ Boolean
Boolean
#followme(edge) ⇒ Boolean
The #followme
method is used to create a shape by making the face follow along an array of edges.
#get_glued_instances ⇒ Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>
The get_glued_instances method returns an ::Array
any ComponentInstances that are glued to the face.
ComponentInstance
objects that are currently glued to the face.
#get_texture_projection(frontside) ⇒ Geom::Vector3d?
The #get_texture_projection
method will return a vector representing the projection for either the front or back side of the face.
#get_UVHelper(front = true, back = true) ⇒ Sketchup::UVHelper
#get_UVHelper(front = true, back = true, texturewriter) ⇒ Sketchup::UVHelper
The get_UVHelper object is used to retrieve a UVHelper
object for use in texture manipulation on a face.
#loops ⇒ Array<Sketchup::Loop>
The loops method is used to get an array of all of the loops that bound the face.
#mesh(flags = 0) ⇒ Geom::PolygonMesh
The mesh method creates a polygon mesh that represents the face. See the ::Geom::PolygonMesh
class for more information.
Valid flags are:
-
0
: Include PolygonMeshPoints, -
1
: Include PolygonMeshUVQFront, -
2
: Include PolygonMeshUVQBack, -
4
: Include PolygonMeshNormals.
Use bitwise OR to combine flags. A value of 7
will include all flags, for example.
#normal ⇒ Geom::Vector3d
The normal method is used to retrieve the 3D vector normal to the face in the front direction.
#outer_loop ⇒ Sketchup::Loop
This method is used to retrieve the outer loop that bounds the face.
#plane ⇒ Array(Float
, Float
, Float
, Float
)
The plane method is used to retrieve the plane of the face. See the ::Array
class for information on how planes are stored.
#position_material(material, points, on_front) ⇒ Face
, false
#position_material(material, points, on_front, projection) ⇒ Face
, false
Face
, false
#position_material(material, points, on_front, projection) ⇒ Face
, false
The #position_material
method is used to position a material on a face.
The points
argument must contain 2, 4, 6 or 8 points. The points are used in pairs to describe 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. 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.
#pushpull(distance, copy = false) ⇒ nil
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.
#reverse! ⇒ Face
, false
The reverse! method is used to reverse the face’s orientation, meaning the front becomes the back.
#set_texture_projection(vector, frontside) ⇒ Boolean
This function never worked correctly. It’s not capable of controlling the position and orientation of the texture. In some cases it produced an invalid model. As of SketchUp 2021.1 the method simply raises NotImplementedError
.
The #set_texture_projection
method is used to set the texture projection direction.
#texture_positioned?(front) ⇒ Boolean
The #texture_positioned?
method is used to check if the face has a texture that is positioned.
A texture is positioned when it’s not using the default texture coordinates.
When a user uses the Paint Bucket Tool
to apply a material sampled from the Material
Browser it will use default texture coordinates and not be positioned. It will be positioned if the user uses the Position Texture Tool
.
When an API user uses Sketchup::Drawinglement#material=
the texture is not positioned. It will be positioned when the API user uses #position_material. It it also positioned of the face was crafted via ::Geom::PolygonMesh
.
#texture_projected?(front) ⇒ Boolean
The #texture_projected?
method is used to check if the face has a texture that is projected.
A texture is projected when the user enables this property via the Position Texture Tool
.
It is also projected when the API user passes a projection vector to #position_material.
#uv_tile_at(position, front) ⇒ Array<Geom::Point3d>?
The #uv_tile_at
method is used to get the corner positions (model and UV) of a UV tile.
The UV tile bounds the given reference point on the plane of the face. If the reference isn’t on the plane of the face it will be projected onto it.
The world coordinates are on the plane of the face unless the texture is projected. When the texture is projected the the world points are on an arbitrary plane that is perpendicular to the projection direction.
The returned coordinates are arranged to be compatible with #position_material.
Getting the bounds of the UV tile under the cursor:
The red quadrilateral represents the model points returned.
#vertices ⇒ Array<Sketchup::Vertex>
The vertices method is used to get an array of all of the vertices that bound the face.