SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

Vertex class

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

Instance Methods


common_edge 

The common_edge method is used to find a common edge that is defined by this vertex and another vertex

Syntax

edge = vertex.common_edge vertex2 

Arguments

vertex2 - a Vertex object

Return Value

edge - an Edge object common to both vertices if successful. Returns nil if there is no edge between the two vertices.

Example

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

 

 


curve_interior? 

The curve_interior? method is used to determine if this vertex is on the interior of a curve.

Syntax

status - vertex.curve_interior? 

Return Value

status - true if it is used by exactly two edges which are both part of the same curve.

Example

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

 

 


edges 

The edges method is used to retrieve an Array of edges that use the Vertex.

Syntax

edges = vertex.edges 

Return Value

edges - an Array of edge objects if successful

Example

edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
edges = vertex1.edges

 

 


faces 

The faces method is used to retrieve an Array of faces that use the vertex.

Syntax

faces = vertex.faces 

Return Value

faces - an Array of faces that use the vertex if successful

Example

edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
faces = vertex1.faces

 

 


loops 

The loops method is used to retrieve an Array of loops that use the vertex.

Syntax

loops = vertex.loops 

Return Value

loops - an Array of loops that use the vertex if successful

Example

edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
loops = vertex1.loops

 

 


position 

The position method is used to retrieve the Point3d position of a vertex.

Syntax

point = vertex.position 

Return Value

point - a Point3d object representing the position of the vertex if successful

Example

edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
position = vertex1.position

 

 


used_by? 

The used_by? method is used to determine if the Vertex is used by a given edge or face.

Syntax

vertex.used_by? edge 
vertex.used_by? face

Return Value

status - true if the vertex is used by the edge or face. False if the vertex is not used by the edge or face.

Example

edge = entities[0]
# returns array of vertices that make up the line
verticies = edge.vertices
vertex1 = verticies[0]
status = vertex1.used_by? face

 

SketchUp  Ruby API Reference: Vertex

© Google Inc. 2007 sketchup.google.com