# block dimensions W = 2.0 H = 0.5 D = 1.0 # ============================================================================== # Assembly # ============================================================================== assembly = Assembly() # default block box = Box.from_width_height_depth(W, H, D) brick = Block.from_shape(box) # make all blocks # place each block on top of previous # shift block randomly in XY plane for i in range(N): block = brick.copy() block.transform(Translation.from_vector([0, 0, 0.5 * H + i * H])) shift(block) assembly.add_block(block) # mark the bottom block as support assembly.node_attribute(0, 'is_support', True)
# from compas_assembly.geometry import Arch from compas_assembly.datastructures import Block, Assembly, assembly_interfaces_numpy # from compas_assembly.rhino import AssemblyArtist # from compas_assembly.blender import AssemblyArtist # from compas.rpc import Proxy from compas_view2.app import App from compas_view2.objects import Object, MeshObject, NetworkObject Object.register(Block, MeshObject) Object.register(Assembly, NetworkObject) # proxy = Proxy('compas_assembly.datastructures') # proxy.restart_server() b1 = Block.from_shape(Box.from_width_height_depth(1, 1, 1)) T = Translation.from_vector([0, 0, 1]) R = Rotation.from_axis_and_angle([0, 0, 1], radians(45)) b2 = b1.transformed(T * R) assembly = Assembly() assembly.add_block(b1) assembly.add_block(b2) # arch = Arch(rise=5, span=10, thickness=0.7, depth=0.5, n=40) # assembly = Assembly.from_geometry(arch) assembly_interfaces_numpy(assembly)