Class: Layout::ConnectionPoint

Inherits:
Object
  • Object
show all

Overview

This is the interface to a LayOut Connection Point. A ConnectionPoint defines a target point to which a Label or LinearDimension can connect.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
entity = doc.pages.first.entities.first
point = [2, 2]
# Create a Connection Point to LayOut Entity in the document
cp = Layout::ConnectionPoint.new(entity, point)
# If the entity is a [Layout::SketchUpModel], then we can use a 3D point
# in model space along with the PID of the entity in the model to make a
# deep connection.
point3D = [100, 200, 300]
pid = "1345"
cp2 = Layout::ConnectionPoint.new(entity, point3D, pid)
# This point can then be used to connect a label or linear dimension to
# the entity.
leader_type = Layout::Label::LEADER_LINE_TYPE_BEZIER
target_point = Geom::Point2d.new(1, 1)
bounds = Geom::Bounds2d.new(2, 1, 1, 1)
label = Layout::Label.new(text, leader_type, target_point, bounds)
label.connect(cp)

Version:

  • LayOut 2018

Instance Method Summary # collapse

Constructor Details

#initialize(entity, point, aperture = 0.0001) ⇒ Layout::ConnectionPoint #initialize(model, point3d, pid = nil) ⇒ Layout::ConnectionPoint

The #initialize method creates a new Layout::ConnectionPoint.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
entity = doc.pages.first.entities.first
point = [2, 2]
# Create a Connection Point to LayOut Entity in the document
cp = Layout::ConnectionPoint.new(entity, point)

Overloads:

  • #initialize(entity, point, aperture = 0.0001) ⇒ Layout::ConnectionPoint

    Parameters:

    • entity (Layout::Entity)
    • point (Geom::Point2d)

      The position on the entity to connect to.

    • aperture (Numeric) (defaults to: 0.0001)

      The search radius to find the entity provided. If no aperture value is provided, a default value of 0.0001 will be used. The value provided must be greater than zero.

    Raises:

    • (ArgumentError)

      if point passed in is not within the bounds of entity

    • (ArgumentError)

      if aperture is not greater than zero

    • (ArgumentError)

      if entity is not in a document

  • #initialize(model, point3d, pid = nil) ⇒ Layout::ConnectionPoint

    Parameters:

    • model (Layout::SketchUpModel)
    • point3d (Geom::Point3d)

      The 3D point in model space to connect to.

    • pid (String, nil) (defaults to: nil)

      The persistent ID of the entity to connect to in the model, if any.

    Raises:

    • (ArgumentError)

      if entity is not in a document

    • (ArgumentError)

      if the provided pid does not exist in the model

Version:

  • LayOut 2018