Skip to content

Commit

Permalink
Merge branch 'uccnc_postprocessor' of https://github.com/papaathome/F…
Browse files Browse the repository at this point in the history
…reeCAD into uccnc_postprocessor
  • Loading branch information
papaathome committed Mar 26, 2021
2 parents 5abd19f + ce6c53a commit 8d186b5
Show file tree
Hide file tree
Showing 45 changed files with 2,473 additions and 1,985 deletions.
2 changes: 2 additions & 0 deletions package/fedora/freecad.spec
Expand Up @@ -339,3 +339,5 @@ fi
%files data
%{_datadir}/%{name}/
%{_docdir}/%{name}/%{name}.q*
%{_docdir}/%{name}/CONTRIBUTORS
%{_docdir}/%{name}/LICENSE.html
2 changes: 2 additions & 0 deletions src/App/ExpressionParser.l
Expand Up @@ -274,6 +274,8 @@ EXPO [eE][-+]?[0-9]+
"kV" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloVolt; yylval.quantity.unitStr = yytext; return UNIT; // kilo Volt
"mV" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliVolt; yylval.quantity.unitStr = yytext; return UNIT; // milli Volt

"MS" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaSiemens; yylval.quantity.unitStr = yytext; return UNIT; // mega Siemens
"kS" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloSiemens; yylval.quantity.unitStr = yytext; return UNIT; // kilo Siemens
"S" COUNTCHARS; yylval.quantity.scaler = Quantity::Siemens; yylval.quantity.unitStr = yytext; return UNIT; // Siemens (A^2*s^3/kg/m^2)
"mS" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliSiemens; yylval.quantity.unitStr = yytext; return UNIT; // milli Siemens
"uS" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroSiemens; yylval.quantity.unitStr = yytext; return UNIT; // micro Siemens
Expand Down
3 changes: 3 additions & 0 deletions src/App/FreeCADInit.py
Expand Up @@ -731,6 +731,8 @@ def report(self,msg,func,*args,**kargs):
App.Units.MilliVolt = App.Units.Quantity('mV')
App.Units.KiloVolt = App.Units.Quantity('kV')

App.Units.MegaSiemens = App.Units.Quantity('MS')
App.Units.KiloSiemens = App.Units.Quantity('kS')
App.Units.Siemens = App.Units.Quantity('S')
App.Units.MilliSiemens = App.Units.Quantity('mS')
App.Units.MicroSiemens = App.Units.Quantity('uS')
Expand Down Expand Up @@ -807,6 +809,7 @@ def report(self,msg,func,*args,**kargs):
App.Units.ElectricalInductance = App.Units.Unit(2,1,-2,-2)
App.Units.ElectricalConductance = App.Units.Unit(-2,-1,3,2)
App.Units.ElectricalResistance = App.Units.Unit(2,1,-3,-2)
App.Units.ElectricalConductivity = App.Units.Unit(-3,-1,3,2)
App.Units.AmountOfSubstance = App.Units.Unit(0,0,0,0,0,1)
App.Units.LuminousIntensity = App.Units.Unit(0,0,0,0,0,0,1)

Expand Down
2 changes: 2 additions & 0 deletions src/Base/Quantity.cpp
Expand Up @@ -331,6 +331,8 @@ Quantity Quantity::Volt (1e+6 ,Unit(2,1,-3,-1)); // Volt (k
Quantity Quantity::MilliVolt (1e+3 ,Unit(2,1,-3,-1));
Quantity Quantity::KiloVolt (1e+9 ,Unit(2,1,-3,-1));

