class Loop

 

Parent: Entity

Class Index

Methods:convex?, edges, edgeuses, face, outer?, verticies

 

Sample Code:looptests.rb

 

Loop is a low level topology class that will not need to be used often. A Loop is a chain of Edges that bound a Face.   
 

Instance Methods

 

convex?

Determine if the loop is convex.

Syntax:

status = loop.convex?

Arguments:

 

Return Value:

status - true if convex, false if not convex

Comments:

 

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
loop = face.outer_loop
status = loop.convex?
if (status)
 UI.messagebox "Loop is Convex"
else
 UI.messagebox "Loop is not Convex"
end

 

edges

Get an array of the edges that define the loop.

Syntax:

edges = loop.edges

Arguments:

 

Return Value:

edges - an array of Edge objects if successful

Comments:

 

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
loop = face.outer_loop
edges = loop.edges
if (edges)
  UI.messagebox edges
else
  UI.messagebox "Failure"
end


 

edgeuses

Get an array of the EdgeUse objects that define this loop.

Syntax:

edgeuses = loop.edgeuse

Arguments:

 

Return Value:

edgeuses - an array of EdgeUse objects if successful

Comments:

 

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
edgeuses = loop.edgeuses
if (edgeuses)
  UI.messagebox edgeuses
else
  UI.messagebox "Failure"
end


 

face

Get the Face object that is bounded by this loop.

Syntax:

face = loop.face

Arguments:

 

Return Value:

face - a Face object if successful

Comments:

 

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
loop = face.outer_loop
f = loop.face
if (f)
 UI.messagebox f
else
 UI.messagebox "Failure"
end


 

outer?

Determine if this is an outer loop. Each face has one outer loop, and will have one loop for each hole.

Syntax:

status = loop.outer?

Arguments:

 

Return Value:

status - true if the loop is an outer loop, false if it is not an outer loop

Comments:

 

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
loop = face.outer_loop
status = loop.outer?
if (status)
  UI.messagebox status
else
  UI.messagebox "Failure"
end


 

vertices

Get an Array of the vertexes that are part of the loop. The array will be ordered correctly.

Syntax:

vertices = loop.vertices

Arguments:

 

Return Value:

verticies - an array of Vertex objects if successful

Comments:

 

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
loop = face.outer_loop
v = loop.vertices
if (v)
 UI.messagebox v
else
  UI.messagebox "Failure"
end