Merge branch 'master' into feature/toggle-active-cmd-support-for-dressups

This commit is contained in:
mlampert
2019-12-20 19:40:25 -08:00
committed by GitHub
53 changed files with 5764 additions and 4756 deletions

View File

@@ -164,10 +164,11 @@ EXPO [eE][-+]?[0-9]+
"mm" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliMetre; yylval.quantity.unitStr = yytext; return UNIT; // milli meter (internal standard length)
"cm" COUNTCHARS; yylval.quantity.scaler = Quantity::CentiMetre; yylval.quantity.unitStr = yytext; return UNIT; // centi meter
"dm" COUNTCHARS; yylval.quantity.scaler = Quantity::DeciMetre; yylval.quantity.unitStr = yytext; return UNIT; // deci meter
"m" COUNTCHARS; yylval.quantity.scaler = Quantity::Metre; yylval.quantity.unitStr = yytext; return UNIT; // metre
"m" COUNTCHARS; yylval.quantity.scaler = Quantity::Metre; yylval.quantity.unitStr = yytext; return UNIT; // Metre
"km" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloMetre; yylval.quantity.unitStr = yytext; return UNIT; // kilo meter
"l" COUNTCHARS; yylval.quantity.scaler = Quantity::Liter; yylval.quantity.unitStr = yytext; return UNIT; // Liter dm^3
"ml" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliLiter; yylval.quantity.unitStr = yytext; return UNIT; // milli Liter
"ug" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroGram; yylval.quantity.unitStr = yytext; return UNIT; // micro gram
"\xC2\xB5g" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroGram; yylval.quantity.unitStr = yytext; return UNIT; // micro gram
@@ -183,14 +184,15 @@ EXPO [eE][-+]?[0-9]+
"A" COUNTCHARS; yylval.quantity.scaler = Quantity::Ampere; yylval.quantity.unitStr = yytext; return UNIT; // Ampere (internal standard electric current)
"mA" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliAmpere; yylval.quantity.unitStr = yytext; return UNIT; // milli Ampere
"kA" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloAmpere; yylval.quantity.unitStr = yytext; return UNIT; // kilo Ampere
"MA" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaAmpere; yylval.quantity.unitStr = yytext; return UNIT; // Mega Ampere
"MA" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaAmpere; yylval.quantity.unitStr = yytext; return UNIT; // mega Ampere
"K" COUNTCHARS; yylval.quantity.scaler = Quantity::Kelvin; yylval.quantity.unitStr = yytext; return UNIT; // Kelvin (internal standard thermodynamic temperature)
"mK" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliKelvin; yylval.quantity.unitStr = yytext; return UNIT; // Kelvin
"\xC2\xB5K" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroKelvin; yylval.quantity.unitStr = yytext; return UNIT; // Kelvin
"uK" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroKelvin; yylval.quantity.unitStr = yytext; return UNIT; // Kelvin
"mK" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliKelvin; yylval.quantity.unitStr = yytext; return UNIT; // milli Kelvin
"\xC2\xB5K" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroKelvin; yylval.quantity.unitStr = yytext; return UNIT; // micro Kelvin
"uK" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroKelvin; yylval.quantity.unitStr = yytext; return UNIT; // micro Kelvin
"mol" COUNTCHARS; yylval.quantity.scaler = Quantity::Mole; yylval.quantity.unitStr = yytext; return UNIT; // Mole (internal standard amount of substance)
"mmol" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliMole; yylval.quantity.unitStr = yytext; return UNIT; // milli Mole
"cd" COUNTCHARS; yylval.quantity.scaler = Quantity::Candela; yylval.quantity.unitStr = yytext; return UNIT; // Candela (internal standard luminous intensity)
@@ -203,8 +205,6 @@ EXPO [eE][-+]?[0-9]+
"yd" COUNTCHARS; yylval.quantity.scaler = Quantity::Yard; yylval.quantity.unitStr = yytext; return UNIT; // yard
"mi" COUNTCHARS; yylval.quantity.scaler = Quantity::Mile; yylval.quantity.unitStr = yytext; return UNIT; // mile
"lb" COUNTCHARS; yylval.quantity.scaler = Quantity::Pound; yylval.quantity.unitStr = yytext; return UNIT; // pound
"lbm" COUNTCHARS; yylval.quantity.scaler = Quantity::Pound; yylval.quantity.unitStr = yytext; return UNIT; // pound
"oz" COUNTCHARS; yylval.quantity.scaler = Quantity::Ounce; yylval.quantity.unitStr = yytext; return UNIT; // ounce
@@ -214,14 +214,17 @@ EXPO [eE][-+]?[0-9]+
"lbf" COUNTCHARS; yylval.quantity.scaler = Quantity::PoundForce; yylval.quantity.unitStr = yytext; return UNIT; // pound
"N" COUNTCHARS; yylval.quantity.scaler = Quantity::Newton; yylval.quantity.unitStr = yytext; return UNIT; // Newton (kg*m/s^2)a-za-za-z
"kN" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloNewton; yylval.quantity.unitStr = yytext; return UNIT; // Newton
"MN" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaNewton; yylval.quantity.unitStr = yytext; return UNIT; // Newton
"mN" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliNewton; yylval.quantity.unitStr = yytext; return UNIT; // Newton
"mN" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliNewton; yylval.quantity.unitStr = yytext; return UNIT; // milli Newton
"kN" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloNewton; yylval.quantity.unitStr = yytext; return UNIT; // kilo Newton
"MN" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaNewton; yylval.quantity.unitStr = yytext; return UNIT; // mega Newton
"Pa" COUNTCHARS; yylval.quantity.scaler = Quantity::Pascal; yylval.quantity.unitStr = yytext; return UNIT; // Pascal (kg/m*s^2 or N/m^2)
"kPa" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloPascal; yylval.quantity.unitStr = yytext; return UNIT; // Pascal
"MPa" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaPascal; yylval.quantity.unitStr = yytext; return UNIT; // Pascal
"GPa" COUNTCHARS; yylval.quantity.scaler = Quantity::GigaPascal; yylval.quantity.unitStr = yytext; return UNIT; // Pascal
"kPa" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloPascal; yylval.quantity.unitStr = yytext; return UNIT; // kilo Pascal
"MPa" COUNTCHARS; yylval.quantity.scaler = Quantity::MegaPascal; yylval.quantity.unitStr = yytext; return UNIT; // mega Pascal
"GPa" COUNTCHARS; yylval.quantity.scaler = Quantity::GigaPascal; yylval.quantity.unitStr = yytext; return UNIT; // giga Pascal
"bar" COUNTCHARS; yylval.quantity.scaler = Quantity::Bar; yylval.quantity.unitStr = yytext; return UNIT; // Bar
"mbar" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliBar; yylval.quantity.unitStr = yytext; return UNIT; // milli Bar
"Torr" COUNTCHARS; yylval.quantity.scaler = Quantity::Torr; yylval.quantity.unitStr = yytext; return UNIT; // portion of Pascal ( 101325/760 )
"mTorr" COUNTCHARS; yylval.quantity.scaler = Quantity::mTorr; yylval.quantity.unitStr = yytext; return UNIT; //
@@ -232,13 +235,40 @@ EXPO [eE][-+]?[0-9]+
"ksi" COUNTCHARS; yylval.quantity.scaler = Quantity::KSI; yylval.quantity.unitStr = yytext; return UNIT; // 1000 x pounds/in^2
"W" COUNTCHARS; yylval.quantity.scaler = Quantity::Watt; yylval.quantity.unitStr = yytext; return UNIT; // Watt (kg*m^2/s^3)
"mW" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliWatt; yylval.quantity.unitStr = yytext; return UNIT; // milli Watt
"kW" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloWatt; yylval.quantity.unitStr = yytext; return UNIT; // kilo Watt
"VA" COUNTCHARS; yylval.quantity.scaler = Quantity::VoltAmpere; yylval.quantity.unitStr = yytext; return UNIT; // VoltAmpere (kg*m^2/s^3)
"V" COUNTCHARS; yylval.quantity.scaler = Quantity::Volt; yylval.quantity.unitStr = yytext; return UNIT; // Volt (kg*m^2/A/s^3)
"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
"C" COUNTCHARS; yylval.quantity.scaler = Quantity::Coulomb; yylval.quantity.unitStr = yytext; return UNIT; // Coulomb (A*s)
"T" COUNTCHARS; yylval.quantity.scaler = Quantity::Tesla; yylval.quantity.unitStr = yytext; return UNIT; // Tesla (kg/s^2/A)
"F" COUNTCHARS; yylval.quantity.scaler = Quantity::Farad; yylval.quantity.unitStr = yytext; return UNIT; // Farad (s^4*A^2/m^2/kg)
"mF" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliFarad; yylval.quantity.unitStr = yytext; return UNIT; // milli Farad
"\xC2\xB5F" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroFarad; yylval.quantity.unitStr = yytext; return UNIT; // micro Farad
"uF" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroFarad; yylval.quantity.unitStr = yytext; return UNIT; // micro Farad
"nF" COUNTCHARS; yylval.quantity.scaler = Quantity::NanoFarad; yylval.quantity.unitStr = yytext; return UNIT; // nano Farad
"pF" COUNTCHARS; yylval.quantity.scaler = Quantity::PicoFarad; yylval.quantity.unitStr = yytext; return UNIT; // pico Farad
"H" COUNTCHARS; yylval.quantity.scaler = Quantity::Henry; yylval.quantity.unitStr = yytext; return UNIT; // Henry (kg*m^2/s^2/A^2)
"mH" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliHenry; yylval.quantity.unitStr = yytext; return UNIT; // milli Henry
"\xC2\xB5H" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroHenry; yylval.quantity.unitStr = yytext; return UNIT; // micro Henry
"uH" COUNTCHARS; yylval.quantity.scaler = Quantity::MicroHenry; yylval.quantity.unitStr = yytext; return UNIT; // micro Henry)
"nH" COUNTCHARS; yylval.quantity.scaler = Quantity::NanoHenry; yylval.quantity.unitStr = yytext; return UNIT; // nano Henry
"J" COUNTCHARS; yylval.quantity.scaler = Quantity::Joule; yylval.quantity.unitStr = yytext; return UNIT; // Joule (kg*m^2/s^2)
"mJ" COUNTCHARS; yylval.quantity.scaler = Quantity::MilliJoule; yylval.quantity.unitStr = yytext; return UNIT; // milli Joule
"kJ" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloJoule; yylval.quantity.unitStr = yytext; return UNIT; // kilo Joule
"Nm" COUNTCHARS; yylval.quantity.scaler = Quantity::NewtonMeter; yylval.quantity.unitStr = yytext; return UNIT; // N*m = Joule
"VAs" COUNTCHARS; yylval.quantity.scaler = Quantity::VoltAmpereSecond; yylval.quantity.unitStr = yytext; return UNIT; // V*A*s = Joule
"CV" COUNTCHARS; yylval.quantity.scaler = Quantity::WattSecond; yylval.quantity.unitStr = yytext; return UNIT; //
"Ws" COUNTCHARS; yylval.quantity.scaler = Quantity::WattSecond; yylval.quantity.unitStr = yytext; return UNIT; // W*s = Joule
"kWh" COUNTCHARS; yylval.quantity.scaler = Quantity::KiloWattHour; yylval.quantity.unitStr = yytext; return UNIT; // 1 kWh = 3.6e6 J
"eV" COUNTCHARS; yylval.quantity.scaler = Quantity::ElectronVolt; yylval.quantity.unitStr = yytext; return UNIT; // 1 eV = 1.602176634e-19 J
"\xC2\xB0" COUNTCHARS; yylval.quantity.scaler = Quantity::Degree; yylval.quantity.unitStr = yytext; return UNIT; // degree (internal standard angle)
"deg" COUNTCHARS; yylval.quantity.scaler = Quantity::Degree; yylval.quantity.unitStr = yytext; return UNIT; // degree (internal standard angle)

View File

@@ -638,6 +638,7 @@ App.Units.DeciMetre = App.Units.Quantity('dm')
App.Units.Metre = App.Units.Quantity('m')
App.Units.KiloMetre = App.Units.Quantity('km')
App.Units.MilliLiter = App.Units.Quantity('ml')
App.Units.Liter = App.Units.Quantity('l')
App.Units.MicroGram = App.Units.Quantity('ug')
@@ -659,6 +660,7 @@ App.Units.Kelvin = App.Units.Quantity('K')
App.Units.MilliKelvin = App.Units.Quantity('mK')
App.Units.MicroKelvin = App.Units.Quantity('uK')
App.Units.MilliMole = App.Units.Quantity('mmol')
App.Units.Mole = App.Units.Quantity('mol')
App.Units.Candela = App.Units.Quantity('cd')
@@ -675,15 +677,18 @@ App.Units.Stone = App.Units.Quantity('st')
App.Units.Hundredweights= App.Units.Quantity('cwt')
App.Units.Newton = App.Units.Quantity('N')
App.Units.MilliNewton = App.Units.Quantity('mN')
App.Units.KiloNewton = App.Units.Quantity('kN')
App.Units.MegaNewton = App.Units.Quantity('MN')
App.Units.MilliNewton = App.Units.Quantity('mN')
App.Units.Pascal = App.Units.Quantity('Pa')
App.Units.KiloPascal = App.Units.Quantity('kPa')
App.Units.MegaPascal = App.Units.Quantity('MPa')
App.Units.GigaPascal = App.Units.Quantity('GPa')
App.Units.MilliBar = App.Units.Quantity('mbar')
App.Units.Bar = App.Units.Quantity('bar')
App.Units.PoundForce = App.Units.Quantity().PoundForce
App.Units.Torr = App.Units.Quantity().Torr
App.Units.mTorr = App.Units.Quantity().mTorr
@@ -693,19 +698,41 @@ App.Units.PSI = App.Units.Quantity('psi')
App.Units.KSI = App.Units.Quantity('ksi')
App.Units.Watt = App.Units.Quantity('W')
App.Units.MilliWatt = App.Units.Quantity('mW')
App.Units.KiloWatt = App.Units.Quantity('kW')
App.Units.VoltAmpere = App.Units.Quantity('VA')
App.Units.Volt = App.Units.Quantity('V')
App.Units.MilliVolt = App.Units.Quantity('mV')
App.Units.KiloVolt = App.Units.Quantity('kV')
App.Units.Coulomb = App.Units.Quantity('C')
App.Units.Tesla = App.Units.Quantity('T')
App.Units.PicoFarad = App.Units.Quantity('pF')
App.Units.NanoFarad = App.Units.Quantity('nF')
App.Units.MicroFarad = App.Units.Quantity('uF')
App.Units.MilliFarad = App.Units.Quantity('mF')
App.Units.Farad = App.Units.Quantity('F')
App.Units.NanoHenry = App.Units.Quantity('nH')
App.Units.MicroHenry = App.Units.Quantity('uH')
App.Units.MilliHenry = App.Units.Quantity('mH')
App.Units.Henry = App.Units.Quantity('H')
App.Units.Joule = App.Units.Quantity('J')
App.Units.MilliJoule = App.Units.Quantity('mJ')
App.Units.KiloJoule = App.Units.Quantity('kJ')
App.Units.NewtonMeter = App.Units.Quantity('Nm')
App.Units.VoltAmpereSecond = App.Units.Quantity('VAs')
App.Units.WattSecond = App.Units.Quantity('Ws')
App.Units.KiloWattHour = App.Units.Quantity('kWh')
App.Units.ElectronVolt = App.Units.Quantity('eV')
App.Units.MPH = App.Units.Quantity('mi/h')
App.Units.KMH = App.Units.Quantity('km/h')
App.Units.Degree = App.Units.Quantity('deg')
App.Units.Radian = App.Units.Quantity('rad')
App.Units.Gon = App.Units.Quantity('gon')
@@ -730,8 +757,12 @@ App.Units.Velocity = App.Units.Unit(1,0,-1)
App.Units.Acceleration = App.Units.Unit(1,0,-2)
App.Units.Temperature = App.Units.Unit(0,0,0,0,1)
App.Units.ElectricCurrent = App.Units.Unit(0,0,0,1)
App.Units.ElectricPotential = App.Units.Unit(2,1,-3,-1)
App.Units.ElectricCurrent = App.Units.Unit(0,0,0,1)
App.Units.ElectricPotential = App.Units.Unit(2,1,-3,-1)
App.Units.ElectricCharge = App.Units.Unit(0,0,1,1)
App.Units.MagneticFluxDensity = App.Units.Unit(0,1,-2,-1)
App.Units.ElectricalCapacitance = App.Units.Unit(-2,-1,4,2)
App.Units.ElectricalInductance = App.Units.Unit(2,1,-2,-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)

View File

@@ -40,15 +40,14 @@ TextDocument::TextDocument()
ADD_PROPERTY_TYPE(
Text, (""), 0, App::Prop_Hidden,
"Content of the document.");
ADD_PROPERTY_TYPE(
ReadOnly, (false), 0, App::Prop_None,
"Defines whether the content can be edited.");
}
void TextDocument::onChanged(const Property* prop)
{
if (prop == &Text)
textChanged();
else if (prop == &Label)
labelChanged();
DocumentObject::onChanged(prop);
}
@@ -57,7 +56,12 @@ const char* TextDocument::getViewProviderName() const
return "Gui::ViewProviderTextDocument";
}
boost::signals2::connection TextDocument::connect(const TextSlot &sub)
boost::signals2::connection TextDocument::connectText(const TextSlot &sub)
{
return textChanged.connect(sub);
}
boost::signals2::connection TextDocument::connectLabel(const TextSlot &sub)
{
return labelChanged.connect(sub);
}