Quantity Quantity::MegaSiemens (1.0 ,Unit(-2,-1,3,2));
Quantity Quantity::KiloSiemens (1e-3 ,Unit(-2,-1,3,2));
Quantity Quantity::Siemens (1e-6 ,Unit(-2,-1,3,2)); // Siemens (A^2*s^3/kg/m^2)
Quantity Quantity::MilliSiemens (1e-9 ,Unit(-2,-1,3,2));
Quantity Quantity::MicroSiemens (1e-12 ,Unit(-2,-1,3,2));
Expand Down
2 changes: 2 additions & 0 deletions src/Base/Quantity.h
Expand Up @@ -268,6 +268,8 @@ class BaseExport Quantity
static Quantity MilliVolt;
static Quantity KiloVolt;

static Quantity MegaSiemens;
static Quantity KiloSiemens;
static Quantity Siemens;
static Quantity MilliSiemens;
static Quantity MicroSiemens;
Expand Down
908 changes: 460 additions & 448 deletions src/Base/QuantityLexer.c

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/Base/QuantityParser.l
Expand Up @@ -164,6 +164,8 @@ CGRP '\,'[0-9][0-9][0-9]
"kV" yylval = Quantity::KiloVolt; return UNIT; // kilo Volt
"mV" yylval = Quantity::MilliVolt; return UNIT; // milli Volt

"MS" yylval = Quantity::MegaSiemens; return UNIT; // mega Siemens
"kS" yylval = Quantity::KiloSiemens; return UNIT; // kilo Siemens
"S" yylval = Quantity::Siemens; return UNIT; // Siemens (A^2*s^3/kg/m^2)
"mS" yylval = Quantity::MilliSiemens; return UNIT; // milli Siemens
"\xC2\xB5S" yylval = Quantity::MicroSiemens; return UNIT; // micro Siemens
Expand Down
2 changes: 2 additions & 0 deletions src/Base/Unit.cpp
Expand Up @@ -447,6 +447,7 @@ QString Unit::getTypeString(void) const
if(*this == Unit::ElectricalInductance ) return QString::fromLatin1("ElectricalInductance");
if(*this == Unit::ElectricalConductance ) return QString::fromLatin1("ElectricalConductance");
if(*this == Unit::ElectricalResistance ) return QString::fromLatin1("ElectricalResistance");
if(*this == Unit::ElectricalConductivity ) return QString::fromLatin1("ElectricalConductivity");
if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance");
if(*this == Unit::LuminousIntensity ) return QString::fromLatin1("LuminousIntensity");
if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure");
Expand Down Expand Up @@ -495,6 +496,7 @@ Unit Unit::ElectricalCapacitance(-2,-1,4,2);
Unit Unit::ElectricalInductance(2,1,-2,-2);
Unit Unit::ElectricalConductance(-2,-1,3,2);
Unit Unit::ElectricalResistance(2,1,-3,-2);
Unit Unit::ElectricalConductivity(-3,-1,3,2);
Unit Unit::AmountOfSubstance(0,0,0,0,0,1);
Unit Unit::LuminousIntensity(0,0,0,0,0,0,1);

Expand Down
1 change: 1 addition & 0 deletions src/Base/Unit.h
Expand Up @@ -121,6 +121,7 @@ class BaseExport Unit
static Unit ElectricalInductance;
static Unit ElectricalConductance;
static Unit ElectricalResistance;
static Unit ElectricalConductivity;
static Unit AmountOfSubstance;
static Unit LuminousIntensity;

