Skip to content

Commit

Permalink
Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Dec 7, 2013
2 parents bfcbf3b + f53579f commit 9be9233
Show file tree
Hide file tree
Showing 8 changed files with 597 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Base/QuantityParser.l
Expand Up @@ -76,7 +76,7 @@ ID [a-z][a-z0-9]*
"'" yylval = Quantity::Foot; return UNIT; // foot
"thou" yylval = Quantity::Thou; return UNIT; // thou (in/1000)
"mil" yylval = Quantity::Thou; return UNIT; // mil (the thou in US)
"yr" yylval = Quantity::Yard; return UNIT; // yard
"yd" yylval = Quantity::Yard; return UNIT; // yard
"mi" yylval = Quantity::Mile; return UNIT; // mile


Expand Down
13 changes: 11 additions & 2 deletions src/Base/QuantityPyImp.cpp
Expand Up @@ -82,8 +82,17 @@ PyObject* QuantityPy::pow(PyObject * args)

PyObject* QuantityPy::getUserPrefered(PyObject *args)
{
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
return 0;
QString uus;
double factor;
Py::Tuple res(3);

QString uss = getQuantityPtr()->getUserString(factor,uus);

res[0] = Py::String(uss.toLatin1());
res[1] = Py::Float(factor);
res[2] = Py::String(uus.toLatin1());

return Py::new_reference_to(res);
}

PyObject* QuantityPy::getValueAs(PyObject *args)
Expand Down
2 changes: 1 addition & 1 deletion src/Base/UnitsSchemaInternal.cpp
Expand Up @@ -55,7 +55,7 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
factor = 1.0;
}else if(UnitValue < 10000000.0){
unitString = QString::fromLatin1("m");
factor = 10000.0;
factor = 1000.0;
}else if(UnitValue < 100000000000.0 ){
unitString = QString::fromLatin1("km");
factor = 10000000.0;
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Fem/App/FemResultObject.cpp
Expand Up @@ -39,6 +39,7 @@ FemResultObject::FemResultObject()
{
ADD_PROPERTY_TYPE(DataType,(""), "General",Prop_None,"Type identifier of the result data");
ADD_PROPERTY_TYPE(Unit,(Base::Quantity()), "General",Prop_None,"Unit of the data");
ADD_PROPERTY_TYPE(ElementNumbers,(0), "Data",Prop_None,"Numbers of the result elements");
}

FemResultObject::~FemResultObject()
Expand Down
4 changes: 3 additions & 1 deletion src/Mod/Fem/App/FemResultObject.h
Expand Up @@ -26,6 +26,7 @@

#include <App/DocumentObject.h>
#include <App/PropertyUnits.h>
#include <App/PropertyStandard.h>
#include <App/FeaturePython.h>
#include "FemResultObject.h"

Expand All @@ -45,7 +46,8 @@ class AppFemExport FemResultObject : public App::DocumentObject
App::PropertyString DataType;
/// Unit and factor of the values
App::PropertyQuantity Unit;

/// List of element numbers in this result object
App::PropertyIntegerList ElementNumbers;
/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";
Expand Down
62 changes: 62 additions & 0 deletions src/Mod/Fem/CalculixLib.py
@@ -0,0 +1,62 @@
#***************************************************************************
#* *
#* Copyright (c) 2013 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************




def readResult(frd_input) :
input = open(frd_input,"r")
nodes_x = []
nodes_y = []
nodes_z = []
disp_x = []
disp_y = []
disp_z = []
displaced_nodes_x = []
displaced_nodes_y = []
displaced_nodes_z = []

disp_found = False
nodes_found = True
while True:
line=input.readline()
if not line: break
#first lets extract the node and coordinate information from the results file
if nodes_found and (line[1:3] == "-1"):
nodes_x.append(float(line[13:25]))
nodes_y.append(float(line[25:37]))
nodes_z.append(float(line[37:49]))
#Check if we found displacement section
if line[5:9] == "DISP":
disp_found = True
#we found a displacement line in the frd file
if disp_found and (line[1:3] == "-1"):
disp_x.append(float(line[13:25]))
disp_y.append(float(line[25:37]))
disp_z.append(float(line[37:49]))
#Check for the end of a section
if line[1:3] == "-3":
#the section with the displacements and the nodes ended
disp_found = False
nodes_found = False

input.close()

0 comments on commit 9be9233

Please sign in to comment.