Class: Sketchup::ConstructionLine

Inherits:
Drawingelement show all
Defined in:
lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb

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

Version:

  • SketchUp 6.0



32
33
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 32

def direction
end

#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

Version:

  • SketchUp 6.0



55
56
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 55

def direction=(vector)
end

#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

Version:

  • SketchUp 6.0



75
76
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 75

def end
end

#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

Version:

  • SketchUp 6.0



105
106
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 105

def end=(arg)
end

#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

Version:

  • SketchUp 6.0



124
125
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 124

def position
end

#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

Version:

  • SketchUp 6.0



147
148
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 147

def position=(point)
end

#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!

Version:

  • SketchUp 6.0



164
165
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 164

def reverse!
end

#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

Version:

  • SketchUp 6.0



184
185
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 184

def start
end

#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

Version:

  • SketchUp 6.0



214
215
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 214

def start=(arg)
end

#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

Version:

  • SketchUp 6.0



231
232
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 231

def stipple
end

#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 = "-.-"

Version:

  • SketchUp 6.0



254
255
# File 'lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb', line 254

def stipple=(pattern)
end