My favorites | English | Sign in

Faster apps faster - GWT 2.0 with Speed Tracer New!

Google SketchUp Ruby API

ConstructionLine

class

Introduction

SketchUp 6.0+

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.

Methods

ConstructionLine.directionSketchUp 6.0+

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

Returns:

vector
a Vector3d object if successful
 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.to_s
 else
   UI.messagebox "Failure"
 end

ConstructionLine.direction=SketchUp 6.0+

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

Arguments:

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

Returns:

vector
the new Vector3d object if successful
 # 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

ConstructionLine.endSketchUp 6.0+

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.

Returns:

point
a Point3d object representing the end of the construction line
 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

ConstructionLine.end=SketchUp 6.0+

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.

Arguments:

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

Returns:

status
3D point if finite or nil if not.
 # Need better examples throughout this file.
 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
 endofline = constline.end = nil        
 if (endofline)
  UI.messagebox endofline.to_s
 else
  UI.messagebox endofline.to_s
 end

ConstructionLine.positionSketchUp 6.0+

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

Returns:

point
the Point3d object used to create the line (if successful)
 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

ConstructionLine.position=SketchUp 6.0+

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

Arguments:

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)
 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

ConstructionLine.reverse!SketchUp 6.0+

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

Returns:

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

ConstructionLine.startSketchUp 6.0+

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.

Returns:

point
the Poin3d object representing the starting point of the construction line (if successful)
 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

ConstructionLine.start=SketchUp 6.0+

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.

Arguments:

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

Returns:

point
a Point3d object if successful or nil
 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

ConstructionLine.stippleSketchUp 6.0+

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

Returns:

pattern
the stipple pattern being used
 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

ConstructionLine.stipple=SketchUp 6.0+

The stipple= method is used to set the stipple pattern used to display the construction line. The stipple pattern can be given as a string or as a number. Valid strings are: ".", "-", "_", "-.-".

Arguments:

pattern
- the stipple pattern to use
 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 = "-.-"