# mypython = "/Users/vanmelet/anaconda3/bin/python" # assembly_interfaces.python = mypython # compute_interface_forces.python = mypython # ============================================================================== # initialise assembly from stored block data # ============================================================================== assembly = Assembly() # read block geometry data from sample json file filepath = compas_rbe.get('simple_stack2.json') with open(filepath, 'r') as fp: data = json.load(fp) for item in data: # simple_stack2.json still uses a dict of half-edges to represent a face # instead of simple lists for fkey, cycle in item['face'].items(): start = list(cycle.keys())[0] key = cycle[start] item['face'][fkey] = [start] while True: if key == start: break
for item in data: for fkey, cycle in item['face'].items(): start = list(cycle.keys())[0] key = cycle[start] item['face'][fkey] = [start] while True: if key == start: break item['face'][fkey].append(key) key = cycle[key] block = Block.from_data(item) assembly.add_block(block) for key, attr in assembly.vertices(True): if assembly.blocks[key].attributes['name'] == 'Block_0': attr['is_support'] = True assembly.to_json(destination) # ============================================================================== # Main # ============================================================================== if __name__ == "__main__": import compas_rbe convert(compas_rbe.get('simple_assembly.json'), compas_rbe.get('simpleassembly.json'))
from __future__ import absolute_import from __future__ import division import compas import compas_rbe from compas_assembly.datastructures import Assembly from compas_assembly.interfaces import assembly_interfaces_bestfit from compas_assembly.interfaces import planarize_interfaces from compas_assembly.viewer import AssemblyViewer from compas_rbe.equilibrium import compute_interface_forces # initialize assembly and blocks from json file assembly = Assembly.from_json(compas_rbe.get('simple_stack_curvedsrf2.json')) # print(list(assembly.vertices_where({'is_support': True}))) # identify block interfaces and update block_model assembly_interfaces_bestfit( assembly, nmax=10, tmax=0.5, amin=0.01, lmin=0.01, ) # TODO: Planerize all interfaces first before compute interface forces # planarize_interfaces(assembly.edge)
from compas.utilities import XFunc from compas_rbe.datastructures import Assembly from compas_rbe.rhino import AssemblyArtist from compas_rbe.rhino import AssemblyHelper assembly_interfaces = XFunc('compas_rbe.interfaces.assembly_interfaces_xfunc', tmpdir=compas_rbe.TEMP) compute_interface_forces = XFunc('compas_rbe.equilibrium.compute_interface_forces_xfunc', tmpdir=compas_rbe.TEMP) # initialize assembly and blocks from json file assembly = Assembly.from_json(compas_rbe.get('simple_stack_4.json')) # identify block interfaces and update block_model data = { 'assembly': assembly.to_data(), 'blocks' : {str(key): assembly.blocks[key].to_data() for key in assembly.blocks}, } result = assembly_interfaces(data, nmax=10, tmax=0.05, amin=0.01, lmin=0.01) assembly.data = result['assembly'] for key in assembly.blocks: assembly.blocks[key].data = result['blocks'][str(key)]
from __future__ import print_function from __future__ import absolute_import from __future__ import division import compas import compas_rbe from compas_assembly.datastructures import Assembly from compas_assembly.datastructures import assembly_interfaces from compas_assembly.viewer import AssemblyViewer from compas_rbe.equilibrium import compute_interface_forces_cvx # initialize assembly and blocks from json file assembly = Assembly.from_json(compas_rbe.get('genevault.json')) # identify block interfaces and update block_model assembly_interfaces( assembly, nmax=10, tmax=0.05, amin=0.01, lmin=0.01, ) # equilibrium # compute_interface_forces_cvx(assembly, verbose=True)