Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
wmayer 2013-12-31 13:26:14 +01:00
commit 9503ad0e1f
20 changed files with 943 additions and 76 deletions

View File

@ -64,7 +64,8 @@ SOURCE_GROUP("Module" FILES ${Mod_SRCS})
SET(FemScripts_SRCS
convert2TetGen.py
FemLib.py
FemLib.py
CalculixLib.py
MechanicalAnalysis.py
MechanicalMaterial.py
)

View File

@ -181,21 +181,42 @@ PyObject* FemMeshPy::compute(PyObject *args)
PyObject* FemMeshPy::addNode(PyObject *args)
{
double x,y,z;
if (!PyArg_ParseTuple(args, "ddd",&x,&y,&z))
return 0;
int i = -1;
if (PyArg_ParseTuple(args, "ddd",&x,&y,&z)){
try {
SMESH_Mesh* mesh = getFemMeshPtr()->getSMesh();
SMESHDS_Mesh* meshDS = mesh->GetMeshDS();
SMDS_MeshNode* node = meshDS->AddNode(x,y,z);
if (!node)
throw std::runtime_error("Failed to add node");
return Py::new_reference_to(Py::Int(node->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
return 0;
}
}
PyErr_Clear();
try {
SMESH_Mesh* mesh = getFemMeshPtr()->getSMesh();
SMESHDS_Mesh* meshDS = mesh->GetMeshDS();
SMDS_MeshNode* node = meshDS->AddNode(x,y,z);
if (!node)
throw std::runtime_error("Failed to add node");
return Py::new_reference_to(Py::Int(node->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
return 0;
if (PyArg_ParseTuple(args, "dddi",&x,&y,&z,&i)){
try {
SMESH_Mesh* mesh = getFemMeshPtr()->getSMesh();
SMESHDS_Mesh* meshDS = mesh->GetMeshDS();
SMDS_MeshNode* node = meshDS->AddNodeWithID(x,y,z,i);
if (!node)
throw std::runtime_error("Failed to add node");
return Py::new_reference_to(Py::Int(node->GetID()));
}
catch (const std::exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
return 0;
}
}
PyErr_SetString(PyExc_TypeError, "addNode() accepts:\n"
"-- addNode(x,y,z)\n"
"-- addNode(x,y,z,ElemId)\n");
return 0;
}
PyObject* FemMeshPy::addEdge(PyObject *args)
@ -356,24 +377,47 @@ PyObject* FemMeshPy::addVolume(PyObject *args)
}
SMDS_MeshVolume* vol=0;
switch(Nodes.size()){
case 4:
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3]);
if (!vol)
throw std::runtime_error("Failed to add Tet4 volume");
break;
case 8:
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7]);
if (!vol)
throw std::runtime_error("Failed to add Tet10 volume");
break;
case 10:
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9]);
if (!vol)
throw std::runtime_error("Failed to add Tet10 volume");
break;
if(ElementId != -1) {
switch(Nodes.size()){
case 4:
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],ElementId);
if (!vol)
throw std::runtime_error("Failed to add Tet4 volume");
break;
case 8:
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],ElementId);
if (!vol)
throw std::runtime_error("Failed to add Tet10 volume");
break;
case 10:
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],ElementId);
if (!vol)
throw std::runtime_error("Failed to add Tet10 volume");
break;
default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|18] are allowed"); //unknown face type
}
}else{
switch(Nodes.size()){
case 4:
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3]);
if (!vol)
throw std::runtime_error("Failed to add Tet4 volume");
break;
case 8:
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7]);
if (!vol)
throw std::runtime_error("Failed to add Tet10 volume");
break;
case 10:
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9]);
if (!vol)
throw std::runtime_error("Failed to add Tet10 volume");
break;
default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|18] are allowed"); //unknown face type
}
default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|18] are allowed"); //unknown face type
}
return Py::new_reference_to(Py::Int(vol->GetID()));

View File

