Class: Sketchup::ConstructionLine

Inherits:
Drawingelement show all

Overview

The ConstructionLine class contains methods for modifying construction lines. Construction lines can be infinite in length, semi-infinite (i.e. infinite in one direction) or finite.

Version:

  • SketchUp 6.0

Instance Method Summary # collapse

Methods inherited from Drawingelement

#bounds, #casts_shadows=, #casts_shadows?, #erase!, #hidden=, #hidden?, #layer, #layer=, #material, #material=, #receives_shadows=, #receives_shadows?, #visible=, #visible?

Methods inherited from Entity

#add_observer, #attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #remove_observer, #set_attribute, #to_s, #typename, #valid?

Instance Method Details

#directionObject

The direction method retrieves a 3D vector in the direction of the construction line.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
point2 = Geom::Point3d.new(20,20,20)
constline = entities.add_cline(point1, point2)
vector = constline.direction
if (vector)
  UI.messagebox(vector)
else
  UI.messagebox("Failure")
end

Returns:

  • vector - a Vector3d object if successful

Version:

  • SketchUp 6.0

#direction=(vector) ⇒ Object

The direction= method is used to set the direction of the construction line to a 3D vector.

Examples:

# Draw a construction line that points diagonally.
model = Sketchup.active_model
entities = model.active_entities
constline = entities.add_cline([10,10,10], [200,200,200])

# Create a new direction that is straight up, and redirect the line.
new_direction = [0, 0, 1]
constline.direction = new_direction

Returns vector - the new Vector3d object if successful.

Parameters:

  • vector

    The Vector3d whose direction will be used to set the direction of the construction line.

Returns:

  • vector - the new Vector3d object if successful

Version:

  • SketchUp 6.0

#endObject

The end method retrieves the end point of a construction line in the form of a 3D point.

If the construction line is infinite at the end, this returns nil.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
point2 = Geom::Point3d.new(20,20,20)
constline = entities.add_cline(point1, point2)
endofline = constline.end

Returns:

  • point - a Point3d object representing the end of the construction line

Version:

  • SketchUp 6.0

#end=(point) ⇒ Object #end=(nil) ⇒ Object

The end= method is used to set the end point of the construction line. This method will make the length finite at the end.

Set the end to nil to make the construction line infinite at the end.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
point2 = Geom::Point3d.new(20,20,20)
point3 = Geom::Point3d.new(10,10,10)
constline = entities.add_cline(point1, point2)
UI.messagebox(constline.end)
# Will display point2

Overloads:

  • #end=(point) ⇒ Object

    Returns point - a Point3d object if successful or nil.

    Parameters:

    • point (Geom::Point3d)

      The Point3d object to set for the end point of the construction line.

    Returns:

    • point - a Point3d object if successful or nil

  • #end=(nil) ⇒ Object

    Returns point - a Point3d object if successful or nil.

    Parameters:

    • nil (nil)

      Sets the end point to infinite.

    Returns:

    • point - a Point3d object if successful or nil

Version:

  • SketchUp 6.0

#positionObject

The position method is used to retrieve a 3D point used to create a construction line on an infinite construction line.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
vector = Geom::Vector3d.new(10,10,10)
constline = entities.add_cline(point1, vector)
# Returns point1 or 0,0,0
position = constline.position

Returns:

  • point - the Point3d object used to create the line (if successful)

Version:

  • SketchUp 6.0

#position=(point) ⇒ Object

The position= method is used to set a 3D point that the construction passes through

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
point2 = Geom::Point3d.new(20,20,20)
point3 = Geom::Point3d.new(0,20,20)
constline = entities.add_cline(point1, point2)
position = constline.position = point3

Returns point - the new Point3d object that the construction line will pass through (if successful).

Parameters:

  • point

    The Point3d object for the construction line to pass through.

Returns:

  • point - the new Point3d object that the construction line will pass through (if successful)

Version:

  • SketchUp 6.0

#reverse!Object

The reverse! method is used to reverse the direction of the construction line.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
point2 = Geom::Point3d.new(20,20,20)
constline = entities.add_cline(point1, point2)
status = constline.reverse!

Returns:

  • status

Version:

  • SketchUp 6.0

#startObject

The start method is used to retrieve the starting point of a construction line.

If the construction line is infinite at the start, this returns nil.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
point2 = Geom::Point3d.new(20,20,20)
constline = entities.add_cline(point1, point2)
startofline = constline.start

Returns:

  • point - the Poin3d object representing the starting point of the construction line (if successful)

Version:

  • SketchUp 6.0

#start=(point) ⇒ Object #start=(nil) ⇒ Object

The start= method is used to set the start point of a construction line making the line's length finite at the start.

Setting the start to nil will make the construction line infinite at the start.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0,0,0)
point2 = Geom::Point3d.new(20,20,20)
point3 = Geom::Point3d.new(5,5,5)
constline = entities.add_cline(point1, point2)
startofline = constline.start = point3

Overloads:

  • #start=(point) ⇒ Object

    Returns point - a Point3d object if successful or nil.

    Parameters:

    • point (Geom::Point3d)

      The Point3d object to set for the start point of the construction line.

    Returns:

    • point - a Point3d object if successful or nil

  • #start=(nil) ⇒ Object

    Returns point - a Point3d object if successful or nil.

    Parameters:

    • nil (nil)

      Sets the start point to infinite.

    Returns:

    • point - a Point3d object if successful or nil

Version:

  • SketchUp 6.0

#stippleString

The #stipple method is used to retrieve the stipple pattern used to display the construction line.

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0, 0, 0)
point2 = Geom::Point3d.new(20, 20, 20)
constline = entities.add_cline(point1, point2)
puts constline.stipple

Returns:

Version:

  • SketchUp 6.0

#stipple=(pattern) ⇒ Object

The #stipple= method is used to set the stipple pattern used to display the construction line. The stipple pattern is given as a string.

Valid strings are:

  • "." (Dotted Line),

  • "-" (Short Dashes Line),

  • "_" (Long Dashes Line),

  • "-.-" (Dash Dot Dash Line).

Examples:

model = Sketchup.active_model
entities = model.active_entities
point1 = Geom::Point3d.new(0, 0, 0)
point2 = Geom::Point3d.new(20, 20, 20)
constline = entities.add_cline(point1, point2)
constline.stipple = "-.-"

Parameters:

Version:

  • SketchUp 6.0