class Group

Parent: Drawingelement | Class Index
Methods:copy, description, description=, entities, explode, locked?, move!, name, name=, transform!, transformation, transformation= |
Sample Code:grouptests.rb |

A Group class contains methods for manipulating groups of entities.

Instance Methods

copy
The copy method is used to create a new Group object that is a copy of the group.
Syntax:
group = group.copy
Arguments:
Return Value:
group - a new Group object
Comments:
Example:
group2 = group.copy

description
The description method is used to retrieve the description for the group.
Syntax:
description = group.description
Arguments:
Return Value:
description - a string description 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 group to the entities in the model group = entities.add_group # Get the entities within the group entities2 = group.entities # Add a face to within the group face = entities2.add_face pts group.description = "This is a Group with a 2d Face" description = group.description if (description) UI.messagebox description else UI.messagebox "Failure" end

description=
The description= method is used to set the description for the group.
Syntax:
description = group.description = "description"
Arguments:
"description" - a string description
Return Value:
description - the new description 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 group to the entities in the model group = entities.add_group # Get the entities within the group entities2 = group.entities # Add a face to within the group face = entities2.add_face pts group.description = "This is a Group with a 2d Face" description = group.description if (description) UI.messagebox description else UI.messagebox "Failure" end

entities
The entities method is used to retrieve a collection of entities in the group.
Syntax:
entities = group.entities
Arguments:
Return Value:
entities - an Entities 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 group to the entities in the model group = entities.add_group # Get the entities within the group entities2 = group.entities # Add a face to within the group face = entities2.add_face pts entities = group.entities if (entities) UI.messagebox entities else UI.messagebox "Failure" end

explode
The explode method is used to explode the group into individual entities.
Syntax:
entities = group.explode
Arguments:
Return Value:
entities - an Entities object if successful
Comments:
Example:
UI.messagebox "Grouped" status = group.explode if (status) UI.messagebox "Exploded Group" else UI.messagebox "Failure" end

locked?
The locked? method is used to determine if a group is locked.
Syntax:
status = group.locked?
Arguments:
Return Value:
status - true if the component instance is locked. False if the instance is not locked.
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 group to the entities in the model group = entities.add_group status = group.locked? UI.messagebox status

move!
The move! method is used to apply a transformation to the group.
Syntax:
group = group.move! transformation
Arguments:
transformation - a Transformation object
Return Value:
group - the transformed Group object if successful
Comments:
This method is the same as the transform! method except that it does not record the move in an undo operation. This method is useful for transparently moving things during an animation.
Example:
point = Geom::Point3d.new 500,500,500 t = Geom::Transformation.new point 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 group to the entities in the model group = entities.add_group # Get the entities within the group entities2 = group.entities # Add a face to within the group face = entities2.add_face pts UI.messagebox "Group before Move" group = group.move! t if (group) UI.messagebox "Group after move" UI.messagebox group else UI.messagebox "Failure" end

name
The name method is used to retrieve the name of the group.
Syntax:
name = group.name
Arguments:
Return Value:
name - The name of the group if successful
Comments:
Example:
group.name = "2d Face" name = group.name

name=
The name= method is used to set the description for the group.
Syntax:
name = group.name = "name"
Arguments:
"name" - a string name
Return Value:
name - a new name if successful
Comments:
Example:
group.name = "2d Face" name = group.name

transform!
The transform! method is used to apply a transformation to a group.
Syntax:
group = group.transform! transformation
Arguments:
transformation - a Transformation object
Return Value:
group - a transformed group object if successful
Comments:
Example:
point = Geom::Point3d.new 500,500,500 t = Geom::Transformation.new point 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 group to the entities in the model group = entities.add_group # Get the entities within the group entities2 = group.entities # Add a face to within the group face = entities2.add_face pts UI.messagebox "Group before Move" group = group.transform! t if (group) UI.messagebox "Group after move" UI.messagebox group else UI.messagebox "Failure" end

transformation
The transformation method is used to retrieve the transformation for the group.
Syntax:
transformation = group.transformation
Arguments:
Return Value:
transformation - a Transformation object if successful
Comments:
Example:
trans = group.transformation

transformation=
The transformation= method is used to set the transformation for the group.
Syntax:
transformation = group.transformation = transformation
Arguments:
transformation - the Transformation object applied to the group
Return Value:
transformation - the Transformation object if successful
Comments:
Example:
trans = group.transformation=t