@ -40,6 +40,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");
ADD_PROPERTY_TYPE(Mesh,(0), "General",Prop_None,"Link to the corosbonding mesh");
}
FemResultObject::~FemResultObject()

View File

@ -48,10 +48,13 @@ public:
App::PropertyQuantity Unit;
/// List of element numbers in this result object
App::PropertyIntegerList ElementNumbers;
/// Link to the corosbonding mesh
App::PropertyLink Mesh;
/// returns the type name of the ViewProvider
//virtual const char* getViewProviderName(void) const {
// return "FemGui::ViewProviderFemSet";
//}
virtual const char* getViewProviderName(void) const {
return "FemGui::ViewProviderResult";
}
virtual App::DocumentObjectExecReturn *execute(void) {
return App::DocumentObject::StdReturn;
}

View File

@ -32,7 +32,7 @@
using namespace Fem;
using namespace App;
PROPERTY_SOURCE(Fem::FemResultValue, App::DocumentObject)
PROPERTY_SOURCE(Fem::FemResultValue, Fem::FemResultObject)
FemResultValue::FemResultValue()

View File

@ -32,7 +32,7 @@
using namespace Fem;
using namespace App;
PROPERTY_SOURCE(Fem::FemResultVector, App::DocumentObject)
PROPERTY_SOURCE(Fem::FemResultVector, Fem::FemResultObject)
FemResultVector::FemResultVector()

View File