View File

@@ -42,7 +42,6 @@ public:
using TextSlot = TextSignal::slot_type;
PropertyString Text;
PropertyBool ReadOnly;
TextDocument();
~TextDocument() {}
@@ -50,9 +49,12 @@ public:
void onChanged(const Property* prop);
const char* getViewProviderName() const;
boost::signals2::connection connect(const TextSlot &sub);
boost::signals2::connection connectText(const TextSlot &sub);
boost::signals2::connection connectLabel(const TextSlot &sub);
private:
TextSignal textChanged;
TextSignal labelChanged;
};
}

View File

@@ -246,7 +246,8 @@ Quantity Quantity::DeciMetre (100.0 ,Unit(1));
Quantity Quantity::Metre (1.0e3 ,Unit(1));
Quantity Quantity::KiloMetre (1.0e6 ,Unit(1));
Quantity Quantity::Liter (1000000.0 ,Unit(3));
Quantity Quantity::MilliLiter (1000.0 ,Unit(3));
Quantity Quantity::Liter (1.0e6 ,Unit(3));
Quantity Quantity::Hertz (1.0 ,Unit(0,0,-1));
Quantity Quantity::KiloHertz (1.0e3 ,Unit(0,0,-1));
@@ -272,6 +273,7 @@ Quantity Quantity::Kelvin (1.0 ,Unit(0,0,0,0,1));
Quantity Quantity::MilliKelvin (0.001 ,Unit(0,0,0,0,1));
Quantity Quantity::MicroKelvin (0.000001 ,Unit(0,0,0,0,1));
Quantity Quantity::MilliMole (0.001 ,Unit(0,0,0,0,0,1));
Quantity Quantity::Mole (1.0 ,Unit(0,0,0,0,0,1));
Quantity Quantity::Candela (1.0 ,Unit(0,0,0,0,0,0,1));
@@ -287,18 +289,21 @@ Quantity Quantity::Ounce (0.0283495231 ,Unit(0,1));
Quantity Quantity::Stone (6.35029318 ,Unit(0,1));
Quantity Quantity::Hundredweights (50.80234544 ,Unit(0,1));
Quantity Quantity::PoundForce (224.81 ,Unit(1,1,-2)); // Newton are ~= 0.22481 lbF
Quantity Quantity::PoundForce (224.81 ,Unit(1,1,-2)); // Newton are ~= 0.22481 lbF
Quantity Quantity::Newton (1000.0 ,Unit(1,1,-2)); // Newton (kg*m/s^2)
Quantity Quantity::Newton (1000.0 ,Unit(1,1,-2)); // Newton (kg*m/s^2)
Quantity Quantity::MilliNewton (1.0 ,Unit(1,1,-2));
Quantity Quantity::KiloNewton (1e+6 ,Unit(1,1,-2));
Quantity Quantity::MegaNewton (1e+9 ,Unit(1,1,-2));
Quantity Quantity::MilliNewton (1.0 ,Unit(1,1,-2));
Quantity Quantity::Pascal (0.001 ,Unit(-1,1,-2)); // Pascal (kg/m/s^2 or N/m^2)
Quantity Quantity::KiloPascal (1.00 ,Unit(-1,1,-2));
Quantity Quantity::MegaPascal (1000.0 ,Unit(-1,1,-2));
Quantity Quantity::GigaPascal (1e+6 ,Unit(-1,1,-2));
Quantity Quantity::MilliBar (0.1 ,Unit(-1,1,-2));
Quantity Quantity::Bar (100.0 ,Unit(-1,1,-2)); // 1 bar = 100 kPa
Quantity Quantity::Torr (101.325/760.0 ,Unit(-1,1,-2)); // Torr is a defined fraction of Pascal (kg/m/s^2 or N/m^2)
Quantity Quantity::mTorr (0.101325/760.0,Unit(-1,1,-2)); // Torr is a defined fraction of Pascal (kg/m/s^2 or N/m^2)
Quantity Quantity::yTorr (0.000101325/760.0 ,Unit(-1,1,-2)); // Torr is a defined fraction of Pascal (kg/m/s^2 or N/m^2)
@@ -306,15 +311,38 @@ Quantity Quantity::yTorr (0.000101325/760.0 ,Unit(-1,1,-2)); // Torr
Quantity Quantity::PSI (6.894744825494,Unit(-1,1,-2)); // pounds/in^2
Quantity Quantity::KSI (6894.744825494,Unit(-1,1,-2)); // 1000 x pounds/in^2
Quantity Quantity::Watt (1e+6 ,Unit(2,1,-3)); // Watt (kg*m^2/s^3)
Quantity Quantity::VoltAmpere (1e+6 ,Unit(2,1,-3)); // VoltAmpere (kg*m^2/s^3)
Quantity Quantity::Watt (1e+6 ,Unit(2,1,-3)); // Watt (kg*m^2/s^3)
Quantity Quantity::MilliWatt (1e+3 ,Unit(2,1,-3));
Quantity Quantity::KiloWatt (1e+9 ,Unit(2,1,-3));
Quantity Quantity::VoltAmpere (1e+6 ,Unit(2,1,-3)); // VoltAmpere (kg*m^2/s^3)
Quantity Quantity::Volt (1e+6 ,Unit(2,1,-3,-1)); // Volt (kg*m^2/A/s^3)
Quantity Quantity::Volt (1e+6 ,Unit(2,1,-3,-1)); // Volt (kg*m^2/A/s^3)
Quantity Quantity::MilliVolt (1e+3 ,Unit(2,1,-3,-1));
Quantity Quantity::KiloVolt (1e+9 ,Unit(2,1,-3,-1));
Quantity Quantity::Joule (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::NewtonMeter (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::VoltAmpereSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::WattSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::Coulomb (1.0 ,Unit(0,0,1,1)); // Coulomb (A*s)
Quantity Quantity::Tesla (1.0 ,Unit(0,1,-2,-1)); // Tesla (kg/s^2/A)
Quantity Quantity::PicoFarad (1e-18 ,Unit(-2,-1,4,2));
Quantity Quantity::NanoFarad (1e-15 ,Unit(-2,-1,4,2));
Quantity Quantity::MicroFarad (1e-12 ,Unit(-2,-1,4,2));
Quantity Quantity::MilliFarad (1e-9 ,Unit(-2,-1,4,2));
Quantity Quantity::Farad (1e-6 ,Unit(-2,-1,4,2)); // Farad (s^4*A^2/m^2/kg)
Quantity Quantity::NanoHenry (1e-3 ,Unit(2,1,-2,-2));
Quantity Quantity::MicroHenry (1.0 ,Unit(2,1,-2,-2));
Quantity Quantity::MilliHenry (1e+3 ,Unit(2,1,-2,-2));
Quantity Quantity::Henry (1e+6 ,Unit(2,1,-2,-2)); // Henry (kg*m^2/s^2/A^2)
Quantity Quantity::Joule (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::MilliJoule (1e+3 ,Unit(2,1,-2));
Quantity Quantity::KiloJoule (1e+9 ,Unit(2,1,-2));
Quantity Quantity::NewtonMeter (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::VoltAmpereSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::WattSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg*m^2/s^2)
Quantity Quantity::KiloWattHour (3.6e+12 ,Unit(2,1,-2)); // 1 kWh = 3.6e6 J
Quantity Quantity::ElectronVolt (1.602176634e-13 ,Unit(2,1,-2)); // 1 eV = 1.602176634e-19 J
Quantity Quantity::KMH (277.778 ,Unit(1,0,-1)); // km/h
Quantity Quantity::MPH (447.04 ,Unit(1,0,-1)); // Mile/h

View File

@@ -187,6 +187,7 @@ public:
static Quantity KiloMetre;
static Quantity Liter;
static Quantity MilliLiter;
static Quantity Hertz;
static Quantity KiloHertz;
@@ -212,6 +213,7 @@ public:
static Quantity MilliKelvin;
static Quantity MicroKelvin;
static Quantity MilliMole;
static Quantity Mole;
static Quantity Candela;
@@ -230,15 +232,18 @@ public:
static Quantity PoundForce;
static Quantity Newton;
static Quantity MilliNewton;
static Quantity KiloNewton;
static Quantity MegaNewton;
static Quantity MilliNewton;
static Quantity Pascal;
static Quantity KiloPascal;
static Quantity MegaPascal;
static Quantity GigaPascal;
static Quantity Bar;
static Quantity MilliBar;
static Quantity Torr;
static Quantity mTorr;
static Quantity yTorr;
@@ -247,14 +252,37 @@ public:
static Quantity KSI;
static Quantity Watt;
static Quantity MilliWatt;
static Quantity KiloWatt;
static Quantity VoltAmpere;
static Quantity Volt;
static Quantity MilliVolt;
static Quantity KiloVolt;
static Quantity Coulomb;
static Quantity Tesla;
static Quantity Farad;
static Quantity MilliFarad;
static Quantity MicroFarad;
static Quantity NanoFarad;
static Quantity PicoFarad;
static Quantity Henry;
static Quantity MilliHenry;
static Quantity MicroHenry;
static Quantity NanoHenry;
static Quantity Joule;
static Quantity MilliJoule;
static Quantity KiloJoule;
static Quantity NewtonMeter;
static Quantity VoltAmpereSecond;
static Quantity WattSecond;
static Quantity KiloWattHour;
static Quantity ElectronVolt;
static Quantity KMH;
static Quantity MPH;

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,12 @@
/* Lexer for the FreeCAD Units language */
/* (c) 2013 Juergen Riegel LGPL */
/* flex --outfile=QuantityLexer.c QuantityParser.l */
/* use this file to generate the file 'QuantityLexer.c' using the program flex
* the command for this operation is:
* flex --outfile=QuantityLexer.c QuantityParser.l
* (flex for Windows is available here:
* https://sourceforge.net/projects/winflexbison/
* (you must then change 'flex' to 'win_flex' in the command)) */
/* This disables inclusion of unistd.h, which is not available under Visual C++
* on Win32. The C++ scanner uses STL streams instead. */
@@ -50,15 +55,16 @@ CGRP '\,'[0-9][0-9][0-9]
"mm" yylval = Quantity::MilliMetre; return UNIT; // milli meter (internal standard length)
"cm" yylval = Quantity::CentiMetre; return UNIT; // centi meter
"dm" yylval = Quantity::DeciMetre; return UNIT; // deci meter
"m" yylval = Quantity::Metre; return UNIT; // metre
"m" yylval = Quantity::Metre; return UNIT; // Metre
"km" yylval = Quantity::KiloMetre; return UNIT; // kilo meter
"l" yylval = Quantity::Liter; return UNIT; // Liter dm^3
"l" yylval = Quantity::Liter; return UNIT; // Liter (dm^3)
"ml" yylval = Quantity::MilliLiter; return UNIT; // milli Liter
"Hz" yylval = Quantity::Hertz; return UNIT; // Hertz
"kHz" yylval = Quantity::KiloHertz; return UNIT; // Kilo Hertz
"MHz" yylval = Quantity::MegaHertz; return UNIT; // Mega Hertz
"GHz" yylval = Quantity::GigaHertz; return UNIT; // Giga Hertz
"kHz" yylval = Quantity::KiloHertz; return UNIT; // kilo Hertz
"MHz" yylval = Quantity::MegaHertz; return UNIT; // mega Hertz
"GHz" yylval = Quantity::GigaHertz; return UNIT; // giga Hertz
"ug" yylval = Quantity::MicroGram; return UNIT; // micro gram
"\xC2\xB5g" yylval = Quantity::MicroGram; return UNIT; // micro gram
@@ -74,14 +80,15 @@ CGRP '\,'[0-9][0-9][0-9]
"A" yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current)
"mA" yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere
"kA" yylval = Quantity::KiloAmpere; return UNIT; // kilo Ampere
"MA" yylval = Quantity::MegaAmpere; return UNIT; // Mega Ampere
"MA" yylval = Quantity::MegaAmpere; return UNIT; // mega Ampere
"K" yylval = Quantity::Kelvin; return UNIT; // Kelvin (internal standard thermodynamic temperature)
"mK" yylval = Quantity::MilliKelvin; return UNIT; // Kelvin
"\xC2\xB5K" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin
"uK" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin
"mK" yylval = Quantity::MilliKelvin; return UNIT; // milli Kelvin
"\xC2\xB5K" yylval = Quantity::MicroKelvin; return UNIT; // micro Kelvin
"uK" yylval = Quantity::MicroKelvin; return UNIT; // micro Kelvin
"mol" yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance)
"mmol" yylval = Quantity::MilliMole; return UNIT; // Milli Mole
"cd" yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity)
@@ -94,8 +101,6 @@ CGRP '\,'[0-9][0-9][0-9]
"yd" yylval = Quantity::Yard; return UNIT; // yard
"mi" yylval = Quantity::Mile; return UNIT; // mile
"lb" yylval = Quantity::Pound; return UNIT; // pound
"lbm" yylval = Quantity::Pound; return UNIT; // pound
"oz" yylval = Quantity::Ounce; return UNIT; // ounce
@@ -105,14 +110,17 @@ CGRP '\,'[0-9][0-9][0-9]
"lbf" yylval = Quantity::PoundForce; return UNIT; // pound
"N" yylval = Quantity::Newton; return UNIT; // Newton (kg*m/s^2)
"kN" yylval = Quantity::KiloNewton; return UNIT; // Newton
"MN" yylval = Quantity::MegaNewton; return UNIT; // Newton
"mN" yylval = Quantity::MilliNewton; return UNIT; // Newton
"mN" yylval = Quantity::MilliNewton; return UNIT; // milli Newton
"kN" yylval = Quantity::KiloNewton; return UNIT; // kilo Newton
"MN" yylval = Quantity::MegaNewton; return UNIT; // mega Newton
"Pa" yylval = Quantity::Pascal; return UNIT; // Pascal (kg/m/s^2 or N/m^2)
"kPa" yylval = Quantity::KiloPascal; return UNIT; // Pascal
"MPa" yylval = Quantity::MegaPascal; return UNIT; // Pascal
"GPa" yylval = Quantity::GigaPascal; return UNIT; // Pascal
"kPa" yylval = Quantity::KiloPascal; return UNIT; // kilo Pascal
"MPa" yylval = Quantity::MegaPascal; return UNIT; // mega Pascal
"GPa" yylval = Quantity::GigaPascal; return UNIT; // giga Pascal
"bar" yylval = Quantity::Bar; return UNIT; // 1 bar = 100 kPa
"mbar" yylval = Quantity::MilliBar; return UNIT; // milli Bar
"Torr" yylval = Quantity::Torr; return UNIT; // portion of Pascal ( 101325/760 )
"mTorr" yylval = Quantity::mTorr; return UNIT; //
@@ -123,15 +131,40 @@ CGRP '\,'[0-9][0-9][0-9]
"ksi" yylval = Quantity::KSI; return UNIT; // 1000 x pounds/in^2
"W" yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3)
"mW" yylval = Quantity::MilliWatt; return UNIT; // milli Watt
"kW" yylval = Quantity::KiloWatt; return UNIT; // kilo Watt
"VA" yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3)
"V" yylval = Quantity::Volt; return UNIT; // Volt (kg*m^2/A/s^3)
"kV" yylval = Quantity::KiloVolt; return UNIT; // kilo Volt
"mV" yylval = Quantity::MilliVolt; return UNIT; // milli Volt
"C" yylval = Quantity::Coulomb; return UNIT; // Coulomb (A*s)
"T" yylval = Quantity::Tesla; return UNIT; // Tesla (kg/s^2/A)
"F" yylval = Quantity::Farad; return UNIT; // Farad (s^4*A^2/m^2/kg)
"mF" yylval = Quantity::MilliFarad; return UNIT; // milli Farad
"\xC2\xB5F" yylval = Quantity::MicroFarad; return UNIT; // micro Farad
"uF" yylval = Quantity::MicroFarad; return UNIT; // micro Farad
"nF" yylval = Quantity::NanoFarad; return UNIT; // nano Farad
"pF" yylval = Quantity::PicoFarad; return UNIT; // pico Farad
"H" yylval = Quantity::Henry; return UNIT; // Henry (kg*m^2/s^2/A^2)
"mH" yylval = Quantity::MilliHenry; return UNIT; // milli Henry
"\xC2\xB5H" yylval = Quantity::MicroHenry; return UNIT; // micro Henry
"uH" yylval = Quantity::MicroHenry; return UNIT; // micro Henry
"nH" yylval = Quantity::NanoHenry; return UNIT; // nano Henry
"J" yylval = Quantity::Joule; return UNIT; // Joule (kg*m^2/s^2)
"mJ" yylval = Quantity::MilliJoule; return UNIT; // milli Joule
"kJ" yylval = Quantity::KiloJoule; return UNIT; // kilo Joule
"Nm" yylval = Quantity::NewtonMeter; return UNIT; // N*m = Joule
"VAs" yylval = Quantity::VoltAmpereSecond; return UNIT; // V*A*s = Joule
"CV" yylval = Quantity::WattSecond; return UNIT; //
"Ws" yylval = Quantity::WattSecond; return UNIT; // W*s = Joule
"kWh" yylval = Quantity::KiloWattHour; return UNIT; // 1 kWh = 3.6e6 J
"eV" yylval = Quantity::ElectronVolt; return UNIT; // 1 eV = 1.602176634e-19 J
"\xC2\xB0" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
"deg" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)

View File

