MarcelHeu
Hey, first i have to say thank you for this library. I really missed these in python. Now my problem: After i combined two models with each other, i sometimes get a "not watertight" model as result. Attached you will find some example source code. ########################################################################## "Function to combine (union) two different trimesh files" def getUnion(model1, model2): ########################################################### # using pycork to combine to different models # Extra list of vertices and triangular faces from the meshes vertsA = model1.vertices trisA = model1.faces vertsB = model2.vertices trisB = model2.faces # Perform the boolean opertions directly with Cork library vertsC, trisC = pycork.union(vertsA, trisA, vertsB, trisB) # combined model combinedModel = trimesh.Trimesh(vertices=vertsC, faces=trisC, process=True) ########################################################### return combinedModel # end of function ########################################################################## # needed variables radius = 0.5 insertConeInMM = 0.001 cylinderHeight = 4 coneHeight = 1 # create cylinder cylinder = cylinder(radius,height=cylinderHeight, sections=36) # create cone1 cone1 = cone(radius,height=coneHeight, sections=36) cone1.apply_translation((0,0,cylinderHeight/2 - insertConeInMM)) # create cone2 cone2 = cone(radius,height=coneHeight, sections=36) alpha2, beta2, gamma2 = np.deg2rad((180,0,0)) R_e = trimesh.transformations.euler_matrix(alpha2, beta2, gamma2, 'rxyz') cone2.apply_transform(R_e) cone2.apply_translation((0,0,-(cylinderHeight/2 - insertConeInMM))) # combine everything part1 = getUnion(cylinder, cone1) combined = getUnion(part1, cone2) print(combined.is_watertight) # export as stl file_path = QtWidgets.QFileDialog.getSaveFileName(parent = None, caption = "Export Model", directory = os.environ['USERPROFILE'] + "/" + "Test", filter = "STL file (*.stl)") if file_path[0] != "": combined.export(file_path[0])