Start updating Fem workbench
This commit is contained in:
parent
214235e753
commit
fede3064b5
|
@ -121,7 +121,7 @@ CmdFemCreateAnalysis::CmdFemCreateAnalysis()
|
|||
sToolTipText = QT_TR_NOOP("Create a FEM analysis");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Fem_FemMesh";
|
||||
sPixmap = "Fem_Analysis";
|
||||
}
|
||||
|
||||
void CmdFemCreateAnalysis::activated(int iMsg)
|
||||
|
@ -166,6 +166,70 @@ void CmdFemCreateAnalysis::activated(int iMsg)
|
|||
}
|
||||
|
||||
bool CmdFemCreateAnalysis::isActive(void)
|
||||
{
|
||||
return !ActiveAnalysis;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
DEF_STD_CMD_A(CmdFemAddPart);
|
||||
|
||||
CmdFemAddPart::CmdFemAddPart()
|
||||
: Command("Fem_FemAddPart")
|
||||
{
|
||||
sAppModule = "Fem";
|
||||
sGroup = QT_TR_NOOP("Fem");
|
||||
sMenuText = QT_TR_NOOP("Add a part to the Analysis");
|
||||
sToolTipText = QT_TR_NOOP("Add a part to the Analysis");
|
||||
sWhatsThis = sToolTipText;
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "Fem_AddFemMesh";
|
||||
}
|
||||
|
||||
void CmdFemAddPart::activated(int iMsg)
|
||||
{
|
||||
#ifndef FCWithNetgen
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("Your FreeCAD is build without NETGEN support. Meshing will not work...."));
|
||||
return;
|
||||
#endif
|
||||
|
||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||
|
||||
if (selection.size() != 1) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("Select an edge, face or body. Only one body is allowed."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!selection[0].isObjectTypeOf(Part::Feature::getClassTypeId())){
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong object type"),
|
||||
QObject::tr("Fillet works only on parts"));
|
||||
return;
|
||||
}
|
||||
|
||||
Part::Feature *base = static_cast<Part::Feature*>(selection[0].getObject());
|
||||
|
||||
std::string AnalysisName = getUniqueObjectName("FemAnalysis");
|
||||
|
||||
std::string MeshName = getUniqueObjectName((std::string(base->getNameInDocument()) +"_Mesh").c_str());
|
||||
|
||||
|
||||
openCommand("Create FEM analysis");
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemAnalysis','%s')",AnalysisName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject','%s')",MeshName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().ActiveObject.Shape = App.activeDocument().%s",base->getNameInDocument());
|
||||
doCommand(Doc,"App.activeDocument().%s.Member = App.activeDocument().%s",AnalysisName.c_str(),MeshName.c_str());
|
||||
addModule(Gui,"FemGui");
|
||||
doCommand(Gui,"FemGui.setActiveAnalysis(App.activeDocument().%s)",AnalysisName.c_str());
|
||||
|
||||
updateActive();
|
||||
|
||||
}
|
||||
|
||||
bool CmdFemAddPart::isActive(void)
|
||||
{
|
||||
if (Gui::Control().activeDialog())
|
||||
return false;
|
||||
|
@ -173,6 +237,7 @@ bool CmdFemCreateAnalysis::isActive(void)
|
|||
return Gui::Selection().countObjectsOfType(type) > 0;
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdFemConstraintBearing);
|
||||
|
@ -569,6 +634,7 @@ void CreateFemCommands(void)
|
|||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
rcCmdMgr.addCommand(new CmdFemCreateFromShape());
|
||||
rcCmdMgr.addCommand(new CmdFemCreateAnalysis());
|
||||
rcCmdMgr.addCommand(new CmdFemAddPart());
|
||||
rcCmdMgr.addCommand(new CmdFemCreateNodesSet());
|
||||
rcCmdMgr.addCommand(new CmdFemDefineNodesSet());
|
||||
rcCmdMgr.addCommand(new CmdFemConstraintBearing());
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<qresource>
|
||||
<file>icons/Fem_FemMesh.svg</file>
|
||||
<file>icons/Fem_FemMesh_createnodebypoly.svg</file>
|
||||
<file>icons/Fem_AddFemMesh.svg</file>
|
||||
<file>icons/Fem_Analysis.svg</file>
|
||||
<file>icons/Fem_ConstraintForce.svg</file>
|
||||
<file>icons/Fem_ConstraintFixed.svg</file>
|
||||
<file>icons/Fem_ConstraintBearing.svg</file>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
id="svg2860"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="MachDist_FemMesh.svg"
|
||||
sodipodi:docname="MachDist_AddFemMesh.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
version="1.1">
|
||||
<defs
|
||||
|
@ -98,6 +98,7 @@
|
|||
<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>
|
||||
|
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
121
src/Mod/Fem/Gui/Resources/icons/Fem_Analysis.svg
Normal file
121
src/Mod/Fem/Gui/Resources/icons/Fem_Analysis.svg
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?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_FemMesh.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" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3377"
|
||||
id="radialGradient3703"
|
||||
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">
|
||||
<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>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3377"
|
||||
id="radialGradient3705"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
cx="148.88333"
|
||||
cy="81.869568"
|
||||
fx="148.88333"
|
||||
fy="81.869568"
|
||||
r="19.467436"
|
||||
gradientTransform="matrix(1.3852588,-5.1367833e-2,3.7056289e-2,0.9993132,-60.392403,7.7040438)" />
|
||||
<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" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.5"
|
||||
inkscape:cx="-0.90909091"
|
||||
inkscape:cy="29.272727"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="750"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="0" />
|
||||
<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">
|
||||
<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"
|
||||
x="10.909091"
|
||||
y="54.909092"
|
||||
id="text3014"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3016"
|
||||
x="10.909091"
|
||||
y="54.909092">A</tspan></text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.7 KiB |
|
@ -57,6 +57,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
fem->setCommand("FEM");
|
||||
*fem << "Fem_CreateFromShape"
|
||||
<< "Fem_CreateAnalysis"
|
||||
<< "Fem_FemAddPart"
|
||||
<< "Fem_CreateNodesSet"
|
||||
<< "Fem_ConstraintFixed"
|
||||
<< "Fem_ConstraintForce"
|
||||
|
@ -66,17 +67,17 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
return root;
|
||||
}
|
||||
|
||||
Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
{
|
||||
Gui::MenuItem* root = StdWorkbench::setupMenuBar();
|
||||
Gui::MenuItem* item = root->findItem("&Windows");
|
||||
Gui::MenuItem* fem = new Gui::MenuItem;
|
||||
root->insertItem(item, fem);
|
||||
fem->setCommand("&FEM");
|
||||
*fem << "Fem_CreateFromShape"
|
||||
<< "Fem_MechanicalMaterial"
|
||||
<< "Fem_NewMechanicalAnalysis"
|
||||
<< "Fem_MechanicalJobControl"
|
||||
Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
{
|
||||
Gui::MenuItem* root = StdWorkbench::setupMenuBar();
|
||||
Gui::MenuItem* item = root->findItem("&Windows");
|
||||
Gui::MenuItem* fem = new Gui::MenuItem;
|
||||
root->insertItem(item, fem);
|
||||
fem->setCommand("&FEM");
|
||||
*fem << "Fem_CreateFromShape"
|
||||
<< "Fem_MechanicalMaterial"
|
||||
<< "Fem_NewMechanicalAnalysis"
|
||||
<< "Fem_MechanicalJobControl"
|
||||
<< "Fem_CreateAnalysis"
|
||||
<< "Fem_CreateNodesSet"
|
||||
<< "Fem_ConstraintFixed"
|
||||
|
@ -84,6 +85,6 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "Fem_ConstraintBearing"
|
||||
<< "Fem_ConstraintGear"
|
||||
<< "Fem_ConstraintPulley";
|
||||
|
||||
return root;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user