In this tutorial, some basic features of the lattice module are presented. The tutorial starts from the demo file pedal.mxp located in the 3-matic installation folder \..\DemoFiles
. The unit cell to create the lattice is located in the 3-matic installation folder \...\UnitCellLibrary
.
import trimatic
import os
trimatic.new_project()
##Import pedal and unit graph from library
trimatic.import_project(os.path.dirname(trimatic.get_application_path()) + r"\DemoFiles\pedal.mxp")
unit_cell = trimatic.import_project(os.path.dirname(trimatic.get_application_path()) + r"\UnitCellLibrary\Dodecahedron.mxp")[0]
##Find the entities and assign them to variables
outer_volume = trimatic.find_part("Outer_Volume")
inner_volume = trimatic.find_part("Inner_Volume")
##Scale the unit cell
dim = unit_cell.dimension_delta
scale_factor = tuple(3.464 /c for c in dim)
trimatic.scale_factor(entities=unit_cell, factor=scale_factor)
##Create Unit cell based lattice
graph_unit_cell = unit_cell.find_graph_set("Dodecahedron")
inner_volume_with_graphs = trimatic.unit_cell_based_lattice(entity=inner_volume, unit_cell=graph_unit_cell)
##Hide the Inner volume and dodecahedron unit cell
inner_volume.visible = False
unit_cell.visible = False
##Attach graph to mesh
part_with_graph_connections= trimatic.attach_graph_to_mesh(graphs=inner_volume_with_graphs, entity=outer_volume, margin=0.5)
##Hide the outer volume and the inner volume with graphs part
inner_volume_with_graphs_part = inner_volume_with_graphs.get_parent()
inner_volume_with_graphs_part.visible = False
outer_volume.visible = False
##Filter graphs
trimatic.filter_loose_beams(entities=part_with_graph_connections,connection_threshold=0)
trimatic.delete(part_with_graph_connections.find_graph("Filtered Loose Graph"))
##Edit graph properties
trimatic.set_graph_properties(entities=part_with_graph_connections, thickness=0.5, accuracy=0.2)
##Convert Lattice to mesh
trimatic.convert_lattice_to_mesh(entities=part_with_graph_connections, connection_thickness=0.025, reduce=True)