Class: Sketchup::Drawingelement

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

Overview

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

Instance Method Summary collapse

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

#boundsGeom::BoundingBox

The bounds method is used to retrieve the BoundingBox for an drawing element.

Examples:

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

Version:

  • SketchUp 6.0



37
38
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 37

def bounds
end

#casts_shadows=(casts) ⇒ Boolean

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

Examples:

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

Version:

  • SketchUp 6.0



67
68
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 67

def casts_shadows=(casts)
end

#casts_shadows?Boolean

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

Examples:

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

Version:

  • SketchUp 6.0



91
92
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 91

def casts_shadows?
end

#erase!Boolean

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.

Examples:

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!

Version:

  • SketchUp 6.0



115
116
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 115

def erase!
end

#hidden=(hidden) ⇒ Boolean

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

Examples:

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

Version:

  • SketchUp 6.0



143
144
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 143

def hidden=(hidden)
end

#hidden?Boolean

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

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

Examples:

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

Version:

  • SketchUp 6.0



168
169
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 168

def hidden?
end

#layerSketchup::Layer

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

Examples:

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

Version:

  • SketchUp 6.0



191
192
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 191

def layer
end

#layer=(layer) ⇒ Sketchup::Layer, String

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.

Examples:

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

Version:

  • SketchUp 6.0



222
223
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 222

def layer=(layer)
end

#materialSketchup::Material

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

Examples:

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

Version:

  • SketchUp 6.0



245
246
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 245

def material
end

#material=(material) ⇒ Sketchup::Material, ...

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

Examples:

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

Version:

  • SketchUp 6.0



281
282
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 281

def material=(material)
end

#receives_shadows=(receive) ⇒ Boolean

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

Examples:

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

Version:

  • SketchUp 6.0



311
312
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 311

def receives_shadows=(receive)
end

#receives_shadows?Boolean

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

Examples:

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

Version:

  • SketchUp 6.0



335
336
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 335

def receives_shadows?
end

#visible=(visibility) ⇒ Boolean

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

Examples:

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

Version:

  • SketchUp 6.0



363
364
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 363

def visible=(visibility)
end

#visible?Boolean

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

Examples:

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

Version:

  • SketchUp 6.0



387
388
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb', line 387

def visible?
end