Assembly

class compas_assembly.datastructures.Assembly(name=None, **kwargs)[source]

Bases: compas.datastructures.datastructure.Datastructure

A data structure for managing the connections between different parts of an assembly.

Parameters

name (str, optional) – The name of the assembly.

Attributes
  • attributes (dict[str, Any]) – General attributes of the data structure that will be included in the data dict and serialization.

  • graph (compas.datastructures.Graph) – The graph that is used under the hood to store the parts and their connections.

Examples

>>>

Methods

add_block

Add a block to the assembly.

add_block_block_interfaces

Add an interface between two blocks.

add_block_from_mesh

Add a block to the assembly from a normal mesh.

block_node

Retrieve the graph node corresponding to a block.

blocks

Iterate over the blocks of the assembly.

edge_blocks

Retrieve the two blocks corresponding to a graph edge.

edge_interfaces

Retrieve the interface corresponding to a graph edge.

edge_line

Retrieve the line segment between the nodes of the edge.

edges

Iterate over the edges of the graph of the assembly.

from_polysurfaces

Construct an assembly from Rhino polysurfaces.

from_rhinomeshes

Construct an assembly from Rhino meshes.

from_template

Construct an assembly from a parameteric template.

has_block

Verify that the assembly contains a given block.

has_interface

Verify that the assembly contains a given interface.

interfaces

Yield the interfaces of the assembly.

node_block

Retrieve the block corresponding to a graph node.

node_point

Retrieve a point representing the location of the node.

nodes

Iterate over the nodes of the graph of the assembly.

number_of_blocks

Return the number of blocks in the assembly.

number_of_edges

Return the number of edges in the assembly graph.

number_of_interfaces

Return the number of interfaces in the assembly.

number_of_nodes

Return the number of nodes in the assembly graph.

set_boundary_condition

Set the boundary condition for a single node.

set_boundary_conditions

Set the boundary condition for multiple nodes.

transform

Transform this assembly by the given transformation matrix.

transformed

Transform a copy of this assembly by the given transformation matrix.

unset_boundary_conditions

Unset all boundary conditions.

Inherited Methods

ToString

Converts the instance to a string.

copy

Make an independent copy of the data object.

from_data

Construct an object of this type from the provided data.

from_json

Construct an object from serialized data contained in a JSON file.

from_jsonstring

Construct an object from serialized data contained in a JSON string.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_data

Convert an object to its native data representation.

to_json

Serialize the data representation of an object to a JSON file.

to_jsonstring

Serialize the data representation of an object to a JSON string.

validate_data

Validate the object's data against its data schema.

validate_json

Validate the object's data against its json schema.