ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::ConstructionLine

Overview

Auxiliary lines. Not a ModraUp::Edge. Created using Entities#add_cline, and cannot be directly instantiated with new. #start / #end being nil indicates an infinite endpoint.

Examples:

ents = ModraUp.active_model.entities
finite = ents.add_cline([0, 0, 0], [10, 0, 0])
inf = ents.add_cline([0, 0, 2], Geom::Vector3d.new(0, 1, 0))
inf.start.nil? && inf.end.nil?

Instance Method Summary # collapse

Inherited from ModraUp::Drawingelement

Inherited from ModraUp::Entity

Instance Method Details

cline.start ⇒ Geom::Point3d, nil

Finite endpoint; infinite endpoint is nil.

Returns:

  • (Geom::Point3d, nil)

Examples:

ModraUp.active_model.entities.add_cline([0, 0, 0], [1, 0, 0]).start.to_a
#=> [0.0, 0.0, 0.0]

cline.start=(point) ⇒ pointcline.start=(nil) ⇒ nil

Set the start point. The point will project onto the current construction line; nil makes this end infinite (semi-infinite or both ends).

Parameters:

  • point (Geom::Point3d, nil)

Returns:

  • (Geom::Point3d, nil)

Examples:

line = ModraUp.active_model.entities.add_cline([0, 0, 0], [10, 0, 0])
line.start = nil
line.start.nil?

cline.end ⇒ Geom::Point3d, nil

Finite endpoints; infinite endpoints are nil.

Returns:

  • (Geom::Point3d, nil)

Examples:

ModraUp.active_model.entities.add_cline([0, 0, 0], [1, 0, 0]).end.to_a
#=> [1.0, 0.0, 0.0]

cline.end=(point) ⇒ pointcline.end=(nil) ⇒ nil

Set the endpoint. The point will project onto the current construction line; nil makes the endpoint infinite.

Parameters:

  • point (Geom::Point3d, nil)

Returns:

  • (Geom::Point3d, nil)

Examples:

line = ModraUp.active_model.entities.add_cline([0, 0, 0], Geom::Vector3d.new(1, 0, 0))
line.end = [10, 0, 0]
line.end.to_a  #=> [10.0, 0.0, 0.0]

cline.position ⇒ Geom::Point3d

Reference point on the construction line (in inches).

Returns:

  • (Geom::Point3d)

Examples:

ModraUp.active_model.entities.add_cline([0, 0, 2], Geom::Vector3d.new(1, 0, 0)).position.to_a
#=> [0.0, 0.0, 2.0]

cline.position=(point) ⇒ point

Make the construction line pass through the point: translate it perpendicularly to #direction, without sliding along itself.

Parameters:

  • point (Geom::Point3d)

Returns:

  • (Geom::Point3d)

Examples:

line = ModraUp.active_model.entities.add_cline([0, 0, 0], Geom::Vector3d.new(1, 0, 0))
line.position = [0, 5, 0]
line.position.to_a  #=> [0.0, 5.0, 0.0]

cline.direction ⇒ Geom::Vector3d

Unit direction.

Returns:

  • (Geom::Vector3d)

Examples:

ModraUp.active_model.entities.add_cline([0, 0, 0], Geom::Vector3d.new(0, 2, 0)).direction.to_a
#=> [0.0, 1.0, 0.0]

cline.direction=(vector) ⇒ vector

Set the direction (normalized), rotate around #position, and limit the end to maintain the parameter along the old direction.

Parameters:

  • vector (Geom::Vector3d)

Returns:

  • (Geom::Vector3d)

Raises:

  • [ArgumentError] Zero vector

Examples:

line = ModraUp.active_model.entities.add_cline([0, 0, 0], Geom::Vector3d.new(1, 0, 0))
line.direction = Geom::Vector3d.new(0, 2, 0)
line.direction.to_a  #=> [0.0, 1.0, 0.0]

cline.reverse! ⇒ self

Reverse: Reverses the direction, swaps the start and end points #start / #end.

Returns:

  • (ModraUp::ConstructionLine)

Examples:

line = ModraUp.active_model.entities.add_cline([0, 0, 0], Geom::Vector3d.new(1, 0, 0))
line.reverse!
line.direction.to_a  #=> [-1.0, 0.0, 0.0]