import os import compas_vibro from compas_vibro.structure import Structure for i in range(50): print('') name = 'mesh_flat_20x20_radiation.obj' s = Structure.from_obj(os.path.join(compas_vibro.DATA, name)) print(s.results['modal'][0].frequency)
fields[f] = {ek: P[i] for i, ek in enumerate(eks)} return fields if __name__ == '__main__': import os import compas_vibro from compas.datastructures import Mesh from compas_vibro.viewers import PressureFieldViewer from compas_vibro.structure import Structure for i in range(50): print('') filepath = os.path.join(compas_vibro.DATA, 'clt_1_remeshed_radiation.obj') s = Structure.from_obj(filepath) frequencies = range(20, 500, 10) waves = generate_uniform_waves_numpy() fields = compute_pressure_fields_structure(waves, s, frequencies, center=True) v = PressureFieldViewer(fields, structure=s) v.real = True v.show() num_waves = 500 model = 'flat_mesh_20x20.json' # model = 'clt_2.json' mesh = Mesh.from_json(compas_vibro.get(model)) # waves = generate_random_waves_numpy(num_waves)
elif elset: eks = structure.sets[elset].selection sec = structure.element_properties[ep].section t = structure.sections[sec].geometry['t'] for ek in eks: nodes = structure.elements[ek].nodes vert = [structure.nodes[nk].xyz() for nk in nodes] n = scale_vector(normalize_vector(normal_polygon(vert)), t / 2.) n_ = scale_vector(n, -1) v_out = [add_vectors(v, n) for v in vert] v_in = [add_vectors(v, n_) for v in vert] s1 = rs.AddSrfPt(v_out) s2 = rs.AddSrfPt(v_in) srfs = [s1, s2] for i in range(len(v_in)): srf = rs.AddSrfPt( [v_in[-i], v_in[-i - 1], v_out[-i - 1], v_out[-i]]) if srf: srfs.append(srf) rs.JoinSurfaces(srfs, delete_input=True) if __name__ == '__main__': import os import compas_vibro from compas_vibro.structure import Structure rs.DeleteObjects(rs.ObjectsByLayer('Default')) fpath = os.path.join(compas_vibro.TEMP, 'clt_1_remeshed_field.obj') s = Structure.from_obj(fpath) plot_structure(s)