# Class: Sketchup::Curve

Inherits:
Entity
• Object
show all

## Overview

The Curve class is used by SketchUp to unite a series of Edge objects into one conceptual entity. Since SketchUp is a surface modeler, all circles, arcs, and arbitrary curves are really just edges that are bound together in sequence.

There is a subclass of Curve called ArcCurve, which is any curve that makes up part of a circle. You can think of ArcCurves as entities that were created with SketchUp's Arc or Circle drawing tools and Curves as entities that were created with the Freehand drawing tool.

Version:

• SketchUp 6.0

ArcCurve

## Instance Method Summary #collapse

• The count_edges method is used to retrieve the number of Edge objects that make up the Curve.

• The each_edge method is used to iterate through all of the Edge objects in the curve.

• The edges method is used to retrieve an array of Edge objects that make up the Curve.

• The first_edge method is used to retrieve the first edge of the curve.

• True if this edge was originally created by the polygon tool, otherwise false.

• The last_edge method is used to retrieve the last edge of the curve.

• The length method retrieves the length of the curve.

• The vertices method retrieves a collection of all vertices in a curve.

• The vertices method retrieves a collection of all vertices in a curve.

## Instance Method Details

### ↑ #count_edges ⇒ Object

The count_edges method is used to retrieve the number of Edge objects that make up the Curve.

Examples:

``````centerpoint = Geom::Point3d.new
# Create a circle perpendicular to the normal or Z axis
vector = Geom::Vector3d.new 0,0,1
vector2 = vector.normalize!
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray
curve = edge.curve
number = curve.count_edges``````

Returns:

• num_edges - the number of edges in the curve

Version:

• SketchUp 6.0

### ↑ #each_edge ⇒ Object

The each_edge method is used to iterate through all of the Edge objects in the curve.

Examples:

``````centerpoint = Geom::Point3d.new
# Create a circle perpendicular to the normal or Z axis
vector = Geom::Vector3d.new 0,0,1
vector2 = vector.normalize!
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray
curve = edge.curve
curve.each_edge {|e| UI.messagebox e}``````

Returns:

• edge - a variable that will hold each Edge object as they are found.

Version:

• SketchUp 6.0

### ↑ #edges ⇒ Object

The edges method is used to retrieve an array of Edge objects that make up the Curve.

Examples:

``````centerpoint = Geom::Point3d.new
# Create a circle perpendicular to the normal or Z axis
vector = Geom::Vector3d.new 0,0,1
vector2 = vector.normalize!
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray
curve = edge.curve
edges = curve.edges``````

Returns:

• edges - an array of Edge objects if successful

Version:

• SketchUp 6.0

### ↑ #first_edge ⇒ Object

The first_edge method is used to retrieve the first edge of the curve.

Examples:

``````centerpoint = Geom::Point3d.new
# Create a circle perpendicular to the normal or Z axis
vector = Geom::Vector3d.new 0,0,1
vector2 = vector.normalize!
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray
curve = edge.curve
firstedge = curve.first_edge``````

Returns:

• edge - the first Edge object in the curve if successful

Version:

• SketchUp 6.0

### ↑ #is_polygon? ⇒ Boolean

Returns True if this edge was originally created by the polygon tool, otherwise false.

Examples:

``````# Create a polygon and check its edge
ents = Sketchup.active_model.entities
ents.add_ngon [0, 0, 0], [0, 0, 1], 10, 6
curve = nil
ents.each { |e| curve = e.curve if e.is_a? Sketchup::Edge }
is_poly = curve.is_polygon?``````

Returns:

• (Boolean)

True if this edge was originally created by the polygon tool, otherwise false.

Version:

• SketchUp 7.1 M1

### ↑ #last_edge ⇒ Object

The last_edge method is used to retrieve the last edge of the curve.

Examples:

``````centerpoint = Geom::Point3d.new
# Create a circle perpendicular to the normal or Z axis
vector = Geom::Vector3d.new 0,0,1
vector2 = vector.normalize!
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray
curve = edge.curve
lastedge = curve.last_edge``````

Returns:

• edge - the last Edge object in the curve if successful

Version:

• SketchUp 6.0

### ↑ #length ⇒ Object

The length method retrieves the length of the curve.

Examples:

``````centerpoint = Geom::Point3d.new
# Create a circle perpendicular to the normal or Z axis
vector = Geom::Vector3d.new 0,0,1
vector2 = vector.normalize!
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray
curve = edge.curve
length = curve.length``````

Returns:

• length - the length of the curve in current units if successful

Version:

• SketchUp 6.0

### ↑ #move_vertices(point_array) ⇒ Object

The vertices method retrieves a collection of all vertices in a curve.

Examples:

``# Need example ruby code here.``

Returns success - true or false.

Parameters:

• point_array

Array of Point3d objects to move each vertex to match.

Returns:

• success - true or false

Version:

• SketchUp 6.0

### ↑ #vertices ⇒ Object

The vertices method retrieves a collection of all vertices in a curve.

Examples:

``````centerpoint = Geom::Point3d.new
# Create a circle perpendicular to the normal or Z axis
vector = Geom::Vector3d.new 0,0,1
vector2 = vector.normalize!
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray
curve = edge.curve
vertices = curve.vertices``````

Returns:

• vertices - a collection of the vertices

Version:

• SketchUp 6.0