Preparation for FEA (3-matic 14.0)

In this tutorial some basic features of remeshing in 3-matic are presented using the project Femur.mxp that is located in the 3-matic installation folder under folder DemoFiles.

import trimatic
import os

# Open the project Femur.mxp
trimatic.new_project()
application_exe = trimatic.get_application_path()
application_path = os.path.dirname(application_exe)
path = application_path + "/DemoFiles/Femur.mxp"
trimatic.open_project(path)

femur = trimatic.find_part("femur")
dup_fem = trimatic.duplicate(femur)
femur.visible = False
dup_fem.name = "femur_dup"

#wrap and smooth the part
wrapped_fem = trimatic.wrap(entities=dup_fem,gap_closing_distance=0.5,smallest_detail=0.5)
dup_fem.visible = False
wrapped_fem.visible = False
smoothed_fem = trimatic.duplicate(entities=wrapped_fem)
smoothed_fem.name = wrapped_fem.name+"_smoothed"
trimatic.smooth(entities=smoothed_fem,smooth_factor=0.6)

#remesh the part
smoothed_fem.visible = False
remeshed_fem = trimatic.duplicate(smoothed_fem)
remeshed_fem.name = smoothed_fem.name+"_remeshed"
remeshed_fem = trimatic.adaptive_remesh(entities=remeshed_fem,target_triangle_edge_length=1,preserve_surface_contours=True)

if remeshed_fem:
	remeshed_fem = trimatic.find_object(smoothed_fem.name+"_remeshed")
#fix the mesh
	remeshed_fem.visible = False
	fixed_fem = trimatic.duplicate(remeshed_fem)
	fixed_fem.name = remeshed_fem.name + "_fixed"
	trimatic.auto_fix(entities=fixed_fem)
#calculate volume mesh
	fixed_fem.visible = False
	vol_mesh_fem = trimatic.duplicate(fixed_fem)
	vol_mesh_fem.name = fixed_fem.name + "_volume_mesh"
	trimatic.create_volume_mesh(part=vol_mesh_fem,maximum_edge_length=2)