@@ -37,7 +37,7 @@ std::string TypePy::representation(void) const
return str.str();
}
PyObject* TypePy::staticCallback_fromName (PyObject * /*self*/, PyObject *args)
PyObject* TypePy::fromName (PyObject *args)
{
const char *name;
if (!PyArg_ParseTuple(args, "s", &name))
@@ -47,7 +47,7 @@ PyObject* TypePy::staticCallback_fromName (PyObject * /*self*/, PyObject *args)
return new TypePy(new Base::Type(type));
}
PyObject* TypePy::staticCallback_fromKey (PyObject * /*self*/, PyObject *args)
PyObject* TypePy::fromKey (PyObject *args)
{
unsigned int index;
if (!PyArg_ParseTuple(args, "I", &index))
@@ -57,7 +57,7 @@ PyObject* TypePy::staticCallback_fromKey (PyObject * /*self*/, PyObject *args)
return new TypePy(new Base::Type(type));
}
PyObject* TypePy::staticCallback_getNumTypes (PyObject * /*self*/, PyObject *args)
PyObject* TypePy::getNumTypes (PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
@@ -66,7 +66,7 @@ PyObject* TypePy::staticCallback_getNumTypes (PyObject * /*self*/, PyObject *arg
return PyLong_FromLong(num);
}
PyObject* TypePy::staticCallback_getBadType (PyObject * /*self*/, PyObject *args)
PyObject* TypePy::getBadType (PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
@@ -120,7 +120,7 @@ PyObject* TypePy::isDerivedFrom(PyObject *args)
return PyBool_FromLong(v ? 1 : 0);
}
PyObject* TypePy::staticCallback_getAllDerivedFrom(PyObject* /*self*/, PyObject *args)
PyObject* TypePy::getAllDerivedFrom(PyObject *args)
{
Base::Type type;

View File

@@ -439,6 +439,10 @@ QString Unit::getTypeString(void) const
if(*this == Unit::Temperature ) return QString::fromLatin1("Temperature");
if(*this == Unit::ElectricCurrent ) return QString::fromLatin1("ElectricCurrent");
if(*this == Unit::ElectricPotential ) return QString::fromLatin1("ElectricPotential");
if(*this == Unit::ElectricCharge ) return QString::fromLatin1("ElectricCharge");
if(*this == Unit::MagneticFluxDensity ) return QString::fromLatin1("MagneticFluxDensity");
if(*this == Unit::ElectricalCapacitance ) return QString::fromLatin1("ElectricalCapacitance");
if(*this == Unit::ElectricalInductance ) return QString::fromLatin1("ElectricalInductance");
if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance");
if(*this == Unit::LuminousIntensity ) return QString::fromLatin1("LuminousIntensity");
if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure");
@@ -478,6 +482,10 @@ Unit Unit::Temperature(0,0,0,0,1);
Unit Unit::ElectricCurrent(0,0,0,1);
Unit Unit::ElectricPotential(2,1,-3,-1);
Unit Unit::ElectricCharge(0,0,1,1);
Unit Unit::MagneticFluxDensity(0,1,-2,-1);
Unit Unit::ElectricalCapacitance(-2,-1,4,2);
Unit Unit::ElectricalInductance(2,1,-2,-2);
Unit Unit::AmountOfSubstance(0,0,0,0,0,1);
Unit Unit::LuminousIntensity(0,0,0,0,0,0,1);

View File

@@ -110,6 +110,10 @@ public:
static Unit ElectricCurrent;
static Unit ElectricPotential;
static Unit ElectricCharge;
static Unit MagneticFluxDensity;
static Unit ElectricalCapacitance;
static Unit ElectricalInductance;
static Unit AmountOfSubstance;
static Unit LuminousIntensity;

View File

@@ -52,7 +52,7 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
// now do special treatment on all cases seems necessary:
if (unit == Unit::Length) { // Length handling ============================
if (UnitValue < 0.000000001) {// smaller then 0.001 nm -> scientific notation
if (UnitValue < 0.000000001) {// smaller than 0.001 nm -> scientific notation
unitString = QString::fromLatin1("mm");
factor = 1.0;
}
@@ -76,16 +76,46 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("km");
factor = 1000000.0;
}
else { // bigger then 1000 km -> scientific notation
else { // bigger than 1000 km -> scientific notation
unitString = QString::fromLatin1("mm");
factor = 1.0;
}
}
else if (unit == Unit::Area) {
// TODO Cascade for the Areas
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
factor = 1.0;
if (UnitValue < 100) {
unitString = QString::fromLatin1("mm^2");
factor = 1.0;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("cm^2");
factor = 100;
}
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("m^2");
factor = 1e6;
}
else { // bigger than 1 square kilometer
unitString = QString::fromLatin1("km^2");
factor = 1e12;
}
}
else if (unit == Unit::Volume) {
if (UnitValue < 1e3) {// smaller than 1 ul
unitString = QString::fromLatin1("mm^3");
factor = 1.0;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("ml");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("l");
factor = 1e6;
}
else { // bigger than 1000 l
unitString = QString::fromLatin1("m^3");
factor = 1e9;
}
}
else if (unit == Unit::Angle) {
// TODO Cascade for the Areas
@@ -94,10 +124,26 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 1.0;
}
else if (unit == Unit::Mass) {
// TODO Cascade for the weights
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
factor = 1.0;
if (UnitValue < 1e-6) {
unitString = QString::fromUtf8("\xC2\xB5g");
factor = 1e-9;
}
else if (UnitValue < 1e-3) {
unitString = QString::fromLatin1("mg");
factor = 1e-6;
}
else if (UnitValue < 1.0) {
unitString = QString::fromLatin1("g");
factor = 1e-3;
}
else if (UnitValue < 1e3) {
unitString = QString::fromLatin1("kg");
factor = 1.0;
}
else {
unitString = QString::fromLatin1("t");
factor = 1e3;
}
}
else if (unit == Unit::Density) {
if (UnitValue < 0.0001) {
@@ -163,13 +209,81 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 0.001;
}
}
else if (unit == Unit::Force) {
if (UnitValue < 1e3) {
unitString = QString::fromLatin1("mN");
factor = 1.0;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("N");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("kN");
factor = 1e6;
}
else {
unitString = QString::fromLatin1("MN");
factor = 1e9;
}
}
else if (unit == Unit::Power) {
unitString = QString::fromLatin1("W");
factor = 1000000;
if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mW");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("W");
factor = 1e6;
}
else {
unitString = QString::fromLatin1("kW");
factor = 1e9;
}
}
else if (unit == Unit::ElectricPotential) {
unitString = QString::fromLatin1("V");
factor = 1000000;
if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mV");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("V");
factor = 1e6;
}
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("kV");
factor = 1e9;
}
else { // > 1000 kV scientificc notation
unitString = QString::fromLatin1("V");
factor = 1e6;
}
}
else if (unit == Unit::Work) {
if (UnitValue < 1.602176634e-10) {
unitString = QString::fromLatin1("eV");
factor = 1.602176634e-13;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mJ");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("J");
factor = 1e6;
}
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("kJ");
factor = 1e9;
}
else if (UnitValue < 3.6e+15) {
unitString = QString::fromLatin1("kWh");
factor = 3.6e+12;
}
else { // bigger than 1000 kWh -> scientific notation
unitString = QString::fromLatin1("J");
factor = 1e6;
}
}
else if (unit == Unit::SpecificEnergy) {
unitString = QString::fromLatin1("m^2/s^2");
@@ -179,6 +293,54 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
unitString = QString::fromLatin1("W/m^2");
factor = 1.0;
}
else if (unit == Unit::ElectricCharge) {
unitString = QString::fromLatin1("C");
factor = 1.0;
}
else if (unit == Unit::MagneticFluxDensity) {
unitString = QString::fromLatin1("T");
factor = 1.0;
}
else if (unit == Unit::ElectricalCapacitance) {
if (UnitValue < 1e-15) {
unitString = QString::fromLatin1("pF");
factor = 1e-18;
}
else if (UnitValue < 1e-12) {
unitString = QString::fromLatin1("nF");
factor = 1e-15;
}
else if (UnitValue < 1e-9) {
unitString = QString::fromUtf8("\xC2\xB5""F"); // \x reads everything to the end, therefore split
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
unitString = QString::fromLatin1("mF");
factor = 1e-9;
}
else {
unitString = QString::fromLatin1("F");
factor = 1e-6;
}
}
else if (unit == Unit::ElectricalInductance) {
if (UnitValue < 1.0) {
unitString = QString::fromLatin1("nH");
factor = 1e-3;
}
else if (UnitValue < 1e3) {
unitString = QString::fromUtf8("\xC2\xB5H");
factor = 1.0;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mH");
factor = 1e3;
}
else {
unitString = QString::fromLatin1("H");
factor = 1e6;
}
}
else if (unit == Unit::Frequency) {
if (UnitValue < 1000.0) {
unitString = QString::fromLatin1("Hz");

View File

@@ -73,24 +73,62 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
}
}
else if (unit == Unit::Area) {
if (UnitValue < 100.0) {// smaller than 1 square cm
if (UnitValue < 100) {
unitString = QString::fromLatin1("mm^2");
factor = 1.0;
}
else if (UnitValue < 10000000000000.0) {
unitString = QString::fromLatin1("m^2");
factor = 1000000.0;
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("cm^2");
factor = 100;
}
else { // bigger then 1 square kilometer
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("m^2");
factor = 1e6;
}
else { // bigger than 1 square kilometer
unitString = QString::fromLatin1("km^2");
factor = 1000000000000.0;
factor = 1e12;
}
}
else if (unit == Unit::Volume) {
if (UnitValue < 1e3) {// smaller than 1 ul
unitString = QString::fromLatin1("mm^3");
factor = 1.0;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("ml");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("l");
factor = 1e6;
}
else { // bigger than 1000 l
unitString = QString::fromLatin1("m^3");
factor = 1e9;
}
}
else if (unit == Unit::Mass) {
// TODO Cascade for the weights
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
factor = 1.0;
if (UnitValue < 1e-6) {
unitString = QString::fromUtf8("\xC2\xB5g");
factor = 1e-9;
}
else if (UnitValue < 1e-3) {
unitString = QString::fromLatin1("mg");
factor = 1e-6;
}
else if (UnitValue < 1.0) {
unitString = QString::fromLatin1("g");
factor = 1e-3;
}
else if (UnitValue < 1e3) {
unitString = QString::fromLatin1("kg");
factor = 1.0;
}
else {
unitString = QString::fromLatin1("t");
factor = 1e3;
}
}
else if (unit == Unit::Density) {
if (UnitValue < 0.0001) {
@@ -120,6 +158,10 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
factor = 1000000000000000000.0;
}
}
else if (unit == Unit::Acceleration) {
unitString = QString::fromLatin1("m/s^2");
factor = 1000.0;
}
else if ((unit == Unit::Pressure) || (unit == Unit::Stress)) {
if (UnitValue < 10.0) {// Pa is the smallest
unitString = QString::fromLatin1("Pa");
@@ -170,13 +212,129 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
unitString = QString::fromLatin1("W/m^2/K");
factor = 1.0;
}
else if (unit == Unit::Force) {
if (UnitValue < 1e3) {
unitString = QString::fromLatin1("mN");
factor = 1.0;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("N");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("kN");
factor = 1e6;
}
else {
unitString = QString::fromLatin1("MN");
factor = 1e9;
}
}
else if (unit == Unit::Power) {
unitString = QString::fromLatin1("W");
factor = 1000000;
if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mW");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("W");
factor = 1e6;
}
else {
unitString = QString::fromLatin1("kW");
factor = 1e9;
}
}
else if (unit == Unit::ElectricPotential) {
unitString = QString::fromLatin1("V");
factor = 1000000;
if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mV");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("V");
factor = 1e6;
}
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("kV");
factor = 1e9;
}
else { // > 1000 kV scientificc notation
unitString = QString::fromLatin1("V");
factor = 1e6;
}
}
else if (unit == Unit::ElectricCharge) {
unitString = QString::fromLatin1("C");
factor = 1.0;
}
else if (unit == Unit::MagneticFluxDensity) {
unitString = QString::fromLatin1("T");
factor = 1.0;
}
else if (unit == Unit::ElectricalCapacitance) {
if (UnitValue < 1e-15) {
unitString = QString::fromLatin1("pF");
factor = 1e-18;
}
else if (UnitValue < 1e-12) {
unitString = QString::fromLatin1("nF");
factor = 1e-15;
}
else if (UnitValue < 1e-9) {
unitString = QString::fromUtf8("\xC2\xB5""F"); // \x reads everything to the end, therefore split
factor = 1e-12;
}
else if (UnitValue < 1e-6) {
unitString = QString::fromLatin1("mF");
factor = 1e-9;
}
else {
unitString = QString::fromLatin1("F");
factor = 1e-6;
}
}
else if (unit == Unit::ElectricalInductance) {
if (UnitValue < 1e-6) {
unitString = QString::fromLatin1("nH");
factor = 1e-3;
}
else if (UnitValue < 1e-3) {
unitString = QString::fromUtf8("\xC2\xB5H");
factor = 1.0;
}
else if (UnitValue < 1.0) {
unitString = QString::fromLatin1("mH");
factor = 1e3;
}
else {
unitString = QString::fromLatin1("H");
factor = 1e6;
}
}
else if (unit == Unit::Work) {
if (UnitValue < 1.602176634e-10) {
unitString = QString::fromLatin1("eV");
factor = 1.602176634e-13;
}
else if (UnitValue < 1e6) {
unitString = QString::fromLatin1("mJ");
factor = 1e3;
}
else if (UnitValue < 1e9) {
unitString = QString::fromLatin1("J");
factor = 1e6;
}
else if (UnitValue < 1e12) {
unitString = QString::fromLatin1("kJ");
factor = 1e9;
}
else if (UnitValue < 3.6e+15) {
unitString = QString::fromLatin1("kWh");
factor = 3.6e+12;
}
else { // bigger than 1000 kWh -> scientific notation
unitString = QString::fromLatin1("J");
factor = 1e6;
}
}
else if (unit == Unit::SpecificEnergy) {
unitString = QString::fromLatin1("m^2/s^2");

View File

@@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>425</width>
<height>187</height>
<width>645</width>
<height>375</height>
</rect>
</property>
<property name="windowTitle">
<string>Units calculator</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@@ -89,42 +89,118 @@ To add a calculation press Return in the value input field</string>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Quantity:</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="quantitySpinBox" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Units:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="unitsBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Quantity</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Quantity:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="quantitySpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Scheme:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="comboBoxScheme">
<item>
<property name="text">
<string>Standard (mm/kg/s/degree)</string>
</property>
</item>
<item>
<property name="text">
<string>MKS (m/kg/s/degree)</string>
</property>
</item>
<item>
<property name="text">
<string>US customary (in/lb)</string>
</property>
</item>
<item>
<property name="text">
<string>Imperial decimal (in/lb)</string>
</property>
</item>
<item>
<property name="text">
<string>Building Euro (cm/m²/m³)</string>
</property>
</item>
<item>
<property name="text">
<string>Building US (ft-in/sqft/cuft)</string>
</property>
</item>
<item>
<property name="text">
<string>Metric small parts &amp; CNC(mm, mm/min)</string>
</property>
</item>
<item>
<property name="text">
<string>Imperial Civil (ft/ft^2/ft^3)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Decimals:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxDecimals">
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>12</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Units:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="unitsBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">

View File

@@ -66,19 +66,45 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
ui->ValueInput->setText(QString::fromLatin1("1 cm"));
ui->UnitInput->setText(QString::fromLatin1("in"));
units << Base::Unit::Length << Base::Unit::Mass << Base::Unit::Angle << Base::Unit::Density
<< Base::Unit::Area << Base::Unit::Volume << Base::Unit::TimeSpan << Base::Unit::Frequency
<< Base::Unit::Velocity << Base::Unit::Acceleration << Base::Unit::Temperature
<< Base::Unit::ElectricCurrent << Base::Unit::ElectricPotential
<< Base::Unit::AmountOfSubstance << Base::Unit::LuminousIntensity << Base::Unit::Stress
<< Base::Unit::Pressure << Base::Unit::Force << Base::Unit::Work << Base::Unit::Power
<< Base::Unit::ThermalConductivity << Base::Unit::ThermalExpansionCoefficient
<< Base::Unit::SpecificHeat << Base::Unit::ThermalTransferCoefficient << Base::Unit::HeatFlux;
units << Base::Unit::Acceleration
<< Base::Unit::AmountOfSubstance
<< Base::Unit::Angle
<< Base::Unit::Area
<< Base::Unit::Density
<< Base::Unit::ElectricalCapacitance
<< Base::Unit::ElectricalInductance
<< Base::Unit::ElectricCharge
<< Base::Unit::ElectricCurrent
<< Base::Unit::ElectricPotential
<< Base::Unit::Frequency
<< Base::Unit::Force
<< Base::Unit::HeatFlux
<< Base::Unit::Length
<< Base::Unit::LuminousIntensity
<< Base::Unit::Mass
<< Base::Unit::MagneticFluxDensity
<< Base::Unit::Pressure
<< Base::Unit::Power
<< Base::Unit::SpecificHeat
<< Base::Unit::Stress
<< Base::Unit::Temperature
<< Base::Unit::ThermalConductivity
<< Base::Unit::ThermalExpansionCoefficient
<< Base::Unit::ThermalTransferCoefficient
<< Base::Unit::TimeSpan
<< Base::Unit::Velocity
<< Base::Unit::Volume
<< Base::Unit::Work;
for (QList<Base::Unit>::iterator it = units.begin(); it != units.end(); ++it) {
ui->unitsBox->addItem(it->getTypeString());
}
ui->quantitySpinBox->setValue(1.0);
ui->quantitySpinBox->setUnit(units.front());
ui->spinBoxDecimals->setValue(Base::UnitsApi::getDecimals());
// see on_comboBoxScheme_activated
ui->comboBoxScheme->setDisabled(true);
}
/** Destroys the object and frees any allocated resources */
@@ -104,8 +130,11 @@ void DlgUnitsCalculator::textChanged(QString unit)
void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant)
{
// first check the unit, if it is invalid, getTypeString() outputs an empty string
if (Base::Unit(ui->UnitInput->text()).getTypeString().isEmpty()) {
// first check the unit, if it is invalid, getTypeString() outputs an empty string
// explicitly check for "ee" like in "eeV" because this would trigger an exception in Base::Unit
// since it expects then a scientific notation number like "1e3"
if ( (ui->UnitInput->text().mid(0, 2) == QString::fromLatin1("ee")) ||
Base::Unit(ui->UnitInput->text()).getTypeString().isEmpty()) {
ui->ValueOutput->setText(tr("unknown unit: ") + ui->UnitInput->text());
ui->pushButton_Copy->setEnabled(false);
} else { // the unit is valid
@@ -158,7 +187,26 @@ void DlgUnitsCalculator::returnPressed(void)
void DlgUnitsCalculator::on_unitsBox_activated(int index)
{
ui->quantitySpinBox->setUnit(units[index]);
// SI units use [m], not [mm] for lengths
//
Base::Quantity q = ui->quantitySpinBox->value();
int32_t old = q.getUnit().getSignature().Length;
double value = q.getValue();
Base::Unit unit = units[index];
int32_t len = unit.getSignature().Length;
ui->quantitySpinBox->setValue(Base::Quantity(value * std::pow(10.0, 3*(len-old)), unit));
}
void DlgUnitsCalculator::on_comboBoxScheme_activated(int index)
{
//TODO
Q_UNUSED(index)
}
void DlgUnitsCalculator::on_spinBoxDecimals_valueChanged(int value)
{
ui->quantitySpinBox->setDecimals(value);
}
#include "moc_DlgUnitsCalculatorImp.cpp"

View File

@@ -53,6 +53,8 @@ protected Q_SLOTS:
void textChanged(const QString);
void valueChanged(const Base::Quantity&);
void on_unitsBox_activated(int);
void on_comboBoxScheme_activated(int);
void on_spinBoxDecimals_valueChanged(int);
void copy(void);
void returnPressed(void);

View File

@@ -682,6 +682,21 @@ void QuantitySpinBox::setRange(double minimum, double maximum)
d->maximum = maximum;
}
int QuantitySpinBox::decimals() const
{
Q_D(const QuantitySpinBox);
return d->quantity.getFormat().precision;
}
void QuantitySpinBox::setDecimals(int v)
{
Q_D(QuantitySpinBox);
Base::QuantityFormat f = d->quantity.getFormat();
f.precision = v;
d->quantity.setFormat(f);
updateText(d->quantity);
}
QAbstractSpinBox::StepEnabled QuantitySpinBox::stepEnabled() const
{
Q_D(const QuantitySpinBox);

View File

@@ -91,6 +91,11 @@ public:
/// Sets the value of the maximum property
void setMaximum(double max);
/// Gets the number of decimals
int decimals() const;
/// Sets the number of decimals
void setDecimals(int v);
/// Gets the path of the bound property
QString boundToName() const;
/// Sets the path of the bound property

View File

@@ -73,7 +73,6 @@ void TextDocumentEditorView::setupEditor()
{
connect(getEditor()->document(), SIGNAL(modificationChanged(bool)),
this, SLOT(setWindowModified(bool)));
getEditor()->setReadOnly(textDocument->ReadOnly.getValue());
setWindowTitle(QString::fromUtf8(textDocument->Label.getValue())
+ QString::fromLatin1("[*]"));
getEditor()->setPlainText(
@@ -82,8 +81,10 @@ void TextDocumentEditorView::setupEditor()
void TextDocumentEditorView::setupConnection()
{
textConnection = textDocument->connect(
textConnection = textDocument->connectText(
boost::bind(&TextDocumentEditorView::sourceChanged, this));
labelConnection = textDocument->connectLabel(
boost::bind(&TextDocumentEditorView::labelChanged, this));
}
void TextDocumentEditorView::sourceChanged()
@@ -96,6 +97,12 @@ void TextDocumentEditorView::sourceChanged()
}
}
void TextDocumentEditorView::labelChanged()
{
setWindowTitle(QString::fromUtf8(textDocument->Label.getValue())
+ QString::fromLatin1("[*]"));
}
void TextDocumentEditorView::refresh()
{
QString text = QString::fromUtf8(

View File

@@ -55,16 +55,21 @@ public:
QPlainTextEdit* getEditor() const { return editor; }
App::TextDocument* getTextObject() const { return textDocument; }
private:
void setupEditor();
void setupConnection();
void saveToObject();
void sourceChanged();
void labelChanged();
void refresh();
bool isEditorModified() const;
private:
QPlainTextEdit *const editor;
App::TextDocument *const textDocument;
boost::signals2::connection textConnection;
boost::signals2::connection labelConnection;
bool sourceModified = false;
};

View File

@@ -35,6 +35,7 @@
#include <Gui/MainWindow.h>
#include <Gui/Document.h>
#include <Gui/ActionFunction.h>
#include <Gui/PythonEditor.h>
#include "ViewProviderTextDocument.h"
@@ -42,10 +43,32 @@
using namespace Gui;
PROPERTY_SOURCE(Gui::ViewProviderTextDocument, Gui::ViewProviderDocumentObject)
const char* ViewProviderTextDocument::SyntaxEnums[]= {"None","Python",nullptr};
ViewProviderTextDocument::ViewProviderTextDocument()
{
sPixmap = "TextDocument";
ADD_PROPERTY_TYPE(
ReadOnly, (false), "Editor", App::Prop_None,
"Defines whether the content can be edited.");
QFont font;
font.setFamily(QString::fromLatin1(App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Editor")->GetASCII("Font", font.family().toLatin1()).c_str()));
font.setPointSize(App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Editor")->GetInt("FontSize", font.pointSize()));
ADD_PROPERTY_TYPE(FontSize,(font.pointSize()), "Editor", App::Prop_None, "Font size");
ADD_PROPERTY_TYPE(FontName,((const char*)font.family().toLatin1()), "Editor", App::Prop_None, "Font name");
ADD_PROPERTY_TYPE(SyntaxHighlighter,(static_cast<long>(0)), "Editor", App::Prop_None, "Syntax highlighting");
SyntaxHighlighter.setEnums(SyntaxEnums);
DisplayMode.setStatus(App::Property::Hidden, true);
OnTopWhenSelected.setStatus(App::Property::Hidden, true);
SelectionStyle.setStatus(App::Property::Hidden, true);
Visibility.setStatus(App::Property::Hidden, true);
}
void ViewProviderTextDocument::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
@@ -60,7 +83,11 @@ void ViewProviderTextDocument::setupContextMenu(QMenu* menu, QObject* receiver,
bool ViewProviderTextDocument::doubleClicked()
{
if (!activateView()) {
auto* editorWidget = new QPlainTextEdit {};
editorWidget = new QPlainTextEdit {};
editorWidget->setReadOnly(ReadOnly.getValue());
FontName.touch();
SyntaxHighlighter.touch();
getMainWindow()->addWindow(
new TextDocumentEditorView {
static_cast<App::TextDocument*>(getObject()),
@@ -69,6 +96,32 @@ bool ViewProviderTextDocument::doubleClicked()
return true;
}
void ViewProviderTextDocument::onChanged(const App::Property* prop)
{
if (editorWidget) {
if (prop == &ReadOnly) {
editorWidget->setReadOnly(ReadOnly.getValue());
}
else if (prop == &FontSize || prop == &FontName) {
QFont font(QString::fromLatin1(this->FontName.getValue()), (int)this->FontSize.getValue());
editorWidget->setFont(font);
}
else if (prop == &SyntaxHighlighter) {
long value = SyntaxHighlighter.getValue();
if (value == 1) {
PythonSyntaxHighlighter* pythonSyntax = new PythonSyntaxHighlighter(editorWidget);
pythonSyntax->setDocument(editorWidget->document());
}
else {
QSyntaxHighlighter* shl = editorWidget->findChild<QSyntaxHighlighter*>();
if (shl)
shl->deleteLater();
}
}
}
ViewProviderDocumentObject::onChanged(prop);
}
bool ViewProviderTextDocument::activateView() const
{
auto views = getDocument()->getMDIViewsOfType(

View File

@@ -25,9 +25,10 @@
#define GUI_ViewProviderTextDocument_H
#include "PreCompiled.h"
#include "ViewProviderDocumentObject.h"
#include <QPointer>
class QPlainTextEdit;
namespace Gui {
@@ -37,11 +38,23 @@ public:
ViewProviderTextDocument();
~ViewProviderTextDocument() {}
App::PropertyBool ReadOnly;
App::PropertyFloat FontSize;
App::PropertyFont FontName;
App::PropertyEnumeration SyntaxHighlighter;
bool doubleClicked();
void setupContextMenu(QMenu* menu, QObject* receiver, const char* member);
bool isShow() const { return true; }
void onChanged(const App::Property* prop);
private:
bool activateView() const;
private:
QPointer<QPlainTextEdit> editorWidget;
static const char* SyntaxEnums[];
};
}

143
src/Mod/.gitattributes vendored
View File

@@ -1 +1,144 @@
JtReader export-ignore
# ****************************************************************************
# line endings
# to surpress line ending changes in github, add ?w=1 at link end of a diff
# for more information see forum topic and a specific pull request
# https://forum.freecadweb.org/viewtopic.php?f=17&t=41117
# https://github.com/FreeCAD/FreeCAD/pull/2752
# get all used file types
# in a directory in a bash use
# find . -type f -name '*.*' | sed 's|.*\.||' | sort -u
# in Mod directory for normalized modules
# find AddonManager Arch Complete Draft Idf Fem Material OpenSCAD Show Tux -type f -name '*.*' | sed 's|.*\.||' | sort -u
# search for a specific file ending in normalized folders
# find AddonManager Arch Complete Draft Idf Fem Material OpenSCAD Show Tux -type f -name '*.emn'
# normalize the line endings of the following files
# standard files
*.bat text
*.cpp text
*.csv text
*.dox text
*.h text
*.json text
*.md text
*.py text
*.qrc text
*.sh text
*.ts text
*.txt text
*.ui text
*.xml text
*.yml text
# Fem specific files
*.dat text
*.frd text
*.geo text
*.inp text
*.sif text
*.unv text
*.vtk text
*.z88 text
# files which are human readable
# but for which it is not sure if normalize is ok
# emn
# emp
# igs
# stp
# svg
# binary files
# FCMat
# FCStd
# ods
# qm
# line endings of the modules commented will be normalized
# AddonManager/** -text
# Arch/** -text
# Complete/** -text
# Draft/** -text
# Idf/** -text
# Fem/** -text
# Material/** -text
# OpenSCAD/** -text
# Show/** -text
# Tux/** -text
# line endings of the modules NOT commented will NOT be normalized
# Be carefully changes here could affect a lot of files automatically!
Assembly/** -text
Cam/** -text
Cloud/** -text
Drawing/** -text
Image/** -text
Import/** -text
Inspection/** -text
JtReader/** -text
Measure/** -text
Mesh/** -text
MeshPart/** -text
Part/** -text
PartDesign/** -text
Path/** -text
Plot/** -text
Points/** -text
Raytracing/** -text
ReverseEngineering/** -text
Robot/** -text
Sandbox/** -text
Ship/** -text
Sketcher/** -text
Spreadsheet/** -text
Start/** -text
Surface/** -text
TechDraw/** -text
TemplatePyMod/** -text
Test/** -text
Web/** -text
# this would let git manage the file endings automatically
# to be save this will be commented
# * text=auto
# if used it has to be at beginning of all line ending commands in this file
# furthermore if used it is very important to set the file types
# which should not be normalized manually (like svg, jpg, etc)
# they should be set to binary
# These files should be ignored as it pertains to line-endings
# because they are binary or should be treated as binary
# Since auto normalize is deactivated all these could be commented too.
# needed if * text=auto is used
# *.FCStd binary
# *.jpg binary
# *.png binary
# *.pyc binary
# *.qm binary
# *.svg binary
# These files will always be checked out with CRLF, i.e. windows-style line endings. This
# really should not be needed...
# *.SomeWindowsFileExtensionThatReallyRequiresCRLFEvenInLinux eol=crlf
# use git to manually correct the file endings
# git add --renormalize .

View File

@@ -1,5 +1,5 @@
/**
\defgroup DICE3DS Dice 3DS
\ingroup EMBEDDED
\brief The Dice 3DS library provides 3DStudio files import to the Arch module
*/
/**
\defgroup DICE3DS Dice 3DS
\ingroup EMBEDDED
\brief The Dice 3DS library provides 3DStudio files import to the Arch module
*/

View File

@@ -1,34 +1,34 @@
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.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 *
#* *
#***************************************************************************
# add import/export types
FreeCAD.addImportType("Industry Foundation Classes (*.ifc)","importIFC")
FreeCAD.addExportType("Industry Foundation Classes (*.ifc)","exportIFC")
FreeCAD.addImportType("Wavefront OBJ - Arch module (*.obj)","importOBJ")
FreeCAD.addExportType("Wavefront OBJ - Arch module (*.obj)","importOBJ")
FreeCAD.addExportType("WebGL file (*.html)","importWebGL")
FreeCAD.addExportType("JavaScript Object Notation (*.json)","importJSON")
FreeCAD.addImportType("Collada (*.dae)","importDAE")
FreeCAD.addExportType("Collada (*.dae)","importDAE")
FreeCAD.addImportType("3D Studio mesh (*.3ds)","import3DS")
FreeCAD.addImportType("SweetHome3D XML export (*.zip)","importSH3D")
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.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 *
#* *
#***************************************************************************
# add import/export types
FreeCAD.addImportType("Industry Foundation Classes (*.ifc)","importIFC")
FreeCAD.addExportType("Industry Foundation Classes (*.ifc)","exportIFC")
FreeCAD.addImportType("Wavefront OBJ - Arch module (*.obj)","importOBJ")
FreeCAD.addExportType("Wavefront OBJ - Arch module (*.obj)","importOBJ")
FreeCAD.addExportType("WebGL file (*.html)","importWebGL")
FreeCAD.addExportType("JavaScript Object Notation (*.json)","importJSON")
FreeCAD.addImportType("Collada (*.dae)","importDAE")
FreeCAD.addExportType("Collada (*.dae)","importDAE")
FreeCAD.addImportType("3D Studio mesh (*.3ds)","import3DS")
FreeCAD.addImportType("SweetHome3D XML export (*.zip)","importSH3D")

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,152 +1,152 @@
<RCC>
<qresource>
<file>icons/Arch_Building.svg</file>
<file>icons/Arch_Floor.svg</file>
<file>icons/Arch_Cell.svg</file>
<file>icons/Arch_Wall.svg</file>
<file>icons/Arch_Site.svg</file>
<file>icons/Arch_Project.svg</file>
<file>icons/Arch_Structure.svg</file>
<file>icons/Arch_Add.svg</file>
<file>icons/Arch_Remove.svg</file>
<file>icons/Arch_MeshToShape.svg</file>
<file>icons/Arch_SplitMesh.svg</file>
<file>icons/preferences-arch.svg</file>
<file>icons/Arch_RemoveShape.svg</file>
<file>icons/Arch_SectionPlane.svg</file>
<file>icons/Arch_Window.svg</file>
<file>icons/Arch_Wall_Tree.svg</file>
<file>icons/Arch_Wall_Clone.svg</file>
<file>icons/Arch_Cell_Tree.svg</file>
<file>icons/Arch_Building_Tree.svg</file>
<file>icons/Arch_Floor_Tree.svg</file>
<file>icons/Arch_SectionPlane_Tree.svg</file>
<file>icons/Arch_Site_Tree.svg</file>
<file>icons/Arch_Project_Tree.svg</file>
<file>icons/Arch_Structure_Tree.svg</file>
<file>icons/Arch_Structure_Clone.svg</file>
<file>icons/Arch_Window_Tree.svg</file>
<file>icons/Arch_Window_Clone.svg</file>
<file>icons/Arch_Axis.svg</file>
<file>icons/Arch_Axis_Tree.svg</file>
<file>icons/Arch_Axis_System.svg</file>
<file>icons/Arch_Axis_System_Tree.svg</file>
<file>icons/Arch_Roof.svg</file>
<file>icons/Arch_Roof_Tree.svg</file>
<file>icons/Arch_CloseHoles.svg</file>
<file>icons/Arch_Check.svg</file>
<file>icons/Arch_SelectNonManifold.svg</file>
<file>icons/Arch_MergeWalls.svg</file>
<file>icons/Arch_Wall_Tree_Assembly.svg</file>
<file>icons/Arch_Fixture.svg</file>
<file>icons/Arch_Space.svg</file>
<file>icons/Arch_Space_Tree.svg</file>
<file>icons/Arch_Space_Clone.svg</file>
<file>icons/Arch_Stairs.svg</file>
<file>icons/Arch_Stairs_Tree.svg</file>
<file>icons/Arch_Rebar.svg</file>
<file>icons/Arch_Rebar_Tree.svg</file>
<file>icons/Arch_Frame.svg</file>
<file>icons/Arch_Frame_Tree.svg</file>
<file>icons/Arch_Panel.svg</file>
<file>icons/Arch_Panel_Tree.svg</file>
<file>icons/Arch_Panel_Clone.svg</file>
<file>icons/Arch_Panel_Cut.svg</file>
<file>icons/Arch_Panel_Sheet.svg</file>
<file>icons/Arch_Equipment.svg</file>
<file>icons/Arch_Equipment_Tree.svg</file>
<file>icons/Arch_Equipment_Clone.svg</file>
<file>icons/Arch_Survey.svg</file>
<file>icons/Arch_3Views.svg</file>
<file>icons/IFC.svg</file>
<file>icons/Arch_StructuralSystem.svg</file>
<file>icons/Arch_StructuralSystem_Tree.svg</file>
<file>icons/Arch_ToggleIfcBrepFlag.svg</file>
<file>icons/Arch_CutPlane.svg</file>
<file>icons/Arch_Bimserver.svg</file>
<file>icons/Git.svg</file>
<file>icons/Arch_Component.svg</file>
<file>icons/Arch_Component_Clone.svg</file>
<file>icons/Arch_Subcomponent.svg</file>
<file>icons/Arch_Material.svg</file>
<file>icons/Arch_Material_Group.svg</file>
<file>icons/Arch_Material_Multi.svg</file>
<file>icons/Arch_Schedule.svg</file>
<file>icons/ArchWorkbench.svg</file>
<file>icons/Arch_Fence.svg</file>
<file>icons/Arch_Fence_Tree.svg</file>
<file>ui/preferences-arch.ui</file>
<file>ui/preferences-archdefaults.ui</file>
<file>ui/preferences-ifc.ui</file>
<file>ui/preferences-dae.ui</file>
<file>ui/ArchMaterial.ui</file>
<file>ui/ArchMultiMaterial.ui</file>
<file>ui/ArchSchedule.ui</file>
<file>icons/Arch_Pipe.svg</file>
<file>icons/Arch_Pipe_Tree.svg</file>
<file>icons/Arch_PipeConnector.svg</file>
<file>icons/Arch_ToggleSubs.svg</file>
<file>icons/Arch_Nest.svg</file>
<file>icons/Arch_Grid.svg</file>
<file>icons/Arch_BuildingPart.svg</file>
<file>icons/Arch_BuildingPart_Tree.svg</file>
<file>icons/Arch_Profile.svg</file>
<file>icons/Arch_Reference.svg</file>
<file>ui/ParametersWindowDouble.svg</file>
<file>ui/ParametersWindowSimple.svg</file>
<file>ui/ParametersWindowFixed.svg</file>
<file>ui/ParametersWindowStash.svg</file>
<file>ui/ParametersDoorSimple.svg</file>
<file>ui/ParametersDoorGlass.svg</file>
<file>ui/ParametersBeam.svg</file>
<file>ui/ParametersPillar.svg</file>
<file>ui/ParametersDent.svg</file>
<file>ui/ParametersPanel.svg</file>
<file>ui/ParametersSlab.svg</file>
<file>ui/ParametersIbeam.svg</file>
<file>ui/ParametersStairs.svg</file>
<file>ui/BimServerTaskPanel.ui</file>
<file>ui/GitTaskPanel.ui</file>
<file>ui/DialogBimServerLogin.ui</file>
<file>ui/DialogDisplayText.ui</file>
<file>ui/ArchNest.ui</file>
<file>ui/DialogIfcProperties.ui</file>
<file>translations/Arch_af.qm</file>
<file>translations/Arch_de.qm</file>
<file>translations/Arch_fi.qm</file>
<file>translations/Arch_fr.qm</file>
<file>translations/Arch_it.qm</file>
<file>translations/Arch_nl.qm</file>
<file>translations/Arch_no.qm</file>
<file>translations/Arch_ru.qm</file>
<file>translations/Arch_uk.qm</file>
<file>translations/Arch_pl.qm</file>
<file>translations/Arch_hr.qm</file>
<file>translations/Arch_ja.qm</file>
<file>translations/Arch_hu.qm</file>
<file>translations/Arch_tr.qm</file>
<file>translations/Arch_sv-SE.qm</file>
<file>translations/Arch_zh-TW.qm</file>
<file>translations/Arch_pt-BR.qm</file>
<file>translations/Arch_cs.qm</file>
<file>translations/Arch_sk.qm</file>
<file>translations/Arch_es-ES.qm</file>
<file>translations/Arch_zh-CN.qm</file>
<file>translations/Arch_ro.qm</file>
<file>translations/Arch_pt-PT.qm</file>
<file>translations/Arch_sr.qm</file>
<file>translations/Arch_el.qm</file>
<file>translations/Arch_sl.qm</file>
<file>translations/Arch_eu.qm</file>
<file>translations/Arch_ca.qm</file>
<file>translations/Arch_gl.qm</file>
<file>translations/Arch_kab.qm</file>
<file>translations/Arch_ko.qm</file>
<file>translations/Arch_fil.qm</file>
<file>translations/Arch_id.qm</file>
<file>translations/Arch_lt.qm</file>
<file>translations/Arch_val-ES.qm</file>
<file>translations/Arch_ar.qm</file>
<file>translations/Arch_vi.qm</file>
</qresource>
</RCC>
<RCC>
<qresource>
<file>icons/Arch_Building.svg</file>
<file>icons/Arch_Floor.svg</file>
<file>icons/Arch_Cell.svg</file>
<file>icons/Arch_Wall.svg</file>
<file>icons/Arch_Site.svg</file>
<file>icons/Arch_Project.svg</file>
<file>icons/Arch_Structure.svg</file>
<file>icons/Arch_Add.svg</file>
<file>icons/Arch_Remove.svg</file>
<file>icons/Arch_MeshToShape.svg</file>
<file>icons/Arch_SplitMesh.svg</file>
<file>icons/preferences-arch.svg</file>
<file>icons/Arch_RemoveShape.svg</file>
<file>icons/Arch_SectionPlane.svg</file>
<file>icons/Arch_Window.svg</file>
<file>icons/Arch_Wall_Tree.svg</file>
<file>icons/Arch_Wall_Clone.svg</file>
<file>icons/Arch_Cell_Tree.svg</file>
<file>icons/Arch_Building_Tree.svg</file>
<file>icons/Arch_Floor_Tree.svg</file>
<file>icons/Arch_SectionPlane_Tree.svg</file>
<file>icons/Arch_Site_Tree.svg</file>
<file>icons/Arch_Project_Tree.svg</file>
<file>icons/Arch_Structure_Tree.svg</file>
<file>icons/Arch_Structure_Clone.svg</file>
<file>icons/Arch_Window_Tree.svg</file>
<file>icons/Arch_Window_Clone.svg</file>
<file>icons/Arch_Axis.svg</file>
<file>icons/Arch_Axis_Tree.svg</file>
<file>icons/Arch_Axis_System.svg</file>
<file>icons/Arch_Axis_System_Tree.svg</file>
<file>icons/Arch_Roof.svg</file>
<file>icons/Arch_Roof_Tree.svg</file>
<file>icons/Arch_CloseHoles.svg</file>
<file>icons/Arch_Check.svg</file>
<file>icons/Arch_SelectNonManifold.svg</file>
<file>icons/Arch_MergeWalls.svg</file>
<file>icons/Arch_Wall_Tree_Assembly.svg</file>
<file>icons/Arch_Fixture.svg</file>
<file>icons/Arch_Space.svg</file>
<file>icons/Arch_Space_Tree.svg</file>
<file>icons/Arch_Space_Clone.svg</file>
<file>icons/Arch_Stairs.svg</file>
<file>icons/Arch_Stairs_Tree.svg</file>
<file>icons/Arch_Rebar.svg</file>
<file>icons/Arch_Rebar_Tree.svg</file>
<file>icons/Arch_Frame.svg</file>
<file>icons/Arch_Frame_Tree.svg</file>
<file>icons/Arch_Panel.svg</file>
<file>icons/Arch_Panel_Tree.svg</file>
<file>icons/Arch_Panel_Clone.svg</file>
<file>icons/Arch_Panel_Cut.svg</file>
<file>icons/Arch_Panel_Sheet.svg</file>
<file>icons/Arch_Equipment.svg</file>
<file>icons/Arch_Equipment_Tree.svg</file>
<file>icons/Arch_Equipment_Clone.svg</file>
<file>icons/Arch_Survey.svg</file>
<file>icons/Arch_3Views.svg</file>
<file>icons/IFC.svg</file>
<file>icons/Arch_StructuralSystem.svg</file>
<file>icons/Arch_StructuralSystem_Tree.svg</file>
<file>icons/Arch_ToggleIfcBrepFlag.svg</file>
<file>icons/Arch_CutPlane.svg</file>
<file>icons/Arch_Bimserver.svg</file>
<file>icons/Git.svg</file>
<file>icons/Arch_Component.svg</file>
<file>icons/Arch_Component_Clone.svg</file>
<file>icons/Arch_Subcomponent.svg</file>
<file>icons/Arch_Material.svg</file>
<file>icons/Arch_Material_Group.svg</file>
<file>icons/Arch_Material_Multi.svg</file>
<file>icons/Arch_Schedule.svg</file>
<file>icons/ArchWorkbench.svg</file>
<file>icons/Arch_Fence.svg</file>
<file>icons/Arch_Fence_Tree.svg</file>
<file>ui/preferences-arch.ui</file>
<file>ui/preferences-archdefaults.ui</file>
<file>ui/preferences-ifc.ui</file>
<file>ui/preferences-dae.ui</file>
<file>ui/ArchMaterial.ui</file>
<file>ui/ArchMultiMaterial.ui</file>
<file>ui/ArchSchedule.ui</file>
<file>icons/Arch_Pipe.svg</file>
<file>icons/Arch_Pipe_Tree.svg</file>
<file>icons/Arch_PipeConnector.svg</file>
<file>icons/Arch_ToggleSubs.svg</file>
<file>icons/Arch_Nest.svg</file>
<file>icons/Arch_Grid.svg</file>
<file>icons/Arch_BuildingPart.svg</file>
<file>icons/Arch_BuildingPart_Tree.svg</file>
<file>icons/Arch_Profile.svg</file>
<file>icons/Arch_Reference.svg</file>
<file>ui/ParametersWindowDouble.svg</file>
<file>ui/ParametersWindowSimple.svg</file>
<file>ui/ParametersWindowFixed.svg</file>
<file>ui/ParametersWindowStash.svg</file>
<file>ui/ParametersDoorSimple.svg</file>
<file>ui/ParametersDoorGlass.svg</file>
<file>ui/ParametersBeam.svg</file>
<file>ui/ParametersPillar.svg</file>
<file>ui/ParametersDent.svg</file>
<file>ui/ParametersPanel.svg</file>
<file>ui/ParametersSlab.svg</file>
<file>ui/ParametersIbeam.svg</file>
<file>ui/ParametersStairs.svg</file>
<file>ui/BimServerTaskPanel.ui</file>
<file>ui/GitTaskPanel.ui</file>
<file>ui/DialogBimServerLogin.ui</file>
<file>ui/DialogDisplayText.ui</file>
<file>ui/ArchNest.ui</file>
<file>ui/DialogIfcProperties.ui</file>
<file>translations/Arch_af.qm</file>
<file>translations/Arch_de.qm</file>
<file>translations/Arch_fi.qm</file>
<file>translations/Arch_fr.qm</file>
<file>translations/Arch_it.qm</file>
<file>translations/Arch_nl.qm</file>
<file>translations/Arch_no.qm</file>
<file>translations/Arch_ru.qm</file>
<file>translations/Arch_uk.qm</file>
<file>translations/Arch_pl.qm</file>
<file>translations/Arch_hr.qm</file>
<file>translations/Arch_ja.qm</file>
<file>translations/Arch_hu.qm</file>
<file>translations/Arch_tr.qm</file>
<file>translations/Arch_sv-SE.qm</file>
<file>translations/Arch_zh-TW.qm</file>
<file>translations/Arch_pt-BR.qm</file>
<file>translations/Arch_cs.qm</file>
<file>translations/Arch_sk.qm</file>
<file>translations/Arch_es-ES.qm</file>
<file>translations/Arch_zh-CN.qm</file>
<file>translations/Arch_ro.qm</file>
<file>translations/Arch_pt-PT.qm</file>
<file>translations/Arch_sr.qm</file>
<file>translations/Arch_el.qm</file>
<file>translations/Arch_sl.qm</file>
<file>translations/Arch_eu.qm</file>
<file>translations/Arch_ca.qm</file>
<file>translations/Arch_gl.qm</file>
<file>translations/Arch_kab.qm</file>
<file>translations/Arch_ko.qm</file>
<file>translations/Arch_fil.qm</file>
<file>translations/Arch_id.qm</file>
<file>translations/Arch_lt.qm</file>
<file>translations/Arch_val-ES.qm</file>
<file>translations/Arch_ar.qm</file>
<file>translations/Arch_vi.qm</file>
</qresource>
</RCC>

View File

@@ -1,3 +1,3 @@
/** \defgroup ARCH Arch
* \ingroup PYTHONWORKBENCHES */
/** \defgroup ARCH Arch
* \ingroup PYTHONWORKBENCHES */

View File

@@ -972,7 +972,8 @@ def export(exportList,filename,colors=None,preferences=None):
if not(Draft.getType(FreeCAD.ActiveDocument.getObject(k)) in ["Site","Building","Floor","BuildingPart"]):
untreated.append(v)
elif Draft.getType(FreeCAD.ActiveDocument.getObject(k)) == "BuildingPart":
if not(FreeCAD.ActiveDocument.getObject(k).IfcType in ["Building","Building Storey","Site","Space","Undefined"]):
if not(FreeCAD.ActiveDocument.getObject(k).IfcType in ["Building","Building Storey","Site","Space"]):
# if ifc type is "Undefined" the object is added to untreated
untreated.append(v)
if untreated:
if not defaulthost:

File diff suppressed because it is too large Load Diff

View File

@@ -1,27 +1,27 @@
# FreeCAD init script of the Complete module
# (c) 2001 Juergen Riegel
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
# FreeCAD init script of the Complete module
# (c) 2001 Juergen Riegel
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/

View File

@@ -1,46 +1,46 @@
# Complete gui init module
# (c) 2003 Juergen Riegel
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
class CompleteWorkbench(Workbench):
"Complete workbench object"
def __init__(self):
self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/Complete/Resources/icons/CompleteWorkbench.svg"
self.__class__.MenuText = "Complete"
self.__class__.ToolTip = "Complete workbench"
def Initialize(self):
pass
def GetClassName(self):
return "Gui::PythonWorkbench"
Gui.addWorkbench(CompleteWorkbench())
# Complete gui init module
# (c) 2003 Juergen Riegel
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
class CompleteWorkbench(Workbench):
"Complete workbench object"
def __init__(self):
self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/Complete/Resources/icons/CompleteWorkbench.svg"
self.__class__.MenuText = "Complete"
self.__class__.ToolTip = "Complete workbench"
def Initialize(self):
pass
def GetClassName(self):
return "Gui::PythonWorkbench"
Gui.addWorkbench(CompleteWorkbench())

View File

@@ -1,51 +1,51 @@
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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 <Python.h>
#endif
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Base/Interpreter.h>
namespace DraftUtils {
extern PyObject* initModule();
}
/* Python entry */
PyMOD_INIT_FUNC(DraftUtils)
{
// load dependent module
try {
Base::Interpreter().loadModule("Part");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0);
}
PyObject* mod = DraftUtils::initModule();
Base::Console().Log("Loading DraftUtils module... done\n");
PyMOD_Return(mod);
}
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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 <Python.h>
#endif
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Base/Interpreter.h>
namespace DraftUtils {
extern PyObject* initModule();
}
/* Python entry */
PyMOD_INIT_FUNC(DraftUtils)
{
// load dependent module
try {
Base::Interpreter().loadModule("Part");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0);
}
PyObject* mod = DraftUtils::initModule();
Base::Console().Log("Loading DraftUtils module... done\n");
PyMOD_Return(mod);
}

View File

@@ -1,100 +1,100 @@
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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 <Python.h>
#endif
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
#include <Base/Console.h>
#include <Base/VectorPy.h>
#include <Base/FileInfo.h>
#include <Base/Interpreter.h>
#include <App/Document.h>
#include <App/DocumentObjectPy.h>
#include <App/Application.h>
#include "DraftDxf.h"
namespace DraftUtils {
class Module : public Py::ExtensionModule<Module>
{
public:
Module() : Py::ExtensionModule<Module>("DraftUtils")
{
add_varargs_method("readDXF",&Module::readDXF,
"readDXF(filename,[document,ignore_errors]): Imports a DXF file into the given document. ignore_errors is True by default."
);
initialize("The DraftUtils module contains utility functions for the Draft module."); // register with Python
}
virtual ~Module() {}
private:
Py::Object readDXF(const Py::Tuple& args)
{
Base::Console().Warning("DraftUtils.readDXF is deprecated. Use Import.readDxf instead.\n");
char* Name;
const char* DocName=0;
bool IgnoreErrors=true;
if (!PyArg_ParseTuple(args.ptr(), "et|sb","utf-8",&Name,&DocName,&IgnoreErrors))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
Base::FileInfo file(EncodedName.c_str());
if (!file.exists())
throw Py::RuntimeError("File doesn't exist");
App::Document *pcDoc;
if (DocName)
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc)
pcDoc = App::GetApplication().newDocument(DocName);
try {
// read the DXF file
DraftDxfRead dxf_file(EncodedName,pcDoc);
dxf_file.DoRead(IgnoreErrors);
pcDoc->recompute();
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
}
return Py::None();
}
};
PyObject* initModule()
{
return (new Module)->module().ptr();
}
} // namespace DraftUtils
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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 <Python.h>
#endif
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
#include <Base/Console.h>
#include <Base/VectorPy.h>
#include <Base/FileInfo.h>
#include <Base/Interpreter.h>
#include <App/Document.h>
#include <App/DocumentObjectPy.h>
#include <App/Application.h>
#include "DraftDxf.h"
namespace DraftUtils {
class Module : public Py::ExtensionModule<Module>
{
public:
Module() : Py::ExtensionModule<Module>("DraftUtils")
{
add_varargs_method("readDXF",&Module::readDXF,
"readDXF(filename,[document,ignore_errors]): Imports a DXF file into the given document. ignore_errors is True by default."
);
initialize("The DraftUtils module contains utility functions for the Draft module."); // register with Python
}
virtual ~Module() {}
private:
Py::Object readDXF(const Py::Tuple& args)
{
Base::Console().Warning("DraftUtils.readDXF is deprecated. Use Import.readDxf instead.\n");
char* Name;
const char* DocName=0;
bool IgnoreErrors=true;
if (!PyArg_ParseTuple(args.ptr(), "et|sb","utf-8",&Name,&DocName,&IgnoreErrors))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
Base::FileInfo file(EncodedName.c_str());
if (!file.exists())
throw Py::RuntimeError("File doesn't exist");
App::Document *pcDoc;
if (DocName)
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc)
pcDoc = App::GetApplication().newDocument(DocName);
try {
// read the DXF file
DraftDxfRead dxf_file(EncodedName,pcDoc);
dxf_file.DoRead(IgnoreErrors);
pcDoc->recompute();
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
}
return Py::None();
}
};
PyObject* initModule()
{
return (new Module)->module().ptr();
}
} // namespace DraftUtils

View File

@@ -26,7 +26,7 @@
#include "dxf.h"
#include <Mod/Part/App/TopoShape.h>
#include <App/Document.h>
#include <gp_Pnt.hxx>
#include <gp_Pnt.hxx>
namespace DraftUtils
{

View File

@@ -1,24 +1,24 @@
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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"
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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"

View File

@@ -1,62 +1,62 @@
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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 DRAFTUTILS_PRECOMPILED_H
#define DRAFTUTILS_PRECOMPILED_H
#include <FCConfig.h>
// Exporting of App classes
#ifdef FC_OS_WIN32
# define DraftUtilsExport __declspec(dllexport)
# define PartExport __declspec(dllexport)
# define BaseExport __declspec(dllimport)
#else // for Linux
# define DraftUtilsExport
# define PartExport
# define BaseExport
#endif
#ifdef _MSC_VER
# pragma warning(disable : 4275)
#endif
#ifdef _PreComp_
// standard
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <assert.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <cctype>
#include <Python.h>
#endif // _PreComp_
#endif
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2015 *
* *
* 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 DRAFTUTILS_PRECOMPILED_H
#define DRAFTUTILS_PRECOMPILED_H
#include <FCConfig.h>
// Exporting of App classes
#ifdef FC_OS_WIN32
# define DraftUtilsExport __declspec(dllexport)
# define PartExport __declspec(dllexport)
# define BaseExport __declspec(dllimport)
#else // for Linux
# define DraftUtilsExport
# define PartExport
# define BaseExport
#endif
#ifdef _MSC_VER
# pragma warning(disable : 4275)
#endif
#ifdef _PreComp_
// standard
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <assert.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <cctype>
#include <Python.h>
#endif // _PreComp_
#endif

View File

@@ -1,162 +1,162 @@
// dxf.h
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#pragma once
#include <algorithm>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <fstream>
#include <sstream>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
//Following is required to be defined on Ubuntu with OCC 6.3.1
#ifndef HAVE_IOSTREAM
#define HAVE_IOSTREAM
#endif
typedef int Aci_t; // AutoCAD color index
typedef enum
{
eUnspecified = 0, // Unspecified (No units)
eInches,
eFeet,
eMiles,
eMillimeters,
eCentimeters,
eMeters,
eKilometers,
eMicroinches,
eMils,
eYards,
eAngstroms,
eNanometers,
eMicrons,
eDecimeters,
eDekameters,
eHectometers,
eGigameters,
eAstronomicalUnits,
eLightYears,
eParsecs
} eDxfUnits_t;
struct SplineData
{
double norm[3];
int degree;
int knots;
int control_points;
int fit_points;
int flag;
std::list<double> starttanx;
std::list<double> starttany;
std::list<double> starttanz;
std::list<double> endtanx;
std::list<double> endtany;
std::list<double> endtanz;
std::list<double> knot;
std::list<double> weight;
std::list<double> controlx;
std::list<double> controly;
std::list<double> controlz;
std::list<double> fitx;
std::list<double> fity;
std::list<double> fitz;
};
class CDxfWrite{
private:
std::ofstream* m_ofs;
bool m_fail;
public:
CDxfWrite(const char* filepath);
~CDxfWrite();
bool Failed(){return m_fail;}
void WriteLine(const double* s, const double* e, const char* layer_name );
void WritePoint(const double*, const char*);
void WriteArc(const double* s, const double* e, const double* c, bool dir, const char* layer_name );
void WriteEllipse(const double* c, double major_radius, double minor_radius, double rotation, double start_angle, double end_angle, bool dir, const char* layer_name );
void WriteCircle(const double* c, double radius, const char* layer_name );
};
// derive a class from this and implement it's virtual functions
class CDxfRead{
private:
std::ifstream* m_ifs;
bool m_fail;
char m_str[1024];
char m_unused_line[1024];
eDxfUnits_t m_eUnits;
bool m_measurement_inch;
char m_layer_name[1024];
char m_section_name[1024];
char m_block_name[1024];
bool m_ignore_errors;
typedef std::map< std::string,Aci_t > LayerAciMap_t;
LayerAciMap_t m_layer_aci; // layer names -> layer color aci map
bool ReadUnits();
bool ReadLayer();
bool ReadLine();
bool ReadText();
bool ReadArc();
bool ReadCircle();
bool ReadEllipse();
bool ReadPoint();
bool ReadSpline();
bool ReadLwPolyLine();
bool ReadPolyLine();
bool ReadVertex(double *pVertex, bool *bulge_found, double *bulge);
void OnReadArc(double start_angle, double end_angle, double radius, const double* c, double z_extrusion_dir, bool hidden);
void OnReadCircle(const double* c, double radius, bool hidden);
void OnReadEllipse(const double* c, const double* m, double ratio, double start_angle, double end_angle);
bool ReadInsert();
bool ReadDimension();
bool ReadBlockInfo();
void get_line();
void put_line(const char *value);
void DerefACI();
protected:
Aci_t m_aci; // manifest color name or 256 for layer color
public:
CDxfRead(const char* filepath); // this opens the file
~CDxfRead(); // this closes the file
bool Failed(){return m_fail;}
void DoRead(const bool ignore_errors = false); // this reads the file and calls the following functions
double mm( double value ) const;
bool IgnoreErrors() const { return(m_ignore_errors); }
virtual void OnReadLine(const double* /*s*/, const double* /*e*/, bool /*hidden*/){}
virtual void OnReadPoint(const double* /*s*/){}
virtual void OnReadText(const double* /*point*/, const double /*height*/, const char* /*text*/){}
virtual void OnReadArc(const double* /*s*/, const double* /*e*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){}
virtual void OnReadCircle(const double* /*s*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){}
virtual void OnReadEllipse(const double* /*c*/, double /*major_radius*/, double /*minor_radius*/, double /*rotation*/, double /*start_angle*/, double /*end_angle*/, bool /*dir*/){}
virtual void OnReadSpline(struct SplineData& /*sd*/){}
virtual void OnReadInsert(const double* /*point*/, const double* /*scale*/, const char* /*name*/, double /*rotation*/){}
virtual void OnReadDimension(const double* /*s*/, const double* /*e*/, const double* /*point*/, double /*rotation*/){}
virtual void AddGraphics() const { }
std::string LayerName() const;
};
// dxf.h
// Copyright (c) 2009, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
#pragma once
#include <algorithm>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <fstream>
#include <sstream>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
//Following is required to be defined on Ubuntu with OCC 6.3.1
#ifndef HAVE_IOSTREAM
#define HAVE_IOSTREAM
#endif
typedef int Aci_t; // AutoCAD color index
typedef enum
{
eUnspecified = 0, // Unspecified (No units)
eInches,
eFeet,
eMiles,
eMillimeters,
eCentimeters,
eMeters,
eKilometers,
eMicroinches,
eMils,
eYards,
eAngstroms,
eNanometers,
eMicrons,
eDecimeters,
eDekameters,
eHectometers,
eGigameters,
eAstronomicalUnits,
eLightYears,
eParsecs
} eDxfUnits_t;
struct SplineData
{
double norm[3];
int degree;
int knots;
int control_points;
int fit_points;
int flag;
std::list<double> starttanx;
std::list<double> starttany;
std::list<double> starttanz;
std::list<double> endtanx;
std::list<double> endtany;
std::list<double> endtanz;
std::list<double> knot;
std::list<double> weight;
std::list<double> controlx;
std::list<double> controly;
std::list<double> controlz;
std::list<double> fitx;
std::list<double> fity;
std::list<double> fitz;
};
class CDxfWrite{
private:
std::ofstream* m_ofs;
bool m_fail;
public:
CDxfWrite(const char* filepath);
~CDxfWrite();
bool Failed(){return m_fail;}
void WriteLine(const double* s, const double* e, const char* layer_name );
void WritePoint(const double*, const char*);
void WriteArc(const double* s, const double* e, const double* c, bool dir, const char* layer_name );
void WriteEllipse(const double* c, double major_radius, double minor_radius, double rotation, double start_angle, double end_angle, bool dir, const char* layer_name );
void WriteCircle(const double* c, double radius, const char* layer_name );
};
// derive a class from this and implement it's virtual functions
class CDxfRead{
private:
std::ifstream* m_ifs;
bool m_fail;
char m_str[1024];
char m_unused_line[1024];
eDxfUnits_t m_eUnits;
bool m_measurement_inch;
char m_layer_name[1024];
char m_section_name[1024];
char m_block_name[1024];
bool m_ignore_errors;
typedef std::map< std::string,Aci_t > LayerAciMap_t;
LayerAciMap_t m_layer_aci; // layer names -> layer color aci map
bool ReadUnits();
bool ReadLayer();
bool ReadLine();
bool ReadText();
bool ReadArc();
bool ReadCircle();
bool ReadEllipse();
bool ReadPoint();
bool ReadSpline();
bool ReadLwPolyLine();
bool ReadPolyLine();
bool ReadVertex(double *pVertex, bool *bulge_found, double *bulge);
void OnReadArc(double start_angle, double end_angle, double radius, const double* c, double z_extrusion_dir, bool hidden);
void OnReadCircle(const double* c, double radius, bool hidden);
void OnReadEllipse(const double* c, const double* m, double ratio, double start_angle, double end_angle);
bool ReadInsert();
bool ReadDimension();
bool ReadBlockInfo();
void get_line();
void put_line(const char *value);
void DerefACI();
protected:
Aci_t m_aci; // manifest color name or 256 for layer color
public:
CDxfRead(const char* filepath); // this opens the file
~CDxfRead(); // this closes the file
bool Failed(){return m_fail;}
void DoRead(const bool ignore_errors = false); // this reads the file and calls the following functions
double mm( double value ) const;
bool IgnoreErrors() const { return(m_ignore_errors); }
virtual void OnReadLine(const double* /*s*/, const double* /*e*/, bool /*hidden*/){}
virtual void OnReadPoint(const double* /*s*/){}
virtual void OnReadText(const double* /*point*/, const double /*height*/, const char* /*text*/){}
virtual void OnReadArc(const double* /*s*/, const double* /*e*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){}
virtual void OnReadCircle(const double* /*s*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){}
virtual void OnReadEllipse(const double* /*c*/, double /*major_radius*/, double /*minor_radius*/, double /*rotation*/, double /*start_angle*/, double /*end_angle*/, bool /*dir*/){}
virtual void OnReadSpline(struct SplineData& /*sd*/){}
virtual void OnReadInsert(const double* /*point*/, const double* /*scale*/, const char* /*name*/, double /*rotation*/){}
virtual void OnReadDimension(const double* /*s*/, const double* /*e*/, const double* /*point*/, double /*rotation*/){}
virtual void AddGraphics() const { }
std::string LayerName() const;
};

View File

@@ -1,32 +1,32 @@
#***************************************************************************
#* *
#* Copyright (c) 2009 Yorik van Havre <yorik@uncreated.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 *
#* *
#***************************************************************************
# add Import/Export types
App.addImportType("Autodesk DXF 2D (*.dxf)","importDXF")
App.addImportType("SVG as geometry (*.svg)","importSVG")
App.addImportType("Open CAD Format (*.oca *.gcad)","importOCA")
App.addImportType("Common airfoil data (*.dat)","importAirfoilDAT")
App.addExportType("Autodesk DXF 2D (*.dxf)","importDXF")
App.addExportType("Flattened SVG (*.svg)","importSVG")
App.addExportType("Open CAD Format (*.oca)","importOCA")
App.addImportType("Autodesk DWG 2D (*.dwg)","importDWG")
App.addExportType("Autodesk DWG 2D (*.dwg)","importDWG")
#***************************************************************************
#* *
#* Copyright (c) 2009 Yorik van Havre <yorik@uncreated.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 *
#* *
#***************************************************************************
# add Import/Export types
App.addImportType("Autodesk DXF 2D (*.dxf)","importDXF")
App.addImportType("SVG as geometry (*.svg)","importSVG")
App.addImportType("Open CAD Format (*.oca *.gcad)","importOCA")
App.addImportType("Common airfoil data (*.dat)","importAirfoilDAT")
App.addExportType("Autodesk DXF 2D (*.dxf)","importDXF")
App.addExportType("Flattened SVG (*.svg)","importSVG")
App.addExportType("Open CAD Format (*.oca)","importOCA")
App.addImportType("Autodesk DWG 2D (*.dwg)","importDWG")
App.addExportType("Autodesk DWG 2D (*.dwg)","importDWG")

View File

@@ -1,154 +1,154 @@
<RCC>
<qresource>
<file>icons/Draft_2DShapeView.svg</file>
<file>icons/Draft_AddPoint.svg</file>
<file>icons/Draft_AddToGroup.svg</file>
<file>icons/Draft_Apply.svg</file>
<file>icons/Draft_Arc.svg</file>
<file>icons/Draft_Arc_3Points.svg</file>
<file>icons/Draft_Array.svg</file>
<file>icons/Draft_AutoGroup.svg</file>
<file>icons/Draft_AutoGroup_on.svg</file>
<file>icons/Draft_AutoGroup_off.svg</file>
<file>icons/Draft_BezCurve.svg</file>
<file>icons/Draft_BezSharpNode.svg</file>
<file>icons/Draft_BezSymNode.svg</file>
<file>icons/Draft_BezTanNode.svg</file>
<file>icons/Draft_BSpline.svg</file>
<file>icons/Draft_Circle.svg</file>
<file>icons/Draft_Clone.svg</file>
<file>icons/Draft_Construction.svg</file>
<file>icons/Draft_CubicBezCurve.svg</file>
<file>icons/Draft_Cursor.svg</file>
<file>icons/Draft_DelPoint.svg</file>
<file>icons/Draft_Dimension.svg</file>
<file>icons/Draft_Dimension_Tree.svg</file>
<file>icons/Draft_Dot.svg</file>
<file>icons/Draft_Downgrade.svg</file>
<file>icons/Draft_Draft.svg</file>
<file>icons/Draft_Draft2Sketch.svg</file>
<file>icons/Draft_Drawing.svg</file>
<file>icons/Draft_Edit.svg</file>
<file>icons/Draft_Ellipse.svg</file>
<file>icons/Draft_Facebinder.svg</file>
<file>icons/Draft_Facebinder_Provider.svg</file>
<file>icons/Draft_Fillet.svg</file>
<file>icons/Draft_Finish.svg</file>
<file>icons/Draft_FlipDimension.svg</file>
<file>icons/Draft_Grid.svg</file>
<file>icons/Draft_Heal.svg</file>
<file>icons/Draft_Join.svg</file>
<file>icons/Draft_Label.svg</file>
<file>icons/Draft_Layer.svg</file>
<file>icons/Draft_Line.svg</file>
<file>icons/Draft_LinkArray.svg</file>
<file>icons/Draft_Lock.svg</file>
<file>icons/Draft_Macro.svg</file>
<file>icons/Draft_Mirror.svg</file>
<file>icons/Draft_Move.svg</file>
<file>icons/Draft_Offset.svg</file>
<file>icons/Draft_PathArray.svg</file>
<file>icons/Draft_PathLinkArray.svg</file>
<file>icons/Draft_Point.svg</file>
<file>icons/Draft_PointArray.svg</file>
<file>icons/Draft_Polygon.svg</file>
<file>icons/Draft_Rectangle.svg</file>
<file>icons/Draft_Rotate.svg</file>
<file>icons/Draft_Scale.svg</file>
<file>icons/Draft_SelectGroup.svg</file>
<file>icons/Draft_SelectPlane.svg</file>
<file>icons/Draft_ShapeString.svg</file>
<file>icons/Draft_Slope.svg</file>
<file>icons/Draft_Snap.svg</file>
<file>icons/Draft_Split.svg</file>
<file>icons/Draft_Stretch.svg</file>
<file>icons/Draft_SubelementHighlight.svg</file>
<file>icons/Draft_SwitchMode.svg</file>
<file>icons/Draft_Text.svg</file>
<file>icons/Draft_Trimex.svg</file>
<file>icons/Draft_Upgrade.svg</file>
<file>icons/Draft_VisGroup.svg</file>
<file>icons/Draft_Wipe.svg</file>
<file>icons/Draft_Wire.svg</file>
<file>icons/Draft_WireToBSpline.svg</file>
<file>icons/DraftWorkbench.svg</file>
<file>icons/preferences-draft.svg</file>
<file>icons/Snap_Angle.svg</file>
<file>icons/Snap_Center.svg</file>
<file>icons/Snap_Dimensions.svg</file>
<file>icons/Snap_Endpoint.svg</file>
<file>icons/Snap_Extension.svg</file>
<file>icons/Snap_Grid.svg</file>
<file>icons/Snap_Intersection.svg</file>
<file>icons/Snap_Lock.svg</file>
<file>icons/Snap_Midpoint.svg</file>
<file>icons/Snap_Near.svg</file>
<file>icons/Snap_Ortho.svg</file>
<file>icons/Snap_Parallel.svg</file>
<file>icons/Snap_Perpendicular.svg</file>
<file>icons/Snap_Special.svg</file>
<file>icons/Snap_WorkingPlane.svg</file>
<file>patterns/brick01</file>
<file>patterns/concrete.svg</file>
<file>patterns/cross.svg</file>
<file>patterns/diagonal1.svg</file>
<file>patterns/diagonal2.svg</file>
<file>patterns/earth.svg</file>
<file>patterns/hbone.svg</file>
<file>patterns/line.svg</file>
<file>patterns/plus.svg</file>
<file>patterns/simple.svg</file>
<file>patterns/solid.svg</file>
<file>patterns/square.svg</file>
<file>patterns/steel.svg</file>
<file>patterns/wood.svg</file>
<file>patterns/woodgrain.svg</file>
<file>translations/Draft_af.qm</file>
<file>translations/Draft_ar.qm</file>
<file>translations/Draft_ca.qm</file>
<file>translations/Draft_cs.qm</file>
<file>translations/Draft_de.qm</file>
<file>translations/Draft_el.qm</file>
<file>translations/Draft_es-ES.qm</file>
<file>translations/Draft_eu.qm</file>
<file>translations/Draft_fi.qm</file>
<file>translations/Draft_fil.qm</file>
<file>translations/Draft_fr.qm</file>
<file>translations/Draft_gl.qm</file>
<file>translations/Draft_hr.qm</file>
<file>translations/Draft_hu.qm</file>
<file>translations/Draft_id.qm</file>
<file>translations/Draft_it.qm</file>
<file>translations/Draft_ja.qm</file>
<file>translations/Draft_kab.qm</file>
<file>translations/Draft_ko.qm</file>
<file>translations/Draft_lt.qm</file>
<file>translations/Draft_nl.qm</file>
<file>translations/Draft_no.qm</file>
<file>translations/Draft_pl.qm</file>
<file>translations/Draft_pt-BR.qm</file>
<file>translations/Draft_pt-PT.qm</file>
<file>translations/Draft_ro.qm</file>
<file>translations/Draft_ru.qm</file>
<file>translations/Draft_sk.qm</file>
<file>translations/Draft_sl.qm</file>
<file>translations/Draft_sr.qm</file>
<file>translations/Draft_sv-SE.qm</file>
<file>translations/Draft_tr.qm</file>
<file>translations/Draft_uk.qm</file>
<file>translations/Draft_val-ES.qm</file>
<file>translations/Draft_vi.qm</file>
<file>translations/Draft_zh-CN.qm</file>
<file>translations/Draft_zh-TW.qm</file>
<file>ui/preferences-draft.ui</file>
<file>ui/preferences-draftsnap.ui</file>
<file>ui/preferences-drafttexts.ui</file>
<file>ui/preferences-draftvisual.ui</file>
<file>ui/preferences-dwg.ui</file>
<file>ui/preferences-dxf.ui</file>
<file>ui/preferences-oca.ui</file>
<file>ui/preferences-svg.ui</file>
<file>ui/TaskSelectPlane.ui</file>
<file>ui/TaskShapeString.ui</file>
</qresource>
</RCC>
<RCC>
<qresource>
<file>icons/Draft_2DShapeView.svg</file>
<file>icons/Draft_AddPoint.svg</file>
<file>icons/Draft_AddToGroup.svg</file>
<file>icons/Draft_Apply.svg</file>
<file>icons/Draft_Arc.svg</file>
<file>icons/Draft_Arc_3Points.svg</file>
<file>icons/Draft_Array.svg</file>
<file>icons/Draft_AutoGroup.svg</file>
<file>icons/Draft_AutoGroup_on.svg</file>
<file>icons/Draft_AutoGroup_off.svg</file>
<file>icons/Draft_BezCurve.svg</file>
<file>icons/Draft_BezSharpNode.svg</file>
<file>icons/Draft_BezSymNode.svg</file>
<file>icons/Draft_BezTanNode.svg</file>
<file>icons/Draft_BSpline.svg</file>
<file>icons/Draft_Circle.svg</file>
<file>icons/Draft_Clone.svg</file>
<file>icons/Draft_Construction.svg</file>
<file>icons/Draft_CubicBezCurve.svg</file>
<file>icons/Draft_Cursor.svg</file>
<file>icons/Draft_DelPoint.svg</file>
<file>icons/Draft_Dimension.svg</file>
<file>icons/Draft_Dimension_Tree.svg</file>
<file>icons/Draft_Dot.svg</file>
<file>icons/Draft_Downgrade.svg</file>
<file>icons/Draft_Draft.svg</file>
<file>icons/Draft_Draft2Sketch.svg</file>
<file>icons/Draft_Drawing.svg</file>
<file>icons/Draft_Edit.svg</file>
<file>icons/Draft_Ellipse.svg</file>
<file>icons/Draft_Facebinder.svg</file>
<file>icons/Draft_Facebinder_Provider.svg</file>
<file>icons/Draft_Fillet.svg</file>
<file>icons/Draft_Finish.svg</file>
<file>icons/Draft_FlipDimension.svg</file>
<file>icons/Draft_Grid.svg</file>
<file>icons/Draft_Heal.svg</file>
<file>icons/Draft_Join.svg</file>
<file>icons/Draft_Label.svg</file>
<file>icons/Draft_Layer.svg</file>
<file>icons/Draft_Line.svg</file>
<file>icons/Draft_LinkArray.svg</file>
<file>icons/Draft_Lock.svg</file>
<file>icons/Draft_Macro.svg</file>
<file>icons/Draft_Mirror.svg</file>
<file>icons/Draft_Move.svg</file>
<file>icons/Draft_Offset.svg</file>
<file>icons/Draft_PathArray.svg</file>
<file>icons/Draft_PathLinkArray.svg</file>
<file>icons/Draft_Point.svg</file>
<file>icons/Draft_PointArray.svg</file>
<file>icons/Draft_Polygon.svg</file>
<file>icons/Draft_Rectangle.svg</file>
<file>icons/Draft_Rotate.svg</file>
<file>icons/Draft_Scale.svg</file>
<file>icons/Draft_SelectGroup.svg</file>
<file>icons/Draft_SelectPlane.svg</file>
<file>icons/Draft_ShapeString.svg</file>
<file>icons/Draft_Slope.svg</file>
<file>icons/Draft_Snap.svg</file>
<file>icons/Draft_Split.svg</file>
<file>icons/Draft_Stretch.svg</file>
<file>icons/Draft_SubelementHighlight.svg</file>
<file>icons/Draft_SwitchMode.svg</file>
<file>icons/Draft_Text.svg</file>
<file>icons/Draft_Trimex.svg</file>
<file>icons/Draft_Upgrade.svg</file>
<file>icons/Draft_VisGroup.svg</file>
<file>icons/Draft_Wipe.svg</file>
<file>icons/Draft_Wire.svg</file>
<file>icons/Draft_WireToBSpline.svg</file>
<file>icons/DraftWorkbench.svg</file>
<file>icons/preferences-draft.svg</file>
<file>icons/Snap_Angle.svg</file>
<file>icons/Snap_Center.svg</file>
<file>icons/Snap_Dimensions.svg</file>
<file>icons/Snap_Endpoint.svg</file>
<file>icons/Snap_Extension.svg</file>
<file>icons/Snap_Grid.svg</file>
<file>icons/Snap_Intersection.svg</file>
<file>icons/Snap_Lock.svg</file>
<file>icons/Snap_Midpoint.svg</file>
<file>icons/Snap_Near.svg</file>
<file>icons/Snap_Ortho.svg</file>
<file>icons/Snap_Parallel.svg</file>
<file>icons/Snap_Perpendicular.svg</file>
<file>icons/Snap_Special.svg</file>
<file>icons/Snap_WorkingPlane.svg</file>
<file>patterns/brick01</file>
<file>patterns/concrete.svg</file>
<file>patterns/cross.svg</file>
<file>patterns/diagonal1.svg</file>
<file>patterns/diagonal2.svg</file>
<file>patterns/earth.svg</file>
<file>patterns/hbone.svg</file>
<file>patterns/line.svg</file>
<file>patterns/plus.svg</file>
<file>patterns/simple.svg</file>
<file>patterns/solid.svg</file>
<file>patterns/square.svg</file>
<file>patterns/steel.svg</file>
<file>patterns/wood.svg</file>
<file>patterns/woodgrain.svg</file>
<file>translations/Draft_af.qm</file>
<file>translations/Draft_ar.qm</file>
<file>translations/Draft_ca.qm</file>
<file>translations/Draft_cs.qm</file>
<file>translations/Draft_de.qm</file>
<file>translations/Draft_el.qm</file>
<file>translations/Draft_es-ES.qm</file>
<file>translations/Draft_eu.qm</file>
<file>translations/Draft_fi.qm</file>
<file>translations/Draft_fil.qm</file>
<file>translations/Draft_fr.qm</file>
<file>translations/Draft_gl.qm</file>
<file>translations/Draft_hr.qm</file>
<file>translations/Draft_hu.qm</file>
<file>translations/Draft_id.qm</file>
<file>translations/Draft_it.qm</file>
<file>translations/Draft_ja.qm</file>
<file>translations/Draft_kab.qm</file>
<file>translations/Draft_ko.qm</file>
<file>translations/Draft_lt.qm</file>
<file>translations/Draft_nl.qm</file>
<file>translations/Draft_no.qm</file>
<file>translations/Draft_pl.qm</file>
<file>translations/Draft_pt-BR.qm</file>
<file>translations/Draft_pt-PT.qm</file>
<file>translations/Draft_ro.qm</file>
<file>translations/Draft_ru.qm</file>
<file>translations/Draft_sk.qm</file>
<file>translations/Draft_sl.qm</file>
<file>translations/Draft_sr.qm</file>
<file>translations/Draft_sv-SE.qm</file>
<file>translations/Draft_tr.qm</file>
<file>translations/Draft_uk.qm</file>
<file>translations/Draft_val-ES.qm</file>
<file>translations/Draft_vi.qm</file>
<file>translations/Draft_zh-CN.qm</file>
<file>translations/Draft_zh-TW.qm</file>
<file>ui/preferences-draft.ui</file>
<file>ui/preferences-draftsnap.ui</file>
<file>ui/preferences-drafttexts.ui</file>
<file>ui/preferences-draftvisual.ui</file>
<file>ui/preferences-dwg.ui</file>
<file>ui/preferences-dxf.ui</file>
<file>ui/preferences-oca.ui</file>
<file>ui/preferences-svg.ui</file>
<file>ui/TaskSelectPlane.ui</file>
<file>ui/TaskShapeString.ui</file>
</qresource>
</RCC>

View File

@@ -1,5 +1,5 @@
/** \defgroup DRAFT Draft
* \ingroup PYTHONWORKBENCHES
* \brief Basic 2D drawing tools and other generic tools
*/
/** \defgroup DRAFT Draft
* \ingroup PYTHONWORKBENCHES
* \brief Basic 2D drawing tools and other generic tools
*/

View File

@@ -1,62 +0,0 @@
# In case people don't have core.autocrlf set, this will manage the default line-ending
# behaviour for all files recursively
# * text=auto
# to be save this will be commented
# for more information see forum topic and pull request
# https://github.com/FreeCAD/FreeCAD/pull/2752
# https://forum.freecadweb.org/viewtopic.php?f=17&t=41117
# get all used file types
# in a directory in a bash use
# find . -type f -name '*.*' | sed 's|.*\.||' | sort -u
# add all of them either to text or binary
# Explicitly declare which files we wish to always normalize line-endings on
# standard endings
*.bat text
*.cpp text
*.csv text
*.h text
*.md text
*.py text
*.qrc text
*.ts text
*.txt text
*.ui text
*.xml text
*.yml text
# Fem specific endings
*.dat text
*.frd text
*.geo text
*.inp text
*.sif text
*.unv text
*.vtk text
*.z88 text
# These files will always be checked out with CRLF, i.e. windows-style line endings. This
# really should not be needed...
# *.SomeWindowsFileExtensionThatReallyRequiresCRLFEvenInLinux eol=crlf
# These files should be ignored as it pertains to line-endings, because they are binary.
# Since auto normalize is deactivated all these could be commented too.
# *.dox binary
# *.FCStd binary
# *.jpg binary
# *.png binary
# *.pyc binary
# *.qm binary
# *.svg binary
# use git to manually correct the file endings
# git add --renormalize .

View File

@@ -1,6 +1,6 @@
(c) 2010 Milos Koutny (milos.koutny@gmail.com)
All parts in this directory are supported by Milos Koutny
and licensed under:
Creative Commons Attribution Share Alike
(c) 2010 Milos Koutny (milos.koutny@gmail.com)
All parts in this directory are supported by Milos Koutny
and licensed under:
Creative Commons Attribution Share Alike

View File

@@ -1,35 +1,35 @@
"FOOTPRINT" "STEP FILE"
"SOT23-R" "SOT23.igs"
"SMD_C_0805-R" "0805_SMD.stp"
"SMD_C_1210-R" "1210_SMD.stp"
"SMD_R_1206-R" "1206_SMD.stp"
"SMD_C_0603-R" "0603_SMD.stp"
"SMD_R_0603-R" "0603_SMD.stp"
"MINISMDC-1812-R" "1812_SMD.stp"
"SMD_C_2225-R" "2225_SMD.stp"
"SMD_R_2512-R" "2512_SMD.stp"
"1812PS" "1812_SMD.stp"
"TSSOP8_065M-R" "TSS0P_8.stp"
"MSOP10E_LT" "MSOP_10.stp"
"TCMT11XX" "TCMT1107_4.stp"
"SMB-TB" "SMB_DO_214AA.stp"
"SOT404-GDS-R" "SOT404.igs"
"SOT428-A1-A2C-R" "SOT428_DPAK.stp"
"SOT96-1-R" "SOT_96.stp"
"SOT323-BEC-R" "SOT_323_3.stp"
"SOD523-R" "SOD_523.stp"
"SMC" "SMC_DO_214AB.stp"
"SOD523-R" "SOD_523.stp"
"TSM-104-01-L-DV" "TSM_104_01_L_DV_A.stp"
"TSM-103-01-L-DV-A" "TSM_103_01_L_DV_A.stp"
"SOD323-R" "SOD_323.igs"
"VC0603-R" "VC0603_SMD.stp"
"RLF12545" "RLF_12545.igs"
"CAPAE830X1050" "CAP_50SGV_8_10.stp"
"RLF7030-R" "RLF_7030.stp"
"EPS_B66285E" "EPL22_6_16.stp"
"EPS_B66285I" "I22_2_5_16.stp"
"FOOTPRINT" "STEP FILE"
"SOT23-R" "SOT23.igs"
"SMD_C_0805-R" "0805_SMD.stp"
"SMD_C_1210-R" "1210_SMD.stp"
"SMD_R_1206-R" "1206_SMD.stp"
"SMD_C_0603-R" "0603_SMD.stp"
"SMD_R_0603-R" "0603_SMD.stp"
"MINISMDC-1812-R" "1812_SMD.stp"
"SMD_C_2225-R" "2225_SMD.stp"
"SMD_R_2512-R" "2512_SMD.stp"
"1812PS" "1812_SMD.stp"
"TSSOP8_065M-R" "TSS0P_8.stp"
"MSOP10E_LT" "MSOP_10.stp"
"TCMT11XX" "TCMT1107_4.stp"
"SMB-TB" "SMB_DO_214AA.stp"
"SOT404-GDS-R" "SOT404.igs"
"SOT428-A1-A2C-R" "SOT428_DPAK.stp"
"SOT96-1-R" "SOT_96.stp"
"SOT323-BEC-R" "SOT_323_3.stp"
"SOD523-R" "SOD_523.stp"
"SMC" "SMC_DO_214AB.stp"
"SOD523-R" "SOD_523.stp"
"TSM-104-01-L-DV" "TSM_104_01_L_DV_A.stp"
"TSM-103-01-L-DV-A" "TSM_103_01_L_DV_A.stp"
"SOD323-R" "SOD_323.igs"
"VC0603-R" "VC0603_SMD.stp"
"RLF12545" "RLF_12545.igs"
"CAPAE830X1050" "CAP_50SGV_8_10.stp"
"RLF7030-R" "RLF_7030.stp"
"EPS_B66285E" "EPL22_6_16.stp"
"EPS_B66285I" "I22_2_5_16.stp"
Can't render this file because it contains an unexpected character in line 1 and column 11.

View File

@@ -1,36 +1,36 @@
# Idf init module
# (c) 2003 Juergen Riegel
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
# two options for IDF added by Milos Koutny (12-Feb-2010)
FreeCAD.addImportType("IDF emn file File Type (*.emn)","Idf")
#FreeCAD.addImportType("IDF emp File Type (*.emp)","Import_Emp")
# Idf init module
# (c) 2003 Juergen Riegel
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
# two options for IDF added by Milos Koutny (12-Feb-2010)
FreeCAD.addImportType("IDF emn file File Type (*.emn)","Idf")
#FreeCAD.addImportType("IDF emp File Type (*.emp)","Import_Emp")

View File

@@ -1,37 +1,37 @@
# FreeCAD init script of the OpenSCAD module
# (c) 2001 Juergen Riegel
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
import FreeCAD,os
FreeCAD.addImportType("OpenSCAD CSG Format (*.csg)","importCSG")
param = FreeCAD.ParamGet(\
"User parameter:BaseApp/Preferences/Mod/OpenSCAD")
openscadfilename = param.GetString('openscadexecutable')
openscadbin = openscadfilename and os.path.isfile(openscadfilename)
if openscadbin:
FreeCAD.addImportType("OpenSCAD Format (*.scad)","importCSG")
FreeCAD.addExportType("OpenSCAD CSG Format (*.csg)","exportCSG")
FreeCAD.addExportType("OpenSCAD Format (*.scad)","exportCSG")
# FreeCAD init script of the OpenSCAD module
# (c) 2001 Juergen Riegel
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
import FreeCAD,os
FreeCAD.addImportType("OpenSCAD CSG Format (*.csg)","importCSG")
param = FreeCAD.ParamGet(\
"User parameter:BaseApp/Preferences/Mod/OpenSCAD")
openscadfilename = param.GetString('openscadexecutable')
openscadbin = openscadfilename and os.path.isfile(openscadfilename)
if openscadbin:
FreeCAD.addImportType("OpenSCAD Format (*.scad)","importCSG")
FreeCAD.addExportType("OpenSCAD CSG Format (*.csg)","exportCSG")
FreeCAD.addExportType("OpenSCAD Format (*.scad)","exportCSG")

View File

@@ -1,5 +1,5 @@
/** \defgroup OPENSCAD OpenSCAD
* \ingroup PYTHONWORKBENCHES
* \brief Interface with OpenSCAD
*/
/** \defgroup OPENSCAD OpenSCAD
* \ingroup PYTHONWORKBENCHES
* \brief Interface with OpenSCAD
*/

View File

@@ -1,54 +1,54 @@
<RCC>
<qresource>
<file>icons/preferences-openscad.svg</file>
<file>icons/OpenSCAD_AddOpenSCADElement.svg</file>
<file>icons/OpenSCAD_ColorCodeShape.svg</file>
<file>icons/OpenSCAD_RefineShapeFeature.svg</file>
<file>icons/OpenSCAD_IncreaseToleranceFeature.svg</file>
<file>icons/OpenSCAD_ReplaceObject.svg</file>
<file>icons/OpenSCAD_RemoveSubtree.svg</file>
<file>icons/OpenSCAD_Explode_Group.svg</file>
<file>icons/OpenSCAD_MeshBooleans.svg</file>
<file>icons/OpenSCAD_Hull.svg</file>
<file>icons/OpenSCAD_Minkowski.svg</file>
<file>icons/OpenSCADWorkbench.svg</file>
<file>ui/openscadprefs-base.ui</file>
<file>translations/OpenSCAD_tr.qm</file>
<file>translations/OpenSCAD_sv-SE.qm</file>
<file>translations/OpenSCAD_de.qm</file>
<file>translations/OpenSCAD_pl.qm</file>
<file>translations/OpenSCAD_fi.qm</file>
<file>translations/OpenSCAD_zh-TW.qm</file>
<file>translations/OpenSCAD_no.qm</file>
<file>translations/OpenSCAD_nl.qm</file>
<file>translations/OpenSCAD_pt-BR.qm</file>
<file>translations/OpenSCAD_uk.qm</file>
<file>translations/OpenSCAD_cs.qm</file>
<file>translations/OpenSCAD_sk.qm</file>
<file>translations/OpenSCAD_fr.qm</file>
<file>translations/OpenSCAD_ru.qm</file>
<file>translations/OpenSCAD_af.qm</file>
<file>translations/OpenSCAD_hr.qm</file>
<file>translations/OpenSCAD_es-ES.qm</file>
<file>translations/OpenSCAD_zh-CN.qm</file>
<file>translations/OpenSCAD_ja.qm</file>
<file>translations/OpenSCAD_ro.qm</file>
<file>translations/OpenSCAD_hu.qm</file>
<file>translations/OpenSCAD_it.qm</file>
<file>translations/OpenSCAD_pt-PT.qm</file>
<file>translations/OpenSCAD_sr.qm</file>
<file>translations/OpenSCAD_el.qm</file>
<file>translations/OpenSCAD_sl.qm</file>
<file>translations/OpenSCAD_eu.qm</file>
<file>translations/OpenSCAD_ca.qm</file>
<file>translations/OpenSCAD_gl.qm</file>
<file>translations/OpenSCAD_kab.qm</file>
<file>translations/OpenSCAD_ko.qm</file>
<file>translations/OpenSCAD_fil.qm</file>
<file>translations/OpenSCAD_id.qm</file>
<file>translations/OpenSCAD_lt.qm</file>
<file>translations/OpenSCAD_val-ES.qm</file>
<file>translations/OpenSCAD_ar.qm</file>
<file>translations/OpenSCAD_vi.qm</file>
</qresource>
</RCC>
<RCC>
<qresource>
<file>icons/preferences-openscad.svg</file>
<file>icons/OpenSCAD_AddOpenSCADElement.svg</file>
<file>icons/OpenSCAD_ColorCodeShape.svg</file>
<file>icons/OpenSCAD_RefineShapeFeature.svg</file>
<file>icons/OpenSCAD_IncreaseToleranceFeature.svg</file>
<file>icons/OpenSCAD_ReplaceObject.svg</file>
<file>icons/OpenSCAD_RemoveSubtree.svg</file>
<file>icons/OpenSCAD_Explode_Group.svg</file>
<file>icons/OpenSCAD_MeshBooleans.svg</file>
<file>icons/OpenSCAD_Hull.svg</file>
<file>icons/OpenSCAD_Minkowski.svg</file>
<file>icons/OpenSCADWorkbench.svg</file>
<file>ui/openscadprefs-base.ui</file>
<file>translations/OpenSCAD_tr.qm</file>
<file>translations/OpenSCAD_sv-SE.qm</file>
<file>translations/OpenSCAD_de.qm</file>
<file>translations/OpenSCAD_pl.qm</file>
<file>translations/OpenSCAD_fi.qm</file>
<file>translations/OpenSCAD_zh-TW.qm</file>
<file>translations/OpenSCAD_no.qm</file>
<file>translations/OpenSCAD_nl.qm</file>
<file>translations/OpenSCAD_pt-BR.qm</file>
<file>translations/OpenSCAD_uk.qm</file>
<file>translations/OpenSCAD_cs.qm</file>
<file>translations/OpenSCAD_sk.qm</file>
<file>translations/OpenSCAD_fr.qm</file>
<file>translations/OpenSCAD_ru.qm</file>
<file>translations/OpenSCAD_af.qm</file>
<file>translations/OpenSCAD_hr.qm</file>
<file>translations/OpenSCAD_es-ES.qm</file>
<file>translations/OpenSCAD_zh-CN.qm</file>
<file>translations/OpenSCAD_ja.qm</file>
<file>translations/OpenSCAD_ro.qm</file>
<file>translations/OpenSCAD_hu.qm</file>
<file>translations/OpenSCAD_it.qm</file>
<file>translations/OpenSCAD_pt-PT.qm</file>
<file>translations/OpenSCAD_sr.qm</file>
<file>translations/OpenSCAD_el.qm</file>
<file>translations/OpenSCAD_sl.qm</file>
<file>translations/OpenSCAD_eu.qm</file>
<file>translations/OpenSCAD_ca.qm</file>
<file>translations/OpenSCAD_gl.qm</file>
<file>translations/OpenSCAD_kab.qm</file>
<file>translations/OpenSCAD_ko.qm</file>
<file>translations/OpenSCAD_fil.qm</file>
<file>translations/OpenSCAD_id.qm</file>
<file>translations/OpenSCAD_lt.qm</file>
<file>translations/OpenSCAD_val-ES.qm</file>
<file>translations/OpenSCAD_ar.qm</file>
<file>translations/OpenSCAD_vi.qm</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@@ -87,6 +87,38 @@ class UnitBasicCases(unittest.TestCase):
v = FreeCAD.Units.parseQuantity(t[0]).getValueAs("ksi")
self.assertAlmostEqual(1, v.Value, msg="Failed with \"{0}\" scheme: {1} != 1 (delta: {2})".format(schemes[i], v.Value, self.delta), delta=self.delta)
def testSchemeTranslation(self):
quantities = []
for i in dir(FreeCAD.Units):
if issubclass(type(getattr(FreeCAD.Units, i)), FreeCAD.Units.Quantity):
quantities.append(i)
schemes = FreeCAD.Units.listSchemas()
for i in quantities:
q1 = getattr(FreeCAD.Units, i)
q1 = FreeCAD.Units.Quantity(q1)
q1.Format = {'Precision': 16}
for idx, val in enumerate(schemes):
t = FreeCAD.Units.schemaTranslate(q1, idx)
try:
q2 = FreeCAD.Units.Quantity(t[0])
if math.fabs(q1.Value - q2.Value) > 0.01:
print (q1, " : ", q2, " : ", t, " : ", i, " : ", val)
except Exception as e:
print ("{}: {}".format(str(e), t[0]))
def testVoltage(self):
q1 = FreeCAD.Units.Quantity("1e20 V")
t = FreeCAD.Units.schemaTranslate(q1, 0) # Standard
q2 = FreeCAD.Units.Quantity(t[0])
self.assertAlmostEqual(q1.Value, q2.Value, delta=self.delta)
def testEnergy(self):
q1 = FreeCAD.Units.Quantity("1e20 J")
t = FreeCAD.Units.schemaTranslate(q1, 0) # Standard
q2 = FreeCAD.Units.Quantity(t[0])
self.assertAlmostEqual(q1.Value, q2.Value, delta=self.delta)
def testTrigonometric(self):
#tu=FreeCAD.Units.translateUnit
self.failUnless(compare(tu('sin(pi)'), math.sin(math.pi)))

View File

@@ -1,30 +1,30 @@
/** \addtogroup WORKBENCHES
Most of FreeCAD's functionality is defined in dedicated Workbenches
Those plugins, also called \b modules or \b workbenches, provide
functionality for specialized facets of FreeCAD. The word \b module
refers to any new group of tools, while \b workbench designates
specifically a GUI group of tools in the FreeCAD interface. All
workbenches are defined in modules, but not all modules contain a
workbench. Practically, though, all the main modules define a
workbench with the same name, so the terms are almost interchangeable.
Some of these modules are programmed in C++, others in Python, and some
in a mix of C++ and Python.
*/
/** \defgroup CWORKBENCHES C++ workbenches
* \ingroup WORKBENCHES
* \brief These workbenches are programmed primarily in C++, but most provide a Python API as well.
*/
/** \defgroup PYTHONWORKBENCHES Python workbenches
* \ingroup WORKBENCHES
* \brief Those are workbenches programmed primarily in Python
*/
/** \defgroup UTILITIES Utility modules
* \ingroup WORKBENCHES
* \brief Modules that provide utility tools to FreeCAD but don't define a workbench
*/
/** \addtogroup WORKBENCHES
Most of FreeCAD's functionality is defined in dedicated Workbenches
Those plugins, also called \b modules or \b workbenches, provide
functionality for specialized facets of FreeCAD. The word \b module
refers to any new group of tools, while \b workbench designates
specifically a GUI group of tools in the FreeCAD interface. All
workbenches are defined in modules, but not all modules contain a
workbench. Practically, though, all the main modules define a
workbench with the same name, so the terms are almost interchangeable.
Some of these modules are programmed in C++, others in Python, and some
in a mix of C++ and Python.
*/
/** \defgroup CWORKBENCHES C++ workbenches
* \ingroup WORKBENCHES
* \brief These workbenches are programmed primarily in C++, but most provide a Python API as well.
*/
/** \defgroup PYTHONWORKBENCHES Python workbenches
* \ingroup WORKBENCHES
* \brief Those are workbenches programmed primarily in Python
*/
/** \defgroup UTILITIES Utility modules
* \ingroup WORKBENCHES
* \brief Modules that provide utility tools to FreeCAD but don't define a workbench
*/

View File

@@ -101,14 +101,26 @@ public:
+ if i.Keyword:
/// callback for the @i.Name@() method
static PyObject * staticCallback_@i.Name@ (PyObject *self, PyObject *args, PyObject *kwd);
+ if not i.Static and not i.Class:
+ if i.Static:
/// implementer for the @i.Name@() method
static PyObject* @i.Name@(PyObject *args, PyObject *kwd);
= elif i.Class:
/// implementer for the @i.Name@() method
static PyObject* @i.Name@(PyObject *self, PyObject *args, PyObject *kwd);
= else:
/// implementer for the @i.Name@() method
PyObject* @i.Name@(PyObject *args, PyObject *kwd);
-
= else:
/// callback for the @i.Name@() method
static PyObject * staticCallback_@i.Name@ (PyObject *self, PyObject *args);
+ if not i.Static and not i.Class:
+ if i.Static:
/// implementer for the @i.Name@() method
static PyObject* @i.Name@(PyObject *args);
= elif i.Class:
/// implementer for the @i.Name@() method
static PyObject* @i.Name@(PyObject *self, PyObject *args);
= else:
/// implementer for the @i.Name@() method
PyObject* @i.Name@(PyObject *args);
-
@@ -533,13 +545,13 @@ PyGetSetDef @self.export.Name@::GetterSetter[] = {
// @i.Name@() callback and implementer
// PyObject* @self.export.Name@::@i.Name@(PyObject *args){};
// has to be implemented in @self.export.Name@Imp.cpp
+ if not i.Static and not i.Class:
+ if i.Keyword:
PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject *args, PyObject * kwd)
= else:
PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject *args)
-
{
+ if not i.Static and not i.Class:
// make sure that not a null pointer is passed
if (!self) {
PyErr_SetString(PyExc_TypeError, "descriptor '@i.Name@' of '@self.export.Namespace@.@self.export.Twin@' object needs an argument");
@@ -560,15 +572,32 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject
}
-
-
try { // catches all exceptions coming up from c++ and generate a python exception
+ if i.Keyword:
+ if i.Static:
(void)self;
PyObject* ret = @self.export.Name@::@i.Name@(args, kwd);
= elif i.Class:
PyObject* ret = @self.export.Name@::@i.Name@(self, args, kwd);
= else:
PyObject* ret = static_cast<@self.export.Name@*>(self)->@i.Name@(args, kwd);
-
= else:
+ if i.Static:
(void)self;
PyObject* ret = @self.export.Name@::@i.Name@(args);
= elif i.Class:
PyObject* ret = @self.export.Name@::@i.Name@(self, args);
= else:
PyObject* ret = static_cast<@self.export.Name@*>(self)->@i.Name@(args);
-
-
+ if not i.Static and not i.Class:
+ if (not i.Const):
if (ret != 0)
static_cast<@self.export.Name@*>(self)->startNotify();
-
-
return ret;
} // Please sync the following catch implementation with PY_CATCH
@@ -611,7 +640,6 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject
#endif
}
-
-
+ for i in self.export.Attribute:
// @i.Name@() callback and implementer
@@ -894,18 +922,24 @@ std::string @self.export.Name@::representation(void) const
}
+ for i in self.export.Methode:
+ if not i.Static and not i.Class:
+ if i.Keyword:
+ if i.Class:
PyObject* @self.export.Name@::@i.Name@(PyObject *self, PyObject *args, PyObject *kwds)
= else:
PyObject* @self.export.Name@::@i.Name@(PyObject *args, PyObject *kwds)
-
= else:
+ if i.Class:
PyObject* @self.export.Name@::@i.Name@(PyObject *self, PyObject *args)
= else:
PyObject* @self.export.Name@::@i.Name@(PyObject *args)
-
-
{
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
return 0;
}
-
-
+ if (self.export.NumberProtocol):
PyObject* @self.export.Name@::number_add_handler(PyObject* /*self*/, PyObject* /*other*/)
@@ -1213,18 +1247,24 @@ int @self.export.Name@::finalization()
+ for i in self.export.Methode:
+ if not i.Static and not i.Class:
+ if i.Keyword:
+ if i.Class:
PyObject* @self.export.Name@::@i.Name@(PyObject * /*self*/, PyObject * /*args*/, PyObject * /*kwds*/)
= else:
PyObject* @self.export.Name@::@i.Name@(PyObject * /*args*/, PyObject * /*kwds*/)
-
= else:
+ if i.Class:
PyObject* @self.export.Name@::@i.Name@(PyObject * /*self*/, PyObject * /*args*/)
= else:
PyObject* @self.export.Name@::@i.Name@(PyObject * /*args*/)
-
-
{
PyErr_SetString(PyExc_NotImplementedError, "Not yet implemented");
return 0;
}
-
-
+ if (self.export.NumberProtocol):
PyObject* @self.export.Name@::number_add_handler(PyObject *self, PyObject *other)