|
SketchUp Ruby API Reference |
An ArcCurve is a Curve that makes up part of a circle. This class can be treated as though it were a representation of a circle entity
Parent:Curve
Methods:center,end_angle, normal, plane , radius, start_angle, xaxis, yaxis
Example Code: arccurvetests.rb
The center method is used to retrieve the Point3d that is at the center of the circular arc.
point = arc.center
point - a Point3d at the center of the arc if successful
centerpoint = Geom::Point3d.new# Create a circle perpendicular to the normal or Z axisvector = Geom::Vector3d.new 0,0,1vector2 = vector.normalize!model = Sketchup.active_modelentities = model.active_entitiesedgearray = entities.add_circle centerpoint, vector2, 10edge = edgearray[0]arccurve = edge.curvepoint = arccurve.center
The end_angle method is used to retrieve the angle of the end of the arc measured from the X axis in radians.
angle = arc.end_angle
angle - the angle of the end of the arc if successful
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.active_entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray[0]
arccurve = edge.curve
endangle = arccurve.end_angle
The normal method retrieves a Vector3d that is perpendicular to the plane of the arc.
vector = arc.normal
vector - a Vector3d object if successful
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.active_entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray[0]
arccurve = edge.curve
v = arccurve.normal
The plane method is used to retrieve the plane of the arc.
plane = arc.plane
plane - the plane of the arc if successful
Refer to the Geom module for instructions to create a plane.
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.active_entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray[0]
arccurve = edge.curve
plane = arccurve.plane
The radius method is used to retrieve the radius of the arc.
radius = arc.radius
radius - the radius of the arc if successful
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.active_entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray[0]
arccurve = edge.curve
radius = arccurve.radius
The start_angle method is used to retrieve the angle of the start of the arc, measured from the X axis in radians.
angle = arc.start_angle
angle - the angle of the start of the arc if successful
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.active_entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray[0]
arccurve = edge.curve
startangle = arccurve.start_angle
The xaxis method is used to retrieve the X axis of the coordinate system for the curve.
vector = arc.xaxis
vector - a Vector3d object if successful
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.active_entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray[0]
arccurve = edge.curve
v = arccurve.xaxis
The yaxis method is used to retrieve the Y axis of the coordinate system for the curve.
vector = arc.yaxis
vector - a Vector3d object if successful
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.active_entities
edgearray = entities.add_circle centerpoint, vector2, 10
edge = edgearray[0]
arccurve = edge.curve
v = arccurve.yaxis
|
SketchUp Ruby API Reference: ArcCurve |
© Google Inc. 2007 sketchup.google.com |