diff --git a/src/Mod/Fem/femmesh/meshsetsgetter.py b/src/Mod/Fem/femmesh/meshsetsgetter.py index 053ea28a97..cffe6e3266 100644 --- a/src/Mod/Fem/femmesh/meshsetsgetter.py +++ b/src/Mod/Fem/femmesh/meshsetsgetter.py @@ -474,16 +474,15 @@ class MeshSetsGetter: for femobj in self.member.cons_tie: # femobj --> dict, FreeCAD document object is femobj["Object"] - print_obj_info(femobj["Object"]) - slave_faces, master_faces = meshtools.get_tie_obj_faces( - self.femmesh, self.femelement_table, self.femnodes_ele_table, femobj - ) - # [ele_id, ele_face_id], [ele_id, ele_face_id], ...] - # whereas the ele_face_id might be ccx specific - femobj["TieSlaveFaces"] = slave_faces - femobj["TieMasterFaces"] = master_faces - # FreeCAD.Console.PrintLog("{}\n".format(femobj["ContactSlaveFaces"])) - # FreeCAD.Console.PrintLog("{}\n".format(femobj["ContactMasterFaces"])) + obj = femobj["Object"] + print_obj_info(obj) + result = [] + ref_data = meshtools.pair_obj_reference(obj.References) + for ref_pair in ref_data: + result.append(meshtools.get_ccx_elements(self, ref_pair)) + + femobj["TieSlaveFaces"] = result[:-1] + femobj["TieMasterFaces"] = result[-1:] def get_constraints_sectionprint_faces(self): if not self.member.cons_sectionprint: diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py b/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py index 4f96280f0e..70d7e73070 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_tie.py @@ -60,12 +60,23 @@ def get_after_write_constraint(): def write_meshdata_constraint(f, femobj, tie_obj, ccxwriter): # slave DEP f.write(f"*SURFACE, NAME=TIE_DEP{tie_obj.Name}\n") - for i in femobj["TieSlaveFaces"]: - f.write(f"{i[0]},S{i[1]}\n") + for refs, surf, is_sub_el in femobj["TieSlaveFaces"]: + if is_sub_el: + for elem, fno in surf: + f.write(f"{elem},S{fno}\n") + else: + for elem in surf: + f.write(f"{elem},S2\n") + # master IND f.write(f"*SURFACE, NAME=TIE_IND{tie_obj.Name}\n") - for i in femobj["TieMasterFaces"]: - f.write(f"{i[0]},S{i[1]}\n") + for refs, surf, is_sub_el in femobj["TieMasterFaces"]: + if is_sub_el: + for elem, fno in surf: + f.write(f"{elem},S{fno}\n") + else: + for elem in surf: + f.write(f"{elem},S2\n") def write_constraint(f, femobj, tie_obj, ccxwriter): diff --git a/src/Mod/Fem/femtaskpanels/task_constraint_tie.py b/src/Mod/Fem/femtaskpanels/task_constraint_tie.py index 3b1cdfbdb0..5f3e633dd7 100644 --- a/src/Mod/Fem/femtaskpanels/task_constraint_tie.py +++ b/src/Mod/Fem/femtaskpanels/task_constraint_tie.py @@ -63,7 +63,7 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): # geometry selection widget self.selectionWidget = selection_widgets.GeometryElementsSelection( - obj.References, ["Face"], False, False + obj.References, ["Edge", "Face"], False, False ) # form made from param and selection widget