ModraUp Ruby API Documentation Ruby API Reference

Class: ModraUp::InputPoint

Inherits:
Object
  • Object
show all

Overview

Infers the pick point. Writes the position and snap type to ModraUp::View#inputpoint or InputPoint#pick. Returns the entity (including nested instances) associated with the pick position for #vertex / #edge / #face.

Examples:

view = ModraUp.active_model.active_view
ip = ModraUp::InputPoint.new
ip.pick(view, 10, 10)
ip.position

Class Method Summary # collapse

Instance Method Summary # collapse

Class Method Details

InputPoint.new ⇒ inputpointInputPoint.new(point_or_vertex) ⇒ inputpoint

Initialize an empty input point, or attach the endpoint to a model point.

Parameters:

  • point_or_vertex (Geom::Point3d, ModraUp::Vertex, Array<Numeric>)

Returns:

  • (ModraUp::InputPoint)

Examples:

ip = ModraUp::InputPoint.new(ORIGIN)
ip.valid?  #=> true

Instance Method Details

#==(other) ⇒ Boolean

Compare the positions of two input points, infer their types, and determine their geometric sources.

Parameters:

  • other (ModraUp::InputPoint)

Returns:

  • (Boolean)

#transformation ⇒ Geom::Transformation

Transformation from local coordinates of picked entities to model coordinates; returns an identity transformation for the root level.

Returns:

  • (Geom::Transformation)

#instance_path ⇒ ModraUp::InstancePath, nil

Returns an independent copy of the current pick instance path; returns nil if there is no associated entity.

Returns:

  • (ModraUp::InstancePath, nil)

inputpoint.pick(view, x, y) ⇒ Booleaninputpoint.pick(view, x, y, other) ⇒ Boolean

Infers a pick from screen coordinates; returns true only if a valid and changed entity is picked.

Parameters:

  • view (ModraUp::View)
  • x (Numeric)
  • y (Numeric)
  • other (ModraUp::InputPoint)

Returns:

  • (Boolean)

Examples:

ip = ModraUp::InputPoint.new
ip.pick(ModraUp.active_model.active_view, 10, 10)

inputpoint.position ⇒ Geom::Point3d

Model space position.

Returns:

  • (Geom::Point3d)

Examples:

ModraUp::InputPoint.new(ORIGIN).position == ORIGIN

inputpoint.valid? ⇒ Boolean

Returns whether the pick found a snap point.

Returns:

  • (Boolean)

Examples:

ModraUp::InputPoint.new.valid?  #=> false

inputpoint.display? ⇒ Boolean

Should the inference mark be displayed.

Returns:

  • (Boolean)

Examples:

ModraUp::InputPoint.new.display?  #=> false

inputpoint.degrees_of_freedom ⇒ Integer

Remaining degrees of freedom: endpoint 0, line 1, face 2, not picked 3.

Returns:

  • (Integer)

Examples:

ModraUp::InputPoint.new.degrees_of_freedom  #=> 3

inputpoint.tooltip ⇒ String

Adhesion types in English tooltips (Endpoint / On Face, etc.).

Returns:

  • (String)

Examples:

ModraUp::InputPoint.new.tooltip  #=> ""

inputpoint.depth ⇒ Integer

Provides the depth of the instance nested within the entity that contains the picked location.

Returns:

  • (Integer)

Examples:

ModraUp::InputPoint.new.depth  #=> 0

inputpoint.vertex ⇒ ModraUp::Vertex, nil

Pick the associated vertex.

Returns:

  • (ModraUp::Vertex, nil)

Examples:

ModraUp::InputPoint.new.vertex  #=> nil

inputpoint.edge ⇒ ModraUp::Edge, nil

Pick the associated edge.

Returns:

  • (ModraUp::Edge, nil)

Examples:

ModraUp::InputPoint.new.edge  #=> nil

inputpoint.face ⇒ ModraUp::Face, nil

Pick the associated face.

Returns:

  • (ModraUp::Face, nil)

Examples:

ModraUp::InputPoint.new.face  #=> nil

inputpoint.clear ⇒ inputpoint

Clears the pick results.

Returns:

  • (ModraUp::InputPoint)

Examples:

ModraUp::InputPoint.new(ORIGIN).clear.valid?  #=> false

inputpoint.copy!(other) ⇒ inputpoint

Duplicates another input point.

Parameters:

  • other (ModraUp::InputPoint)

Returns:

  • (ModraUp::InputPoint)

Examples:

a = ModraUp::InputPoint.new(ORIGIN)
b = ModraUp::InputPoint.new
b.copy!(a).position == ORIGIN

inputpoint.draw(view) ⇒ view

Draw a crosshair in ModraUp::Tool#draw.

Parameters:

  • view (ModraUp::View)

Returns:

  • (ModraUp::View)

Examples:

ip = ModraUp::InputPoint.new(ORIGIN)
ip.draw(ModraUp.active_model.active_view)