class Sketchup::Drawingelement

Drawingelement is a base class for an item in the model that can be displayed. These items include edges, construction points, construction lines, and images. Arc curves and arcs are not included because they are not drawing elements by themselves, but are a composition of edges.

@version SketchUp 6.0

Public Instance Methods

bounds() click to toggle source

The {#bounds} method is used to retrieve the {Geom::BoundingBox} bounding a {Sketchup::Drawingelement}.

For a {Sketchup::Edge}, {Sketchup::ComponentInstance} and most other {Sketchup::Drawingelement}s, the boundingbox follows the coordinate system the drawing element is placed in. For {Sketchup::ComponentDefinition}, the box bounds the contents of the component and follows the component's own internal coordinate system.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
# Remember, anything that can be displayed, such as a face, is also
# a Drawingelement. So I can call bounds on a face because Face
# is a sub-class of Drawingelement.
boundingbox = face.bounds

@return [Geom::BoundingBox]

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 43
def bounds
end
casts_shadows=(casts) click to toggle source

The casts_shadows= method is used to set the Drawingelement to cast shadows.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 100]
pts[1] = [width, 0, 100]
pts[2] = [width, depth, 100]
pts[3] = [0, depth, 100]
# Add the face to the entities in the model.
face = entities.add_face pts

# Make the face not cast shadows.
status = face.casts_shadows = false
UI.messagebox status.to_s

@param [Boolean] casts

true if you want the Drawingelement object to cast
shadows, false if you do not want the Drawingelement
object to cast shadows.

@return [Boolean] true if successful, false if unsuccessful.

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 73
def casts_shadows=(casts)
end
casts_shadows?() click to toggle source

The casts_shadows? method is used to determine if the Drawingelement is casting shadows.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
status = face.casts_shadows?
UI.messagebox status.to_s

@return [Boolean]

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 97
def casts_shadows?
end
erase!() click to toggle source

The erase! method is used to erase an element from the model.

Erasing an Edge also erases all of the Face objects that use the Edge.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
status = face.erase!

@return [Boolean] true if successful, false if unsuccessful

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 121
def erase!
end
hidden=(hidden) click to toggle source

The hidden= method is used to set the hidden status for an element.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
UI.messagebox "Click OK to Hide the Box"
status = face.hidden = true

@param [Boolean] hidden

true if you want to hide the element, false if you do
not want to hide the element.

@return [Boolean] true if the element has been hidden, false if

the element has not been hidden.

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 149
def hidden=(hidden)
end
hidden?() click to toggle source

The hidden? method is used to determine if the element is hidden.

Hidden elements are still in the model, but they are not displayed.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
status = face.hidden?
UI.messagebox "hidden? " + status.to_s

@return [Boolean]

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 174
def hidden?
end
layer() click to toggle source

The layer method is used to retrieve the Layer object of the drawing element.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
layer = face.layer

@return [Sketchup::Layer] a layer object if successful

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 197
def layer
end
layer=(layer) click to toggle source

The layer= method is used to set the layer for the drawing element.

An exception is raised if you give a string that doesn't match any layer name.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
# Add a layer
layer = Sketchup.active_model.layers.add "joe"
# Put the face on the joe layer (instead of layer 0)
newlayer = face.layer = layer

@param [Sketchup::Layer, String] layer

A layer or layer name.

@return [Sketchup::Layer, String] the new Layer object if successful

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 228
def layer=(layer)
end
material() click to toggle source

The material method is used to retrieve the material for the drawing element.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
material = face.material

@return [Sketchup::Material] the Material object if successful

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 251
def material
end
material=(material) click to toggle source

The material= method is used to set the material for the drawing element.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
m = model.materials.add "Joe"
begin
  # Returns nil if not successful, path if successful.
  # Should return a texture object.
  m.texture = "c:\\My Textures\\Carpet.jpg"
rescue
  UI.messagebox $!.message
end
# You will see the material applied when you reverse the box's faces
material = face.material = m

@param [Sketchup::Material, String, Sketchup::Color] material

A Material, name of a material, Color, or name of a
color.

@return [Sketchup::Material, String, Sketchup::Color] the new Material object if successful

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 287
def material=(material)
end
receives_shadows=(receive) click to toggle source

The receive_shadows= method is used to set the Drawingelement to receive shadows.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 100]
pts[1] = [width, 0, 100]
pts[2] = [width, depth, 100]
pts[3] = [0, depth, 100]
# Add the face to the entities in the model.
face = entities.add_face pts

# Make the face not receive shadows.
status = face.receives_shadows = false
UI.messagebox status.to_s

@param [Boolean] receive

true if you want the Drawingelement object to
receive shadows, false if not.

@return [Boolean] true if successful, false if unsuccessful.

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 317
def receives_shadows=(receive)
end
receives_shadows?() click to toggle source

The receive_shadows? method is used to determine if the Drawingelement is receiving shadows.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
status = face.receives_shadows?
UI.messagebox status.to_s

@return [Boolean]

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 341
def receives_shadows?
end
visible=(visibility) click to toggle source

The visible= method is used to set the visible status for an element. This method performs an opposite function to the hidden= method.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
UI.messagebox "Click OK to Hide the Box"
status = face.visible = false

@param [Boolean] visibility

true if you want to hide the element, false if not

@return [Boolean] true if the element has been hidden, false if

the element has not been hidden.

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 369
def visible=(visibility)
end
visible?() click to toggle source

The visible? method is used to get the visible status for an element.

@example

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
UI.messagebox "Click OK to Hide the Box"
face.visible = false
UI.messagebox "Is the face visible? " + face.visible?.to_s

@return [Boolean]

@version SketchUp 6.0

# File lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb, line 393
def visible?
end