123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::ArcCurve

Relationships
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Curve, Entity
Instance Chain:
self, Curve, Entity
Inherits: Sketchup::Curve

Overview

An ArcCurve is a Curve that makes up part of a circle. This is the underlying class for circles as well.

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.

However, keep in mind that all Curves in SketchUp are really edges with some extra data attached to them. When you use the API to draw a Curve or ArcCurve, you are really drawing edges.

ArcCurve is a subclass of Curve, so all of the methods that are available to Curves are also available to ArcCurves.

Examples:

# Draw a circle on the ground plane around the origin.
center_point = Geom::Point3d.new(0,0,0)
normal_vector = Geom::Vector3d.new(0,0,1)
radius = 10

entities = Sketchup.active_model.entities
edgearray = entities.add_circle center_point, normal_vector, radius
first_edge = edgearray[0]
arccurve = first_edge.curve

Version:

  • SketchUp 6.0

Instance Attribute Summary

Curve - Inherited

Entity - Inherited

#deleted?

The deleted? method is used to determine if your entity is still valid (not deleted by another script, for example.).

#valid?

The #valid? method is used to determine if your entity is still valid (not deleted by another script, for example).

Instance Method Summary

  • #center ⇒ Object

    The center method is used to retrieve the Point3d that is at the center of the circular arc.

  • #end_angle ⇒ Float

    The #end_angle method is used to retrieve the angle of the end of the arc measured from the X axis in radians.

  • #normal ⇒ Object

    The normal method retrieves a Vector3d that is perpendicular to the plane of the arc.

  • #plane ⇒ Object

    The plane method is used to retrieve the plane of the arc.

  • #radius ⇒ Object

    The radius method is used to retrieve the radius of the arc.

  • #start_angle ⇒ Object

    The start_angle method is used to retrieve the angle of the start of the arc, measured from the X axis in radians.

  • #xaxis ⇒ Object

    The xaxis method is used to retrieve the X axis of the coordinate system for the curve.

  • #yaxis ⇒ Object

    The yaxis method is used to retrieve the Y axis of the coordinate system for the curve.

Curve - Inherited

#count_edges

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

#each_edge

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

#edges

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

#first_edge

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

#last_edge

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

#length

The length method retrieves the length of the curve.

#move_vertices

The #move_vertices method moves the vertices in the curve to points.

#vertices

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

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 AttributeDictionaries collection attached to the entity.

#attribute_dictionary

The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an Entity.

#delete_attribute

The #delete_attribute method is used to delete an attribute from an entity.

#entityID

The entityID method is used to retrieve a unique ID assigned to an entity.

#get_attribute

The #get_attribute method is used to retrieve the value of an attribute in the entity’s attribute dictionary.

#inspect

The #inspect method is used to retrieve the string representation of the entity.

#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 #persistent_id method is used to retrieve a unique persistent id assigned to an entity.

#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 #to_s method is used to retrieve the string representation of the entity.

#typename

The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”.

Instance Attribute Details

#circular?Boolean (readonly)

Checks if the ArcCurve is a circle.

Examples:

entities = Sketchup.active_model.entities
center_point = Geom::Point3d.new(0, 0, 0)
normal_vector = Geom::Vector3d.new(0, 0, 1)
radius = 10
edges = entities.add_circle(center_point, normal_vector, radius)
curve = edges[0].curve
is_circular = curve.circular?

Version:

  • SketchUp 2023.1

Instance Method Details

#centerObject

The center method is used to retrieve the Point3d that is at the center of the circular arc.

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[0]
arccurve = edge.curve
point = arccurve.center

Returns:

  • point - a Point3d at the center of the arc if successful

Version:

  • SketchUp 6.0

#end_angleFloat

Note:

A bug in SketchUp 2017 and older will report the end-angle for some circles as more than 360 degrees. In such case, subtract 2 * PI from the end angle value.

The #end_angle method is used to retrieve the angle of the end of the arc measured from the X axis in radians.

Examples:

# Create a 1/2 circle, normal to the Z axis
start_a = 0.0
end_a = 180.degrees
model = Sketchup.active_model
entities = model.entities
edges = entities.add_arc(ORIGIN, X_AXIS, Z_AXIS, 5, start_a, end_a)
arc_curve = edges.first.curve
end_angle = arc_curve.end_angle

Version:

  • SketchUp 6.0

#normalObject

The normal method retrieves a Vector3d that is perpendicular to the plane of the arc.

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[0]
arccurve = edge.curve
v = arccurve.normal

Returns:

  • vector - a Vector3d object if successful

Version:

  • SketchUp 6.0

#planeObject

The plane method is used to retrieve the plane of the arc.

Refer to the ::Geom module for instructions to create a plane.

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[0]
arccurve = edge.curve
plane = arccurve.plane

Returns:

  • plane - the plane of the arc if successful

Version:

  • SketchUp 6.0

#radiusObject

The radius method is used to retrieve the radius of the arc.

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[0]
arccurve = edge.curve
radius = arccurve.radius

Returns:

  • radius - the radius of the arc if successful

Version:

  • SketchUp 6.0

#start_angleObject

The start_angle method is used to retrieve the angle of the start of the arc, measured from the X axis in radians.

Examples:

# Create a 1/4 circle, radius of 5, normal to the Z axis
center = Geom::Point3d.new 0, 0, -1
normal = Geom::Vector3d.new 0,0,1
xaxis = Geom::Vector3d.new 1,0,0
start_a = Math::PI/2
end_a = Math::PI
model = Sketchup.active_model
entities = model.entities
edgearray = entities.add_arc center, xaxis, normal, 5, start_a, end_a
edge = edgearray[0]
arccurve = edge.curve
start_angle = arccurve.start_angle

Returns:

  • angle - the angle of the start of the arc if successful

Version:

  • SketchUp 6.0

#xaxisObject

The xaxis method is used to retrieve the X axis of the coordinate system for the curve. Note that the length of the returned vector is equal to the radius of the underlying 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[0]
arccurve = edge.curve
v = arccurve.xaxis

Returns:

  • vector - a Vector3d object if successful

Version:

  • SketchUp 6.0

#yaxisObject

The yaxis method is used to retrieve the Y axis of the coordinate system for the curve. Note that the length of the returned vector is equal to the radius of the underlying 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[0]
arccurve = edge.curve
v = arccurve.yaxis

Returns:

  • vector - a Vector3d object if successful

Version:

  • SketchUp 6.0