@ -1,5 +1,6 @@
#***************************************************************************
#* *
#* Copyright (c) 2013 - Joachim Zettler *
#* Copyright (c) 2013 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
@ -21,42 +22,158 @@
#***************************************************************************
import FreeCAD,os
from math import pow,sqrt
__title__="FreeCAD Calculix library"
__author__ = "Juergen Riegel "
__url__ = "http://www.freecadweb.org"
if open.__module__ == '__builtin__':
pyopen = open # because we'll redefine open below
# read a calculix result file and extract the nodes, displacement vectores and stress values.
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 = []
input = pyopen(frd_input,"r")
nodes = {}
disp = {}
stress = {}
elements = {}
disp_found = False
nodes_found = True
nodes_found = False
stress_found = False
elements_found = False
elem = -1
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
line=input.readline()
if not line: break
#Check if we found nodes section
if line[4:6] == "2C":
nodes_found = True
#first lets extract the node and coordinate information from the results file
if nodes_found and (line[1:3] == "-1"):
elem = int(line[4:13])
nodes_x = float(line[13:25])
nodes_y = float(line[25:37])
nodes_z = float(line[37:49])
nodes[elem] = FreeCAD.Vector(nodes_x,nodes_y,nodes_z)
#Check if we found nodes section
if line[4:6] == "3C":
elements_found = True
#first lets extract element number
if elements_found and (line[1:3] == "-1"):
elem = int(line[4:13])
#then the 10 id's for the Tet10 element
if elements_found and (line[1:3] == "-2"):
node_id_2 = int(line[3:13])
node_id_1 = int(line[13:23])
node_id_3 = int(line[23:33])
node_id_4 = int(line[33:43])
node_id_5 = int(line[43:53])
node_id_7 = int(line[53:63])
node_id_6 = int(line[63:73])
node_id_9 = int(line[73:83])
node_id_8 = int(line[83:93])
node_id_10 = int(line[93:103])
elements[elem] = (node_id_1,node_id_2,node_id_3,node_id_4,node_id_5,node_id_6,node_id_7,node_id_8,node_id_9,node_id_10)
#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"):
elem = int(line[4:13])
disp_x = float(line[13:25])
disp_y = float(line[25:37])
disp_z = float(line[37:49])
disp[elem] = FreeCAD.Vector(disp_x,disp_y,disp_z)
if line[5:11] == "STRESS":
stress_found = True
#we found a displacement line in the frd file
if stress_found and (line[1:3] == "-1"):
elem = int(line[4:13])
stress_1 = float(line[13:25])
stress_2 = float(line[25:37])
stress_3 = float(line[37:49])
stress_4 = float(line[49:61])
stress_5 = float(line[61:73])
stress_6 = float(line[73:85])
stress[elem] = (stress_1,stress_2,stress_3,stress_4,stress_5,stress_6)
#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
stress_found = False
elements_found = False
input.close()
FreeCAD.Console.PrintLog('Read Calculix result: ' + `len(nodes)` + ' Nodes, ' + `len(disp)` + ' Displacements and ' + `len(stress)` + ' Stress values\n')
return {'Nodes':nodes,'Tet10Elem':elements,'Displacement':disp,'Stress':stress}
def importFrd(filename):
m = readResult(filename);
MeshObject = None
if(len(m) > 0):
import Fem
AnalysisName = os.path.splitext(os.path.basename(filename))[0]
AnalysisObject = FreeCAD.ActiveDocument.addObject('Fem::FemAnalysis','Analysis')
AnalysisObject.Label = AnalysisName
if(m.has_key('Tet10Elem') and m.has_key('Nodes') ):
mesh = Fem.FemMesh()
nds = m['Nodes']
for i in nds:
n = nds[i]
mesh.addNode(n[0],n[1],n[2],i)
elms = m['Tet10Elem']
for i in elms:
e = elms[i]
mesh.addVolume([e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9]],i)
MeshObject = FreeCAD.ActiveDocument.addObject('Fem::FemMeshObject','ResultMesh')
MeshObject.FemMesh = mesh
AnalysisObject.Member = AnalysisObject.Member + [MeshObject]
if(m.has_key('Displacement')):
disp = m['Displacement']
o = FreeCAD.ActiveDocument.addObject('Fem::FemResultVector','Displacement')
o.Values = disp.values()
o.ElementNumbers = disp.keys()
if(MeshObject):
o.Mesh = MeshObject
AnalysisObject.Member = AnalysisObject.Member + [o]
if(m.has_key('Stress')):
stress = m['Stress']
o = FreeCAD.ActiveDocument.addObject('Fem::FemResultValue','MisesStress')
mstress = []
for i in stress.values():
# van mises stress (http://en.wikipedia.org/wiki/Von_Mises_yield_criterion)
mstress.append( sqrt( pow( i[0] - i[1] ,2) + pow( i[1] - i[2] ,2) + pow( i[2] - i[0] ,2) + 6 * (pow(i[3],2)+pow(i[4],2)+pow(i[5],2) ) ) )
o.Values = mstress
o.ElementNumbers = stress.keys()
if(MeshObject):
o.Mesh = MeshObject
AnalysisObject.Member = AnalysisObject.Member + [o]
if(FreeCAD.GuiUp):
import FemGui
FemGui.setActiveAnalysis(AnalysisObject)
def insert(filename,docname):
"called when freecad wants to import a file"
try:
doc = FreeCAD.getDocument(docname)
except:
doc = FreeCAD.newDocument(docname)
FreeCAD.ActiveDocument = doc
importFrd(filename)
def open(filename):
"called when freecad opens a file"
docname = os.path.splitext(os.path.basename(filename))[0]
insert(filename,docname)

View File

@ -45,6 +45,7 @@
#include "ViewProviderFemConstraintForce.h"
#include "ViewProviderFemConstraintGear.h"
#include "ViewProviderFemConstraintPulley.h"
#include "ViewProviderResult.h"
#include "Workbench.h"
//#include "resources/qrc_Fem.cpp"
@ -94,6 +95,7 @@ void FemGuiExport initFemGui()
FemGui::ViewProviderFemConstraintForce ::init();
FemGui::ViewProviderFemConstraintGear ::init();
FemGui::ViewProviderFemConstraintPulley ::init();
FemGui::ViewProviderResult ::init();
Base::Interpreter().loadModule("MechanicalAnalysis");
Base::Interpreter().loadModule("MechanicalMaterial");

