From 3fcdef5ca0fc08d78a66bd52d6385ea73815232f Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Tue, 6 Jul 2021 12:13:23 +0200 Subject: [PATCH] FEM: calculix writer, use obj name as unique identifier for constraint section print --- src/Mod/Fem/femsolver/calculix/writer.py | 14 ++++---------- .../data/calculix/constraint_sectionprint.inp | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Mod/Fem/femsolver/calculix/writer.py b/src/Mod/Fem/femsolver/calculix/writer.py index 7df2fca43d..7acea2e9f8 100644 --- a/src/Mod/Fem/femsolver/calculix/writer.py +++ b/src/Mod/Fem/femsolver/calculix/writer.py @@ -636,25 +636,21 @@ class FemInputWriterCcx(writerbase.FemInputWriter): # into get_constraints_sectionprint_faces method def write_surfacefaces_constraints_sectionprint(self, f): # get surface nodes and write them to file - obj = 0 for femobj in self.sectionprint_objects: # femobj --> dict, FreeCAD document object is femobj["Object"] sectionprint_obj = femobj["Object"] f.write("** " + sectionprint_obj.Label + "\n") - obj = obj + 1 for o, elem_tup in sectionprint_obj.References: for elem in elem_tup: ref_shape = o.Shape.getElement(elem) if ref_shape.ShapeType == "Face": - name = "SECTIONFACE" + str(obj) - f.write("*SURFACE, NAME=" + name + "\n") - + f.write("*SURFACE, NAME=SECTIONFACE{}\n".format(sectionprint_obj.Name)) v = self.mesh_object.FemMesh.getccxVolumesByFace(ref_shape) if len(v) > 0: # volume elements found FreeCAD.Console.PrintLog( "{}, surface {}, {} touching volume elements found\n" - .format(sectionprint_obj.Label, name, len(v)) + .format(sectionprint_obj.Label, sectionprint_obj.Name, len(v)) ) for i in v: f.write("{},S{}\n".format(i[0], i[1])) @@ -663,7 +659,7 @@ class FemInputWriterCcx(writerbase.FemInputWriter): FreeCAD.Console.PrintError( "{}, surface {}, Error: " "No volume elements found!\n" - .format(sectionprint_obj.Label, name) + .format(sectionprint_obj.Label, sectionprint_obj.Name) ) f.write("** Error: empty list\n") @@ -676,15 +672,13 @@ class FemInputWriterCcx(writerbase.FemInputWriter): f.write("\n***********************************************************\n") f.write("** SectionPrint Constraints\n") f.write("** written by {} function\n".format(sys._getframe().f_code.co_name)) - obj = 0 for femobj in self.sectionprint_objects: # femobj --> dict, FreeCAD document object is femobj["Object"] - obj = obj + 1 sectionprint_obj = femobj["Object"] f.write("** {}\n".format(sectionprint_obj.Label)) f.write( "*SECTION PRINT, SURFACE=SECTIONFACE{}, NAME=SECTIONPRINT{}\n" - .format(obj, obj) + .format(sectionprint_obj.Name, sectionprint_obj.Name) ) f.write("SOF, SOM, SOAREA\n") diff --git a/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp b/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp index 074f7bade4..937740938d 100644 --- a/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp +++ b/src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp @@ -3359,7 +3359,7 @@ Evolumes ** constraints sectionprint surface sets ** written by write_surfaces_constraints_sectionprint function ** ConstraintSectionPrint -*SURFACE, NAME=SECTIONFACE1 +*SURFACE, NAME=SECTIONFACEConstraintSectionPrint 811,S4 872,S2 880,S1 @@ -3425,7 +3425,7 @@ ConstraintFixed,3 ** SectionPrint Constraints ** written by write_constraints_sectionprint function ** ConstraintSectionPrint -*SECTION PRINT, SURFACE=SECTIONFACE1, NAME=SECTIONPRINT1 +*SECTION PRINT, SURFACE=SECTIONFACEConstraintSectionPrint, NAME=SECTIONPRINTConstraintSectionPrint SOF, SOM, SOAREA ***********************************************************