Module: AMS::Group

Defined in:
docs/ams/group.rb

Overview

Since:

  • 3.3.0

Class Method Summary collapse

Class Method Details

.calc_centre_of_mass(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Geom::Point3d

Note:

This method only works with convex groups.

Note:

This function was revised in version 3.6.0.

Calculate group/component-instance centre of mass from faces.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Geom::Point3d)

Since:

  • 3.3.0

.copy(object, context, transformation = nil, recurse = true) {|sub_entity| ... } ⇒ Sketchup::Group, ...

Note:

This function was revised in version 3.6.0.

Note:

Make sure to wrap this function with a start/commit operation to avoid polluting the undo stack.

Note:

The original object is not modified in any way.

Note:

If a block is passed, copied object is made unique.

Note:

The main, copied group is assigned its original name, layer, material, visibility state, casts/receives shadows state; attributes are not copied.

Copy group/component-instance without including the undesired entities.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • context (Sketchup::Entities)

    The entities context to paste into.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A transformation matrix, relative to context, to apply to the resulting group. Pass nil to have the resulting group be applied the matrix of object.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Sketchup::Group, Sketchup::ComponentInstance, nil)

    A copied group or nil if nothing copied.

Since:

  • 3.3.0

.get_bounding_box_from_edges(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Geom::BoundingBox

Note:

This function was revised in version 3.6.0.

Compute group/component-instance axes-aligned bounding-box from edges.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Geom::BoundingBox)

Since:

  • 3.5.0

.get_bounding_box_from_faces(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Geom::BoundingBox

Note:

This function was revised in version 3.6.0.

Compute group/component-instance axes-aligned bounding-box from faces.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Geom::BoundingBox)

Since:

  • 3.3.0

.get_construction(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Geom::Point3d>

Note:

This function was revised in version 3.6.0.

Get group/component-instance construction point and line positions.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Geom::Point3d>)

    An array of points.

Since:

  • 3.3.0

.get_definition(object) ⇒ Sketchup::ComponentDefinition

Get group/component instance definition.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

Returns:

  • (Sketchup::ComponentDefinition)

Since:

  • 3.3.0

.get_edges(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Array<Geom::Point3d>>

Note:

This function was revised in version 3.6.0.

Get group/component-instance edges.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Array<Geom::Point3d>>)

    An array of edges. Each edge represents an array of two points.

Since:

  • 3.3.0

.get_entities(object) ⇒ Sketchup::Entities

Get group/component instance entities.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

Returns:

  • (Sketchup::Entities)

Since:

  • 3.3.0

.get_faces(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Array<Geom::Point3d>>

Note:

This function was revised in version 3.6.0.

Get group/component-instance faces.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Array<Geom::Point3d>>)

    An array of faces. Each face represents an array of points.

Since:

  • 3.3.0

.get_polygons_from_faces(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Array<Geom::Point3d>>

Note:

This function was revised in version 3.6.0.

Get group/component-instance face triplets.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Array<Geom::Point3d>>)

    An array of polygons. Each polygon represents an array of three points - a triplet.

Since:

  • 3.3.0

.get_triangular_mesh(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Geom::PolygonMesh

Note:

This function was revised in version 3.6.0.

Get group/component-instance triangular mesh.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Geom::PolygonMesh)

    Everything merged into one mesh.

Since:

  • 3.3.0

.get_triangular_meshes(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Geom::PolygonMesh>

Note:

This function was revised in version 3.6.0.

Get group/component-instance triangular mesh collections. Each sub-group, sub-component, a collection of connected faces is reserved its own mesh.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Geom::PolygonMesh>)

    An array of meshes.

Since:

  • 3.3.0

.get_vertices_from_edges(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Geom::Point3d>

Note:

This function was revised in version 3.6.0.

Get group/component-instance edge vertices.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Geom::Point3d>)

    An array of points.

Since:

  • 3.3.0

.get_vertices_from_faces(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Geom::Point3d>

Note:

This function was revised in version 3.6.0.

Get group/component-instance face vertices.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Geom::Point3d>)

    An array of points.

Since:

  • 3.3.0

.get_vertices_from_faces2(object, recurse = true, transformation = nil) {|sub_entity| ... } ⇒ Array<Array<Geom::Point3d>>

Note:

This function was revised in version 3.6.0.

Get group/component-instance face vertices collections.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A coordinate system in which the computation is to be performed. Usually this parameter is set to the coordinate system object is associated to. Pass nil to have the computation performed in object's local space.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Array<Geom::Point3d>>)

    An array of point collections from every included sub-group/sub-component instance. Each point collection represents an array of points.

Since:

  • 3.3.0

.split(object, point, normal, context, transformation = nil, recurse = true) {|sub_entity| ... } ⇒ Array<Sketchup::Group, Sketchup::ComponentInstance, nil>

Note:

Make sure to wrap this function with a start/commit operation to avoid polluting the undo stack.

Note:

The original object is not modified in any way.

Note:

Copied groups are assigned their original name, layer, material, visibility state, casts/receives shadows state; attributes are not copied.

Split group/component-instance at plane.

Parameters:

  • object (Sketchup::Group, Sketchup::ComponentInstance)

    A group or a component instance.

  • point (Geom::Point3d)

    A point on plane in context coordinates.

  • normal (Geom::Vector3d)

    Plane normal in context coordinates.

  • context (Sketchup::Entities)

    The entities context to paste into.

  • transformation (Geom::Transformation, nil) (defaults to: nil)

    A transformation matrix, relative to context, to apply to the resulting groups. Pass nil to have the resulting groups be applied the matrix of object.

  • recurse (Boolean) (defaults to: true)

    Whether to process sub-groups and sub-component instances.

Yields:

  • A procedure for determining whether a particular sub-group or a sub-component-instance is to be considered a part of the operation.

Yield Parameters:

  • sub_entity (Sketchup::Group, Sketchup::ComponentInstance)

Yield Returns:

  • (Boolean)

    Pass true to have sub_entity included in the operation; pass false to have sub_entity ignored.

Returns:

  • (Array<Sketchup::Group, Sketchup::ComponentInstance, nil>)

    An array of two items. Each item is either a group, a component-instance, or nil if turned out empty, during the split operation.

Since:

  • 3.6.0