View File

@ -133,6 +133,8 @@ SET(FemGui_SRCS_ViewProvider
ViewProviderFemConstraintGear.h
ViewProviderFemConstraintPulley.cpp
ViewProviderFemConstraintPulley.h
ViewProviderResult.cpp
ViewProviderResult.h
)
SOURCE_GROUP("ViewProvider" FILES ${FemGui_SRCS_ViewProvider})

View File

@ -13,6 +13,9 @@
<file>icons/Fem_AddPart.svg</file>
<file>icons/Fem_Material.svg</file>
<file>icons/Fem_NewAnalysis.svg</file>
<file>icons/Fem_Result.svg</file>
<file>icons/Fem_ResultDisplacement.svg</file>
<file>icons/Fem_ResultStress.svg</file>
<file>translations/Fem_af.qm</file>
<file>translations/Fem_de.qm</file>
<file>translations/Fem_fi.qm</file>

View File

@ -15,7 +15,7 @@
id="svg2860"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Fem_FemMesh.svg"
sodipodi:docname="Fem_Analysis.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
@ -79,7 +79,7 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.5"
inkscape:cx="-0.90909091"
inkscape:cx="1.1818182"
inkscape:cy="29.272727"
inkscape:current-layer="layer1"
showgrid="true"
@ -87,8 +87,8 @@
inkscape:grid-bbox="true"
inkscape:window-width="1280"
inkscape:window-height="750"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-x="1349"
inkscape:window-y="189"
inkscape:window-maximized="0" />
<metadata
id="metadata2865">
@ -98,7 +98,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@ -108,7 +108,7 @@
inkscape:groupmode="layer">
<text
xml:space="preserve"
style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffff00;fill-opacity:1;stroke:#241c1c;font-family:DejaVu Serif;-inkscape-font-specification:DejaVu Serif"
style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffff00;fill-opacity:1;stroke:#241c1c;font-family:DejaVu Serif;-inkscape-font-specification:DejaVu Serif;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:4.09999999999999960"
x="10.909091"
y="54.909092"
id="text3014"

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2860"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Fem_ResultDisplacement.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs2862">
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3692"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2868" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-8"
id="radialGradient3703-7"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)" />
<linearGradient
id="linearGradient3377-8">
<stop
id="stop3379-0"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381-6"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="radialGradient3703-1"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)" />
<linearGradient
id="linearGradient3377-6">
<stop
style="stop-color:#00ff00;stop-opacity:1;"
offset="0"
id="stop3784" />
<stop
id="stop3786"
offset="0.5"
style="stop-color:#0003f8;stop-opacity:1;" />
<stop
id="stop3381-5"
offset="1"
style="stop-color:#ff0000;stop-opacity:1;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3788"
x1="-0.01679256"
y1="14.293757"
x2="64.0868"
y2="14.293757"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3814"
x1="163.77647"
y1="96.396309"
x2="179.47777"
y2="96.396309"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3816"
x1="12.594974"
y1="31.093735"
x2="53.898453"
y2="32.617771"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.01411218,-1.3055708,0.47684233,0.03863846,15.500382,72.056154)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8.7393979"
inkscape:cx="24.04931"
inkscape:cy="35.562796"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="1042"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata2865">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="fill:url(#linearGradient3816);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.32764792;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="M 45.533176,61.752047 17.129484,61.744506 17.468441,2.1933317 45.262316,2.4730246 z"
id="rect3520-7"
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.51256716px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 13.110404,79.471866 c 0.09167,0 0.183347,0 0,0 z"
id="path2394"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2860"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Fem_ResultStress.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs2862">
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3692"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2868" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-8"
id="radialGradient3703-7"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)" />
<linearGradient
id="linearGradient3377-8">
<stop
id="stop3379-0"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381-6"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="radialGradient3703-1"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)" />
<linearGradient
id="linearGradient3377-6">
<stop
style="stop-color:#00ff00;stop-opacity:1;"
offset="0"
id="stop3784" />
<stop
id="stop3786"
offset="0.5"
style="stop-color:#0003f8;stop-opacity:1;" />
<stop
id="stop3381-5"
offset="1"
style="stop-color:#ff0000;stop-opacity:1;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3788"
x1="-0.01679256"
y1="14.293757"
x2="64.0868"
y2="14.293757"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3814"
x1="163.77647"
y1="96.396309"
x2="179.47777"
y2="96.396309"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3816"
x1="12.594974"
y1="31.093735"
x2="53.898453"
y2="32.617771"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.01411218,-1.3055708,0.47684233,0.03863846,2.7992781,72.628276)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8.7393979"
inkscape:cx="24.04931"
inkscape:cy="35.562796"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="1042"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata2865">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="fill:url(#linearGradient3816);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.32764792;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="M 32.832072,62.324169 4.4283805,62.316628 4.7673371,2.7654535 32.561212,3.0451464 z"
id="rect3520-7"
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.51256716px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 13.110404,79.471866 c 0.09167,0 0.183347,0 0,0 z"
id="path2394"
inkscape:connector-curvature="0" />
<path
style="fill:#ffad00;fill-opacity:1;stroke:#000000;stroke-width:2.15225554px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 41.368413,56.44961 48.632684,9.5952235 55.77787,56.958895 z"
id="path3822-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2860"
sodipodi:version="0.32"
inkscape:version="0.48.4 r9939"
sodipodi:docname="Fem_Result.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs2862">
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient3692"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2868" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-8"
id="radialGradient3703-7"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)" />
<linearGradient
id="linearGradient3377-8">
<stop
id="stop3379-0"
offset="0"
style="stop-color:#faff2b;stop-opacity:1;" />
<stop
id="stop3381-6"
offset="1"
style="stop-color:#ffaa00;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="radialGradient3703-1"
gradientUnits="userSpaceOnUse"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)" />
<linearGradient
id="linearGradient3377-6">
<stop
style="stop-color:#00ff00;stop-opacity:1;"
offset="0"
id="stop3784" />
<stop
id="stop3786"
offset="0.5"
style="stop-color:#0003f8;stop-opacity:1;" />
<stop
id="stop3381-5"
offset="1"
style="stop-color:#ff0000;stop-opacity:1;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3788"
x1="-0.01679256"
y1="14.293757"
x2="64.0868"
y2="14.293757"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3814"
x1="163.77647"
y1="96.396309"
x2="179.47777"
y2="96.396309"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-6"
id="linearGradient3816"
x1="12.594974"
y1="31.093735"
x2="53.898453"
y2="32.617771"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.01411218,-1.3055708,0.47684233,0.03863846,2.7992781,72.628276)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8.7393979"
inkscape:cx="24.04931"
inkscape:cy="35.562796"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1137"
inkscape:window-x="1042"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata2865">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="fill:url(#linearGradient3816);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.32764792;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="M 32.832072,62.324169 4.4283805,62.316628 4.7673371,2.7654535 32.561212,3.0451464 z"
id="rect3520-7"
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1.51256716px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 13.110404,79.471866 c 0.09167,0 0.183347,0 0,0 z"
id="path2394"
inkscape:connector-curvature="0" />
<rect
style="fill:#ffff00;stroke:#241c1c"
id="rect3818"
width="18.536747"
height="22.656023"
x="38.675434"
y="23.036079" />
<path
style="fill:#ffad00;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 40.792285,19.202863 47.77217,8.6758225 54.637632,19.317287 z"
id="path3822-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:#ffad00;fill-opacity:1;stroke:#000000;stroke-width:1.00258374px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 41.136849,49.268555 6.978582,10.583484 6.864181,-10.698521 z"
id="path3822-2-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -50,7 +50,7 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemAnalysis, Gui::ViewProviderDocumentObject
ViewProviderFemAnalysis::ViewProviderFemAnalysis()
{
sPixmap = "Fem_Analysis";
}

View File

@ -60,6 +60,9 @@ public:
virtual bool onDelete(const std::vector<std::string> &);
// shows solid in the tree
virtual bool isShow(void) const{return true;}
protected:
virtual bool setEdit(int ModNum);
virtual void unsetEdit(int ModNum);

View File

@ -166,6 +166,7 @@ App::PropertyFloatConstraint::Constraints ViewProviderFemMesh::floatRange = {1.0
ViewProviderFemMesh::ViewProviderFemMesh()
{
sPixmap = "Fem_FemMesh";
ADD_PROPERTY(PointColor,(App::Color(0.7f,0.7f,0.7f)));
ADD_PROPERTY(PointSize,(5.0f));

View File

@ -0,0 +1,73 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Standard_math.hxx>
#endif
#include "ViewProviderResult.h"
#include <Gui/Command.h>
#include <Gui/Document.h>
#include <Gui/Control.h>
#include <Mod/Fem/App/FemAnalysis.h>
#include "TaskDlgAnalysis.h"
using namespace FemGui;
PROPERTY_SOURCE(FemGui::ViewProviderResult, Gui::ViewProviderDocumentObject)
ViewProviderResult::ViewProviderResult()
{
sPixmap = "Fem_Result";
}
ViewProviderResult::~ViewProviderResult()
{
}
// Python feature -----------------------------------------------------------------------
namespace Gui {
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(FemGui::ViewProviderResultPython, FemGui::ViewProviderResult)
/// @endcond
// explicit template instantiation
template class FemGuiExport ViewProviderPythonFeatureT<ViewProviderResult>;
}

View File

@ -0,0 +1,65 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef FEM_ViewProviderResult_H
#define FEM_ViewProviderResult_H
#include <Gui/ViewProviderGeometryObject.h>
#include <Gui/ViewProviderBuilder.h>
#include <Gui/ViewProviderPythonFeature.h>
class SoCoordinate3;
class SoDrawStyle;
class SoIndexedFaceSet;
class SoIndexedLineSet;
class SoShapeHints;
class SoMaterialBinding;
namespace FemGui
{
class FemGuiExport ViewProviderResult : public Gui::ViewProviderDocumentObject
{
PROPERTY_HEADER(FemGui::ViewProviderResult);
public:
/// constructor
ViewProviderResult();
/// destructor
~ViewProviderResult();
// shows solid in the tree
virtual bool isShow(void) const{return true;}
protected:
};
typedef Gui::ViewProviderPythonFeatureT<ViewProviderResult> ViewProviderResultPython;
} //namespace FemGui
#endif // FEM_ViewProviderResult_H

View File

@ -6,7 +6,7 @@ SET(Material_SRCS
importFCMat.py
MaterialEditor.py
)
SOURCE_GROUP("" FILES ${Material_SRCS})
SOURCE_GROUP("Module" FILES ${Material_SRCS})
# collect all the material cards:
#FILE( GLOB MaterialLib_Files ./StandardMaterial/*.FCMat ./StandardMaterial/*.txt )
@ -17,8 +17,9 @@ SET (MaterialLib_Files
StandardMaterial/PLA.FCMat
StandardMaterial/Readme.txt
)
SOURCE_GROUP("MatLib" FILES ${MaterialLib_Files})
SET(all_files ${Material_SRCS})
SET(all_files ${Material_SRCS} ${MaterialLib_Files} )
ADD_CUSTOM_TARGET(Material ALL
SOURCES ${all_files}
@ -26,6 +27,7 @@ ADD_CUSTOM_TARGET(Material ALL
fc_copy_sources(Material "${CMAKE_BINARY_DIR}/Mod/Material" ${all_files})
fc_target_copy_resource(Material
${CMAKE_SOURCE_DIR}/src/Mod/Material
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Material