Class: Sketchup::ArcCurve

Inherits:
Curve show all
Defined in:
lib/arccurve.rb

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
edge_array = entities.add_circle center_point, normal_vector, radius
first_edge = edge_array[0]
arc_curve = first_edge.curve

See Also:

Since:

  • SketchUp 6.0

Instance Method Summary collapse

Methods inherited from Curve

#count_edges, #each_edge, #edges, #first_edge, #last_edge, #length, #move_vertices, #vertices

Methods inherited from Entity

#add_observer, #attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #model, #parent, #remove_observer, #set_attribute, #to_s, #typename, #valid?

Instance Method Details

#centerGeom::Point3d

Get center of the circular arc.

Examples:

center_point = 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
edge_array = entities.add_circle center_point, vector2, 10
edge = edge_array[0]
arc_curve = edge.curve
point = arc_curve.center

Returns:

Since:

  • SketchUp 6.0



48
49
# File 'lib/arccurve.rb', line 48

def center
end

#end_angleNumeric

Get 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
center = Geom::Point3d.new
normal = Geom::Vector3d.new 0,0,1
xaxis = Geom::Vector3d.new 1,0,0
start_a = 0.0
end_a = Math::PI
model = Sketchup.active_model
entities = model.entities
edge_array = entities.add_arc center, xaxis, normal, 5, start_a, end_a
edge = edge_array[0]
arc_curve = edge.curve
end_angle = arc_curve.end_angle

Returns:

  • (Numeric)

    The angle of the end of the arc (in radians) if successful.

Since:

  • SketchUp 6.0



69
70
# File 'lib/arccurve.rb', line 69

def end_angle
end

#normalGeom::Vector3d

Get arc normal, the vector that is perpendicular to the plane of the arc.

Examples:

center_point = 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
edge_array = entities.add_circle center_point, vector2, 10
edge = edge_array[0]
arc_curve = edge.curve
v = arc_curve.normal

Returns:

Since:

  • SketchUp 6.0



87
88
# File 'lib/arccurve.rb', line 87

def normal
end

#planeArray<Numeric>

Note:

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

Get arc plane.

Examples:

center_point = 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
edge_array = entities.add_circle center_point, vector2, 10
edge = edge_array[0]
arc_curve = edge.curve
plane = arc_curve.plane

Returns:

  • (Array<Numeric>)

    An a array of four values representing the plane of the arc curve.

Since:

  • SketchUp 6.0



108
109
# File 'lib/arccurve.rb', line 108

def plane
end

#radiusNumeric

Get arc radius.

Examples:

center_point = 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
edge_array = entities.add_circle center_point, vector2, 10
edge = edge_array[0]
arc_curve = edge.curve
radius = arc_curve.radius

Returns:

  • (Numeric)

    The radius of the arc if successful.

Since:

  • SketchUp 6.0



126
127
# File 'lib/arccurve.rb', line 126

def radius
end

#start_angleNumeric

Get 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
edge_array = entities.add_arc center, xaxis, normal, 5, start_a, end_a
edge = edge_array[0]
arc_curve = edge.curve
start_angle = arc_curve.start_angle

Returns:

  • (Numeric)

    The angle of the start of the arc (in radians) if successful.

Since:

  • SketchUp 6.0



148
149
# File 'lib/arccurve.rb', line 148

def start_angle
end

#xaxisGeom::Vector3d

Note:

The length of the returned vector is equal to the radius of the underlying curve.

Get the X axis of the arc's coordinate system.

Examples:

center_point = 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
edge_array = entities.add_circle center_point, vector2, 10
edge = edge_array[0]
arc_curve = edge.curve
v = arc_curve.xaxis

Returns:

  • (Geom::Vector3d)

    The xaxis of the arc's coordinate system if successful.

Since:

  • SketchUp 6.0



170
171
# File 'lib/arccurve.rb', line 170

def xaxis
end

#yaxisGeom::Vector3d

Note:

The length of the returned vector is equal to the radius of the underlying curve.

Get the Y axis of the arc's coordinate system.

Examples:

center_point = 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
edge_array = entities.add_circle center_point, vector2, 10
edge = edge_array[0]
arc_curve = edge.curve
v = arc_curve.yaxis

Returns:

  • (Geom::Vector3d)

    The yaxis of the arc's coordinate system if successful.

Since:

  • SketchUp 6.0



192
193
# File 'lib/arccurve.rb', line 192

def yaxis
end