…
To get the eigenfrequency values in GUI we have to write .dat file reader first. It’s not hard, but it takes time (I can help if someone is willing to code it)
Hi PrzemoF,
I tried to write a small function/definiton to read in the eigenfrequency values stored in the .dat file.
Maybe it is usefull but do not expect to much I am no computer scientist.
BR Howil
# -*- coding: utf-8 -*-
import numpy as np
def dat_ef_reader(foldername, filename, freecad_fem_mesh_fn, skh=7, nr_ef=10):
#==============================================================================
# Data readin
#==============================================================================
f = open(foldername+filename) # opening the input file
# skipping the header
for n in np.arange(skh):
text2 = f.readline()
# output list
ef_data = []
# reading the eigenfrequencies
for n in np.arange(nr_ef):
ef_data.append(np.fromstring(f.readline(), dtype=float, sep=' '))
f.close() # closing the input file
return ef_data
#==============================================================================
# Setting default parameter
#==============================================================================
# foldername of .dat file has to be adopted for windows !!!!!!!
foldername = '/tmp/'
# filename of Freecad FEM mesh name
freecad_fem_mesh_fn = 'Pad_Mesh'
filename = freecad_fem_mesh_fn+'.dat'
# setting skip_header and skip_footer
skh = 7
# number of eigenfrequencies to readin
nr_ef = 10
ef_data = dat_ef_reader(foldername, filename, freecad_fem_mesh_fn, skh, nr_ef)
#==============================================================================
# Testing the found data
#==============================================================================
ef_counter = 3
print(" Eigenfrequency nr "+str(ef_counter)+" : "+str(ef_data[ef_counter][3])+" Hz (CYCLES/TIME)")
Hi Howil,
Thanks for the code! I’m sure we could make it work, but we’ll need something that can be easily extended to parse different parts of the .dat file.
I started using ccxFrdReader as the base [1]. It’s not fully usable yet, but it can produce this:
If you would like to have the CalculiX file named the way you would like to have it you could make a new DocumentObject with your favorite name and copy the FEMMesh to the new Document object by python.
old_label = "Face_Mesh" # the name displayed in FreeCAD Tree View
new_name = "My_Fancy_FEM_Mesh"
newobj = App.ActiveDocument.addObject("Fem::FemMeshObject",new_name)
newobj.FemMesh = App.ActiveDocument.getObjectsByLabel(old_label)[0].FemMesh