Merge branch 'master' into master

This commit is contained in:
troyp76
2021-07-07 18:12:26 +10:00
committed by GitHub
2 changed files with 42 additions and 26 deletions

View File

@@ -654,31 +654,10 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
caller_method_name=sys._getframe().f_code.co_name,
)
# TODO move code parts from this method to base writer module
# into get_constraints_sectionprint_faces method
def write_surfacefaces_constraints_sectionprint(self, f, femobj, sectionprint_obj):
for o, elem_tup in sectionprint_obj.References:
for elem in elem_tup:
ref_shape = o.Shape.getElement(elem)
if ref_shape.ShapeType == "Face":
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, sectionprint_obj.Name, len(v))
)
for i in v:
f.write("{},S{}\n".format(i[0], i[1]))
else:
# no volume elements found, shell elements not allowed
FreeCAD.Console.PrintError(
"{}, surface {}, Error: "
"No volume elements found!\n"
.format(sectionprint_obj.Label, sectionprint_obj.Name)
)
f.write("** Error: empty list\n")
f.write("*SURFACE, NAME=SECTIONFACE{}\n".format(sectionprint_obj.Name))
for i in femobj["SectionPrintFaces"]:
f.write("{},S{}\n".format(i[0], i[1]))
def constraint_sectionprint_writer(self, f, femobj, sectionprint_obj):
f.write(

View File

@@ -395,8 +395,45 @@ class FemInputWriter():
# FreeCAD.Console.PrintLog("{}\n".format(femobj["ContactMasterFaces"]))
def get_constraints_sectionprint_faces(self):
pass
# TODO implement
# TODO: use meshtools to get the surfaces
# see constraint contact or constrint tie
for femobj in self.sectionprint_objects:
# femobj --> dict, FreeCAD document object is femobj["Object"]
sectionprint_obj = femobj["Object"]
if len(sectionprint_obj.References) > 1:
FreeCAD.Console.PrintError(
"Only one reference shape allowed for a section print "
"but {} found: {}\n"
.format(len(sectionprint_obj.References), sectionprint_obj.References)
)
for o, elem_tup in sectionprint_obj.References:
for elem in elem_tup:
# there should only be one reference for each section print object
# in the gui this is checked
ref_shape = o.Shape.getElement(elem)
if ref_shape.ShapeType == "Face":
v = self.mesh_object.FemMesh.getccxVolumesByFace(ref_shape)
if len(v) > 0:
femobj["SectionPrintFaces"] = v
# volume elements found
FreeCAD.Console.PrintLog(
"{}, surface {}, {} touching volume elements found\n"
.format(sectionprint_obj.Label, sectionprint_obj.Name, len(v))
)
else:
# no volume elements found, shell elements not allowed
FreeCAD.Console.PrintError(
"{}, surface {}, Error: "
"No volume elements found!\n"
.format(sectionprint_obj.Label, sectionprint_obj.Name)
)
else:
# in Gui only Faces can be added
FreeCAD.Console.PrintError(
"Wrong reference shapt type for {} "
"Only Faces are allowed, but a {} was found.\n"
.format(sectionprint_obj.Name, ref_shape.ShapeType)
)
def get_constraints_heatflux_faces(self):
pass