| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | __title__ = "FreeCAD FEM calculix constraint tie" |
| | __author__ = "Bernd Hahnebach" |
| | __url__ = "https://www.freecad.org" |
| |
|
| |
|
| | from FreeCAD import Units, Vector |
| |
|
| |
|
| | def get_analysis_types(): |
| | return "all" |
| |
|
| |
|
| | def get_sets_name(): |
| | return "constraints_tie_surface_sets" |
| |
|
| |
|
| | def get_constraint_title(): |
| | return "Tie Constraints" |
| |
|
| |
|
| | def get_before_write_meshdata_constraint(): |
| | return "" |
| |
|
| |
|
| | def get_after_write_meshdata_constraint(): |
| | return "" |
| |
|
| |
|
| | def get_before_write_constraint(): |
| | return "" |
| |
|
| |
|
| | def get_after_write_constraint(): |
| | return "" |
| |
|
| |
|
| | def write_meshdata_constraint(f, femobj, tie_obj, ccxwriter): |
| | |
| | f.write(f"*SURFACE, NAME=TIE_DEP{tie_obj.Name}\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") |
| |
|
| | |
| | f.write(f"*SURFACE, NAME=TIE_IND{tie_obj.Name}\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): |
| |
|
| | |
| |
|
| | tolerance = tie_obj.Tolerance.getValueAs("mm").Value |
| | adjust = "" |
| | symmetry = "" |
| | tie_name = tie_obj.Name |
| | if not tie_obj.Adjust: |
| | adjust = ", ADJUST=NO" |
| |
|
| | if tie_obj.CyclicSymmetry: |
| | symmetry = ", CYCLIC SYMMETRY" |
| |
|
| | f.write( |
| | "*TIE, POSITION TOLERANCE={:.13G}{}{}, NAME=TIE{}\n".format( |
| | tolerance, adjust, symmetry, tie_name |
| | ) |
| | ) |
| | ind_surf = f"TIE_IND{tie_name}" |
| | dep_surf = f"TIE_DEP{tie_name}" |
| | f.write(f"{dep_surf}, {ind_surf}\n") |
| |
|
| | |
| | if tie_obj.CyclicSymmetry: |
| | f.write( |
| | "*CYCLIC SYMMETRY MODEL, N={}, NGRAPH={}, TIE=TIE{}, ELSET=Eall\n".format( |
| | tie_obj.Sectors, tie_obj.ConnectedSectors, tie_name |
| | ) |
| | ) |
| |
|
| | |
| | vec_a = tie_obj.SymmetryAxis.Base |
| | vec_b = tie_obj.SymmetryAxis * Vector(0, 0, 1) |
| |
|
| | set_unit = lambda x: Units.Quantity(x, Units.Length).getValueAs("mm").Value |
| | point_a = [set_unit(coord) for coord in vec_a] |
| | point_b = [set_unit(coord) for coord in vec_b] |
| |
|
| | f.write("{:.13G},{:.13G},{:.13G},{:.13G},{:.13G},{:.13G}\n".format(*point_a, *point_b)) |
| |
|