|
SketchUp Ruby API Reference |
A Vertex. A Vertex represents the end of an Edge.
Parent:Entity
Methods: common_edge, curve_interior?, edges, faces, loops, position, used_by?
Example Code: vertextests.rb
The common_edge method is used to find a common edge that is defined by this vertex and another vertex
edge = vertex.common_edge vertex2
vertex2 - a Vertex object
edge - an Edge object common to both vertices if successful. Returns nil if there is no edge between the two vertices.
edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
vertex2 = verticies[1]
edge = vertex1.common_edge vertex2
if (edge)
UI.messagebox edge
else
UI.messagebox "Failure" end
The curve_interior? method is used to determine if this vertex is on the interior of a curve.
status - vertex.curve_interior?
status - true if it is used by exactly two edges which are both part of the same curve.
edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
status = vertex1.curve_interior?
if (status)
UI.messagebox status
else
#returns nil if vertex is not on interior of a Curve
UI.messagebox "Failure"
end
The edges method is used to retrieve an Array of edges that use the Vertex.
edges = vertex.edges
edges - an Array of edge objects if successful
edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
edges = vertex1.edges
The faces method is used to retrieve an Array of faces that use the vertex.
faces = vertex.faces
faces - an Array of faces that use the vertex if successful
edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
faces = vertex1.faces
The loops method is used to retrieve an Array of loops that use the vertex.
loops = vertex.loops
loops - an Array of loops that use the vertex if successful
edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
loops = vertex1.loops
The position method is used to retrieve the Point3d position of a vertex.
point = vertex.position
point - a Point3d object representing the position of the vertex if successful
edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
position = vertex1.position
The used_by? method is used to determine if the Vertex is used by a given edge or face.
vertex.used_by? edge
vertex.used_by? face
status - true if the vertex is used by the edge or face. False if the vertex is not used by the edge or face.
edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
status = vertex1.used_by? face