ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::Curve

Inherits:
ModraUp::Entity show all

Overview

Curves on the edge. Circles/-arcs are a subclass ModraUp::ArcCurve. They are not ModraUp::Drawingelement.

Examples:

edges = ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5, 12)
edges[0].curve.is_a?(ModraUp::Curve)  #=> true

Instance Method Summary # collapse

Inherited from ModraUp::Entity

Instance Method Details

curve.vertices ⇒ Array<ModraUp::Vertex>

Returns the vertices of the curve in the order of curve edges, without repeating the starting point for closed curves.

Returns:

  • (Array<ModraUp::Vertex>)

curve.each_edge { |edge| ... } ⇒ nil

Iterate through each edge of the curve; returns an Enumerator if no block is passed.

Returns:

  • (nil, Enumerator)

curve.length ⇒ Length or Float

The length of a general curve is the sum of the lengths of its segments, while an arc length is calculated by multiplying the radius by the swept angle.

Returns:

  • (Length, Float) An arc returns the parsed arc length (Float); a regular curve returns its Length.

curve.is_polygon? ⇒ Boolean

Returns true if the curve is a polygon created by a polygon tool, add_ngon, or a conversion operation.

Returns:

  • (Boolean)

curve.move_vertices(points) ⇒ Boolean

Move all vertices of the curve, the number of vertices must match the input, preserving curve association for non-circular transformations.

Parameters:

  • points (Array<Geom::Point3d>)

Returns:

  • (Boolean)

curve.count_edges ⇒ Integer

The number of edges that compose the curve.

Returns:

  • (Integer)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5, 12)[0].curve.count_edges

curve.edges ⇒ Array<ModraUp::Edge>

The edges that compose this curve.

Returns:

  • (Array<ModraUp::Edge>)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5, 8)[0].curve.edges.length

curve.first_edge ⇒ ModraUp::Edge, nil

The first edge.

Returns:

  • (ModraUp::Edge, nil)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.first_edge

curve.last_edge ⇒ ModraUp::Edge, nil

The last edge.

Returns:

  • (ModraUp::Edge, nil)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.last_edge

curve.typename ⇒ String

Type Name ArcCurve.

Returns:

  • (String)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.typename

curve.entityID ⇒ Integer

The curve entity ID within the current Sketchup session.

Returns:

  • (Integer)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.entityID

curve.persistent_id ⇒ Integer

Curve ID saved with the model, see ModraUp::Entity#persistent_id.

Returns:

  • (Integer)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.persistent_id

curve.parent ⇒ ModraUp::Model, ModraUp::ComponentDefinition

The owner in the drawing context.

Returns:

  • (ModraUp::Model, ModraUp::ComponentDefinition)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.parent

curve.attribute_dictionaries ⇒ nil

Arc curves do not have attribute dictionaries.

Returns:

  • (nil)

Examples:

ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.attribute_dictionaries

curve.set_attribute(dict_name, key, value) ⇒ value

Arc curves do not support attribute dictionaries.

Parameters:

  • dict_name (String)
  • key (String)
  • value (Object)

Raises:

  • [RuntimeError]

Examples:

begin
  ModraUp.active_model.entities.add_circle([0, 0, 0], [0, 0, 1], 5)[0].curve.set_attribute("d", "k", "v")
rescue RuntimeError
end