Expand Down
18 changes: 18 additions & 0 deletions src/Base/UnitsSchemaInternal.cpp
Expand Up @@ -360,6 +360,24 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 1e12;
}
}
else if (unit == Unit::ElectricalConductivity) {
if (UnitValue < 1e-3) {
unitString = QString::fromLatin1("mS/m");
factor = 1e-12;
}
else if (UnitValue < 1.0) {
unitString = QString::fromLatin1("S/m");
factor = 1e-9;
}
else if (UnitValue < 1e3) {
unitString = QString::fromLatin1("kS/m");
factor = 1e-6;
}
else {
unitString = QString::fromLatin1("MS/m");
factor = 1e-3;
}
}
else if (unit == Unit::ElectricalCapacitance) {
if (UnitValue < 1e-15) {
unitString = QString::fromLatin1("pF");
Expand Down
18 changes: 18 additions & 0 deletions src/Base/UnitsSchemaMKS.cpp
Expand Up @@ -307,6 +307,24 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
factor = 1e12;
}
}
else if (unit == Unit::ElectricalConductivity) {
if (UnitValue < 1e-3) {
unitString = QString::fromLatin1("mS/m");
factor = 1e-12;
}
else if (UnitValue < 1.0) {
unitString = QString::fromLatin1("S/m");
factor = 1e-9;
}
else if (UnitValue < 1e3) {
unitString = QString::fromLatin1("kS/m");
factor = 1e-6;
}
else {
unitString = QString::fromLatin1("MS/m");
factor = 1e-3;
}
}
else if (unit == Unit::ElectricalCapacitance) {
if (UnitValue < 1e-15) {
unitString = QString::fromLatin1("pF");
Expand Down
2 changes: 1 addition & 1 deletion src/Ext/freecad/CMakeLists.txt
@@ -1,5 +1,5 @@
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c
"from distutils.sysconfig import get_python_lib; print(get_python_lib())"
"from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix='', plat_specific=True))"
OUTPUT_VARIABLE python_libs OUTPUT_STRIP_TRAILING_WHITESPACE )
SET(PYTHON_MAIN_DIR ${python_libs})

Expand Down
1 change: 1 addition & 0 deletions src/Gui/DlgUnitsCalculatorImp.cpp
Expand Up @@ -81,6 +81,7 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
<< Base::Unit::ElectricalInductance
<< Base::Unit::ElectricalConductance
<< Base::Unit::ElectricalResistance
<< Base::Unit::ElectricalConductivity
<< Base::Unit::ElectricCharge
<< Base::Unit::ElectricCurrent
<< Base::Unit::ElectricPotential
Expand Down
3 changes: 0 additions & 3 deletions src/Gui/PropertyView.cpp
Expand Up @@ -89,9 +89,6 @@ PropertyView::PropertyView(QWidget *parent)
tabs = new QTabWidget (this);
tabs->setObjectName(QString::fromUtf8("propertyTab"));
tabs->setTabPosition(QTabWidget::South);
#if defined(Q_OS_WIN32)
tabs->setTabShape(QTabWidget::Triangular);
#endif
pLayout->addWidget(tabs, 0, 0);

propertyEditorView = new Gui::PropertyEditor::PropertyEditor();
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Fem/Gui/Resources/ui/MeshGmsh.ui
Expand Up @@ -34,7 +34,7 @@
<item row="1" column="0">
<widget class="QLabel" name="l_dimension">
<property name="text">
<string>Mesh element dimension:</string>
<string>Element dimension:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -135,7 +135,7 @@
<item row="2" column="0">
<widget class="QLabel" name="I_order">
<property name="text">
<string>Mesh order</string>
<string>Element order:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -195,7 +195,7 @@
</property>
</spacer>
</item>
<item row="7" column="0">
<item row="7" column="0">
<widget class="QPushButton" name="pb_get_gmsh_version">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
Expand All @@ -208,7 +208,7 @@
</property>
</widget>
</item>
</layout>
</layout>
</item>
</layout>
</item>
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femguiutils/selection_widgets.py
Expand Up @@ -231,7 +231,7 @@ def sizeHint(self):

class GeometryElementsSelection(QtGui.QWidget):

def __init__(self, ref, eltypes=[], multigeom, showHintEmptyList):
def __init__(self, ref, eltypes, multigeom, showHintEmptyList):
super(GeometryElementsSelection, self).__init__()
# init ui stuff
FreeCADGui.Selection.clearSelection()
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Fem/femviewprovider/view_mesh_gmsh.py
Expand Up @@ -96,10 +96,9 @@ def setEdit(self, vobj, mode=0):
)
"""

# overwrite unsetEdit, hide mesh object on task panel exit
# overwrite unsetEdit
def unsetEdit(self, vobj, mode):
FreeCADGui.Control.closeDialog()
self.ViewObject.hide()
return True

def doubleClicked(self, vobj):
Expand Down
11 changes: 10 additions & 1 deletion src/Mod/Material/StandardMaterial/TEMPLATE.FCMat
Expand Up @@ -94,7 +94,7 @@ YoungsModulus =


[Thermal]
; Description to be updated
; Specific capacity in [FreeCAD SpecificHeat unit]
; https://en.wikipedia.org/wiki/Heat_capacity
SpecificHeat =

Expand All @@ -106,6 +106,15 @@ ThermalConductivity =
; https://en.wikipedia.org/wiki/Volumetric_thermal_expansion_coefficient
ThermalExpansionCoefficient =

[Electrical]
; The ratio to the permittivity of the vacuum
; https://en.wikipedia.org/wiki/Relative_permittivity
RelativePermittivity =

; The electrical conductivity in [FreeCAD ElectricalConductivity unit]
; https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity
ElectricalConductivity =


[Architectural]
; Description to be updated
Expand Down
10 changes: 7 additions & 3 deletions src/Mod/Material/Templatematerial.yml
Expand Up @@ -142,11 +142,11 @@
SpecificHeat:
Type: 'Quantity'
URL: 'https://en.wikipedia.org/wiki/Heat_capacity'
Description: " "
Description: "Specific capacity in [FreeCAD SpecificHeat unit]"
ThermalConductivity:
Type: 'Quantity'
URL: 'https://en.wikipedia.org/wiki/Thermal_conductivity'
Description: "Thermal conductivity in [FreCAD ThermalConductivity unit]"
Description: "Thermal conductivity in [FreeCAD ThermalConductivity unit]"
ThermalExpansionCoefficient:
Type: 'Quantity'
URL: 'https://en.wikipedia.org/wiki/Volumetric_thermal_expansion_coefficient'
Expand All @@ -155,7 +155,11 @@
RelativePermittivity:
Type: 'Float'
URL: 'https://en.wikipedia.org/wiki/Relative_permittivity'
Description: "a material property, expressing the ratio to the permittivity of the Vacuum"
Description: "The ratio to the permittivity of the vacuum"
ElectricalConductivity:
Type: 'Quantity'
URL: 'https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity'
Description: "The electrical conductivity in [FreeCAD ElectricalConductivity unit]"
- Architectural:
Color:
Type: 'String'
Expand Down
33 changes: 21 additions & 12 deletions src/Mod/Mesh/Gui/RemeshGmsh.cpp
Expand Up @@ -92,16 +92,25 @@ GmshWidget::GmshWidget(QWidget* parent, Qt::WindowFlags fl)
d->syntax = new Gui::DockWnd::ReportHighlighter(d->ui.outputWindow);
d->ui.outputWindow->setReadOnly(true);

// Meshing algorithms
// 1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=Frontal Quad
// 9=Packing of Parallelograms
d->ui.method->addItem(tr("Automatic"), static_cast<int>(2));
d->ui.method->addItem(tr("Adaptive"), static_cast<int>(1));
d->ui.method->addItem(QString::fromLatin1("Delaunay"), static_cast<int>(5));
d->ui.method->addItem(tr("Frontal"), static_cast<int>(6));
d->ui.method->addItem(QString::fromLatin1("BAMG"), static_cast<int>(5));
d->ui.method->addItem(tr("Frontal Quad"), static_cast<int>(6));
d->ui.method->addItem(tr("Parallelograms"), static_cast<int>(9));
// 2D Meshing algorithms
// https://gmsh.info/doc/texinfo/gmsh.html#index-Mesh_002eAlgorithm
enum {
MeshAdapt = 1,
Automatic = 2,
Delaunay = 5,
FrontalDelaunay = 6,
BAMG = 7,
FrontalDelaunayForQuads = 8,
PackingOfParallelograms = 9
};

d->ui.method->addItem(tr("Automatic"), static_cast<int>(Automatic));
d->ui.method->addItem(tr("Adaptive"), static_cast<int>(MeshAdapt));
d->ui.method->addItem(QString::fromLatin1("Delaunay"), static_cast<int>(Delaunay));
d->ui.method->addItem(tr("Frontal"), static_cast<int>(FrontalDelaunay));
d->ui.method->addItem(QString::fromLatin1("BAMG"), static_cast<int>(BAMG));
d->ui.method->addItem(tr("Frontal Quad"), static_cast<int>(FrontalDelaunayForQuads));
d->ui.method->addItem(tr("Parallelograms"), static_cast<int>(PackingOfParallelograms));
}

GmshWidget::~GmshWidget()
Expand Down Expand Up @@ -316,9 +325,9 @@ bool RemeshGmsh::writeProject(QString& inpFile, QString& outFile)
<< " Exit;\n"
<< "EndIf\n"
<< "Merge \"" << stl.filePath() << "\";\n\n"
<< "// 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=Frontal Quad)\n"
<< "// 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=Frontal Quad, 9=Packing of Parallelograms)\n"
<< "Mesh.Algorithm = " << algorithm << ";\n\n"
<< "// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree)\n"
<< "// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 7=MMG3D, 9=R-tree, 10=HTX)\n"
<< "// Mesh.Algorithm3D = 1;\n\n"
<< "Mesh.CharacteristicLengthMax = " << maxSize << ";\n"
<< "Mesh.CharacteristicLengthMin = " << minSize << ";\n\n"
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/MeshPart/Gui/Tessellation.cpp
Expand Up @@ -484,9 +484,9 @@ bool Mesh2ShapeGmsh::writeProject(QString& inpFile, QString& outFile)
<< "// Second order nodes are created by linear interpolation instead by curvilinear\n"
<< "Mesh.SecondOrderLinear = 1;\n\n"
<< "// mesh algorithm, only a few algorithms are usable with 3D boundary layer generation\n"
<< "// 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=DelQuad)\n"
<< "// 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=BAMG, 8=DelQuad, 9=Packing of Parallelograms)\n"
<< "Mesh.Algorithm = " << algorithm << ";\n"
<< "// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree)\n"
<< "// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 7=MMG3D, 9=R-tree, 10=HTX)\n"
<< "Mesh.Algorithm3D = 1;\n\n"
<< "// meshing\n"
<< "// set geometrical tolerance (also used for merging nodes)\n"
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Part/Gui/CommandSimple.cpp
Expand Up @@ -181,7 +181,7 @@ CmdPartPointsFromMesh::CmdPartPointsFromMesh()
sToolTipText = QT_TR_NOOP("Create selectable points object from selected mesh object");
sWhatsThis = "Part_PointsFromMesh";
sStatusTip = sToolTipText;
sPixmap = "Part_Points_from_Mesh";
sPixmap = "Part_PointsFromMesh";
}

void CmdPartPointsFromMesh::activated(int iMsg)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Part/Gui/Resources/Part.qrc
Expand Up @@ -72,7 +72,7 @@
<file>icons/tools/Part_Mirror.svg</file>
<file>icons/tools/Part_Offset.svg</file>
<file>icons/tools/Part_Offset2D.svg</file>
<file>icons/tools/Part_Points_from_Mesh.svg</file>
<file>icons/tools/Part_PointsFromMesh.svg</file>
<file>icons/tools/Part_ProjectionOnSurface.svg</file>
<file>icons/tools/Part_Refine_Shape.svg</file>
<file>icons/tools/Part_Reverse_Shape.svg</file>
Expand Down

0 comments on commit 8d186b5

Please sign in to comment.