FEM: Abaqus writer, add method parameter for elem and group options
This commit is contained in:
committed by
Yorik van Havre
parent
ab2fbcbcad
commit
b142ce5bc7
@@ -1171,11 +1171,8 @@ void FemMesh::read(const char *FileName)
|
||||
}
|
||||
}
|
||||
|
||||
void FemMesh::writeABAQUS(const std::string &Filename) const
|
||||
void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool groupParam) const
|
||||
{
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem/Abaqus");
|
||||
int elemParam = hGrp->GetInt("AbaqusElementChoice", 1);
|
||||
bool groupParam = hGrp->GetBool("AbaqusWriteGroups", false);
|
||||
/*
|
||||
* elemParam:
|
||||
* 0 = all elements
|
||||
@@ -1585,8 +1582,12 @@ void FemMesh::write(const char *FileName) const
|
||||
myMesh->ExportDAT(File.filePath().c_str());
|
||||
}
|
||||
else if (File.hasExtension("inp") ) {
|
||||
// get Abaqus inp prefs
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem/Abaqus");
|
||||
int elemParam = hGrp->GetInt("AbaqusElementChoice", 1);
|
||||
bool groupParam = hGrp->GetBool("AbaqusWriteGroups", false);
|
||||
// write ABAQUS Output
|
||||
writeABAQUS(File.filePath());
|
||||
writeABAQUS(File.filePath(), elemParam, groupParam);
|
||||
}
|
||||
#ifdef FC_USE_VTK
|
||||
else if (File.hasExtension("vtk") || File.hasExtension("vtu") ) {
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
/// import from files
|
||||
void read(const char *FileName);
|
||||
void write(const char *FileName) const;
|
||||
void writeABAQUS(const std::string &Filename) const;
|
||||
void writeABAQUS(const std::string &Filename, int elemParam, bool groupParam) const;
|
||||
|
||||
private:
|
||||
void copyMeshData(const FemMesh&);
|
||||
|
||||
@@ -71,7 +71,11 @@
|
||||
</Methode>
|
||||
<Methode Name="writeABAQUS" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>write out as ABAQUS.</UserDocu>
|
||||
<UserDocu>write out as ABAQUS inp
|
||||
writeABAQUS(file, int elemParam, bool groupParam)
|
||||
elemParam: 0 = all elements, 1 = highest elements only, 2 = FEM elements only (only edges not belonging to faces and faces not belonging to volumes)
|
||||
groupParam: true = write group data, false = do not write group data
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setTransform">
|
||||
|
||||
@@ -640,13 +640,16 @@ PyObject* FemMeshPy::write(PyObject *args)
|
||||
PyObject* FemMeshPy::writeABAQUS(PyObject *args)
|
||||
{
|
||||
char* Name;
|
||||
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
|
||||
int elemParam;
|
||||
PyObject* groupParam;
|
||||
if (!PyArg_ParseTuple(args, "etiO!","utf-8",&Name,&elemParam,&PyBool_Type,&groupParam))
|
||||
return 0;
|
||||
std::string EncodedName = std::string(Name);
|
||||
PyMem_Free(Name);
|
||||
bool grpParam = PyObject_IsTrue(groupParam) ? true : false;
|
||||
|
||||
try {
|
||||
getFemMeshPtr()->writeABAQUS(EncodedName.c_str());
|
||||
getFemMeshPtr()->writeABAQUS(EncodedName.c_str(), elemParam, grpParam);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
|
||||
Reference in New Issue
Block a user