ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::EdgeUse

Inherits:
ModraUp::Entity show all

Overview

How to use an edge at a certain step on a face. Edges are not independently stored entities but are queried with the face ring. The parent class is ModraUp::Entity, not ModraUp::Drawingelement.

Examples:

loop = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop
use = loop.edgeuses[0]
use.edge.is_a?(ModraUp::Edge) && use.next.is_a?(ModraUp::EdgeUse)

Instance Method Summary # collapse

Inherited from ModraUp::Entity

Instance Method Details

edgeuse.typename ⇒ String

typename + "EdgeUse"+.

Returns:

  • (String)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].typename
  #=> "EdgeUse"

edgeuse.entityID ⇒ Integer

The entity ID within the current session.

Returns:

  • (Integer)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].entityID

edgeuse.persistent_id ⇒ Integer

EdgeUse does not have a persistent ID, always 0 (consistent with SketchUp).

Returns:

  • (Integer)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].persistent_id

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

Parent model or definition.

Returns:

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

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].parent

edgeuse.valid? ⇒ Boolean

Returns true if the corresponding face loop is still valid.

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].valid?

edgeuse.deleted? ⇒ Boolean

Opposite of #valid?.

Returns:

  • (Boolean)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].deleted?
  #=> false

edgeuse.attribute_dictionaries ⇒ nil

EdgeUse does not support attribute dictionaries.

Returns:

  • (nil)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].attribute_dictionaries
  #=> nil

edgeuse.attribute_dictionary(name, create = false) ⇒ nil

EdgeUse does not support attribute dictionaries.

Parameters:

  • name (String)
  • create (Boolean)

Returns:

  • (nil)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].attribute_dictionary("dc")
  #=> nil

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

EdgeUse does not support attribute dictionaries.

Raises:

  • [RuntimeError]

Examples:

begin
  ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].set_attribute("dc", "a", 1)
rescue RuntimeError
  true
end

edgeuse.get_attribute(dict_name, key, default = nil) ⇒ Object

EdgeUse does not support attribute dictionaries, returns default.

Parameters:

  • dict_name (String)
  • key (String)
  • default (Object)

Returns:

  • (Object)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].get_attribute("dc", "a", 0)
  #=> 0

edgeuse.delete_attribute(dict_name, key = nil) ⇒ nil

EdgeUse does not support attribute dictionaries.

Returns:

  • (nil)

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].delete_attribute("dc")
  #=> nil

edgeuse.edge ⇒ ModraUp::Edge, nil

This step uses the edge.

Returns:

  • (ModraUp::Edge, nil)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

use = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0]
use.edge.is_a?(ModraUp::Edge)

edgeuse.next ⇒ ModraUp::EdgeUse

The next step on the ring.

Returns:

  • (ModraUp::EdgeUse)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

uses = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses
uses[0].next == uses[1]

edgeuse.previous ⇒ ModraUp::EdgeUse

The previous step on the loop.

Returns:

  • (ModraUp::EdgeUse)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

uses = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses
uses[0].previous == uses[3]

edgeuse.reversed? ⇒ Boolean

Returns whether the edge's v0→v1 direction is reversed relative to the other edge.

Returns:

  • (Boolean)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

use = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0]
[true, false].include?(use.reversed?)

edgeuse.face ⇒ ModraUp::Face

The owning face.

Returns:

  • (ModraUp::Face)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

face = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0])
face.outer_loop.edgeuses[0].face == face

edgeuse.loop ⇒ ModraUp::Loop

Loop belonging edge.

Returns:

  • (ModraUp::Loop)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

loop = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop
loop.edgeuses[0].loop == loop

edgeuse.partners ⇒ Array<ModraUp::EdgeUse>

Usage of an edge on other faces.

Returns:

  • (Array<ModraUp::EdgeUse>)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]).outer_loop.edgeuses[0].partners

edgeuse.start_vertex_normal ⇒ Geom::Vector3d

The normal of the face at the start vertex.

Returns:

  • (Geom::Vector3d)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

face = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0])
face.outer_loop.edgeuses[0].start_vertex_normal.parallel?(face.normal)

edgeuse.end_vertex_normal ⇒ Geom::Vector3d

The normal of the face at the end vertex.

Returns:

  • (Geom::Vector3d)

Raises:

  • [RuntimeError] Edge has been deleted.

Examples:

face = ModraUp.active_model.entities.add_face([0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0])
face.outer_loop.edgeuses[0].end_vertex_normal.parallel?(face.normal)