From 8752982b784ded7633e892fd5243fbc760ea0b22 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 18 Dec 2024 11:35:53 +0900 Subject: [PATCH 001/224] Base: Improved FindElement performance by reducing call of transcode --- src/Base/Parameter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index b2308a7804..1b0b97722a 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -1396,15 +1396,19 @@ ParameterGrp::FindElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* Start, Type); return nullptr; } + const XStr xType(Type); + const XStr xName(Name); for (DOMNode* clChild = Start->getFirstChild(); clChild != nullptr; clChild = clChild->getNextSibling()) { if (clChild->getNodeType() == DOMNode::ELEMENT_NODE) { // the right node Type - if (!strcmp(Type, StrX(clChild->getNodeName()).c_str())) { + if (!XMLString::compareString(xType.unicodeForm(), clChild->getNodeName())) { if (clChild->getAttributes()->getLength() > 0) { if (Name) { DOMNode* attr = FindAttribute(clChild, "Name"); - if (attr && !strcmp(Name, StrX(attr->getNodeValue()).c_str())) { + if (attr + && !XMLString::compareString(xName.unicodeForm(), + attr->getNodeValue())) { return dynamic_cast(clChild); } } @@ -1426,10 +1430,11 @@ ParameterGrp::FindNextElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* Prev, cons return nullptr; } + const XStr xType(Type); while ((clChild = clChild->getNextSibling()) != nullptr) { if (clChild->getNodeType() == DOMNode::ELEMENT_NODE) { // the right node Type - if (!strcmp(Type, StrX(clChild->getNodeName()).c_str())) { + if (!XMLString::compareString(xType.unicodeForm(), clChild->getNodeName())) { return dynamic_cast(clChild); } } From 04ff8988ce15ff4bc9add6221df5afd884066850 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Sun, 22 Dec 2024 13:20:08 -0300 Subject: [PATCH 002/224] refactor(PD): dynamically set threadSize enums --- src/Mod/PartDesign/App/FeatureHole.cpp | 118 +++---------------------- src/Mod/PartDesign/App/FeatureHole.h | 10 --- 2 files changed, 14 insertions(+), 114 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index d4329b4a31..ff63ed393d 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -75,7 +75,6 @@ const char* Hole::DrillPointEnums[] = { "Flat", "Angled", nullp /* "None" profile */ const char* Hole::HoleCutType_None_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr }; -const char* Hole::ThreadSize_None_Enums[] = { "None", nullptr }; const char* Hole::ThreadClass_None_Enums[] = { "None", nullptr }; /* Sources: @@ -615,20 +614,22 @@ const Hole::UTSClearanceDefinition Hole::UTSHoleDiameters[22] = { "1 1/2", 39.7, 41.3, 44.0 } }; +std::vector getThreadDesignations(const int threadType) { + std::vector designations; + for (const auto& thread : Hole::threadDescription[threadType]) { + if (thread.designation != nullptr) { + designations.emplace_back(thread.designation); + } + } + return designations; +} + /* ISO coarse metric enums */ std::vector Hole::HoleCutType_ISOmetric_Enums = { "None", "Counterbore", "Countersink", "Counterdrill"}; -const char* Hole::ThreadSize_ISOmetric_Enums[] = { "M1", "M1.1", "M1.2", "M1.4", "M1.6", - "M1.8", "M2", "M2.2", "M2.5", "M3", - "M3.5", "M4", "M4.5", "M5", "M6", - "M7", "M8", "M9", "M10", "M11", - "M12", "M14", "M16", "M18", "M20", - "M22", "M24", "M27", "M30", "M33", - "M36", "M39", "M42", "M45", "M48", - "M52", "M56", "M60", "M64", "M68", nullptr }; const char* Hole::ThreadClass_ISOmetric_Enums[] = { "4G", "4H", "5G", "5H", "6G", "6H", "7G", "7H","8G", "8H", nullptr }; std::vector Hole::HoleCutType_ISOmetricfine_Enums = { @@ -636,50 +637,6 @@ std::vector Hole::HoleCutType_ISOmetricfine_Enums = { "Counterbore", "Countersink", "Counterdrill"}; -const char* Hole::ThreadSize_ISOmetricfine_Enums[] = { - "M1x0.2", "M1.1x0.2", "M1.2x0.2", "M1.4x0.2", - "M1.6x0.2", "M1.8x0.2", "M2x0.25", "M2.2x0.25", - "M2.5x0.35", "M3x0.35", "M3.5x0.35", - "M4x0.5", "M4.5x0.5", "M5x0.5", "M5.5x0.5", - "M6x0.75", "M7x0.75", "M8x0.75", "M8x1.0", - "M9x0.75", "M9x1.0", "M10x0.75", "M10x1.0", - "M10x1.25", "M11x0.75", "M11x1.0", "M12x1.0", - "M12x1.25", "M12x1.5", "M14x1.0", "M14x1.25", - "M14x1.5", "M15x1.0", "M15x1.5", "M16x1.0", - "M16x1.5", "M17x1.0", "M17x1.5", "M18x1.0", - "M18x1.5", "M18x2.0", "M20x1.0", "M20x1.5", - "M20x2.0", "M22x1.0", "M22x1.5", "M22x2.0", - "M24x1.0", "M24x1.5", "M24x2.0", "M25x1.0", - "M25x1.5", "M25x2.0", "M27x1.0", "M27x1.5", - "M27x2.0", "M28x1.0", "M28x1.5", "M28x2.0", - "M30x1.0", "M30x1.5", "M30x2.0", "M30x3.0", - "M32x1.5", "M32x2.0", "M33x1.5", "M33x2.0", - "M33x3.0", "M35x1.5", "M35x2.0", "M36x1.5", - "M36x2.0", "M36x3.0", "M39x1.5", "M39x2.0", - "M39x3.0", "M40x1.5", "M40x2.0", "M40x3.0", - "M42x1.5", "M42x2.0", "M42x3.0", "M42x4.0", - "M45x1.5", "M45x2.0", "M45x3.0", "M45x4.0", - "M48x1.5", "M48x2.0", "M48x3.0", "M48x4.0", - "M50x1.5", "M50x2.0", "M50x3.0", "M52x1.5", - "M52x2.0", "M52x3.0", "M52x4.0", "M55x1.5", - "M55x2.0", "M55x3.0", "M55x4.0", "M56x1.5", - "M56x2.0", "M56x3.0", "M56x4.0", "M58x1.5", - "M58x2.0", "M58x3.0", "M58x4.0", "M60x1.5", - "M60x2.0", "M60x3.0", "M60x4.0", "M62x1.5", - "M62x2.0", "M62x3.0", "M62x4.0", "M64x1.5", - "M64x2.0", "M64x3.0", "M64x4.0", "M65x1.5", - "M65x2.0", "M65x3.0", "M65x4.0", "M68x1.5", - "M68x2.0", "M68x3.0", "M68x4.0", "M70x1.5", - "M70x2.0", "M70x3.0", "M70x4.0", "M70x6.0", - "M72x1.5", "M72x2.0", "M72x3.0", "M72x4.0", - "M72x6.0", "M75x1.5", "M75x2.0", "M75x3.0", - "M75x4.0", "M75x6.0", "M76x1.5", "M76x2.0", - "M76x3.0", "M76x4.0", "M76x6.0", "M80x1.5", - "M80x2.0", "M80x3.0", "M80x4.0", "M80x6.0", - "M85x2.0", "M85x3.0", "M85x4.0", "M85x6.0", - "M90x2.0", "M90x3.0", "M90x4.0", "M90x6.0", - "M95x2.0", "M95x3.0", "M95x4.0", "M95x6.0", - "M100x2.0", "M100x3.0", "M100x4.0", "M100x6.0", nullptr }; const char* Hole::ThreadClass_ISOmetricfine_Enums[] = { "4G", "4H", "5G", "5H", "6G", "6H", "7G", "7H","8G", "8H", nullptr }; // ISO 965-1:2013 ISO general purpose metric screw threads - Tolerances - Part 1 @@ -747,67 +704,28 @@ const double Hole::ThreadRunout[ThreadRunout_size][2] = { /* UTS coarse */ const char* Hole::HoleCutType_UNC_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr}; -const char* Hole::ThreadSize_UNC_Enums[] = { "#1", "#2", "#3", "#4", "#5", "#6", - "#8", "#10", "#12", - "1/4", "5/16", "3/8", "7/16", "1/2", "9/16", - "5/8", "3/4", "7/8", "1", "1 1/8", "1 1/4", - "1 3/8", "1 1/2", "1 3/4", "2", "2 1/4", - "2 1/2", "2 3/4", "3", "3 1/4", "3 1/2", - "3 3/4", "4", nullptr }; const char* Hole::ThreadClass_UNC_Enums[] = { "1B", "2B", "3B", nullptr }; /* UTS fine */ const char* Hole::HoleCutType_UNF_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr}; -const char* Hole::ThreadSize_UNF_Enums[] = { "#0", "#1", "#2", "#3", "#4", "#5", "#6", - "#8", "#10", "#12", - "1/4", "5/16", "3/8", "7/16", "1/2", "9/16", - "5/8", "3/4", "7/8", "1", "1 1/8", "1 1/4", - "1 3/8", "1 1/2", nullptr }; const char* Hole::ThreadClass_UNF_Enums[] = { "1B", "2B", "3B", nullptr }; /* UTS extrafine */ const char* Hole::HoleCutType_UNEF_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr}; -const char* Hole::ThreadSize_UNEF_Enums[] = { "#12", "1/4", "5/16", "3/8", "7/16", "1/2", - "9/16", "5/8", "11/16", "3/4", "13/16", "7/8", - "15/16", "1", "1 1/16", "1 1/8", "1 1/4", - "1 5/16", "1 3/8", "1 7/16", "1 1/2", "1 9/16", - "1 5/8", "1 11/16", nullptr }; const char* Hole::ThreadClass_UNEF_Enums[] = { "1B", "2B", "3B", nullptr }; /* NPT */ const char* Hole::HoleCutType_NPT_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr}; -const char* Hole::ThreadSize_NPT_Enums[] = { "1/16", "1/8", "1/4", "3/8", "1/2", "3/4", - "1", "1 1/4", "1 1/2", - "2", "2 1/2", - "3", "3 1/2", - "4", "5", "6", "8", "10", "12", nullptr }; /* BSP */ const char* Hole::HoleCutType_BSP_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr}; -const char* Hole::ThreadSize_BSP_Enums[] = { "1/16", "1/8", "1/4", "3/8", "1/2", "5/8", "3/4", "7/8", - "1", "1 1/8", "1 1/4", "1 3/8", "1 1/2", "1 3/4", - "2", "2 1/4", "2 1/2", "2 3/4", - "3", "3 1/2", "4", "4 1/2", - "5", "5 1/2", "6", nullptr }; /* BSW */ const char* Hole::HoleCutType_BSW_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr}; -const char* Hole::ThreadSize_BSW_Enums[] = { "1/8", "3/16", "1/4", "5/16", "3/8", "7/16", - "1/2", "9/16", "5/8", "11/16", "3/4", "7/8", - "1", "1 1/8", "1 1/4", "1 1/2", "1 3/4", - "2", "2 1/4", "2 1/2", "2 3/4", - "3", "3 1/4", "3 1/2", "3 3/4", - "4", "4 1/2", "5", "5 1/2", "6", nullptr }; const char* Hole::ThreadClass_BSW_Enums[] = { "Medium", "Normal", nullptr }; /* BSF */ const char* Hole::HoleCutType_BSF_Enums[] = { "None", "Counterbore", "Countersink", "Counterdrill", nullptr}; -const char* Hole::ThreadSize_BSF_Enums[] = { "3/16", "7/32", "1/4", "9/32", "5/16", "3/8", "7/16", - "1/2", "9/16", "5/8", "11/16", "3/4", "7/8", - "1", "1 1/8", "1 1/4", "1 3/8", "1 1/2", "1 5/8", "1 3/4", - "2", "2 1/4", "2 1/2", "2 3/4", - "3", "3 1/4", "3 1/2", "3 3/4", - "4", "4 1/4", nullptr }; const char* Hole::ThreadClass_BSF_Enums[] = { "Medium", "Normal", nullptr }; const char* Hole::ThreadDirectionEnums[] = { "Right", "Left", nullptr}; @@ -832,7 +750,7 @@ Hole::Hole() ThreadType.setEnums(ThreadTypeEnums); ADD_PROPERTY_TYPE(ThreadSize, (0L), "Hole", App::Prop_None, "Thread size"); - ThreadSize.setEnums(ThreadSize_None_Enums); + ThreadSize.setEnums(getThreadDesignations(ThreadType.getValue())); ADD_PROPERTY_TYPE(ThreadClass, (0L), "Hole", App::Prop_None, "Thread class"); ThreadClass.setEnums(ThreadClass_None_Enums); @@ -1444,13 +1362,14 @@ void Hole::onChanged(const App::Property* prop) { if (prop == &ThreadType) { std::string type, holeCutTypeStr; - if (ThreadType.isValid()) + if (ThreadType.isValid()) { type = ThreadType.getValueAsString(); + ThreadSize.setEnums(getThreadDesignations(ThreadType.getValue())); + } if (HoleCutType.isValid()) holeCutTypeStr = HoleCutType.getValueAsString(); if (type == "None") { - ThreadSize.setEnums(ThreadSize_None_Enums); ThreadClass.setEnums(ThreadClass_None_Enums); HoleCutType.setEnums(HoleCutType_None_Enums); Threaded.setReadOnly(true); @@ -1468,7 +1387,6 @@ void Hole::onChanged(const App::Property* prop) UseCustomThreadClearance.setValue(false); } else if (type == "ISOMetricProfile") { - ThreadSize.setEnums(ThreadSize_ISOmetric_Enums); ThreadClass.setEnums(ThreadClass_ISOmetric_Enums); HoleCutType.setEnums(HoleCutType_ISOmetric_Enums); ThreadFit.setEnums(ClearanceMetricEnums); @@ -1486,7 +1404,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "ISOMetricFineProfile") { - ThreadSize.setEnums(ThreadSize_ISOmetricfine_Enums); ThreadClass.setEnums(ThreadClass_ISOmetricfine_Enums); HoleCutType.setEnums(HoleCutType_ISOmetricfine_Enums); ThreadFit.setEnums(ClearanceMetricEnums); @@ -1504,7 +1421,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "UNC") { - ThreadSize.setEnums(ThreadSize_UNC_Enums); ThreadClass.setEnums(ThreadClass_UNC_Enums); HoleCutType.setEnums(HoleCutType_UNC_Enums); ThreadFit.setEnums(ClearanceUTSEnums); @@ -1522,7 +1438,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "UNF") { - ThreadSize.setEnums(ThreadSize_UNF_Enums); ThreadClass.setEnums(ThreadClass_UNF_Enums); HoleCutType.setEnums(HoleCutType_UNF_Enums); ThreadFit.setEnums(ClearanceUTSEnums); @@ -1540,7 +1455,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "UNEF") { - ThreadSize.setEnums(ThreadSize_UNEF_Enums); ThreadClass.setEnums(ThreadClass_UNEF_Enums); HoleCutType.setEnums(HoleCutType_UNEF_Enums); ThreadFit.setEnums(ClearanceUTSEnums); @@ -1558,7 +1472,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "BSP") { - ThreadSize.setEnums(ThreadSize_BSP_Enums); ThreadClass.setEnums(ThreadClass_None_Enums); HoleCutType.setEnums(HoleCutType_BSP_Enums); Threaded.setReadOnly(false); @@ -1572,7 +1485,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "NPT") { - ThreadSize.setEnums(ThreadSize_NPT_Enums); ThreadClass.setEnums(ThreadClass_None_Enums); HoleCutType.setEnums(HoleCutType_NPT_Enums); Threaded.setReadOnly(false); @@ -1586,7 +1498,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "BSW") { - ThreadSize.setEnums(ThreadSize_BSW_Enums); ThreadClass.setEnums(ThreadClass_BSW_Enums); HoleCutType.setEnums(HoleCutType_BSW_Enums); Threaded.setReadOnly(false); @@ -1600,7 +1511,6 @@ void Hole::onChanged(const App::Property* prop) ThreadDepth.setReadOnly(!Threaded.getValue()); } else if (type == "BSF") { - ThreadSize.setEnums(ThreadSize_BSF_Enums); ThreadClass.setEnums(ThreadClass_BSF_Enums); HoleCutType.setEnums(HoleCutType_BSF_Enums); Threaded.setReadOnly(false); diff --git a/src/Mod/PartDesign/App/FeatureHole.h b/src/Mod/PartDesign/App/FeatureHole.h index b239f44e1b..11f75cb1a7 100644 --- a/src/Mod/PartDesign/App/FeatureHole.h +++ b/src/Mod/PartDesign/App/FeatureHole.h @@ -123,51 +123,41 @@ private: /* "None" thread profile */ static const char* HoleCutType_None_Enums[]; - static const char* ThreadSize_None_Enums[]; static const char* ThreadClass_None_Enums[]; /* ISO metric coarse profile */ static std::vector HoleCutType_ISOmetric_Enums; - static const char* ThreadSize_ISOmetric_Enums[]; static const char* ThreadClass_ISOmetric_Enums[]; static const double ThreadClass_ISOmetric_data[ThreadClass_ISOmetric_data_size][2]; /* ISO metric fine profile */ static std::vector HoleCutType_ISOmetricfine_Enums; - static const char* ThreadSize_ISOmetricfine_Enums[]; static const char* ThreadClass_ISOmetricfine_Enums[]; /* UNC profile */ static const char* HoleCutType_UNC_Enums[]; - static const char* ThreadSize_UNC_Enums[]; static const char* ThreadClass_UNC_Enums[]; /* UNF profile */ static const char* HoleCutType_UNF_Enums[]; - static const char* ThreadSize_UNF_Enums[]; static const char* ThreadClass_UNF_Enums[]; /* UNEF profile */ static const char* HoleCutType_UNEF_Enums[]; - static const char* ThreadSize_UNEF_Enums[]; static const char* ThreadClass_UNEF_Enums[]; /* NPT profile */ static const char* HoleCutType_NPT_Enums[]; - static const char* ThreadSize_NPT_Enums[]; /* BSP profile */ static const char* HoleCutType_BSP_Enums[]; - static const char* ThreadSize_BSP_Enums[]; /* BSW profile */ static const char* HoleCutType_BSW_Enums[]; - static const char* ThreadSize_BSW_Enums[]; static const char* ThreadClass_BSW_Enums[]; /* BSF profile */ static const char* HoleCutType_BSF_Enums[]; - static const char* ThreadSize_BSF_Enums[]; static const char* ThreadClass_BSF_Enums[]; static const double ThreadRunout[ThreadRunout_size][2]; From 7ae463f245898f125c22023fc47552c586d4d4ae Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 25 Dec 2024 10:42:33 +0900 Subject: [PATCH 003/224] Base: Added helper macro for caching transcode-ed string literal --- src/App/Metadata.cpp | 42 +++++------ src/App/ProjectFile.cpp | 56 +++++++------- src/Base/Parameter.cpp | 100 ++++++++++++++----------- src/Base/XMLTools.h | 11 +++ src/Mod/Mesh/App/Core/IO/Reader3MF.cpp | 55 ++++++++------ 5 files changed, 146 insertions(+), 118 deletions(-) diff --git a/src/App/Metadata.cpp b/src/App/Metadata.cpp index 4e9df6f5fe..6e8dcf7812 100644 --- a/src/App/Metadata.cpp +++ b/src/App/Metadata.cpp @@ -158,7 +158,7 @@ void Metadata::loadFromInputSource(const InputSource& source) throw Base::XMLBaseException( "Malformed package.xml document: Root group not found"); } - auto formatVersion = XMLString::parseInt(_dom->getAttribute(XUTF8Str("format").unicodeForm())); + auto formatVersion = XMLString::parseInt(_dom->getAttribute(XUTF8StrLiteral("format").unicodeForm())); switch (formatVersion) { case 1: parseVersion1(_dom); @@ -560,10 +560,10 @@ void addAttribute(DOMElement* node, const std::string& key, const std::string& v void addAttribute(DOMElement* node, const std::string& key, bool value) { if (value) { - node->setAttribute(XUTF8Str(key.c_str()).unicodeForm(), XUTF8Str("True").unicodeForm()); + node->setAttribute(XUTF8Str(key.c_str()).unicodeForm(), XUTF8StrLiteral("True").unicodeForm()); } else { - node->setAttribute(XUTF8Str(key.c_str()).unicodeForm(), XUTF8Str("False").unicodeForm()); + node->setAttribute(XUTF8Str(key.c_str()).unicodeForm(), XUTF8StrLiteral("False").unicodeForm()); } } @@ -608,13 +608,13 @@ void addDependencyNode(DOMElement* root, const std::string& name, const Meta::De void Metadata::write(const fs::path& file) const { DOMImplementation* impl = - DOMImplementationRegistry::getDOMImplementation(XUTF8Str("Core LS").unicodeForm()); + DOMImplementationRegistry::getDOMImplementation(XUTF8StrLiteral("Core LS").unicodeForm()); - DOMDocument* doc = impl->createDocument(nullptr, XUTF8Str("package").unicodeForm(), nullptr); + DOMDocument* doc = impl->createDocument(nullptr, XUTF8StrLiteral("package").unicodeForm(), nullptr); DOMElement* root = doc->getDocumentElement(); - root->setAttribute(XUTF8Str("format").unicodeForm(), XUTF8Str("1").unicodeForm()); - root->setAttribute(XUTF8Str("xmlns").unicodeForm(), - XUTF8Str("https://wiki.freecad.org/Package_Metadata").unicodeForm()); + root->setAttribute(XUTF8StrLiteral("format").unicodeForm(), XUTF8StrLiteral("1").unicodeForm()); + root->setAttribute(XUTF8StrLiteral("xmlns").unicodeForm(), + XUTF8StrLiteral("https://wiki.freecad.org/Package_Metadata").unicodeForm()); appendToElement(root); @@ -852,7 +852,7 @@ void Metadata::appendToElement(DOMElement* root) const if (!_content.empty()) { auto doc = root->getOwnerDocument(); - DOMElement* contentRootElement = doc->createElement(XUTF8Str("content").unicodeForm()); + DOMElement* contentRootElement = doc->createElement(XUTF8StrLiteral("content").unicodeForm()); root->appendChild(contentRootElement); for (const auto& content : _content) { DOMElement* contentElement = @@ -982,7 +982,7 @@ Meta::Contact::Contact(const XERCES_CPP_NAMESPACE::DOMElement* elem) if (!elem) { return; } - auto emailAttribute = elem->getAttribute(XUTF8Str("email").unicodeForm()); + auto emailAttribute = elem->getAttribute(XUTF8StrLiteral("email").unicodeForm()); name = StrXUTF8(elem->getTextContent()).str; email = StrXUTF8(emailAttribute).str; } @@ -1004,7 +1004,7 @@ Meta::License::License(const XERCES_CPP_NAMESPACE::DOMElement* elem) if (!elem) { return; } - auto fileAttribute = elem->getAttribute(XUTF8Str("file").unicodeForm()); + auto fileAttribute = elem->getAttribute(XUTF8StrLiteral("file").unicodeForm()); if (XMLString::stringLen(fileAttribute) > 0) { file = fs::path(StrXUTF8(fileAttribute).str); } @@ -1033,7 +1033,7 @@ Meta::Url::Url(const XERCES_CPP_NAMESPACE::DOMElement* elem) if (!elem) { return; } - auto typeAttribute = StrXUTF8(elem->getAttribute(XUTF8Str("type").unicodeForm())).str; + auto typeAttribute = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("type").unicodeForm())).str; if (typeAttribute.empty() || typeAttribute == "website") { type = UrlType::website; } @@ -1057,7 +1057,7 @@ Meta::Url::Url(const XERCES_CPP_NAMESPACE::DOMElement* elem) } if (type == UrlType::repository) { - branch = StrXUTF8(elem->getAttribute(XUTF8Str("branch").unicodeForm())).str; + branch = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("branch").unicodeForm())).str; } location = StrXUTF8(elem->getTextContent()).str; } @@ -1083,13 +1083,13 @@ App::Meta::Dependency::Dependency(std::string pkg) Meta::Dependency::Dependency(const XERCES_CPP_NAMESPACE::DOMElement* elem) { - version_lt = StrXUTF8(elem->getAttribute(XUTF8Str("version_lt").unicodeForm())).str; - version_lte = StrXUTF8(elem->getAttribute(XUTF8Str("version_lte").unicodeForm())).str; - version_eq = StrXUTF8(elem->getAttribute(XUTF8Str("version_eq").unicodeForm())).str; - version_gte = StrXUTF8(elem->getAttribute(XUTF8Str("version_gte").unicodeForm())).str; - version_gt = StrXUTF8(elem->getAttribute(XUTF8Str("version_gt").unicodeForm())).str; - condition = StrXUTF8(elem->getAttribute(XUTF8Str("condition").unicodeForm())).str; - std::string opt_string = StrXUTF8(elem->getAttribute(XUTF8Str("optional").unicodeForm())).str; + version_lt = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("version_lt").unicodeForm())).str; + version_lte = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("version_lte").unicodeForm())).str; + version_eq = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("version_eq").unicodeForm())).str; + version_gte = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("version_gte").unicodeForm())).str; + version_gt = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("version_gt").unicodeForm())).str; + condition = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("condition").unicodeForm())).str; + std::string opt_string = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("optional").unicodeForm())).str; if (opt_string == "true" || opt_string == "True") { // Support Python capitalization in this one case... optional = true; @@ -1097,7 +1097,7 @@ Meta::Dependency::Dependency(const XERCES_CPP_NAMESPACE::DOMElement* elem) else { optional = false; } - std::string type_string = StrXUTF8(elem->getAttribute(XUTF8Str("type").unicodeForm())).str; + std::string type_string = StrXUTF8(elem->getAttribute(XUTF8StrLiteral("type").unicodeForm())).str; if (type_string == "automatic" || type_string.empty()) { dependencyType = Meta::DependencyType::automatic; } diff --git a/src/App/ProjectFile.cpp b/src/App/ProjectFile.cpp index 03dbac3df1..7cc7490100 100644 --- a/src/App/ProjectFile.cpp +++ b/src/App/ProjectFile.cpp @@ -84,12 +84,12 @@ public: std::map propMap = initMap(); - DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStr("Properties").unicodeForm()); + DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("Properties").unicodeForm()); for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { auto elem = static_cast(node); // NOLINT - DOMNodeList* propList = elem->getElementsByTagName(XStr("Property").unicodeForm()); + DOMNodeList* propList = elem->getElementsByTagName(XStrLiteral("Property").unicodeForm()); for (XMLSize_t j = 0; j < propList->getLength(); j++) { DOMNode* propNode = propList->item(j); readProperty(propNode, propMap); @@ -105,12 +105,12 @@ private: void readProgramVersion() { if (DOMNodeList* nodes = - xmlDocument->getElementsByTagName(XStr("Document").unicodeForm())) { + xmlDocument->getElementsByTagName(XStrLiteral("Document").unicodeForm())) { for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { DOMNode* nameAttr = - node->getAttributes()->getNamedItem(XStr("ProgramVersion").unicodeForm()); + node->getAttributes()->getNamedItem(XStrLiteral("ProgramVersion").unicodeForm()); if (nameAttr) { std::string value = StrX(nameAttr->getNodeValue()).c_str(); metadata.programVersion = value; @@ -153,7 +153,7 @@ private: static void readProperty(DOMNode* propNode, std::map& propMap) { - DOMNode* nameAttr = propNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); + DOMNode* nameAttr = propNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); if (nameAttr) { std::string name = StrX(nameAttr->getNodeValue()).c_str(); auto it = propMap.find(name); @@ -169,7 +169,7 @@ private: if (DOMElement* child = static_cast(node)->getFirstElementChild()) { // NOLINT if (DOMNode* nameAttr = - child->getAttributes()->getNamedItem(XStr("value").unicodeForm())) { + child->getAttributes()->getNamedItem(XStrLiteral("value").unicodeForm())) { std::string value = StrX(nameAttr->getNodeValue()).c_str(); return value; } @@ -260,18 +260,18 @@ std::list ProjectFile::getObjects() const return names; } - DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStr("Objects").unicodeForm()); + DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("Objects").unicodeForm()); for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { DOMNodeList* objectList = static_cast(node)->getElementsByTagName( - XStr("Object").unicodeForm()); // NOLINT + XStrLiteral("Object").unicodeForm()); // NOLINT for (XMLSize_t j = 0; j < objectList->getLength(); j++) { DOMNode* objectNode = objectList->item(j); DOMNode* typeAttr = - objectNode->getAttributes()->getNamedItem(XStr("type").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("type").unicodeForm()); DOMNode* nameAttr = - objectNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); if (typeAttr && nameAttr) { Object obj; obj.name = StrX(nameAttr->getNodeValue()).c_str(); @@ -292,18 +292,18 @@ std::list ProjectFile::getObjectsOfType(const Base::Type& typeId) c return names; } - DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStr("Objects").unicodeForm()); + DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("Objects").unicodeForm()); for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { DOMNodeList* objectList = static_cast(node)->getElementsByTagName( - XStr("Object").unicodeForm()); // NOLINT + XStrLiteral("Object").unicodeForm()); // NOLINT for (XMLSize_t j = 0; j < objectList->getLength(); j++) { DOMNode* objectNode = objectList->item(j); DOMNode* typeAttr = - objectNode->getAttributes()->getNamedItem(XStr("type").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("type").unicodeForm()); DOMNode* nameAttr = - objectNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); if (typeAttr && nameAttr) { if (Base::Type::fromName(StrX(typeAttr->getNodeValue()).c_str()) == typeId) { names.emplace_back(StrX(nameAttr->getNodeValue()).c_str()); @@ -366,18 +366,18 @@ Base::Type ProjectFile::getTypeId(const std::string& name) const return Base::Type::badType(); } - DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStr("Objects").unicodeForm()); + DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("Objects").unicodeForm()); for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { DOMNodeList* objectList = static_cast(node)->getElementsByTagName( - XStr("Object").unicodeForm()); // NOLINT + XStrLiteral("Object").unicodeForm()); // NOLINT for (XMLSize_t j = 0; j < objectList->getLength(); j++) { DOMNode* objectNode = objectList->item(j); DOMNode* typeAttr = - objectNode->getAttributes()->getNamedItem(XStr("type").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("type").unicodeForm()); DOMNode* nameAttr = - objectNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); if (typeAttr && nameAttr) { if (strcmp(name.c_str(), StrX(nameAttr->getNodeValue()).c_str()) == 0) { std::string typeId = StrX(typeAttr->getNodeValue()).c_str(); @@ -407,16 +407,16 @@ std::list ProjectFile::getPropertyFiles(const std::st } std::list files; - DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStr("ObjectData").unicodeForm()); + DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("ObjectData").unicodeForm()); for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { DOMNodeList* objectList = static_cast(node)->getElementsByTagName( - XStr("Object").unicodeForm()); // NOLINT + XStrLiteral("Object").unicodeForm()); // NOLINT for (XMLSize_t j = 0; j < objectList->getLength(); j++) { DOMNode* objectNode = objectList->item(j); DOMNode* nameAttr = - objectNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); if (nameAttr && strcmp(name.c_str(), StrX(nameAttr->getNodeValue()).c_str()) == 0) { // now go recursively through the sub-tree (i.e. the properties) and collect // every file attribute @@ -434,18 +434,18 @@ void ProjectFile::findFiles(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, { if (node->hasAttributes()) { ProjectFile::PropertyFile prop; - DOMNode* fileAttr = node->getAttributes()->getNamedItem(XStr("file").unicodeForm()); + DOMNode* fileAttr = node->getAttributes()->getNamedItem(XStrLiteral("file").unicodeForm()); if (fileAttr) { DOMNode* parentNode = node->getParentNode(); if (parentNode) { DOMNode* nameAttr = - parentNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); + parentNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); if (nameAttr) { prop.name = StrX(nameAttr->getNodeValue()).c_str(); } DOMNode* typeAttr = - parentNode->getAttributes()->getNamedItem(XStr("type").unicodeForm()); + parentNode->getAttributes()->getNamedItem(XStrLiteral("type").unicodeForm()); if (typeAttr) { prop.type = Base::Type::fromName(StrX(typeAttr->getNodeValue()).c_str()); } @@ -486,16 +486,16 @@ std::list ProjectFile::getInputFiles(const std::string& name) const } std::list files; - DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStr("ObjectData").unicodeForm()); + DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("ObjectData").unicodeForm()); for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { DOMNodeList* objectList = static_cast(node)->getElementsByTagName( - XStr("Object").unicodeForm()); // NOLINT + XStrLiteral("Object").unicodeForm()); // NOLINT for (XMLSize_t j = 0; j < objectList->getLength(); j++) { DOMNode* objectNode = objectList->item(j); DOMNode* nameAttr = - objectNode->getAttributes()->getNamedItem(XStr("name").unicodeForm()); + objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); if (nameAttr && strcmp(name.c_str(), StrX(nameAttr->getNodeValue()).c_str()) == 0) { // now go recursively through the sub-tree (i.e. the properties) and collect // every file attribute @@ -512,7 +512,7 @@ void ProjectFile::findFiles(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node, std::list& files) const { if (node->hasAttributes()) { - DOMNode* fileAttr = node->getAttributes()->getNamedItem(XStr("file").unicodeForm()); + DOMNode* fileAttr = node->getAttributes()->getNamedItem(XStrLiteral("file").unicodeForm()); if (fileAttr) { files.emplace_back(StrX(fileAttr->getNodeValue()).c_str()); } diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index 1b0b97722a..bce28a56e1 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -362,8 +362,9 @@ ParameterGrp::CreateElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* Start, const char* Type, const char* Name) { - if (XMLString::compareString(Start->getNodeName(), XStr("FCParamGroup").unicodeForm()) != 0 - && XMLString::compareString(Start->getNodeName(), XStr("FCParameters").unicodeForm()) + if (XMLString::compareString(Start->getNodeName(), XStrLiteral("FCParamGroup").unicodeForm()) + != 0 + && XMLString::compareString(Start->getNodeName(), XStrLiteral("FCParameters").unicodeForm()) != 0) { Base::Console().Warning("CreateElement: %s cannot have the element %s of type %s\n", StrX(Start->getNodeName()).c_str(), @@ -380,7 +381,7 @@ ParameterGrp::CreateElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* Start, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDocument = Start->getOwnerDocument(); auto pcElem = pDocument->createElement(XStr(Type).unicodeForm()); - pcElem->setAttribute(XStr("Name").unicodeForm(), XStr(Name).unicodeForm()); + pcElem->setAttribute(XStrLiteral("Name").unicodeForm(), XStr(Name).unicodeForm()); Start->appendChild(pcElem); return pcElem; @@ -488,9 +489,10 @@ std::vector> ParameterGrp::GetGroups() DOMElement* pcTemp = FindElement(_pGroupNode, "FCParamGroup"); while (pcTemp) { - Name = - StrX(pcTemp->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()) - .c_str(); + Name = StrX(pcTemp->getAttributes() + ->getNamedItem(XStrLiteral("Name").unicodeForm()) + ->getNodeValue()) + .c_str(); // already created? if (!(rParamGrp = _GroupMap[Name]).isValid()) { rParamGrp = Base::Reference(new ParameterGrp(pcTemp, Name.c_str(), this)); @@ -630,7 +632,7 @@ const char* ParameterGrp::GetAttribute(ParamType Type, Value = GetASCII(Name, Default); } else if (Type != ParamType::FCGroup) { - Value = StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(); + Value = StrX(pcElem->getAttribute(XStrLiteral("Value").unicodeForm())).c_str(); } return Value.c_str(); } @@ -654,7 +656,7 @@ ParameterGrp::GetAttributeMap(ParamType Type, const char* sFilter) const while (pcTemp) { Name = StrX(static_cast(pcTemp) ->getAttributes() - ->getNamedItem(XStr("Name").unicodeForm()) + ->getNamedItem(XStrLiteral("Name").unicodeForm()) ->getNodeValue()) .c_str(); // check on filter condition @@ -665,7 +667,7 @@ ParameterGrp::GetAttributeMap(ParamType Type, const char* sFilter) const else { res.emplace_back(Name, StrX(static_cast(pcTemp)->getAttribute( - XStr("Value").unicodeForm())) + XStrLiteral("Value").unicodeForm())) .c_str()); } } @@ -731,7 +733,8 @@ bool ParameterGrp::GetBool(const char* Name, bool bPreset) const } // if yes check the value and return - return (strcmp(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(), "1") == 0); + return (strcmp(StrX(pcElem->getAttribute(XStrLiteral("Value").unicodeForm())).c_str(), "1") + == 0); } void ParameterGrp::SetBool(const char* Name, bool bValue) @@ -750,10 +753,11 @@ std::vector ParameterGrp::GetBools(const char* sFilter) const DOMElement* pcTemp = FindElement(_pGroupNode, "FCBool"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { - if (strcmp(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str(), "1") != 0) { + if (strcmp(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str(), "1") + != 0) { vrValues.push_back(false); } else { @@ -777,10 +781,11 @@ std::vector> ParameterGrp::GetBoolMap(const char* s DOMElement* pcTemp = FindElement(_pGroupNode, "FCBool"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { - if (strcmp(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str(), "1") != 0) { + if (strcmp(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str(), "1") + != 0) { vrValues.emplace_back(Name, false); } else { @@ -806,7 +811,7 @@ long ParameterGrp::GetInt(const char* Name, long lPreset) const return lPreset; } // if yes check the value and return - return atol(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str()); + return atol(StrX(pcElem->getAttribute(XStrLiteral("Value").unicodeForm())).c_str()); } void ParameterGrp::SetInt(const char* Name, long lValue) @@ -826,11 +831,11 @@ std::vector ParameterGrp::GetInts(const char* sFilter) const DOMElement* pcTemp = FindElement(_pGroupNode, "FCInt"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { vrValues.push_back( - atol(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str())); + atol(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str())); } pcTemp = FindNextElement(pcTemp, "FCInt"); } @@ -849,12 +854,12 @@ std::vector> ParameterGrp::GetIntMap(const char* sF DOMElement* pcTemp = FindElement(_pGroupNode, "FCInt"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { vrValues.emplace_back( Name, - (atol(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str()))); + (atol(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str()))); } pcTemp = FindNextElement(pcTemp, "FCInt"); } @@ -877,7 +882,9 @@ unsigned long ParameterGrp::GetUnsigned(const char* Name, unsigned long lPreset) // if yes check the value and return const int base = 10; - return strtoul(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(), nullptr, base); + return strtoul(StrX(pcElem->getAttribute(XStrLiteral("Value").unicodeForm())).c_str(), + nullptr, + base); } void ParameterGrp::SetUnsigned(const char* Name, unsigned long lValue) @@ -898,11 +905,11 @@ std::vector ParameterGrp::GetUnsigneds(const char* sFilter) const DOMElement* pcTemp = FindElement(_pGroupNode, "FCUInt"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { vrValues.push_back( - strtoul(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str(), + strtoul(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str(), nullptr, base)); } @@ -925,12 +932,12 @@ ParameterGrp::GetUnsignedMap(const char* sFilter) const DOMElement* pcTemp = FindElement(_pGroupNode, "FCUInt"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { vrValues.emplace_back( Name, - (strtoul(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str(), + (strtoul(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str(), nullptr, base))); } @@ -953,7 +960,7 @@ double ParameterGrp::GetFloat(const char* Name, double dPreset) const return dPreset; } // if yes check the value and return - return atof(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str()); + return atof(StrX(pcElem->getAttribute(XStrLiteral("Value").unicodeForm())).c_str()); } void ParameterGrp::SetFloat(const char* Name, double dValue) @@ -974,11 +981,11 @@ std::vector ParameterGrp::GetFloats(const char* sFilter) const DOMElement* pcTemp = FindElement(_pGroupNode, "FCFloat"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { vrValues.push_back( - atof(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str())); + atof(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str())); } pcTemp = FindNextElement(pcTemp, "FCFloat"); } @@ -997,12 +1004,12 @@ std::vector> ParameterGrp::GetFloatMap(const char DOMElement* pcTemp = FindElement(_pGroupNode, "FCFloat"); while (pcTemp) { - Name = StrX(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrX(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { vrValues.emplace_back( Name, - (atof(StrX(pcTemp->getAttribute(XStr("Value").unicodeForm())).c_str()))); + (atof(StrX(pcTemp->getAttribute(XStrLiteral("Value").unicodeForm())).c_str()))); } pcTemp = FindNextElement(pcTemp, "FCFloat"); } @@ -1086,7 +1093,7 @@ std::vector ParameterGrp::GetASCIIs(const char* sFilter) const DOMElement* pcTemp = FindElement(_pGroupNode, "FCText"); while (pcTemp) { - Name = StrXUTF8(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrXUTF8(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { // retrieve the text element @@ -1116,7 +1123,7 @@ ParameterGrp::GetASCIIMap(const char* sFilter) const DOMElement* pcTemp = FindElement(_pGroupNode, "FCText"); while (pcTemp) { - Name = StrXUTF8(pcTemp->getAttribute(XStr("Name").unicodeForm())).c_str(); + Name = StrXUTF8(pcTemp->getAttribute(XStrLiteral("Name").unicodeForm())).c_str(); // check on filter condition if (!sFilter || Name.find(sFilter) != std::string::npos) { // retrieve the text element @@ -1299,7 +1306,7 @@ bool ParameterGrp::RenameGrp(const char* OldName, const char* NewName) // check if Element in group DOMElement* pcElem = FindElement(_pGroupNode, "FCParamGroup", OldName); if (pcElem) { - pcElem->setAttribute(XStr("Name").unicodeForm(), XStr(NewName).unicodeForm()); + pcElem->setAttribute(XStrLiteral("Name").unicodeForm(), XStr(NewName).unicodeForm()); } _Notify(ParamType::FCGroup, NewName, OldName); @@ -1349,7 +1356,7 @@ void ParameterGrp::Clear(bool notify) if (type != ParamType::FCInvalid && type != ParamType::FCGroup) { params.emplace_back(type, StrX(child->getAttributes() - ->getNamedItem(XStr("Name").unicodeForm()) + ->getNamedItem(XStrLiteral("Name").unicodeForm()) ->getNodeValue()) .c_str()); } @@ -1387,8 +1394,9 @@ ParameterGrp::FindElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* Start, const char* Type, const char* Name) const { - if (XMLString::compareString(Start->getNodeName(), XStr("FCParamGroup").unicodeForm()) != 0 - && XMLString::compareString(Start->getNodeName(), XStr("FCParameters").unicodeForm()) + if (XMLString::compareString(Start->getNodeName(), XStrLiteral("FCParamGroup").unicodeForm()) + != 0 + && XMLString::compareString(Start->getNodeName(), XStrLiteral("FCParameters").unicodeForm()) != 0) { Base::Console().Warning("FindElement: %s cannot have the element %s of type %s\n", StrX(Start->getNodeName()).c_str(), @@ -1484,7 +1492,7 @@ ParameterGrp::GetParameterNames(const char* sFilter) const if (Type != ParamType::FCInvalid && Type != ParamType::FCGroup) { if (clChild->getAttributes()->getLength() > 0) { StrX name(clChild->getAttributes() - ->getNamedItem(XStr("Name").unicodeForm()) + ->getNamedItem(XStrLiteral("Name").unicodeForm()) ->getNodeValue()); if (!sFilter || strstr(name.c_str(), sFilter)) { res.emplace_back(Type, name.c_str()); @@ -1975,16 +1983,17 @@ void ParameterManager::CreateDocument() { // creating a document from screatch DOMImplementation* impl = - DOMImplementationRegistry::getDOMImplementation(XStr("Core").unicodeForm()); + DOMImplementationRegistry::getDOMImplementation(XStrLiteral("Core").unicodeForm()); delete _pDocument; - _pDocument = impl->createDocument(nullptr, // root element namespace URI. - XStr("FCParameters").unicodeForm(), // root element name - nullptr); // document type object (DTD). + _pDocument = + impl->createDocument(nullptr, // root element namespace URI. + XStrLiteral("FCParameters").unicodeForm(), // root element name + nullptr); // document type object (DTD). // creating the node for the root group DOMElement* rootElem = _pDocument->getDocumentElement(); - _pGroupNode = _pDocument->createElement(XStr("FCParamGroup").unicodeForm()); - _pGroupNode->setAttribute(XStr("Name").unicodeForm(), XStr("Root").unicodeForm()); + _pGroupNode = _pDocument->createElement(XStrLiteral("FCParamGroup").unicodeForm()); + _pGroupNode->setAttribute(XStrLiteral("Name").unicodeForm(), XStrLiteral("Root").unicodeForm()); rootElem->appendChild(_pGroupNode); } @@ -2095,14 +2104,15 @@ DOMPrintFilter::DOMPrintFilter(ShowType whatToShow) DOMPrintFilter::FilterAction DOMPrintFilter::acceptNode(const DOMNode* node) const { - if (XMLString::compareString(node->getNodeName(), XStr("FCParameters").unicodeForm()) == 0) { + if (XMLString::compareString(node->getNodeName(), XStrLiteral("FCParameters").unicodeForm()) + == 0) { // This node is supposed to have a single FCParamGroup and two text nodes. // Over time it can happen that the text nodes collect extra newlines. const DOMNodeList* children = node->getChildNodes(); for (XMLSize_t i = 0; i < children->getLength(); i++) { DOMNode* child = children->item(i); if (child->getNodeType() == DOMNode::TEXT_NODE) { - child->setNodeValue(XStr("\n").unicodeForm()); + child->setNodeValue(XStrLiteral("\n").unicodeForm()); } } } @@ -2115,7 +2125,7 @@ DOMPrintFilter::FilterAction DOMPrintFilter::acceptNode(const DOMNode* node) con // there. auto parent = node->getParentNode(); if (parent && XMLString::compareString(parent->getNodeName(), - XStr("FCParamGroup").unicodeForm()) == 0) { + XStrLiteral("FCParamGroup").unicodeForm()) == 0) { return DOMNodeFilter::FILTER_REJECT; } return DOMNodeFilter::FILTER_ACCEPT; diff --git a/src/Base/XMLTools.h b/src/Base/XMLTools.h index 798b975d8c..621015ae10 100644 --- a/src/Base/XMLTools.h +++ b/src/Base/XMLTools.h @@ -174,6 +174,12 @@ inline XStr::~XStr() XERCES_CPP_NAMESPACE_QUALIFIER XMLString::release(&fUnicodeForm); } +#define XStrLiteral(literal) \ + ([]() -> const XStr& { \ + static const XStr str {literal}; \ + return str; \ + }()) + // ----------------------------------------------------------------------- // Getter methods @@ -210,6 +216,11 @@ inline XUTF8Str::XUTF8Str(const char* const fromTranscode) inline XUTF8Str::~XUTF8Str() = default; +#define XUTF8StrLiteral(literal) \ + ([]() -> const XUTF8Str& { \ + static const XUTF8Str str {literal}; \ + return str; \ + }()) // ----------------------------------------------------------------------- // Getter methods diff --git a/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp b/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp index 6f7610173e..6305795e69 100644 --- a/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp +++ b/src/Mod/Mesh/App/Core/IO/Reader3MF.cpp @@ -138,7 +138,7 @@ bool Reader3MF::TryLoadModel(std::istream& str, const Component& comp) bool Reader3MF::LoadModel(DOMDocument& xmlDocument, const Component& comp) { - DOMNodeList* nodes = xmlDocument.getElementsByTagName(XStr("model").unicodeForm()); + DOMNodeList* nodes = xmlDocument.getElementsByTagName(XStrLiteral("model").unicodeForm()); for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { @@ -152,8 +152,8 @@ bool Reader3MF::LoadModel(DOMDocument& xmlDocument, const Component& comp) bool Reader3MF::LoadResourcesAndBuild(DOMElement* node, const Component& comp) { bool resource = - LoadResources(node->getElementsByTagName(XStr("resources").unicodeForm()), comp); - bool build = LoadBuild(node->getElementsByTagName(XStr("build").unicodeForm())); + LoadResources(node->getElementsByTagName(XStrLiteral("resources").unicodeForm()), comp); + bool build = LoadBuild(node->getElementsByTagName(XStrLiteral("build").unicodeForm())); return (resource && build); } @@ -167,7 +167,8 @@ bool Reader3MF::LoadResources(DOMNodeList* nodes, const Component& comp) DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { auto elem = static_cast(node); - DOMNodeList* objectList = elem->getElementsByTagName(XStr("object").unicodeForm()); + DOMNodeList* objectList = + elem->getElementsByTagName(XStrLiteral("object").unicodeForm()); return LoadObject(objectList, comp); } } @@ -185,7 +186,7 @@ bool Reader3MF::LoadBuild(DOMNodeList* nodes) DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { auto elem = static_cast(node); - DOMNodeList* objectList = elem->getElementsByTagName(XStr("item").unicodeForm()); + DOMNodeList* objectList = elem->getElementsByTagName(XStrLiteral("item").unicodeForm()); return LoadItems(objectList); } } @@ -210,12 +211,12 @@ bool Reader3MF::LoadItems(DOMNodeList* nodes) void Reader3MF::LoadItem(DOMNamedNodeMap* nodeMap) { - DOMNode* idAttr = nodeMap->getNamedItem(XStr("objectid").unicodeForm()); + DOMNode* idAttr = nodeMap->getNamedItem(XStrLiteral("objectid").unicodeForm()); if (idAttr) { std::string id = StrX(idAttr->getNodeValue()).c_str(); int idValue = std::stoi(id); - DOMNode* transformAttr = nodeMap->getNamedItem(XStr("transform").unicodeForm()); + DOMNode* transformAttr = nodeMap->getNamedItem(XStrLiteral("transform").unicodeForm()); if (transformAttr) { std::optional mat = ReadTransform(transformAttr); if (mat) { @@ -280,17 +281,19 @@ bool Reader3MF::LoadObject(DOMNodeList* nodes, const Component& comp) for (XMLSize_t i = 0; i < nodes->getLength(); i++) { DOMNode* objectNode = nodes->item(i); if (objectNode->getNodeType() == DOMNode::ELEMENT_NODE) { - DOMNode* idAttr = objectNode->getAttributes()->getNamedItem(XStr("id").unicodeForm()); + DOMNode* idAttr = + objectNode->getAttributes()->getNamedItem(XStrLiteral("id").unicodeForm()); auto elem = static_cast(objectNode); if (idAttr) { int id = std::stoi(StrX(idAttr->getNodeValue()).c_str()); - DOMNodeList* meshNode = elem->getElementsByTagName(XStr("mesh").unicodeForm()); + DOMNodeList* meshNode = + elem->getElementsByTagName(XStrLiteral("mesh").unicodeForm()); if (meshNode->getLength() > 0) { LoadMesh(meshNode, id, comp); } else { DOMNodeList* compNode = - elem->getElementsByTagName(XStr("components").unicodeForm()); + elem->getElementsByTagName(XStrLiteral("components").unicodeForm()); LoadComponents(compNode, id); } } @@ -321,7 +324,8 @@ void Reader3MF::LoadComponents(DOMNodeList* nodes, int id) DOMNode* objectNode = nodes->item(i); if (objectNode->getNodeType() == DOMNode::ELEMENT_NODE) { auto elem = static_cast(objectNode); - DOMNodeList* compNode = elem->getElementsByTagName(XStr("component").unicodeForm()); + DOMNodeList* compNode = + elem->getElementsByTagName(XStrLiteral("component").unicodeForm()); if (compNode->getLength() > 0) { LoadComponent(compNode, id); } @@ -353,13 +357,13 @@ void Reader3MF::LoadComponent(DOMNamedNodeMap* attr, int id) Component component; component.id = id; - if (DOMNode* pathAttr = attr->getNamedItem(XStr("p:path").unicodeForm())) { + if (DOMNode* pathAttr = attr->getNamedItem(XStrLiteral("p:path").unicodeForm())) { component.path = StrX(pathAttr->getNodeValue()).c_str(); } - if (DOMNode* idAttr = attr->getNamedItem(XStr("objectid").unicodeForm())) { + if (DOMNode* idAttr = attr->getNamedItem(XStrLiteral("objectid").unicodeForm())) { component.objectId = std::stoi(StrX(idAttr->getNodeValue()).c_str()); } - if (DOMNode* transformAttr = attr->getNamedItem(XStr("transform").unicodeForm())) { + if (DOMNode* transformAttr = attr->getNamedItem(XStrLiteral("transform").unicodeForm())) { std::optional mat = ReadTransform(transformAttr); if (mat) { component.transform = mat.value(); @@ -382,8 +386,9 @@ void Reader3MF::LoadMesh(DOMNodeList* nodes, int id, const Component& comp) auto elem = static_cast(node); MeshPointArray points; MeshFacetArray facets; - LoadVertices(elem->getElementsByTagName(XStr("vertices").unicodeForm()), points); - LoadTriangles(elem->getElementsByTagName(XStr("triangles").unicodeForm()), facets); + LoadVertices(elem->getElementsByTagName(XStrLiteral("vertices").unicodeForm()), points); + LoadTriangles(elem->getElementsByTagName(XStrLiteral("triangles").unicodeForm()), + facets); MeshCleanup meshCleanup(points, facets); meshCleanup.RemoveInvalids(); @@ -408,7 +413,8 @@ void Reader3MF::LoadVertices(DOMNodeList* nodes, MeshPointArray& points) DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { auto elem = static_cast(node); - DOMNodeList* vertexList = elem->getElementsByTagName(XStr("vertex").unicodeForm()); + DOMNodeList* vertexList = + elem->getElementsByTagName(XStrLiteral("vertex").unicodeForm()); if (vertexList) { ReadVertices(vertexList, points); } @@ -424,9 +430,9 @@ void Reader3MF::ReadVertices(DOMNodeList* vertexList, MeshPointArray& points) DOMNode* vertexNode = vertexList->item(j); DOMNamedNodeMap* attr = vertexNode->getAttributes(); if (attr) { - DOMNode* xAttr = attr->getNamedItem(XStr("x").unicodeForm()); - DOMNode* yAttr = attr->getNamedItem(XStr("y").unicodeForm()); - DOMNode* zAttr = attr->getNamedItem(XStr("z").unicodeForm()); + DOMNode* xAttr = attr->getNamedItem(XStrLiteral("x").unicodeForm()); + DOMNode* yAttr = attr->getNamedItem(XStrLiteral("y").unicodeForm()); + DOMNode* zAttr = attr->getNamedItem(XStrLiteral("z").unicodeForm()); if (xAttr && yAttr && zAttr) { // NOLINTBEGIN float x = std::stof(StrX(xAttr->getNodeValue()).c_str()); @@ -449,7 +455,8 @@ void Reader3MF::LoadTriangles(DOMNodeList* nodes, MeshFacetArray& facets) DOMNode* node = nodes->item(i); if (node->getNodeType() == DOMNode::ELEMENT_NODE) { auto elem = static_cast(node); - DOMNodeList* triangleList = elem->getElementsByTagName(XStr("triangle").unicodeForm()); + DOMNodeList* triangleList = + elem->getElementsByTagName(XStrLiteral("triangle").unicodeForm()); if (triangleList) { ReadTriangles(triangleList, facets); } @@ -465,9 +472,9 @@ void Reader3MF::ReadTriangles(DOMNodeList* triangleList, MeshFacetArray& facets) DOMNode* triangleNode = triangleList->item(j); DOMNamedNodeMap* attr = triangleNode->getAttributes(); if (attr) { - DOMNode* v1Attr = attr->getNamedItem(XStr("v1").unicodeForm()); - DOMNode* v2Attr = attr->getNamedItem(XStr("v2").unicodeForm()); - DOMNode* v3Attr = attr->getNamedItem(XStr("v3").unicodeForm()); + DOMNode* v1Attr = attr->getNamedItem(XStrLiteral("v1").unicodeForm()); + DOMNode* v2Attr = attr->getNamedItem(XStrLiteral("v2").unicodeForm()); + DOMNode* v3Attr = attr->getNamedItem(XStrLiteral("v3").unicodeForm()); if (v1Attr && v2Attr && v3Attr) { PointIndex v1 = std::stoul(StrX(v1Attr->getNodeValue()).c_str()); PointIndex v2 = std::stoul(StrX(v2Attr->getNodeValue()).c_str()); From 194a9f975166e2aab9d6b5bbcf8c259582742a14 Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Tue, 31 Dec 2024 10:07:29 +0900 Subject: [PATCH 004/224] Base: Expanded FindAttribute() to get rid of frequent constant transcode --- src/Base/Parameter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Base/Parameter.cpp b/src/Base/Parameter.cpp index bce28a56e1..3e02aae6e6 100644 --- a/src/Base/Parameter.cpp +++ b/src/Base/Parameter.cpp @@ -1411,9 +1411,10 @@ ParameterGrp::FindElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* Start, if (clChild->getNodeType() == DOMNode::ELEMENT_NODE) { // the right node Type if (!XMLString::compareString(xType.unicodeForm(), clChild->getNodeName())) { - if (clChild->getAttributes()->getLength() > 0) { + auto attrs = clChild->getAttributes(); + if (attrs->getLength() > 0) { if (Name) { - DOMNode* attr = FindAttribute(clChild, "Name"); + DOMNode* attr = attrs->getNamedItem(XStrLiteral("Name").unicodeForm()); if (attr && !XMLString::compareString(xName.unicodeForm(), attr->getNodeValue())) { From 62ab74d2dfcf7041441e38799f58e5fa7b51d6bd Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Fri, 3 Jan 2025 11:54:07 -0300 Subject: [PATCH 005/224] refactor(PD): change threadDescription into a vector --- src/Mod/PartDesign/App/FeatureHole.cpp | 6 ++---- src/Mod/PartDesign/App/FeatureHole.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index ff63ed393d..5a4b8cee3b 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -83,7 +83,7 @@ const char* Hole::ThreadClass_None_Enums[] = { "None", nullptr }; */ -const Hole::ThreadDescription Hole::threadDescription[][171] = +const std::vector Hole::threadDescription[] = { /* None */ { @@ -617,9 +617,7 @@ const Hole::UTSClearanceDefinition Hole::UTSHoleDiameters[22] = std::vector getThreadDesignations(const int threadType) { std::vector designations; for (const auto& thread : Hole::threadDescription[threadType]) { - if (thread.designation != nullptr) { - designations.emplace_back(thread.designation); - } + designations.push_back(thread.designation); } return designations; } diff --git a/src/Mod/PartDesign/App/FeatureHole.h b/src/Mod/PartDesign/App/FeatureHole.h index 11f75cb1a7..6b50107e03 100644 --- a/src/Mod/PartDesign/App/FeatureHole.h +++ b/src/Mod/PartDesign/App/FeatureHole.h @@ -92,7 +92,7 @@ public: double pitch; double TapDrill; }; - static const ThreadDescription threadDescription[][171]; + static const std::vector threadDescription[]; static const double metricHoleDiameters[51][4]; From f2ac3837ebe44b4bfa12ea59d455419e5bfade4f Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Sat, 18 Jan 2025 11:07:23 -0300 Subject: [PATCH 006/224] feat(PD): create a test to check the thread enums and positions --- .../PartDesign/PartDesignTests/TestHole.py | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/src/Mod/PartDesign/PartDesignTests/TestHole.py b/src/Mod/PartDesign/PartDesignTests/TestHole.py index 3965d28f42..301412e5ef 100644 --- a/src/Mod/PartDesign/PartDesignTests/TestHole.py +++ b/src/Mod/PartDesign/PartDesignTests/TestHole.py @@ -194,6 +194,152 @@ class TestHole(unittest.TestCase): self.Doc.recompute() self.assertEqual(len(self.Hole.Shape.Faces), 7) + + def testThreadEnums(self): + """Test thread enums for correct order""" + # Due to the savefile use of indexes and not strings + # The correct mapping needs to be ensured to not break savefiles + # The order of the arrays and elements is critical + thread_types = { + 'ISOMetricProfile': [ + "M1", "M1.1", "M1.2", "M1.4", "M1.6", + "M1.8", "M2", "M2.2", "M2.5", "M3", + "M3.5", "M4", "M4.5", "M5", "M6", + "M7", "M8", "M9", "M10", "M11", + "M12", "M14", "M16", "M18", "M20", + "M22", "M24", "M27", "M30", "M33", + "M36", "M39", "M42", "M45", "M48", + "M52", "M56", "M60", "M64", "M68", + ], + 'ISOMetricFineProfile': [ + "M1x0.2", "M1.1x0.2", "M1.2x0.2", "M1.4x0.2", + "M1.6x0.2", "M1.8x0.2", "M2x0.25", "M2.2x0.25", + "M2.5x0.35", "M3x0.35", "M3.5x0.35", + "M4x0.5", "M4.5x0.5", "M5x0.5", "M5.5x0.5", + "M6x0.75", "M7x0.75", "M8x0.75", "M8x1.0", + "M9x0.75", "M9x1.0", "M10x0.75", "M10x1.0", + "M10x1.25", "M11x0.75", "M11x1.0", "M12x1.0", + "M12x1.25", "M12x1.5", "M14x1.0", "M14x1.25", + "M14x1.5", "M15x1.0", "M15x1.5", "M16x1.0", + "M16x1.5", "M17x1.0", "M17x1.5", "M18x1.0", + "M18x1.5", "M18x2.0", "M20x1.0", "M20x1.5", + "M20x2.0", "M22x1.0", "M22x1.5", "M22x2.0", + "M24x1.0", "M24x1.5", "M24x2.0", "M25x1.0", + "M25x1.5", "M25x2.0", "M27x1.0", "M27x1.5", + "M27x2.0", "M28x1.0", "M28x1.5", "M28x2.0", + "M30x1.0", "M30x1.5", "M30x2.0", "M30x3.0", + "M32x1.5", "M32x2.0", "M33x1.5", "M33x2.0", + "M33x3.0", "M35x1.5", "M35x2.0", "M36x1.5", + "M36x2.0", "M36x3.0", "M39x1.5", "M39x2.0", + "M39x3.0", "M40x1.5", "M40x2.0", "M40x3.0", + "M42x1.5", "M42x2.0", "M42x3.0", "M42x4.0", + "M45x1.5", "M45x2.0", "M45x3.0", "M45x4.0", + "M48x1.5", "M48x2.0", "M48x3.0", "M48x4.0", + "M50x1.5", "M50x2.0", "M50x3.0", "M52x1.5", + "M52x2.0", "M52x3.0", "M52x4.0", "M55x1.5", + "M55x2.0", "M55x3.0", "M55x4.0", "M56x1.5", + "M56x2.0", "M56x3.0", "M56x4.0", "M58x1.5", + "M58x2.0", "M58x3.0", "M58x4.0", "M60x1.5", + "M60x2.0", "M60x3.0", "M60x4.0", "M62x1.5", + "M62x2.0", "M62x3.0", "M62x4.0", "M64x1.5", + "M64x2.0", "M64x3.0", "M64x4.0", "M65x1.5", + "M65x2.0", "M65x3.0", "M65x4.0", "M68x1.5", + "M68x2.0", "M68x3.0", "M68x4.0", "M70x1.5", + "M70x2.0", "M70x3.0", "M70x4.0", "M70x6.0", + "M72x1.5", "M72x2.0", "M72x3.0", "M72x4.0", + "M72x6.0", "M75x1.5", "M75x2.0", "M75x3.0", + "M75x4.0", "M75x6.0", "M76x1.5", "M76x2.0", + "M76x3.0", "M76x4.0", "M76x6.0", "M80x1.5", + "M80x2.0", "M80x3.0", "M80x4.0", "M80x6.0", + "M85x2.0", "M85x3.0", "M85x4.0", "M85x6.0", + "M90x2.0", "M90x3.0", "M90x4.0", "M90x6.0", + "M95x2.0", "M95x3.0", "M95x4.0", "M95x6.0", + "M100x2.0", "M100x3.0", "M100x4.0", "M100x6.0", + ], + 'UNC': [ + "#1", "#2", "#3", "#4", "#5", "#6", + "#8", "#10", "#12", + "1/4", "5/16", "3/8", "7/16", "1/2", "9/16", + "5/8", "3/4", "7/8", "1", "1 1/8", "1 1/4", + "1 3/8", "1 1/2", "1 3/4", "2", "2 1/4", + "2 1/2", "2 3/4", "3", "3 1/4", "3 1/2", + "3 3/4", "4", + ], + 'UNF': [ + "#0", "#1", "#2", "#3", "#4", "#5", "#6", + "#8", "#10", "#12", + "1/4", "5/16", "3/8", "7/16", "1/2", "9/16", + "5/8", "3/4", "7/8", "1", "1 1/8", "1 1/4", + "1 3/8", "1 1/2", + ], + 'UNEF': [ + "#12", "1/4", "5/16", "3/8", "7/16", "1/2", + "9/16", "5/8", "11/16", "3/4", "13/16", "7/8", + "15/16", "1", "1 1/16", "1 1/8", "1 1/4", + "1 5/16", "1 3/8", "1 7/16", "1 1/2", "1 9/16", + "1 5/8", "1 11/16", + ], + 'NPT': [ + "1/16", "1/8", "1/4", "3/8", "1/2", "3/4", + "1", "1 1/4", "1 1/2", + "2", "2 1/2", + "3", "3 1/2", + "4", "5", "6", "8", "10", "12", + ], + 'BSP': [ + "1/16", "1/8", "1/4", "3/8", "1/2", "5/8", "3/4", "7/8", + "1", "1 1/8", "1 1/4", "1 1/2", "1 3/4", + "2", "2 1/4", "2 1/2", "2 3/4", + "3", "3 1/2", "4", "4 1/2", + "5", "5 1/2", "6", + ], + 'BSW': [ + "1/8", "3/16", "1/4", "5/16", "3/8", "7/16", + "1/2", "9/16", "5/8", "11/16", "3/4", "7/8", + "1", "1 1/8", "1 1/4", "1 1/2", "1 3/4", + "2", "2 1/4", "2 1/2", "2 3/4", + "3", "3 1/4", "3 1/2", "3 3/4", + "4", "4 1/2", "5", "5 1/2", "6", + ], + 'BSF': [ + "3/16", "7/32", "1/4", "9/32", "5/16", "3/8", "7/16", + "1/2", "9/16", "5/8", "11/16", "3/4", "7/8", + "1", "1 1/8", "1 1/4", "1 3/8", "1 1/2", "1 5/8", "1 3/4", + "2", "2 1/4", "2 1/2", "2 3/4", + "3", "3 1/4", "3 1/2", "3 3/4", + "4", "4 1/4", + ], + } + allowed_types = self.Hole.getEnumerationsOfProperty("ThreadType") + for type_index, thread_type in enumerate(thread_types.keys(), 1): + if thread_type not in allowed_types: + self._helperNotFoundMessage(thread_type, allowed_types) + # Set by number like the saved files + self.Hole.ThreadType = type_index + self._helperNotCorrectMessage(self.Hole.ThreadType, thread_type) + + allowed_sizes = self.Hole.getEnumerationsOfProperty("ThreadSize") + for size_index, designation in enumerate(thread_types[thread_type]): + if designation not in allowed_sizes: + self._helperNotFoundMessage(designation, allowed_sizes) + # Set by number like the saved files + self.Hole.ThreadSize = size_index + self._helperNotCorrectMessage(self.Hole.ThreadSize, designation) + + def _helperNotCorrectMessage(self, value, comparison): + self.assertEqual( + value, comparison, + f"{comparison} is not in the correct position\n\n" + "it will break compatibility with older saves" + ) + + def _helperNotFoundMessage(self, prop, allowed_props): + raise AssertionError( + "\n" + f"{prop} is not in {allowed_props}\n\n" + "Verify that the tested enums names are updated \n\n" + ) + def tearDown(self): #closing doc FreeCAD.closeDocument("PartDesignTestHole") From aaa976953d13a8ee26e28b930d901e5c94bcb06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kapelrud?= Date: Mon, 6 Jan 2025 13:02:10 -0300 Subject: [PATCH 007/224] Base: Add surface charge density unit --- src/App/Application.cpp | 1 + src/App/PropertyUnits.cpp | 11 +++++++++++ src/App/PropertyUnits.h | 13 +++++++++++++ src/Base/Unit.cpp | 4 +++- src/Base/Unit.h | 1 + src/Base/UnitsSchemaInternal.cpp | 4 ++++ src/Base/UnitsSchemaMKS.cpp | 4 ++++ 7 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 967bf5bcb2..ee28b528eb 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -2060,6 +2060,7 @@ void Application::initTypes() App::PropertyElectricalInductance ::init(); App::PropertyElectricalResistance ::init(); App::PropertyElectricCharge ::init(); + App::PropertySurfaceChargeDensity ::init(); App::PropertyElectricCurrent ::init(); App::PropertyElectricPotential ::init(); App::PropertyElectromagneticPotential ::init(); diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp index b18ea6b65f..b4ed219cd9 100644 --- a/src/App/PropertyUnits.cpp +++ b/src/App/PropertyUnits.cpp @@ -392,6 +392,17 @@ PropertyElectricCharge::PropertyElectricCharge() setUnit(Base::Unit::ElectricCharge); } +//************************************************************************** +// PropertySurfaceChargeDensity +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +TYPESYSTEM_SOURCE(App::PropertySurfaceChargeDensity, App::PropertyQuantity) + +PropertySurfaceChargeDensity::PropertySurfaceChargeDensity() +{ + setUnit(Base::Unit::SurfaceChargeDensity); +} + //************************************************************************** // PropertyElectricCurrent //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h index 8a19ead0ce..e81a8fd9c3 100644 --- a/src/App/PropertyUnits.h +++ b/src/App/PropertyUnits.h @@ -361,6 +361,19 @@ public: ~PropertyElectricCharge() override = default; }; +/** SurfaceChargeDensity property + * This is a property for representing surface charge density. It is basically a float + * property. On the Gui it has a quantity like C/m^2. + */ +class AppExport PropertySurfaceChargeDensity: public PropertyQuantity +{ + TYPESYSTEM_HEADER_WITH_OVERRIDE(); + +public: + PropertySurfaceChargeDensity(); + ~PropertySurfaceChargeDensity() override = default; +}; + /** ElectricCurrent property * This is a property for representing electric currents. It is basically a * float property. On the Gui it has a quantity like A. diff --git a/src/Base/Unit.cpp b/src/Base/Unit.cpp index a3c2a12c87..6aaa117af1 100644 --- a/src/Base/Unit.cpp +++ b/src/Base/Unit.cpp @@ -587,7 +587,7 @@ std::string Unit::getString() const std::string Unit::getTypeString() const { - static std::array, 55> unitSpecs {{ + static std::array, 56> unitSpecs {{ { Unit::Acceleration, "Acceleration" }, { Unit::AmountOfSubstance, "AmountOfSubstance" }, { Unit::Angle, "Angle" }, @@ -603,6 +603,7 @@ std::string Unit::getTypeString() const { Unit::ElectricalInductance, "ElectricalInductance" }, { Unit::ElectricalResistance, "ElectricalResistance" }, { Unit::ElectricCharge, "ElectricCharge" }, + { Unit::SurfaceChargeDensity, "SurfaceChargeDensity" }, { Unit::ElectricCurrent, "ElectricCurrent" }, { Unit::ElectricPotential, "ElectricPotential" }, { Unit::ElectromagneticPotential, "ElectromagneticPotential" }, @@ -681,6 +682,7 @@ const Unit Unit::ElectricalConductivity (-3, -1, 3, 2); const Unit Unit::ElectricalInductance (2, 1, -2, -2); const Unit Unit::ElectricalResistance (2, 1, -3, -2); const Unit Unit::ElectricCharge (0, 0, 1, 1); +const Unit Unit::SurfaceChargeDensity (-2, 0, 1, 1); const Unit Unit::ElectricPotential (2, 1, -3, -1); const Unit Unit::ElectromagneticPotential (1, 1, -2, -1); const Unit Unit::Force (1, 1, -2); diff --git a/src/Base/Unit.h b/src/Base/Unit.h index 670cf67526..b47d5c26ae 100644 --- a/src/Base/Unit.h +++ b/src/Base/Unit.h @@ -110,6 +110,7 @@ public: static const Unit ElectricCurrent; static const Unit ElectricPotential; static const Unit ElectricCharge; + static const Unit SurfaceChargeDensity; static const Unit MagneticFieldStrength; static const Unit MagneticFlux; static const Unit MagneticFluxDensity; diff --git a/src/Base/UnitsSchemaInternal.cpp b/src/Base/UnitsSchemaInternal.cpp index 63e543d205..1d67455bab 100644 --- a/src/Base/UnitsSchemaInternal.cpp +++ b/src/Base/UnitsSchemaInternal.cpp @@ -364,6 +364,10 @@ UnitsSchemaInternal::schemaTranslate(const Quantity& quant, double& factor, std: unitString = "C"; factor = 1.0; } + else if (unit == Unit::SurfaceChargeDensity) { + unitString = "C/m^2"; + factor = 1e-6; + } else if (unit == Unit::CurrentDensity) { if (UnitValue <= 1e3) { unitString = "A/m^2"; diff --git a/src/Base/UnitsSchemaMKS.cpp b/src/Base/UnitsSchemaMKS.cpp index 98ef0545eb..241e3eba9b 100644 --- a/src/Base/UnitsSchemaMKS.cpp +++ b/src/Base/UnitsSchemaMKS.cpp @@ -312,6 +312,10 @@ UnitsSchemaMKS::schemaTranslate(const Quantity& quant, double& factor, std::stri unitString = "C"; factor = 1.0; } + else if (unit == Unit::SurfaceChargeDensity) { + unitString = "C/m^2"; + factor = 1e-6; + } else if (unit == Unit::CurrentDensity) { if (UnitValue <= 1e3) { unitString = "A/m^2"; From 9ad7bd37e3bdfff58aa21618b85de131989eac53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kapelrud?= Date: Mon, 6 Jan 2025 16:57:18 -0300 Subject: [PATCH 008/224] Fem: Add Neumann boundary condition for electrostatic potential --- .../Resources/ui/ElectrostaticPotential.ui | 1187 +++++++++-------- .../constraint_electrostaticpotential.py | 20 + .../elmer/equations/electrostatic_writer.py | 36 +- .../task_constraint_electrostaticpotential.py | 38 +- 4 files changed, 716 insertions(+), 565 deletions(-) diff --git a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui index 0e0338008c..fd83f7d508 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui @@ -6,8 +6,8 @@ 0 0 - 317 - 303 + 357 + 593 @@ -15,602 +15,690 @@ - - - - - Potential: - - - - - - - Qt::Horizontal - - - - 20 - 20 - - - - - - - - false - - - - 100 - 20 - - - - Electric potential - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - unspecified - - - true - - - - - - - - - To define a vector field - + - Vector Field + Dirichlet true + + BCtypeBG + - - - - true + + + + Neumann - - Imaginary part is only used for equations -with a harmonic/oscillating driving force + + BCtypeBG + + + + + + + false - - false - - - - + + + true - - Real - - - - - - - true - - - Imaginary - - - - - - - true - - - Scalar - - - - - - - false - - - - 100 - 20 - - - Potential as specified above - - - true - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - true - - - - 100 - 20 - - - - Imaginary part of scalar potential - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - unspecified + Whether the boundary condition defines a farfield potential - + Farfield / Electric infinity + + + + + + + + + false + + + Electric potential + + + true + + + + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + Potential: + + + + + + + unspecified + + + true + + + + + + + Qt::Horizontal + + + + 20 + 20 + + + + + + + + + + Whether the boundary condition defines a constant potential + + + Potential Constant - + true - - x - - - - - - - true - - - - 100 - 20 - - - Real part of potential x-component + Imaginary part is only used for equations +with a harmonic/oscillating driving force + + + false + + + false + + + + + + true + + + Real + + + + + + + true + + + Imaginary + + + + + + + true + + + Scalar + + + + + + + false + + + + 100 + 20 + + + + Potential as specified above + + + true + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + true + + + + 100 + 20 + + + + Imaginary part of scalar potential + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + unspecified + + + + + + + + + + true + + + x + + + + + + + true + + + + 100 + 20 + + + + Real part of potential x-component Note: has no effect if a solid was selected - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - unspecified - - - - - - - - - - true - - - - 100 - 20 - - - - Imaginary part of potential x-component + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + unspecified + + + + + + + + + + true + + + + 100 + 20 + + + + Imaginary part of potential x-component Note: has no effect if a solid was selected - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - unspecified - - - - - - - - - - true - - - y - - - - - - - true - - - - 100 - 20 - - - - Real part of potential y-component + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + unspecified + + + + + + + + + + true + + + y + + + + + + + true + + + + 100 + 20 + + + + Real part of potential y-component Note: has no effect if a solid was selected - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - unspecified - - - - - - - - - - true - - - - 100 - 20 - - - - Imaginary part of potential y-component + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + unspecified + + + + + + + + + + true + + + + 100 + 20 + + + + Imaginary part of potential y-component Note: has no effect if a solid was selected - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - unspecified - - - - - - - - - - true - - - z - - - - - - - true - - - - 100 - 20 - - - - Real part of potential z-component + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + unspecified + + + + + + + + + + true + + + z + + + + + + + true + + + + 100 + 20 + + + + Real part of potential z-component Note: has no effect if a solid was selected - - - true - - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - - - - - unspecified - - - - - - - - - - true - - - - 100 - 20 - - - - Imaginary part of potential z-component + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + unspecified + + + + + + + + + + true + + + + 100 + 20 + + + + Imaginary part of potential z-component Note: has no effect if a solid was selected + + + true + + + V + + + -1000000000000000000000.000000000000000 + + + 1000000000000000000000.000000000000000 + + + 1.000000000000000 + + + 1.000000000000000 + + + + + + + unspecified + + + + + + + + + + + + + + + Capacitance Body: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + unspecified + + + true + + + + + + + + 55 + 16777215 + + + + Counter of the body (or face) with a capacitance + + + 1 + + + 1 + + + + + + + + + To define a vector field - + + Vector Field + + true - - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - - - 1.000000000000000 - - - 1.000000000000000 - - - + + - unspecified + Whether the boundary condition is for the electric force - + Calculate Electric Force - - - - Whether the boundary condition defines a constant potential + + + + - - Potential Constant + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Surface Charge Density: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Surface Charge density + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + - - - - true - - - Whether the boundary condition defines a farfield potential - - - Farfield / Electric infinity - - - - - - - Whether the boundary condition is for the electric force - - - Calculate Electric Force - - - - - - - - - Capacity Body: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - unspecified - - - true - - - - - - - - 55 - 16777215 - - - - Counter of the body (or face) with a capacitance - - - 1 - - - 1 - - - - - @@ -783,4 +871,7 @@ Note: has no effect if a solid was selected + + + diff --git a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py index e3e9554531..749d12cf62 100644 --- a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py @@ -195,3 +195,23 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) ) obj.setPropertyStatus("CapacitanceBodyEnabled", "LockDynamic") obj.CapacitanceBodyEnabled = False + + if not hasattr(obj, "SurfaceChargeDensity"): + obj.addProperty( + "App::PropertySurfaceChargeDensity", + "SurfaceChargeDensity", + "Parameter", + "(free) Surface Charge Density", + ) + obj.setPropertyStatus("SurfaceChargeDensity", "LockDynamic") + obj.SurfaceChargeDensity = "0.0 s*A/mm^2" + + if not hasattr(obj, "Dirichlet"): + obj.addProperty( + "App::PropertyBool", + "Dirichlet", + "Parameter", + "Dirichlet (true) or Neumann (false) type BC", + ) + obj.setPropertyStatus("Dirichlet", "LockDynamic") + obj.Dirichlet = True diff --git a/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py b/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py index 5014df97ff..1751c9b78b 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py @@ -125,22 +125,26 @@ class ESwriter: # output the FreeCAD label as comment if obj.Label: self.write.boundary(name, "! FreeCAD Name", obj.Label) - if obj.PotentialEnabled: - if hasattr(obj, "Potential"): - # Potential was once a float and scaled not fitting SI units - if isinstance(obj.Potential, float): - savePotential = obj.Potential - obj.removeProperty("Potential") - obj.addProperty( - "App::PropertyElectricPotential", - "Potential", - "Parameter", - "Electric Potential", - ) - # scale to match SI units - obj.Potential = savePotential * 1e6 - potential = float(obj.Potential.getValueAs("V")) - self.write.boundary(name, "Potential", potential) + if obj.Dirichlet: + if obj.PotentialEnabled: + if hasattr(obj, "Potential"): + # Potential was once a float and scaled not fitting SI units + if isinstance(obj.Potential, float): + savePotential = obj.Potential + obj.removeProperty("Potential") + obj.addProperty( + "App::PropertyElectricPotential", + "Potential", + "Parameter", + "Electric Potential", + ) + # scale to match SI units + obj.Potential = savePotential * 1e6 + potential = float(obj.Potential.getValueAs("V")) + self.write.boundary(name, "Potential", potential) + elif not obj.Dirichlet and hasattr(obj, "SurfaceChargeDensity"): + sc_density = float(obj.SurfaceChargeDensity.getValueAs("A*s/m^2")) + self.write.boundary(name, "Surface Charge Density", sc_density) if obj.PotentialConstant: self.write.boundary(name, "Potential Constant", True) if obj.ElectricInfinity: diff --git a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py index da268a8b3b..f7a7e12f26 100644 --- a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py @@ -24,7 +24,7 @@ # *************************************************************************** __title__ = "FreeCAD FEM constraint electrostatic potential task panel for the document object" -__author__ = "Markus Hovorka, Bernd Hahnebach, Uwe Stöhr" +__author__ = "Markus Hovorka, Bernd Hahnebach, Uwe Stöhr, André Kapelrud" __url__ = "https://www.freecad.org" ## @package task_constraint_electrostaticpotential @@ -88,6 +88,13 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self._vectorField_visibility, ) + def _BCtype_clicked(self, button): + self._BCtype(button == self._paramWidget.dirichletBC_RB) + + def _BCtype(self, isDirichlet): + self._paramWidget.neumannGB.setEnabled(not isDirichlet) + self._paramWidget.dirichletGB.setEnabled(isDirichlet) + def _vectorField_visibility(self, visible): self._paramWidget.vectorFieldGB.setVisible(visible) @@ -166,6 +173,20 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): not self._paramWidget.capacitanceBodyBox.isChecked() ) + # neumann/dirichlet radiogroup selection + self._paramWidget.BCtypeBG.buttonClicked.connect(self._BCtype_clicked) + if self.obj.Dirichlet: + self._paramWidget.dirichletBC_RB.click() + else: + self._paramWidget.neumannBC_RB.click() + + self._paramWidget.surfacechargedensityQSB.setProperty( + "value", self.obj.SurfaceChargeDensity + ) + FreeCADGui.ExpressionBinding(self._paramWidget.surfacechargedensityQSB).bind( + self.obj, "SurfaceChargeDensity" + ) + def _applyPotentialChanges(self, enabledBox, potentialQSB): enabled = enabledBox.isChecked() potential = None @@ -219,3 +240,18 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): if self.obj.CapacitanceBodyEnabled: self._paramWidget.capacitanceBody_spinBox.setEnabled(True) self.obj.CapacitanceBody = self._paramWidget.capacitanceBody_spinBox.value() + + self.obj.Dirichlet = self._paramWidget.dirichletBC_RB.isChecked() + + try: + self.obj.SurfaceChargeDensity = self._paramWidget.surfacechargedensityQSB.property( + "value" + ) + except ValueError: + FreeCAD.Console.PrintMessage( + "Wrong input. Not recognised input: '{}' " + "SurfaceChargeDensity has not been set.\n".format( + self._paramWidget.surfacechargedensityQSB.text() + ) + ) + self.obj.SurfaceChargeDensity = "0.0 s*A/(mm^2)" From 30c7efbc60f356eca100710b9799815d20011a92 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Sun, 12 Jan 2025 10:17:56 -0300 Subject: [PATCH 009/224] Fem: Fix vector potential unit and use enumeration property for boundary condition --- .../Resources/ui/ElectrostaticPotential.ui | 675 +++++------------- .../constraint_electrostaticpotential.py | 414 ++++++----- .../elmer/equations/electrostatic_writer.py | 32 +- .../task_constraint_electrostaticpotential.py | 435 ++++++++--- 4 files changed, 766 insertions(+), 790 deletions(-) diff --git a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui index fd83f7d508..de85084c5d 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui @@ -13,56 +13,46 @@ Analysis feature properties - - - - - Dirichlet + + + + + - - true - - - BCtypeBG - - - - - - - Neumann - - - BCtypeBG - + + + + + Boundary Condition: + + + + + + + - + - + Dirichlet false - - - - true - - - Whether the boundary condition defines a farfield potential - - - Farfield / Electric infinity - - - - - + + + + Potential: + + + + + false @@ -73,13 +63,7 @@ true - - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 + V 1.000000000000000 @@ -89,45 +73,18 @@ - - - - Potential: - - - - - - - unspecified - - - true - - - - - - - Qt::Horizontal - - - - 20 - 20 - - - - - - + + - Whether the boundary condition defines a constant potential + To define scalar potential and magnetic vector potential - Potential Constant + Electromagnetic Potential + + + true @@ -147,7 +104,7 @@ with a harmonic/oscillating driving force false - + true @@ -157,7 +114,7 @@ with a harmonic/oscillating driving force - + true @@ -178,16 +135,20 @@ with a harmonic/oscillating driving force - + + + unspecified + + + + + + + + false - - - 100 - 20 - - Potential as specified above @@ -200,12 +161,6 @@ with a harmonic/oscillating driving force V - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - 1.000000000000000 @@ -215,16 +170,20 @@ with a harmonic/oscillating driving force - + + + unspecified + + + + + + + + true - - - 100 - 20 - - Imaginary part of scalar potential @@ -234,12 +193,6 @@ with a harmonic/oscillating driving force V - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 - 1.000000000000000 @@ -248,16 +201,6 @@ with a harmonic/oscillating driving force - - - - unspecified - - - - - - @@ -269,16 +212,20 @@ with a harmonic/oscillating driving force - + + + unspecified + + + + + + + + true - - - 100 - 20 - - Real part of potential x-component Note: has no effect if a solid was selected @@ -287,13 +234,7 @@ Note: has no effect if a solid was selected true - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 + Wb/m 1.000000000000000 @@ -303,8 +244,8 @@ Note: has no effect if a solid was selected - - + + unspecified @@ -313,17 +254,11 @@ Note: has no effect if a solid was selected - - + + true - - - 100 - 20 - - Imaginary part of potential x-component Note: has no effect if a solid was selected @@ -332,13 +267,7 @@ Note: has no effect if a solid was selected true - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 + Wb/m 1.000000000000000 @@ -348,16 +277,6 @@ Note: has no effect if a solid was selected - - - - unspecified - - - - - - @@ -369,16 +288,20 @@ Note: has no effect if a solid was selected - + + + unspecified + + + + + + + + true - - - 100 - 20 - - Real part of potential y-component Note: has no effect if a solid was selected @@ -387,13 +310,7 @@ Note: has no effect if a solid was selected true - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 + Wb/m 1.000000000000000 @@ -403,8 +320,8 @@ Note: has no effect if a solid was selected - - + + unspecified @@ -413,17 +330,11 @@ Note: has no effect if a solid was selected - - + + true - - - 100 - 20 - - Imaginary part of potential y-component Note: has no effect if a solid was selected @@ -432,13 +343,7 @@ Note: has no effect if a solid was selected true - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 + Wb/m 1.000000000000000 @@ -448,16 +353,6 @@ Note: has no effect if a solid was selected - - - - unspecified - - - - - - @@ -469,16 +364,20 @@ Note: has no effect if a solid was selected - + + + unspecified + + + + + + + + true - - - 100 - 20 - - Real part of potential z-component Note: has no effect if a solid was selected @@ -487,13 +386,7 @@ Note: has no effect if a solid was selected true - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 + Wb/m 1.000000000000000 @@ -503,8 +396,8 @@ Note: has no effect if a solid was selected - - + + unspecified @@ -513,17 +406,11 @@ Note: has no effect if a solid was selected - - + + true - - - 100 - 20 - - Imaginary part of potential z-component Note: has no effect if a solid was selected @@ -532,13 +419,7 @@ Note: has no effect if a solid was selected true - V - - - -1000000000000000000000.000000000000000 - - - 1000000000000000000000.000000000000000 + Wb/m 1.000000000000000 @@ -548,62 +429,62 @@ Note: has no effect if a solid was selected - - - - unspecified - - - - - - + + + + true + + + Whether the boundary condition defines a farfield potential + + + Farfield / Electric infinity + + + + + + + Whether the boundary condition defines a constant potential + + + Potential Constant + + + + + + + Whether the boundary condition is for the electric force + + + Calculate Electric Force + + + - + - Capacitance Body: + Capacitance Body: + + + Enabled by 'Calculate Capacity Matrix' in Electrostatic equation - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - unspecified - - - true - - - - - - - - 55 - 16777215 - - + Counter of the body (or face) with a capacitance + + false + 1 @@ -614,87 +495,31 @@ Note: has no effect if a solid was selected - - - - To define a vector field - - - Vector Field - - - true - - - - - - - Whether the boundary condition is for the electric force - - - Calculate Electric Force - - - - - + + - + Neumann - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - + - - - - - Surface Charge Density: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Surface Charge density - - - - - - - + + + Surface Charge Density: + + - - - - Qt::Vertical + + + + Surface charge density - - - 20 - 40 - + + C/m^2 - + @@ -709,168 +534,6 @@ Note: has no effect if a solid was selected - - - capacitanceBodyBox - toggled(bool) - capacitanceBody_spinBox - setDisabled(bool) - - - 262 - 116 - - - 323 - 116 - - - - - potentialBox - toggled(bool) - potentialQSB - setDisabled(bool) - - - 301 - 19 - - - 206 - 19 - - - - - potentialQSB - valueChanged(Base::Quantity) - realScalarQSB - setValue(Base::Quantity) - - - 126 - 19 - - - 103 - 98 - - - - - reZunspecBox - toggled(bool) - realZQSB - setDisabled(bool) - - - 179 - 178 - - - 103 - 176 - - - - - reYunspecBox - toggled(bool) - realYQSB - setDisabled(bool) - - - 179 - 148 - - - 103 - 150 - - - - - imXunspecBox - toggled(bool) - imagXQSB - setDisabled(bool) - - - 339 - 128 - - - 258 - 127 - - - - - reXunspecBox - toggled(bool) - realXQSB - setDisabled(bool) - - - 179 - 128 - - - 103 - 124 - - - - - imZunspecBox - toggled(bool) - imagZQSB - setDisabled(bool) - - - 339 - 178 - - - 258 - 179 - - - - - imYunspecBox - toggled(bool) - imagYQSB - setDisabled(bool) - - - 339 - 148 - - - 258 - 153 - - - - - imScalarunspecBox - toggled(bool) - imagScalarQSB - setDisabled(bool) - - - 339 - 98 - - - 258 - 101 - - - - diff --git a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py index 749d12cf62..f1e7f595ec 100644 --- a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py @@ -2,6 +2,7 @@ # * Copyright (c) 2017 Markus Hovorka * # * Copyright (c) 2020 Bernd Hahnebach * # * Copyright (c) 2023 Uwe Stöhr * +# * Copyright (c) 2024 Mario Passaglia * # * * # * This file is part of the FreeCAD CAx development system. * # * * @@ -24,7 +25,7 @@ # *************************************************************************** __title__ = "FreeCAD FEM constraint electrostatic potential document object" -__author__ = "Markus Hovorka, Bernd Hahnebach, Uwe Stöhr" +__author__ = "Markus Hovorka, Bernd Hahnebach, Uwe Stöhr, Mario Passaglia" __url__ = "https://www.freecad.org" ## @package constraint_electrostaticpotential @@ -33,6 +34,8 @@ __url__ = "https://www.freecad.org" from . import base_fempythonobject +_PropHelper = base_fempythonobject._PropHelper + class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject): @@ -40,178 +43,243 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) def __init__(self, obj): super().__init__(obj) - self.add_properties(obj) + + for prop in self._get_properties(): + prop.add_to_object(obj) + + def _get_properties(self): + prop = [] + + prop.append( + _PropHelper( + type="App::PropertyElectricPotential", + name="Potential", + group="Parameter", + doc="Electric Potential", + value="1 V", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="PotentialEnabled", + group="Parameter", + doc="Enable electric potential", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectromagneticPotential", + name="AV_re_1", + group="Vector Potential", + doc="Real part of potential x-component", + value="0 Wb/m", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectromagneticPotential", + name="AV_re_2", + group="Vector Potential", + doc="Real part of potential y-component", + value="0 Wb/m", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectromagneticPotential", + name="AV_re_3", + group="Vector Potential", + doc="Real part of potential z-component", + value="0 Wb/m", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectromagneticPotential", + name="AV_im_1", + group="Vector Potential", + doc="Imaginary part of potential x-component", + value="0 Wb/m", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectromagneticPotential", + name="AV_im_2", + group="Vector Potential", + doc="Imaginary part of potential y-component", + value="0 Wb/m", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectromagneticPotential", + name="AV_im_3", + group="Vector Potential", + doc="Imaginary part of potential z-component", + value="0 Wb/m", + ) + ) + prop.append( + _PropHelper( + type="App::PropertySurfaceChargeDensity", + name="SurfaceChargeDensity", + group="Parameter", + doc="Free surface charge density", + value="0 C/m^2", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyEnumeration", + name="BoundaryCondition", + group="Parameter", + doc="Set boundary condition type", + value=["Dirichlet", "Neumann"], + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectricPotential", + name="AV_im", + group="Parameter", + doc="Imaginary part of scalar potential", + value="0 V", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_re_1_Disabled", + group="Vector Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_re_2_Disabled", + group="Vector Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_re_3_Disabled", + group="Vector Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_im_1_Disabled", + group="Vector Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_im_2_Disabled", + group="Vector Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_im_3_Disabled", + group="Vector Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_im_Disabled", + group="Vector Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="PotentialConstant", + group="Parameter", + doc="", + value=False, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="ElectricInfinity", + group="Parameter", + doc="Electric Infinity", + value=False, + ) + ) + + prop.append( + _PropHelper( + type="App::PropertyBool", + name="ElectricForcecalculation", + group="Parameter", + doc="Electric force calculation", + value=False, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyInteger", + name="CapacitanceBody", + group="Parameter", + doc="Capacitance body", + value=0, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="CapacitanceBodyEnabled", + group="Parameter", + doc="Capacitance body enabled", + value=False, + ) + ) + + return prop def onDocumentRestored(self, obj): - self.add_properties(obj) + # update old project with new properties + for prop in self._get_properties(): + try: + obj.getPropertyByName(prop.name) + except Base.PropertyError: + prop.add_to_object(obj) - def add_properties(self, obj): - if not hasattr(obj, "Potential"): - obj.addProperty( - "App::PropertyElectricPotential", "Potential", "Parameter", "Electric Potential" - ) - obj.setPropertyStatus("Potential", "LockDynamic") - # setting 1 V assures that the unit does not switch to mV - # and the constraint holds usually Volts - obj.Potential = "1 V" - - if not hasattr(obj, "AV_re_1"): - obj.addProperty( - "App::PropertyElectricPotential", - "AV_re_1", - "Vector Potential", - "Real part of potential x-component", - ) - obj.setPropertyStatus("AV_re_1", "LockDynamic") - obj.AV_re_1 = "0 V" - if not hasattr(obj, "AV_re_2"): - obj.addProperty( - "App::PropertyElectricPotential", - "AV_re_2", - "Vector Potential", - "Real part of potential y-component", - ) - obj.setPropertyStatus("AV_re_2", "LockDynamic") - obj.AV_re_2 = "0 V" - if not hasattr(obj, "AV_re_3"): - obj.addProperty( - "App::PropertyElectricPotential", - "AV_re_3", - "Vector Potential", - "Real part of potential z-component", - ) - obj.setPropertyStatus("AV_re_3", "LockDynamic") - obj.AV_re_3 = "0 V" - if not hasattr(obj, "AV_im"): - obj.addProperty( - "App::PropertyElectricPotential", - "AV_im", - "Vector Potential", - "Imaginary part of scalar potential", - ) - obj.setPropertyStatus("AV_im", "LockDynamic") - obj.AV_im = "0 V" - if not hasattr(obj, "AV_im_1"): - obj.addProperty( - "App::PropertyElectricPotential", - "AV_im_1", - "Vector Potential", - "Imaginary part of potential x-component", - ) - obj.setPropertyStatus("AV_im_1", "LockDynamic") - obj.AV_im_1 = "0 V" - if not hasattr(obj, "AV_im_2"): - obj.addProperty( - "App::PropertyElectricPotential", - "AV_im_2", - "Vector Potential", - "Imaginary part of potential y-component", - ) - obj.setPropertyStatus("AV_im_2", "LockDynamic") - obj.AV_im_2 = "0 V" - if not hasattr(obj, "AV_im_3"): - obj.addProperty( - "App::PropertyElectricPotential", - "AV_im_3", - "Vector Potential", - "Imaginary part of potential z-component", - ) - obj.setPropertyStatus("AV_im_3", "LockDynamic") - obj.AV_im_3 = "0 V" - - # now the enable bools - if not hasattr(obj, "PotentialEnabled"): - obj.addProperty( - "App::PropertyBool", "PotentialEnabled", "Parameter", "Potential Enabled" - ) - obj.setPropertyStatus("PotentialEnabled", "LockDynamic") - obj.PotentialEnabled = True - if not hasattr(obj, "AV_re_1_Disabled"): - obj.addProperty("App::PropertyBool", "AV_re_1_Disabled", "Vector Potential", "") - obj.setPropertyStatus("AV_re_1_Disabled", "LockDynamic") - obj.AV_re_1_Disabled = True - if not hasattr(obj, "AV_re_2_Disabled"): - obj.addProperty("App::PropertyBool", "AV_re_2_Disabled", "Vector Potential", "") - obj.setPropertyStatus("AV_re_2_Disabled", "LockDynamic") - obj.AV_re_2_Disabled = True - if not hasattr(obj, "AV_re_3_Disabled"): - obj.addProperty("App::PropertyBool", "AV_re_3_Disabled", "Vector Potential", "") - obj.setPropertyStatus("AV_re_3_Disabled", "LockDynamic") - obj.AV_re_3_Disabled = True - if not hasattr(obj, "AV_im_Disabled"): - obj.addProperty("App::PropertyBool", "AV_im_Disabled", "Vector Potential", "") - obj.setPropertyStatus("AV_im_Disabled", "LockDynamic") - obj.AV_im_Disabled = True - if not hasattr(obj, "AV_im_1_Disabled"): - obj.addProperty("App::PropertyBool", "AV_im_1_Disabled", "Vector Potential", "") - obj.setPropertyStatus("AV_im_1_Disabled", "LockDynamic") - obj.AV_im_1_Disabled = True - if not hasattr(obj, "AV_im_2_Disabled"): - obj.addProperty("App::PropertyBool", "AV_im_2_Disabled", "Vector Potential", "") - obj.setPropertyStatus("AV_im_2_Disabled", "LockDynamic") - obj.AV_im_2_Disabled = True - if not hasattr(obj, "AV_im_3_Disabled"): - obj.addProperty("App::PropertyBool", "AV_im_3_Disabled", "Vector Potential", "") - obj.setPropertyStatus("AV_im_3_Disabled", "LockDynamic") - obj.AV_im_3_Disabled = True - - if not hasattr(obj, "PotentialConstant"): - obj.addProperty( - "App::PropertyBool", "PotentialConstant", "Parameter", "Potential Constant" - ) - obj.setPropertyStatus("PotentialConstant", "LockDynamic") - obj.PotentialConstant = False - - if not hasattr(obj, "ElectricInfinity"): - obj.addProperty( - "App::PropertyBool", "ElectricInfinity", "Parameter", "Electric Infinity" - ) - obj.setPropertyStatus("ElectricInfinity", "LockDynamic") - obj.ElectricInfinity = False - - if not hasattr(obj, "ElectricForcecalculation"): - obj.addProperty( - "App::PropertyBool", - "ElectricForcecalculation", - "Parameter", - "Electric Force Calculation", - ) - obj.setPropertyStatus("ElectricForcecalculation", "LockDynamic") - obj.ElectricForcecalculation = False - - if not hasattr(obj, "CapacitanceBody"): - obj.addProperty( - "App::PropertyInteger", "CapacitanceBody", "Parameter", "Capacitance Body" - ) - obj.setPropertyStatus("CapacitanceBody", "LockDynamic") - obj.CapacitanceBody = 0 - - if not hasattr(obj, "CapacitanceBodyEnabled"): - obj.addProperty( - "App::PropertyBool", - "CapacitanceBodyEnabled", - "Parameter", - "Capacitance Body Enabled", - ) - obj.setPropertyStatus("CapacitanceBodyEnabled", "LockDynamic") - obj.CapacitanceBodyEnabled = False - - if not hasattr(obj, "SurfaceChargeDensity"): - obj.addProperty( - "App::PropertySurfaceChargeDensity", - "SurfaceChargeDensity", - "Parameter", - "(free) Surface Charge Density", - ) - obj.setPropertyStatus("SurfaceChargeDensity", "LockDynamic") - obj.SurfaceChargeDensity = "0.0 s*A/mm^2" - - if not hasattr(obj, "Dirichlet"): - obj.addProperty( - "App::PropertyBool", - "Dirichlet", - "Parameter", - "Dirichlet (true) or Neumann (false) type BC", - ) - obj.setPropertyStatus("Dirichlet", "LockDynamic") - obj.Dirichlet = True + # convert old potential float to Volt + if prop.name == "Potential": + prop.handle_change_type( + obj, + old_type="App::PropertyFloat", + convert_old_value=lambda x: "{} V".format(1e6 * x), + ) + # fix unit for magnetic vector potential properties + if prop.name in ("AV_re_1", "AV_re_2", "AV_re_3", "AV_im_1", "AV_im_2", "AV_im_3"): + prop.handle_change_type( + obj, + old_type="App::PropertyElectricPotential", + convert_old_value=lambda x: "{} Wb/m".format(x.getValueAs("V").Value), + ) diff --git a/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py b/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py index 1751c9b78b..6ffba76461 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py @@ -125,26 +125,17 @@ class ESwriter: # output the FreeCAD label as comment if obj.Label: self.write.boundary(name, "! FreeCAD Name", obj.Label) - if obj.Dirichlet: + if obj.BoundaryCondition == "Dirichlet": if obj.PotentialEnabled: - if hasattr(obj, "Potential"): - # Potential was once a float and scaled not fitting SI units - if isinstance(obj.Potential, float): - savePotential = obj.Potential - obj.removeProperty("Potential") - obj.addProperty( - "App::PropertyElectricPotential", - "Potential", - "Parameter", - "Electric Potential", - ) - # scale to match SI units - obj.Potential = savePotential * 1e6 - potential = float(obj.Potential.getValueAs("V")) - self.write.boundary(name, "Potential", potential) - elif not obj.Dirichlet and hasattr(obj, "SurfaceChargeDensity"): - sc_density = float(obj.SurfaceChargeDensity.getValueAs("A*s/m^2")) - self.write.boundary(name, "Surface Charge Density", sc_density) + self.write.boundary( + name, "Potential", obj.Potential.getValueAs("V").Value + ) + elif obj.BoundaryCondition == "Neumann": + self.write.boundary( + name, + "Surface Charge Density", + obj.SurfaceChargeDensity.getValueAs("C/m^2").Value, + ) if obj.PotentialConstant: self.write.boundary(name, "Potential Constant", True) if obj.ElectricInfinity: @@ -152,8 +143,7 @@ class ESwriter: if obj.ElectricForcecalculation: self.write.boundary(name, "Calculate Electric Force", True) if obj.CapacitanceBodyEnabled: - if hasattr(obj, "CapacitanceBody"): - self.write.boundary(name, "Capacitance Body", obj.CapacitanceBody) + self.write.boundary(name, "Capacitance Body", obj.CapacitanceBody) self.write.handled(obj) diff --git a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py index f7a7e12f26..33a17dcff2 100644 --- a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py @@ -2,6 +2,7 @@ # * Copyright (c) 2017 Markus Hovorka * # * Copyright (c) 2020 Bernd Hahnebach * # * Copyright (c) 2023 Uwe Stöhr * +# * Copyright (c) 2024 Mario Passaglia * # * * # * This file is part of the FreeCAD CAx development system. * # * * @@ -24,7 +25,7 @@ # *************************************************************************** __title__ = "FreeCAD FEM constraint electrostatic potential task panel for the document object" -__author__ = "Markus Hovorka, Bernd Hahnebach, Uwe Stöhr, André Kapelrud" +__author__ = "Markus Hovorka, Bernd Hahnebach, Uwe Stöhr, André Kapelrud, Mario Passaglia" __url__ = "https://www.freecad.org" ## @package task_constraint_electrostaticpotential @@ -46,10 +47,9 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): def __init__(self, obj): super().__init__(obj) - self._paramWidget = FreeCADGui.PySideUic.loadUi( + self.parameter_widget = FreeCADGui.PySideUic.loadUi( FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/ElectrostaticPotential.ui" ) - self._initParamWidget() # geometry selection widget # start with Solid in list! @@ -58,7 +58,7 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): ) # form made from param and selection widget - self.form = [self._paramWidget, self._selectionWidget] + self.form = [self.parameter_widget, self._selectionWidget] analysis = obj.getParentGroup() self._mesh = None @@ -81,22 +81,138 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): and self.obj.AV_im_3_Disabled ): self._vectorField_visibility(False) - self._paramWidget.vectorFieldBox.setChecked(False) + self.parameter_widget.vectorFieldBox.setChecked(False) + QtCore.QObject.connect( - self._paramWidget.vectorFieldBox, + self.parameter_widget.vectorFieldBox, QtCore.SIGNAL("toggled(bool)"), self._vectorField_visibility, ) + QtCore.QObject.connect( + self.parameter_widget.cb_boundary_condition, + QtCore.SIGNAL("currentIndexChanged(int)"), + self.boundary_condition_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_potential, + QtCore.SIGNAL("toggled(bool)"), + self.potential_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_potential, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.potential_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_re, + QtCore.SIGNAL("toggled(bool)"), + self.av_re_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_re_1, + QtCore.SIGNAL("toggled(bool)"), + self.av_re_1_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_re_1, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_re_1_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_re_2, + QtCore.SIGNAL("toggled(bool)"), + self.av_re_2_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_re_2, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_re_2_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_re_3, + QtCore.SIGNAL("toggled(bool)"), + self.av_re_3_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_re_3, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_re_3_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_im, + QtCore.SIGNAL("toggled(bool)"), + self.av_im_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_im, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_im_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_im_1, + QtCore.SIGNAL("toggled(bool)"), + self.av_im_1_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_im_1, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_im_1_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_im_2, + QtCore.SIGNAL("toggled(bool)"), + self.av_im_2_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_im_2, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_im_2_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_av_im_3, + QtCore.SIGNAL("toggled(bool)"), + self.av_im_3_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_im_3, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_im_3_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_capacitance_body, + QtCore.SIGNAL("toggled(bool)"), + self.capacitance_body_enabled_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.spb_capacitance_body, + QtCore.SIGNAL("valueChanged(int)"), + self.capacitance_body_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_potential_constant, + QtCore.SIGNAL("toggled(bool)"), + self.potential_constant_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_electric_infinity, + QtCore.SIGNAL("toggled(bool)"), + self.electric_infinity_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.ckb_electric_forcecalculation, + QtCore.SIGNAL("toggled(bool)"), + self.electric_forcecalculation_changed, + ) + QtCore.QObject.connect( + self.parameter_widget.qsb_surface_charge_density, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.surface_charge_density_changed, + ) - def _BCtype_clicked(self, button): - self._BCtype(button == self._paramWidget.dirichletBC_RB) - - def _BCtype(self, isDirichlet): - self._paramWidget.neumannGB.setEnabled(not isDirichlet) - self._paramWidget.dirichletGB.setEnabled(isDirichlet) + self.init_parameter_widget() def _vectorField_visibility(self, visible): - self._paramWidget.vectorFieldGB.setVisible(visible) + self.parameter_widget.vectorFieldGB.setVisible(visible) def open(self): if self._mesh is not None and self._part is not None: @@ -113,7 +229,7 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): def accept(self): if self.obj.References != self._selectionWidget.references: self.obj.References = self._selectionWidget.references - self._applyWidgetChanges() + self._set_params() self._selectionWidget.finish_selection() self._restoreVisibility() return super().accept() @@ -129,64 +245,222 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): else: self._part.ViewObject.hide() - def _initParamWidget(self): - self._paramWidget.potentialQSB.setProperty("value", self.obj.Potential) - FreeCADGui.ExpressionBinding(self._paramWidget.potentialQSB).bind(self.obj, "Potential") - self._paramWidget.potentialBox.setChecked(not self.obj.PotentialEnabled) + def _get_params(self): + self.potential = self.obj.Potential + self.potential_enabled = self.obj.PotentialEnabled + + self.av_re_1 = self.obj.AV_re_1 + self.av_re_2 = self.obj.AV_re_2 + self.av_re_3 = self.obj.AV_re_3 + self.av_im = self.obj.AV_im + self.av_im_1 = self.obj.AV_im_1 + self.av_im_2 = self.obj.AV_im_2 + self.av_im_3 = self.obj.AV_im_3 + + self.av_re_enabled = not self.obj.PotentialEnabled + self.av_re_1_enabled = not self.obj.AV_re_1_Disabled + self.av_re_2_enabled = not self.obj.AV_re_2_Disabled + self.av_re_3_enabled = not self.obj.AV_re_3_Disabled + self.av_im_enabled = not self.obj.AV_im_Disabled + self.av_im_1_enabled = not self.obj.AV_im_1_Disabled + self.av_im_2_enabled = not self.obj.AV_im_2_Disabled + self.av_im_3_enabled = not self.obj.AV_im_3_Disabled + + self.boundary_condition = self.obj.BoundaryCondition + self.potential_constant = self.obj.PotentialConstant + self.electric_infinity = self.obj.ElectricInfinity + self.electric_forcecalculation = self.obj.ElectricForcecalculation + self.capacitance_body_enabled = self.obj.CapacitanceBodyEnabled + self.capacitance_body = self.obj.CapacitanceBody + + self.surface_charge_density = self.obj.SurfaceChargeDensity + + def _set_params(self): + self.obj.Potential = self.potential + self.obj.PotentialEnabled = self.potential_enabled + + self.obj.AV_re_1 = self.av_re_1 + self.obj.AV_re_2 = self.av_re_2 + self.obj.AV_re_3 = self.av_re_3 + self.obj.AV_im = self.av_im + self.obj.AV_im_1 = self.av_im_1 + self.obj.AV_im_2 = self.av_im_2 + self.obj.AV_im_3 = self.av_im_3 + + self.obj.AV_re_1_Disabled = not self.av_re_1_enabled + self.obj.AV_re_2_Disabled = not self.av_re_2_enabled + self.obj.AV_re_3_Disabled = not self.av_re_3_enabled + self.obj.AV_im_Disabled = not self.av_im_enabled + self.obj.AV_im_1_Disabled = not self.av_im_1_enabled + self.obj.AV_im_2_Disabled = not self.av_im_2_enabled + self.obj.AV_im_3_Disabled = not self.av_im_3_enabled + + self.obj.BoundaryCondition = self.boundary_condition + self.obj.PotentialConstant = self.potential_constant + self.obj.ElectricInfinity = self.electric_infinity + self.obj.ElectricForcecalculation = self.electric_forcecalculation + self.obj.CapacitanceBodyEnabled = self.capacitance_body_enabled + self.obj.CapacitanceBody = self.capacitance_body + + self.obj.SurfaceChargeDensity = self.surface_charge_density + + def init_parameter_widget(self): + self._get_params() + + self.parameter_widget.qsb_potential.setProperty("value", self.potential) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_potential).bind( + self.obj, "Potential" + ) + self.parameter_widget.ckb_potential.setChecked(self.potential_enabled) # the vector potentials - # realScalarQSB always the same value as potentialQSB - self._paramWidget.realScalarQSB.setProperty("value", self.obj.Potential) - FreeCADGui.ExpressionBinding(self._paramWidget.realScalarQSB).bind(self.obj, "Potential") - self._paramWidget.realXQSB.setProperty("value", self.obj.AV_re_1) - FreeCADGui.ExpressionBinding(self._paramWidget.realXQSB).bind(self.obj, "AV_re_1") - self._paramWidget.realYQSB.setProperty("value", self.obj.AV_re_2) - FreeCADGui.ExpressionBinding(self._paramWidget.realYQSB).bind(self.obj, "AV_re_2") - self._paramWidget.realZQSB.setProperty("value", self.obj.AV_re_3) - FreeCADGui.ExpressionBinding(self._paramWidget.realZQSB).bind(self.obj, "AV_re_3") - self._paramWidget.imagScalarQSB.setProperty("value", self.obj.AV_im) - FreeCADGui.ExpressionBinding(self._paramWidget.imagScalarQSB).bind(self.obj, "AV_im") - self._paramWidget.imagXQSB.setProperty("value", self.obj.AV_im_1) - FreeCADGui.ExpressionBinding(self._paramWidget.imagXQSB).bind(self.obj, "AV_im_1") - self._paramWidget.imagYQSB.setProperty("value", self.obj.AV_im_2) - FreeCADGui.ExpressionBinding(self._paramWidget.imagYQSB).bind(self.obj, "AV_im_2") - self._paramWidget.imagZQSB.setProperty("value", self.obj.AV_im_3) - FreeCADGui.ExpressionBinding(self._paramWidget.imagZQSB).bind(self.obj, "AV_im_3") + self.parameter_widget.qsb_av_re.setProperty("value", self.potential) + self.parameter_widget.qsb_av_re.setEnabled(self.av_re_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re).bind(self.obj, "Potential") - self._paramWidget.reXunspecBox.setChecked(self.obj.AV_re_1_Disabled) - self._paramWidget.reYunspecBox.setChecked(self.obj.AV_re_2_Disabled) - self._paramWidget.reZunspecBox.setChecked(self.obj.AV_re_3_Disabled) - self._paramWidget.imScalarunspecBox.setChecked(self.obj.AV_im_Disabled) - self._paramWidget.imXunspecBox.setChecked(self.obj.AV_im_1_Disabled) - self._paramWidget.imYunspecBox.setChecked(self.obj.AV_im_2_Disabled) - self._paramWidget.imZunspecBox.setChecked(self.obj.AV_im_3_Disabled) + self.parameter_widget.qsb_av_re_1.setProperty("value", self.av_re_1) + self.parameter_widget.qsb_av_re_1.setEnabled(self.av_re_1_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_1).bind(self.obj, "AV_re_1") + self.parameter_widget.qsb_av_re_2.setProperty("value", self.av_re_2) + self.parameter_widget.qsb_av_re_2.setEnabled(self.av_re_2_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_2).bind(self.obj, "AV_re_2") + self.parameter_widget.qsb_av_re_3.setProperty("value", self.av_re_3) + self.parameter_widget.qsb_av_re_3.setEnabled(self.av_re_3_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_3).bind(self.obj, "AV_re_3") + self.parameter_widget.qsb_av_im.setProperty("value", self.av_im) + self.parameter_widget.qsb_av_im.setEnabled(self.av_im_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im).bind(self.obj, "AV_im") + self.parameter_widget.qsb_av_im_1.setProperty("value", self.av_im_1) + self.parameter_widget.qsb_av_im_1.setEnabled(self.av_im_1_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_1).bind(self.obj, "AV_im_1") + self.parameter_widget.qsb_av_im_2.setProperty("value", self.av_im_2) + self.parameter_widget.qsb_av_im_2.setEnabled(self.av_im_2_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_2).bind(self.obj, "AV_im_2") + self.parameter_widget.qsb_av_im_3.setProperty("value", self.av_im_3) + self.parameter_widget.qsb_av_im_3.setEnabled(self.av_im_3_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_3).bind(self.obj, "AV_im_3") - self._paramWidget.potentialConstantBox.setChecked(self.obj.PotentialConstant) + self.parameter_widget.ckb_av_re_1.setChecked(self.av_re_1_enabled) + self.parameter_widget.ckb_av_re_2.setChecked(self.av_re_2_enabled) + self.parameter_widget.ckb_av_re_3.setChecked(self.av_re_3_enabled) + self.parameter_widget.ckb_av_im.setChecked(self.av_im_enabled) + self.parameter_widget.ckb_av_im_1.setChecked(self.av_im_1_enabled) + self.parameter_widget.ckb_av_im_2.setChecked(self.av_im_2_enabled) + self.parameter_widget.ckb_av_im_3.setChecked(self.av_im_3_enabled) - self._paramWidget.electricInfinityBox.setChecked(self.obj.ElectricInfinity) + self.parameter_widget.ckb_potential_constant.setChecked(self.potential_constant) - self._paramWidget.electricForcecalculationBox.setChecked(self.obj.ElectricForcecalculation) + self.parameter_widget.ckb_electric_infinity.setChecked(self.electric_infinity) - self._paramWidget.capacitanceBodyBox.setChecked(not self.obj.CapacitanceBodyEnabled) - self._paramWidget.capacitanceBody_spinBox.setValue(self.obj.CapacitanceBody) - self._paramWidget.capacitanceBody_spinBox.setEnabled( - not self._paramWidget.capacitanceBodyBox.isChecked() + self.parameter_widget.ckb_electric_forcecalculation.setChecked( + self.electric_forcecalculation ) - # neumann/dirichlet radiogroup selection - self._paramWidget.BCtypeBG.buttonClicked.connect(self._BCtype_clicked) - if self.obj.Dirichlet: - self._paramWidget.dirichletBC_RB.click() - else: - self._paramWidget.neumannBC_RB.click() + self.parameter_widget.ckb_capacitance_body.setChecked(self.capacitance_body_enabled) + self.parameter_widget.spb_capacitance_body.setValue(self.capacitance_body) - self._paramWidget.surfacechargedensityQSB.setProperty( - "value", self.obj.SurfaceChargeDensity + self.parameter_widget.qsb_surface_charge_density.setProperty( + "value", self.surface_charge_density ) - FreeCADGui.ExpressionBinding(self._paramWidget.surfacechargedensityQSB).bind( + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_surface_charge_density).bind( self.obj, "SurfaceChargeDensity" ) + self.bc_enum = self.obj.getEnumerationsOfProperty("BoundaryCondition") + self.parameter_widget.cb_boundary_condition.addItems(self.bc_enum) + index = self.bc_enum.index(self.boundary_condition) + self.parameter_widget.cb_boundary_condition.setCurrentIndex(index) + self.boundary_condition_changed(index) + + def potential_changed(self, value): + self.potential = value + + def potential_enabled_changed(self, value): + self.potential_enabled = value + self.parameter_widget.qsb_potential.setEnabled(value) + + def av_re_enabled_changed(self, value): + self.av_re_enabled = value + self.parameter_widget.qsb_av_re.setEnabled(value) + + def av_re_1_enabled_changed(self, value): + self.av_re_1_enabled = value + self.parameter_widget.qsb_av_re_1.setEnabled(value) + + def av_re_2_enabled_changed(self, value): + self.av_re_2_enabled = value + self.parameter_widget.qsb_av_re_2.setEnabled(value) + + def av_re_3_enabled_changed(self, value): + self.av_re_3_enabled = value + self.parameter_widget.qsb_av_re_3.setEnabled(value) + + def av_im_enabled_changed(self, value): + self.av_im_enabled = value + self.parameter_widget.qsb_av_im.setEnabled(value) + + def av_im_1_enabled_changed(self, value): + self.av_im_1_enabled = value + self.parameter_widget.qsb_av_im_1.setEnabled(value) + + def av_im_2_enabled_changed(self, value): + self.av_im_2_enabled = value + self.parameter_widget.qsb_av_im_2.setEnabled(value) + + def av_im_3_enabled_changed(self, value): + self.av_im_3_enabled = value + self.parameter_widget.qsb_av_im_3.setEnabled(value) + + def av_re_1_changed(self, value): + self.av_re_1 = value + + def av_re_2_changed(self, value): + self.av_re_2 = value + + def av_re_3_changed(self, value): + self.av_re_3 = value + + def av_im_changed(self, value): + self.av_im = value + + def av_im_1_changed(self, value): + self.av_im_1 = value + + def av_im_2_changed(self, value): + self.av_im_2 = value + + def av_im_3_changed(self, value): + self.av_im_3 = value + + def potential_constant_changed(self, value): + self.potential_constant = value + + def electric_infinity_changed(self, value): + self.electric_infinity = value + + def electric_forcecalculation_changed(self, value): + self.electric_forcecalculation = value + + def capacitance_body_enabled_changed(self, value): + self.capacitance_body_enabled = value + self.parameter_widget.spb_capacitance_body.setEnabled(value) + + def capacitance_body_changed(self, value): + self.capacitance_body = value + self.parameter_widget.spb_capacitance_body.setValue(value) + + def surface_charge_density_changed(self, value): + self.surface_charge_density = value + + def boundary_condition_changed(self, index): + self.boundary_condition = self.bc_enum[index] + if self.boundary_condition == "Dirichlet": + self.parameter_widget.gb_neumann.setEnabled(False) + self.parameter_widget.gb_dirichlet.setEnabled(True) + elif self.boundary_condition == "Neumann": + self.parameter_widget.gb_neumann.setEnabled(True) + self.parameter_widget.gb_dirichlet.setEnabled(False) + def _applyPotentialChanges(self, enabledBox, potentialQSB): enabled = enabledBox.isChecked() potential = None @@ -202,56 +476,37 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): def _applyWidgetChanges(self): # apply the voltages and their enabled state - self.obj.PotentialEnabled, self.obj.Potential = self._applyPotentialChanges( - self._paramWidget.potentialBox, self._paramWidget.potentialQSB - ) self.obj.AV_re_1_Disabled, self.obj.AV_re_1 = self._applyPotentialChanges( - self._paramWidget.reXunspecBox, self._paramWidget.realXQSB + self.parameter_widget.reXunspecBox, self.parameter_widget.realXQSB ) self.obj.AV_re_2_Disabled, self.obj.AV_re_2 = self._applyPotentialChanges( - self._paramWidget.reYunspecBox, self._paramWidget.realYQSB + self.parameter_widget.reYunspecBox, self.parameter_widget.realYQSB ) self.obj.AV_re_3_Disabled, self.obj.AV_re_3 = self._applyPotentialChanges( - self._paramWidget.reZunspecBox, self._paramWidget.realZQSB + self.parameter_widget.reZunspecBox, self.parameter_widget.realZQSB ) self.obj.AV_im_Disabled, self.obj.AV_im = self._applyPotentialChanges( - self._paramWidget.imScalarunspecBox, self._paramWidget.imagScalarQSB + self.parameter_widget.imScalarunspecBox, self.parameter_widget.imagScalarQSB ) self.obj.AV_im_1_Disabled, self.obj.AV_im_1 = self._applyPotentialChanges( - self._paramWidget.imXunspecBox, self._paramWidget.imagXQSB + self.parameter_widget.imXunspecBox, self.parameter_widget.imagXQSB ) self.obj.AV_im_2_Disabled, self.obj.AV_im_2 = self._applyPotentialChanges( - self._paramWidget.imYunspecBox, self._paramWidget.imagYQSB + self.parameter_widget.imYunspecBox, self.parameter_widget.imagYQSB ) self.obj.AV_im_3_Disabled, self.obj.AV_im_3 = self._applyPotentialChanges( - self._paramWidget.imZunspecBox, self._paramWidget.imagZQSB + self.parameter_widget.imZunspecBox, self.parameter_widget.imagZQSB ) # because this is an enable the others are disabled, reverse self.obj.PotentialEnabled = not self.obj.PotentialEnabled - self.obj.PotentialConstant = self._paramWidget.potentialConstantBox.isChecked() + self.obj.PotentialConstant = self.parameter_widget.potentialConstantBox.isChecked() - self.obj.ElectricInfinity = self._paramWidget.electricInfinityBox.isChecked() + self.obj.ElectricInfinity = self.parameter_widget.electricInfinityBox.isChecked() - calc_is_checked = self._paramWidget.electricForcecalculationBox.isChecked() + calc_is_checked = self.parameter_widget.electricForcecalculationBox.isChecked() self.obj.ElectricForcecalculation = calc_is_checked # two lines because max line length - self.obj.CapacitanceBodyEnabled = not self._paramWidget.capacitanceBodyBox.isChecked() - if self.obj.CapacitanceBodyEnabled: - self._paramWidget.capacitanceBody_spinBox.setEnabled(True) - self.obj.CapacitanceBody = self._paramWidget.capacitanceBody_spinBox.value() - - self.obj.Dirichlet = self._paramWidget.dirichletBC_RB.isChecked() - - try: - self.obj.SurfaceChargeDensity = self._paramWidget.surfacechargedensityQSB.property( - "value" - ) - except ValueError: - FreeCAD.Console.PrintMessage( - "Wrong input. Not recognised input: '{}' " - "SurfaceChargeDensity has not been set.\n".format( - self._paramWidget.surfacechargedensityQSB.text() - ) - ) - self.obj.SurfaceChargeDensity = "0.0 s*A/(mm^2)" + self.obj.SurfaceChargeDensity = self.parameter_widget.surfacechargedensityQSB.property( + "value" + ) From 0194070ce93b57e596f273f02673309c97de9944 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Mon, 20 Jan 2025 00:33:19 -0300 Subject: [PATCH 010/224] Fem: Update electromagnetics boundary conditions --- .../Resources/ui/ElectrostaticPotential.ui | 168 ++++++++---------- .../constraint_electrostaticpotential.py | 76 +++++--- .../elmer/equations/magnetodynamic_writer.py | 23 ++- .../task_constraint_electrostaticpotential.py | 141 +++++---------- 4 files changed, 176 insertions(+), 232 deletions(-) diff --git a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui index de85084c5d..dedb7b97d3 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui @@ -14,12 +14,12 @@ Analysis feature properties - + - + @@ -41,9 +41,9 @@ false - - - + + + @@ -75,8 +75,8 @@ - - + + To define scalar potential and magnetic vector potential @@ -88,8 +88,11 @@ - - + + + + + true @@ -100,10 +103,7 @@ with a harmonic/oscillating driving force false - - false - - + @@ -136,9 +136,6 @@ with a harmonic/oscillating driving force - - unspecified - @@ -147,13 +144,10 @@ with a harmonic/oscillating driving force - false + true - Potential as specified above - - - true + Real part of scalar potential true @@ -171,9 +165,6 @@ with a harmonic/oscillating driving force - - unspecified - @@ -213,9 +204,6 @@ with a harmonic/oscillating driving force - - unspecified - @@ -246,9 +234,6 @@ Note: has no effect if a solid was selected - - unspecified - @@ -289,9 +274,6 @@ Note: has no effect if a solid was selected - - unspecified - @@ -322,9 +304,6 @@ Note: has no effect if a solid was selected - - unspecified - @@ -365,9 +344,6 @@ Note: has no effect if a solid was selected - - unspecified - @@ -398,9 +374,6 @@ Note: has no effect if a solid was selected - - unspecified - @@ -432,64 +405,28 @@ Note: has no effect if a solid was selected - - - - true - - - Whether the boundary condition defines a farfield potential - - - Farfield / Electric infinity - - - - - - - Whether the boundary condition defines a constant potential - - - Potential Constant - - - - - - - Whether the boundary condition is for the electric force - - - Calculate Electric Force - - - - - - - - - Capacitance Body: + + + + + + true - Enabled by 'Calculate Capacity Matrix' in Electrostatic equation + Whether the boundary condition defines a farfield potential + + + Electric Infinity - - + + - Counter of the body (or face) with a capacitance + Whether the boundary condition defines a constant potential - - false - - - 1 - - - 1 + + Potential Constant @@ -503,7 +440,7 @@ Note: has no effect if a solid was selected Neumann - + @@ -524,6 +461,41 @@ Note: has no effect if a solid was selected + + + + Capacitance + + + + + + Capacitance Body: + + + Enabled by 'Calculate Capacity Matrix' in Electrostatic equation + + + + + + + Counter of the body (or face) with a capacitance + + + false + + + 1 + + + 1 + + + + + + @@ -532,9 +504,11 @@ Note: has no effect if a solid was selected QWidget
Gui/QuantitySpinBox.h
+ + Gui::IntSpinBox + QWidget +
Gui/SpinBox.h
+
- - - diff --git a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py index f1e7f595ec..f2d1d3381e 100644 --- a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py @@ -32,6 +32,8 @@ __url__ = "https://www.freecad.org" # \ingroup FEM # \brief constraint electrostatic potential object +from FreeCAD import Base + from . import base_fempythonobject _PropHelper = base_fempythonobject._PropHelper @@ -68,12 +70,30 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) value=True, ) ) + prop.append( + _PropHelper( + type="App::PropertyElectricPotential", + name="AV_re", + group="Electromagnetic Potential", + doc="Real part of scalar potential", + value="0 V", + ) + ) + prop.append( + _PropHelper( + type="App::PropertyElectricPotential", + name="AV_im", + group="Electromagnetic Potential", + doc="Imaginary part of scalar potential", + value="0 V", + ) + ) prop.append( _PropHelper( type="App::PropertyElectromagneticPotential", name="AV_re_1", - group="Vector Potential", - doc="Real part of potential x-component", + group="Electromagnetic Potential", + doc="Real part of vector potential x-component", value="0 Wb/m", ) ) @@ -81,8 +101,8 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyElectromagneticPotential", name="AV_re_2", - group="Vector Potential", - doc="Real part of potential y-component", + group="Electromagnetic Potential", + doc="Real part of vector potential y-component", value="0 Wb/m", ) ) @@ -90,8 +110,8 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyElectromagneticPotential", name="AV_re_3", - group="Vector Potential", - doc="Real part of potential z-component", + group="Electromagnetic Potential", + doc="Real part of vector potential z-component", value="0 Wb/m", ) ) @@ -99,8 +119,8 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyElectromagneticPotential", name="AV_im_1", - group="Vector Potential", - doc="Imaginary part of potential x-component", + group="Electromagnetic Potential", + doc="Imaginary part of vector potential x-component", value="0 Wb/m", ) ) @@ -108,8 +128,8 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyElectromagneticPotential", name="AV_im_2", - group="Vector Potential", - doc="Imaginary part of potential y-component", + group="Electromagnetic Potential", + doc="Imaginary part of vector potential y-component", value="0 Wb/m", ) ) @@ -117,8 +137,8 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyElectromagneticPotential", name="AV_im_3", - group="Vector Potential", - doc="Imaginary part of potential z-component", + group="Electromagnetic Potential", + doc="Imaginary part of vector potential z-component", value="0 Wb/m", ) ) @@ -140,20 +160,11 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) value=["Dirichlet", "Neumann"], ) ) - prop.append( - _PropHelper( - type="App::PropertyElectricPotential", - name="AV_im", - group="Parameter", - doc="Imaginary part of scalar potential", - value="0 V", - ) - ) prop.append( _PropHelper( type="App::PropertyBool", name="AV_re_1_Disabled", - group="Vector Potential", + group="Electromagnetic Potential", doc="", value=True, ) @@ -162,7 +173,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyBool", name="AV_re_2_Disabled", - group="Vector Potential", + group="Electromagnetic Potential", doc="", value=True, ) @@ -171,7 +182,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyBool", name="AV_re_3_Disabled", - group="Vector Potential", + group="Electromagnetic Potential", doc="", value=True, ) @@ -180,7 +191,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyBool", name="AV_im_1_Disabled", - group="Vector Potential", + group="Electromagnetic Potential", doc="", value=True, ) @@ -189,7 +200,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyBool", name="AV_im_2_Disabled", - group="Vector Potential", + group="Electromagnetic Potential", doc="", value=True, ) @@ -198,7 +209,16 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyBool", name="AV_im_3_Disabled", - group="Vector Potential", + group="Electromagnetic Potential", + doc="", + value=True, + ) + ) + prop.append( + _PropHelper( + type="App::PropertyBool", + name="AV_re_Disabled", + group="Electromagnetic Potential", doc="", value=True, ) @@ -207,7 +227,7 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) _PropHelper( type="App::PropertyBool", name="AV_im_Disabled", - group="Vector Potential", + group="Electromagnetic Potential", doc="", value=True, ) diff --git a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py index c67ddf22ba..7bcb968838 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py @@ -31,6 +31,7 @@ __url__ = "https://www.freecad.org" from FreeCAD import Console from FreeCAD import Units +from femtools import femutils from .. import sifio from .. import writer as general_writer @@ -289,29 +290,27 @@ class MgDynwriter: currentDensity = float(obj.CurrentDensity_im_1.getValueAs("A/m^2")) self.write.boundary(name, "Current Density Im 1", round(currentDensity, 6)) - if hasattr(obj, "PotentialEnabled"): - # check for PotentialEnabled not Potential since PotentialEnabled was - # added later and only with this the vectorial properties are available - if obj.PotentialEnabled: - potential = float(obj.Potential.getValueAs("V")) + if femutils.is_derived_from(obj, "Fem::ConstraintElectrostaticPotential"): + if not obj.AV_re_Disabled: + potential = obj.AV_re.getValueAs("V").Value if equation.IsHarmonic: self.write.boundary(name, "AV re", round(potential, 6)) else: self.write.boundary(name, "AV", round(potential, 6)) if not obj.AV_re_1_Disabled: - potential = float(obj.AV_re_1.getValueAs("V")) + potential = obj.AV_re_1.getValueAs("Wb/m").Value if equation.IsHarmonic: self.write.boundary(name, "AV re {e} 1", round(potential, 6)) else: self.write.boundary(name, "AV {e} 1", round(potential, 6)) if not obj.AV_re_2_Disabled: - potential = float(obj.AV_re_2.getValueAs("V")) + potential = obj.AV_re_2.getValueAs("Wb/m").Value if equation.IsHarmonic: self.write.boundary(name, "AV re {e} 2", round(potential, 6)) else: self.write.boundary(name, "AV {e} 2", round(potential, 6)) if not obj.AV_re_3_Disabled: - potential = float(obj.AV_re_3.getValueAs("V")) + potential = obj.AV_re_3.getValueAs("Wb/m").Value if equation.IsHarmonic: self.write.boundary(name, "AV re {e} 3", round(potential, 6)) else: @@ -319,16 +318,16 @@ class MgDynwriter: # imaginaries are only needed for harmonic equation if equation.IsHarmonic: if not obj.AV_im_Disabled: - potential = float(obj.AV_im.getValueAs("V")) + potential = obj.AV_im.getValueAs("V").Value self.write.boundary(name, "AV im", round(potential, 6)) if not obj.AV_im_1_Disabled: - potential = float(obj.AV_im_1.getValueAs("V")) + potential = obj.AV_im_1.getValueAs("Wb/m").Value self.write.boundary(name, "AV im {e} 1", round(potential, 6)) if not obj.AV_im_2_Disabled: - potential = float(obj.AV_im_2.getValueAs("V")) + potential = obj.AV_im_2.getValueAs("Wb/m").Value self.write.boundary(name, "AV im {e} 2", round(potential, 6)) if not obj.AV_im_3_Disabled: - potential = float(obj.AV_im_3.getValueAs("V")) + potential = obj.AV_im_3.getValueAs("Wb/m").Value self.write.boundary(name, "AV im {e} 3", round(potential, 6)) def handleMagnetodynamicBndConditions(self, equation): diff --git a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py index 33a17dcff2..7cf8903cd6 100644 --- a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py @@ -70,23 +70,10 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self._partVisible = None self._meshVisible = None - # start with vector inputs hidden if no vector is set - if ( - self.obj.AV_re_1_Disabled - and self.obj.AV_re_2_Disabled - and self.obj.AV_re_3_Disabled - and self.obj.AV_im_Disabled - and self.obj.AV_im_1_Disabled - and self.obj.AV_im_2_Disabled - and self.obj.AV_im_3_Disabled - ): - self._vectorField_visibility(False) - self.parameter_widget.vectorFieldBox.setChecked(False) - QtCore.QObject.connect( - self.parameter_widget.vectorFieldBox, + self.parameter_widget.ckb_electromagnetic, QtCore.SIGNAL("toggled(bool)"), - self._vectorField_visibility, + self.electromagnetic_enabled_changed, ) QtCore.QObject.connect( self.parameter_widget.cb_boundary_condition, @@ -108,6 +95,11 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): QtCore.SIGNAL("toggled(bool)"), self.av_re_enabled_changed, ) + QtCore.QObject.connect( + self.parameter_widget.qsb_av_re, + QtCore.SIGNAL("valueChanged(Base::Quantity)"), + self.av_re_changed, + ) QtCore.QObject.connect( self.parameter_widget.ckb_av_re_1, QtCore.SIGNAL("toggled(bool)"), @@ -198,11 +190,6 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): QtCore.SIGNAL("toggled(bool)"), self.electric_infinity_changed, ) - QtCore.QObject.connect( - self.parameter_widget.ckb_electric_forcecalculation, - QtCore.SIGNAL("toggled(bool)"), - self.electric_forcecalculation_changed, - ) QtCore.QObject.connect( self.parameter_widget.qsb_surface_charge_density, QtCore.SIGNAL("valueChanged(Base::Quantity)"), @@ -211,9 +198,6 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.init_parameter_widget() - def _vectorField_visibility(self, visible): - self.parameter_widget.vectorFieldGB.setVisible(visible) - def open(self): if self._mesh is not None and self._part is not None: self._meshVisible = self._mesh.ViewObject.isVisible() @@ -249,6 +233,7 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.potential = self.obj.Potential self.potential_enabled = self.obj.PotentialEnabled + self.av_re = self.obj.AV_re self.av_re_1 = self.obj.AV_re_1 self.av_re_2 = self.obj.AV_re_2 self.av_re_3 = self.obj.AV_re_3 @@ -257,11 +242,11 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.av_im_2 = self.obj.AV_im_2 self.av_im_3 = self.obj.AV_im_3 - self.av_re_enabled = not self.obj.PotentialEnabled + self.av_re_enabled = not self.obj.AV_re_Disabled + self.av_im_enabled = not self.obj.AV_im_Disabled self.av_re_1_enabled = not self.obj.AV_re_1_Disabled self.av_re_2_enabled = not self.obj.AV_re_2_Disabled self.av_re_3_enabled = not self.obj.AV_re_3_Disabled - self.av_im_enabled = not self.obj.AV_im_Disabled self.av_im_1_enabled = not self.obj.AV_im_1_Disabled self.av_im_2_enabled = not self.obj.AV_im_2_Disabled self.av_im_3_enabled = not self.obj.AV_im_3_Disabled @@ -269,16 +254,15 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.boundary_condition = self.obj.BoundaryCondition self.potential_constant = self.obj.PotentialConstant self.electric_infinity = self.obj.ElectricInfinity - self.electric_forcecalculation = self.obj.ElectricForcecalculation self.capacitance_body_enabled = self.obj.CapacitanceBodyEnabled self.capacitance_body = self.obj.CapacitanceBody - self.surface_charge_density = self.obj.SurfaceChargeDensity def _set_params(self): self.obj.Potential = self.potential self.obj.PotentialEnabled = self.potential_enabled + self.obj.AV_re = self.av_re self.obj.AV_re_1 = self.av_re_1 self.obj.AV_re_2 = self.av_re_2 self.obj.AV_re_3 = self.av_re_3 @@ -287,10 +271,11 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.obj.AV_im_2 = self.av_im_2 self.obj.AV_im_3 = self.av_im_3 + self.obj.AV_re_Disabled = not self.av_re_enabled + self.obj.AV_im_Disabled = not self.av_im_enabled self.obj.AV_re_1_Disabled = not self.av_re_1_enabled self.obj.AV_re_2_Disabled = not self.av_re_2_enabled self.obj.AV_re_3_Disabled = not self.av_re_3_enabled - self.obj.AV_im_Disabled = not self.av_im_enabled self.obj.AV_im_1_Disabled = not self.av_im_1_enabled self.obj.AV_im_2_Disabled = not self.av_im_2_enabled self.obj.AV_im_3_Disabled = not self.av_im_3_enabled @@ -298,7 +283,6 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.obj.BoundaryCondition = self.boundary_condition self.obj.PotentialConstant = self.potential_constant self.obj.ElectricInfinity = self.electric_infinity - self.obj.ElectricForcecalculation = self.electric_forcecalculation self.obj.CapacitanceBodyEnabled = self.capacitance_body_enabled self.obj.CapacitanceBody = self.capacitance_body @@ -313,11 +297,15 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): ) self.parameter_widget.ckb_potential.setChecked(self.potential_enabled) - # the vector potentials - self.parameter_widget.qsb_av_re.setProperty("value", self.potential) + # scalar potential + self.parameter_widget.qsb_av_re.setProperty("value", self.av_re) self.parameter_widget.qsb_av_re.setEnabled(self.av_re_enabled) - FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re).bind(self.obj, "Potential") + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re).bind(self.obj, "AV_re") + self.parameter_widget.qsb_av_im.setProperty("value", self.av_im) + self.parameter_widget.qsb_av_im.setEnabled(self.av_im_enabled) + FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im).bind(self.obj, "AV_im") + # vector potential self.parameter_widget.qsb_av_re_1.setProperty("value", self.av_re_1) self.parameter_widget.qsb_av_re_1.setEnabled(self.av_re_1_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_1).bind(self.obj, "AV_re_1") @@ -327,9 +315,7 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.parameter_widget.qsb_av_re_3.setProperty("value", self.av_re_3) self.parameter_widget.qsb_av_re_3.setEnabled(self.av_re_3_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_3).bind(self.obj, "AV_re_3") - self.parameter_widget.qsb_av_im.setProperty("value", self.av_im) - self.parameter_widget.qsb_av_im.setEnabled(self.av_im_enabled) - FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im).bind(self.obj, "AV_im") + self.parameter_widget.qsb_av_im_1.setProperty("value", self.av_im_1) self.parameter_widget.qsb_av_im_1.setEnabled(self.av_im_1_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_1).bind(self.obj, "AV_im_1") @@ -340,6 +326,7 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.parameter_widget.qsb_av_im_3.setEnabled(self.av_im_3_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_3).bind(self.obj, "AV_im_3") + self.parameter_widget.ckb_av_re.setChecked(self.av_re_enabled) self.parameter_widget.ckb_av_re_1.setChecked(self.av_re_1_enabled) self.parameter_widget.ckb_av_re_2.setChecked(self.av_re_2_enabled) self.parameter_widget.ckb_av_re_3.setChecked(self.av_re_3_enabled) @@ -352,12 +339,11 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.parameter_widget.ckb_electric_infinity.setChecked(self.electric_infinity) - self.parameter_widget.ckb_electric_forcecalculation.setChecked( - self.electric_forcecalculation - ) - self.parameter_widget.ckb_capacitance_body.setChecked(self.capacitance_body_enabled) - self.parameter_widget.spb_capacitance_body.setValue(self.capacitance_body) + self.parameter_widget.spb_capacitance_body.setProperty("value", self.capacitance_body) + FreeCADGui.ExpressionBinding(self.parameter_widget.spb_capacitance_body).bind( + self.obj, "CapacitanceBody" + ) self.parameter_widget.qsb_surface_charge_density.setProperty( "value", self.surface_charge_density @@ -367,10 +353,22 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): ) self.bc_enum = self.obj.getEnumerationsOfProperty("BoundaryCondition") - self.parameter_widget.cb_boundary_condition.addItems(self.bc_enum) index = self.bc_enum.index(self.boundary_condition) + self.parameter_widget.cb_boundary_condition.addItems(self.bc_enum) self.parameter_widget.cb_boundary_condition.setCurrentIndex(index) - self.boundary_condition_changed(index) + + # start with electromagnetic inputs hidden if no field is set + if not ( + self.av_re_enabled + or self.av_im_enabled + or self.av_re_1_enabled + or self.av_re_2_enabled + or self.av_re_3_enabled + or self.av_im_1_enabled + or self.av_im_2_enabled + or self.av_im_3_enabled + ): + self.parameter_widget.ckb_electromagnetic.setChecked(False) def potential_changed(self, value): self.potential = value @@ -379,6 +377,9 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.potential_enabled = value self.parameter_widget.qsb_potential.setEnabled(value) + def electromagnetic_enabled_changed(self, value): + self.parameter_widget.gb_electromagnetic.setVisible(value) + def av_re_enabled_changed(self, value): self.av_re_enabled = value self.parameter_widget.qsb_av_re.setEnabled(value) @@ -411,6 +412,9 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.av_im_3_enabled = value self.parameter_widget.qsb_av_im_3.setEnabled(value) + def av_re_changed(self, value): + self.av_re = value + def av_re_1_changed(self, value): self.av_re_1 = value @@ -438,9 +442,6 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): def electric_infinity_changed(self, value): self.electric_infinity = value - def electric_forcecalculation_changed(self, value): - self.electric_forcecalculation = value - def capacitance_body_enabled_changed(self, value): self.capacitance_body_enabled = value self.parameter_widget.spb_capacitance_body.setEnabled(value) @@ -460,53 +461,3 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): elif self.boundary_condition == "Neumann": self.parameter_widget.gb_neumann.setEnabled(True) self.parameter_widget.gb_dirichlet.setEnabled(False) - - def _applyPotentialChanges(self, enabledBox, potentialQSB): - enabled = enabledBox.isChecked() - potential = None - try: - potential = potentialQSB.property("value") - except ValueError: - FreeCAD.Console.PrintMessage( - "Wrong input. Not recognised input: '{}' " - "Potential has not been set.\n".format(potentialQSB.text()) - ) - potential = "0.0 mm^2*kg/(s^3*A)" - return enabled, potential - - def _applyWidgetChanges(self): - # apply the voltages and their enabled state - self.obj.AV_re_1_Disabled, self.obj.AV_re_1 = self._applyPotentialChanges( - self.parameter_widget.reXunspecBox, self.parameter_widget.realXQSB - ) - self.obj.AV_re_2_Disabled, self.obj.AV_re_2 = self._applyPotentialChanges( - self.parameter_widget.reYunspecBox, self.parameter_widget.realYQSB - ) - self.obj.AV_re_3_Disabled, self.obj.AV_re_3 = self._applyPotentialChanges( - self.parameter_widget.reZunspecBox, self.parameter_widget.realZQSB - ) - self.obj.AV_im_Disabled, self.obj.AV_im = self._applyPotentialChanges( - self.parameter_widget.imScalarunspecBox, self.parameter_widget.imagScalarQSB - ) - self.obj.AV_im_1_Disabled, self.obj.AV_im_1 = self._applyPotentialChanges( - self.parameter_widget.imXunspecBox, self.parameter_widget.imagXQSB - ) - self.obj.AV_im_2_Disabled, self.obj.AV_im_2 = self._applyPotentialChanges( - self.parameter_widget.imYunspecBox, self.parameter_widget.imagYQSB - ) - self.obj.AV_im_3_Disabled, self.obj.AV_im_3 = self._applyPotentialChanges( - self.parameter_widget.imZunspecBox, self.parameter_widget.imagZQSB - ) - # because this is an enable the others are disabled, reverse - self.obj.PotentialEnabled = not self.obj.PotentialEnabled - - self.obj.PotentialConstant = self.parameter_widget.potentialConstantBox.isChecked() - - self.obj.ElectricInfinity = self.parameter_widget.electricInfinityBox.isChecked() - - calc_is_checked = self.parameter_widget.electricForcecalculationBox.isChecked() - self.obj.ElectricForcecalculation = calc_is_checked # two lines because max line length - - self.obj.SurfaceChargeDensity = self.parameter_widget.surfacechargedensityQSB.property( - "value" - ) From 0757a78cadab68f46ab3a95f870a9b01fdd25dc0 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Tue, 21 Jan 2025 15:13:53 -0300 Subject: [PATCH 011/224] Fem: Rename enable/disable electromagnetic properties --- .../Resources/ui/ElectrostaticPotential.ui | 52 ++----- .../equation_magnetodynamics_elmer.py | 26 ++-- .../constraint_electrostaticpotential.py | 92 ++++++------ .../elmer/equations/magnetodynamic_writer.py | 39 ++--- .../task_constraint_electrostaticpotential.py | 133 ++++++------------ 5 files changed, 123 insertions(+), 219 deletions(-) diff --git a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui index dedb7b97d3..3956a7e83d 100644 --- a/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui +++ b/src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui @@ -103,7 +103,7 @@ with a harmonic/oscillating driving force false - + @@ -114,7 +114,7 @@ with a harmonic/oscillating driving force - + true @@ -135,7 +135,7 @@ with a harmonic/oscillating driving force - + @@ -164,13 +164,6 @@ with a harmonic/oscillating driving force - - - - - - - true @@ -203,7 +196,7 @@ with a harmonic/oscillating driving force - + @@ -215,7 +208,7 @@ with a harmonic/oscillating driving force true - Real part of potential x-component + Real part of vector potential x-component Note: has no effect if a solid was selected @@ -233,19 +226,12 @@ Note: has no effect if a solid was selected - - - - - - - true - Imaginary part of potential x-component + Imaginary part of vector potential x-component Note: has no effect if a solid was selected @@ -273,7 +259,7 @@ Note: has no effect if a solid was selected - + @@ -285,7 +271,7 @@ Note: has no effect if a solid was selected true - Real part of potential y-component + Real part of vector potential y-component Note: has no effect if a solid was selected @@ -303,19 +289,12 @@ Note: has no effect if a solid was selected - - - - - - - true - Imaginary part of potential y-component + Imaginary part of vector potential y-component Note: has no effect if a solid was selected @@ -343,7 +322,7 @@ Note: has no effect if a solid was selected - + @@ -355,7 +334,7 @@ Note: has no effect if a solid was selected true - Real part of potential z-component + Real part of vector potential z-component Note: has no effect if a solid was selected @@ -373,19 +352,12 @@ Note: has no effect if a solid was selected - - - - - - - true - Imaginary part of potential z-component + Imaginary part of vector potential z-component Note: has no effect if a solid was selected diff --git a/src/Mod/Fem/femexamples/equation_magnetodynamics_elmer.py b/src/Mod/Fem/femexamples/equation_magnetodynamics_elmer.py index fa56c42130..bd5778f875 100644 --- a/src/Mod/Fem/femexamples/equation_magnetodynamics_elmer.py +++ b/src/Mod/Fem/femexamples/equation_magnetodynamics_elmer.py @@ -164,30 +164,28 @@ def setup(doc=None, solvertype="elmer"): (BooleanFragments, "Face6"), ] AxialField.PotentialEnabled = False - AxialField.AV_im_1_Disabled = False - AxialField.AV_im_2_Disabled = False - AxialField.AV_re_1_Disabled = False - AxialField.AV_re_2_Disabled = False + AxialField.EnableAV_1 = True + AxialField.EnableAV_2 = True analysis.addObject(AxialField) # voltage on one end Voltage = ObjectsFem.makeConstraintElectrostaticPotential(doc, "Voltage") Voltage.References = [(BooleanFragments, "Face3")] - Voltage.Potential = "10.000 mV" - Voltage.AV_im_1_Disabled = False - Voltage.AV_im_2_Disabled = False - Voltage.AV_re_1_Disabled = False - Voltage.AV_re_2_Disabled = False + Voltage.AV_re = "10.000 mV" + Voltage.AV_im = "0 V" + Voltage.EnableAV = True + Voltage.EnableAV_1 = True + Voltage.EnableAV_2 = True analysis.addObject(Voltage) # ground on other end Ground = ObjectsFem.makeConstraintElectrostaticPotential(doc, "Ground") Ground.References = [(BooleanFragments, "Face2")] - Ground.Potential = "0 V" - Ground.AV_im_1_Disabled = False - Ground.AV_im_2_Disabled = False - Ground.AV_re_1_Disabled = False - Ground.AV_re_2_Disabled = False + Ground.AV_re = "0 V" + Ground.AV_im = "0 V" + Ground.EnableAV = True + Ground.EnableAV_1 = True + Ground.EnableAV_2 = True analysis.addObject(Ground) # magnetization diff --git a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py index f2d1d3381e..50ac56a951 100644 --- a/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femobjects/constraint_electrostaticpotential.py @@ -163,73 +163,37 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) prop.append( _PropHelper( type="App::PropertyBool", - name="AV_re_1_Disabled", + name="EnableAV", group="Electromagnetic Potential", - doc="", - value=True, + doc="Enable scalar potential boundary condition", + value=False, ) ) prop.append( _PropHelper( type="App::PropertyBool", - name="AV_re_2_Disabled", + name="EnableAV_1", group="Electromagnetic Potential", - doc="", - value=True, + doc="Enable vector potential x-component boundary condition", + value=False, ) ) prop.append( _PropHelper( type="App::PropertyBool", - name="AV_re_3_Disabled", + name="EnableAV_2", group="Electromagnetic Potential", - doc="", - value=True, + doc="Enable vector potential y-component boundary condition", + value=False, ) ) prop.append( _PropHelper( type="App::PropertyBool", - name="AV_im_1_Disabled", + name="EnableAV_3", group="Electromagnetic Potential", - doc="", - value=True, - ) - ) - prop.append( - _PropHelper( - type="App::PropertyBool", - name="AV_im_2_Disabled", - group="Electromagnetic Potential", - doc="", - value=True, - ) - ) - prop.append( - _PropHelper( - type="App::PropertyBool", - name="AV_im_3_Disabled", - group="Electromagnetic Potential", - doc="", - value=True, - ) - ) - prop.append( - _PropHelper( - type="App::PropertyBool", - name="AV_re_Disabled", - group="Electromagnetic Potential", - doc="", - value=True, - ) - ) - prop.append( - _PropHelper( - type="App::PropertyBool", - name="AV_im_Disabled", - group="Electromagnetic Potential", - doc="", - value=True, + doc="Enable vector potential z-component boundary condition", + value=False, ) ) prop.append( @@ -303,3 +267,35 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject) old_type="App::PropertyElectricPotential", convert_old_value=lambda x: "{} Wb/m".format(x.getValueAs("V").Value), ) + + # enable electromagnetic properties from old properties + try: + obj.EnableAV_1 = not obj.getPropertyByName( + "AV_re_1_Disabled" + ) or not obj.getPropertyByName("AV_im_1_Disabled") + obj.EnableAV_2 = not obj.getPropertyByName( + "AV_re_2_Disabled" + ) or not obj.getPropertyByName("AV_im_2_Disabled") + obj.EnableAV_3 = not obj.getPropertyByName( + "AV_re_3_Disabled" + ) or not obj.getPropertyByName("AV_im_3_Disabled") + obj.EnableAV = not obj.getPropertyByName("AV_im_Disabled") + + # remove old properties + obj.setPropertyStatus("AV_re_1_Disabled", "-LockDynamic") + obj.removeProperty("AV_re_1_Disabled") + obj.setPropertyStatus("AV_re_2_Disabled", "-LockDynamic") + obj.removeProperty("AV_re_2_Disabled") + obj.setPropertyStatus("AV_re_3_Disabled", "-LockDynamic") + obj.removeProperty("AV_re_3_Disabled") + obj.setPropertyStatus("AV_im_1_Disabled", "-LockDynamic") + obj.removeProperty("AV_im_1_Disabled") + obj.setPropertyStatus("AV_im_2_Disabled", "-LockDynamic") + obj.removeProperty("AV_im_2_Disabled") + obj.setPropertyStatus("AV_im_3_Disabled", "-LockDynamic") + obj.removeProperty("AV_im_3_Disabled") + obj.setPropertyStatus("AV_im_Disabled", "-LockDynamic") + obj.removeProperty("AV_im_Disabled") + + except Base.PropertyError: + pass diff --git a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py index 7bcb968838..d0a7e759fc 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py @@ -208,16 +208,13 @@ class MgDynwriter: magnetization = float(obj.Magnetization_im_3.getValueAs("A/m")) self.write.bodyForce(name, "Magnetization Im 3", magnetization) - if hasattr(obj, "PotentialEnabled"): - # check for PotentialEnabled not Potential since PotentialEnabled was - # added later and only with this the imaginary property is available + if femutils.is_derived_from(obj, "Fem::ConstraintElectrostaticPotential"): if obj.PotentialEnabled: # output only if potential is enabled and needed potential = float(obj.Potential.getValueAs("V")) self.write.bodyForce(name, "Electric Potential", round(potential, 6)) - # imaginary is only needed for harmonic equation - if equation.IsHarmonic: - if not obj.AV_im_Disabled: + # imaginary is only needed for harmonic equation + if equation.IsHarmonic: potential = float(obj.AV_im.getValueAs("V")) self.write.bodyForce(name, "Electric Potential Im", round(potential, 6)) @@ -291,44 +288,38 @@ class MgDynwriter: self.write.boundary(name, "Current Density Im 1", round(currentDensity, 6)) if femutils.is_derived_from(obj, "Fem::ConstraintElectrostaticPotential"): - if not obj.AV_re_Disabled: + if obj.EnableAV: potential = obj.AV_re.getValueAs("V").Value if equation.IsHarmonic: self.write.boundary(name, "AV re", round(potential, 6)) + potential = obj.AV_im.getValueAs("V").Value + self.write.boundary(name, "AV im", round(potential, 6)) else: self.write.boundary(name, "AV", round(potential, 6)) - if not obj.AV_re_1_Disabled: + if obj.EnableAV_1: potential = obj.AV_re_1.getValueAs("Wb/m").Value if equation.IsHarmonic: self.write.boundary(name, "AV re {e} 1", round(potential, 6)) + potential = obj.AV_im_1.getValueAs("Wb/m").Value + self.write.boundary(name, "AV im {e} 1", round(potential, 6)) else: self.write.boundary(name, "AV {e} 1", round(potential, 6)) - if not obj.AV_re_2_Disabled: + if obj.EnableAV_2: potential = obj.AV_re_2.getValueAs("Wb/m").Value if equation.IsHarmonic: self.write.boundary(name, "AV re {e} 2", round(potential, 6)) + potential = obj.AV_im_2.getValueAs("Wb/m").Value + self.write.boundary(name, "AV im {e} 2", round(potential, 6)) else: self.write.boundary(name, "AV {e} 2", round(potential, 6)) - if not obj.AV_re_3_Disabled: + if obj.EnableAV_3: potential = obj.AV_re_3.getValueAs("Wb/m").Value if equation.IsHarmonic: self.write.boundary(name, "AV re {e} 3", round(potential, 6)) - else: - self.write.boundary(name, "AV {e} 3", round(potential, 6)) - # imaginaries are only needed for harmonic equation - if equation.IsHarmonic: - if not obj.AV_im_Disabled: - potential = obj.AV_im.getValueAs("V").Value - self.write.boundary(name, "AV im", round(potential, 6)) - if not obj.AV_im_1_Disabled: - potential = obj.AV_im_1.getValueAs("Wb/m").Value - self.write.boundary(name, "AV im {e} 1", round(potential, 6)) - if not obj.AV_im_2_Disabled: - potential = obj.AV_im_2.getValueAs("Wb/m").Value - self.write.boundary(name, "AV im {e} 2", round(potential, 6)) - if not obj.AV_im_3_Disabled: potential = obj.AV_im_3.getValueAs("Wb/m").Value self.write.boundary(name, "AV im {e} 3", round(potential, 6)) + else: + self.write.boundary(name, "AV {e} 3", round(potential, 6)) def handleMagnetodynamicBndConditions(self, equation): # the current density can either be a body force or a boundary constraint diff --git a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py index 7cf8903cd6..3d1826e126 100644 --- a/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py +++ b/src/Mod/Fem/femtaskpanels/task_constraint_electrostaticpotential.py @@ -91,9 +91,9 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.potential_changed, ) QtCore.QObject.connect( - self.parameter_widget.ckb_av_re, + self.parameter_widget.ckb_av, QtCore.SIGNAL("toggled(bool)"), - self.av_re_enabled_changed, + self.av_enabled_changed, ) QtCore.QObject.connect( self.parameter_widget.qsb_av_re, @@ -101,9 +101,9 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.av_re_changed, ) QtCore.QObject.connect( - self.parameter_widget.ckb_av_re_1, + self.parameter_widget.ckb_av_1, QtCore.SIGNAL("toggled(bool)"), - self.av_re_1_enabled_changed, + self.av_1_enabled_changed, ) QtCore.QObject.connect( self.parameter_widget.qsb_av_re_1, @@ -111,9 +111,9 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.av_re_1_changed, ) QtCore.QObject.connect( - self.parameter_widget.ckb_av_re_2, + self.parameter_widget.ckb_av_2, QtCore.SIGNAL("toggled(bool)"), - self.av_re_2_enabled_changed, + self.av_2_enabled_changed, ) QtCore.QObject.connect( self.parameter_widget.qsb_av_re_2, @@ -121,50 +121,30 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.av_re_2_changed, ) QtCore.QObject.connect( - self.parameter_widget.ckb_av_re_3, + self.parameter_widget.ckb_av_3, QtCore.SIGNAL("toggled(bool)"), - self.av_re_3_enabled_changed, + self.av_3_enabled_changed, ) QtCore.QObject.connect( self.parameter_widget.qsb_av_re_3, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.av_re_3_changed, ) - QtCore.QObject.connect( - self.parameter_widget.ckb_av_im, - QtCore.SIGNAL("toggled(bool)"), - self.av_im_enabled_changed, - ) QtCore.QObject.connect( self.parameter_widget.qsb_av_im, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.av_im_changed, ) - QtCore.QObject.connect( - self.parameter_widget.ckb_av_im_1, - QtCore.SIGNAL("toggled(bool)"), - self.av_im_1_enabled_changed, - ) QtCore.QObject.connect( self.parameter_widget.qsb_av_im_1, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.av_im_1_changed, ) - QtCore.QObject.connect( - self.parameter_widget.ckb_av_im_2, - QtCore.SIGNAL("toggled(bool)"), - self.av_im_2_enabled_changed, - ) QtCore.QObject.connect( self.parameter_widget.qsb_av_im_2, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.av_im_2_changed, ) - QtCore.QObject.connect( - self.parameter_widget.ckb_av_im_3, - QtCore.SIGNAL("toggled(bool)"), - self.av_im_3_enabled_changed, - ) QtCore.QObject.connect( self.parameter_widget.qsb_av_im_3, QtCore.SIGNAL("valueChanged(Base::Quantity)"), @@ -242,14 +222,10 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.av_im_2 = self.obj.AV_im_2 self.av_im_3 = self.obj.AV_im_3 - self.av_re_enabled = not self.obj.AV_re_Disabled - self.av_im_enabled = not self.obj.AV_im_Disabled - self.av_re_1_enabled = not self.obj.AV_re_1_Disabled - self.av_re_2_enabled = not self.obj.AV_re_2_Disabled - self.av_re_3_enabled = not self.obj.AV_re_3_Disabled - self.av_im_1_enabled = not self.obj.AV_im_1_Disabled - self.av_im_2_enabled = not self.obj.AV_im_2_Disabled - self.av_im_3_enabled = not self.obj.AV_im_3_Disabled + self.av_enabled = self.obj.EnableAV + self.av_1_enabled = self.obj.EnableAV_1 + self.av_2_enabled = self.obj.EnableAV_2 + self.av_3_enabled = self.obj.EnableAV_3 self.boundary_condition = self.obj.BoundaryCondition self.potential_constant = self.obj.PotentialConstant @@ -271,14 +247,10 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.obj.AV_im_2 = self.av_im_2 self.obj.AV_im_3 = self.av_im_3 - self.obj.AV_re_Disabled = not self.av_re_enabled - self.obj.AV_im_Disabled = not self.av_im_enabled - self.obj.AV_re_1_Disabled = not self.av_re_1_enabled - self.obj.AV_re_2_Disabled = not self.av_re_2_enabled - self.obj.AV_re_3_Disabled = not self.av_re_3_enabled - self.obj.AV_im_1_Disabled = not self.av_im_1_enabled - self.obj.AV_im_2_Disabled = not self.av_im_2_enabled - self.obj.AV_im_3_Disabled = not self.av_im_3_enabled + self.obj.EnableAV = self.av_enabled + self.obj.EnableAV_1 = self.av_1_enabled + self.obj.EnableAV_2 = self.av_2_enabled + self.obj.EnableAV_3 = self.av_3_enabled self.obj.BoundaryCondition = self.boundary_condition self.obj.PotentialConstant = self.potential_constant @@ -299,41 +271,37 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): # scalar potential self.parameter_widget.qsb_av_re.setProperty("value", self.av_re) - self.parameter_widget.qsb_av_re.setEnabled(self.av_re_enabled) + self.parameter_widget.qsb_av_re.setEnabled(self.av_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re).bind(self.obj, "AV_re") self.parameter_widget.qsb_av_im.setProperty("value", self.av_im) - self.parameter_widget.qsb_av_im.setEnabled(self.av_im_enabled) + self.parameter_widget.qsb_av_im.setEnabled(self.av_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im).bind(self.obj, "AV_im") # vector potential self.parameter_widget.qsb_av_re_1.setProperty("value", self.av_re_1) - self.parameter_widget.qsb_av_re_1.setEnabled(self.av_re_1_enabled) + self.parameter_widget.qsb_av_re_1.setEnabled(self.av_1_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_1).bind(self.obj, "AV_re_1") self.parameter_widget.qsb_av_re_2.setProperty("value", self.av_re_2) - self.parameter_widget.qsb_av_re_2.setEnabled(self.av_re_2_enabled) + self.parameter_widget.qsb_av_re_2.setEnabled(self.av_2_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_2).bind(self.obj, "AV_re_2") self.parameter_widget.qsb_av_re_3.setProperty("value", self.av_re_3) - self.parameter_widget.qsb_av_re_3.setEnabled(self.av_re_3_enabled) + self.parameter_widget.qsb_av_re_3.setEnabled(self.av_3_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_re_3).bind(self.obj, "AV_re_3") self.parameter_widget.qsb_av_im_1.setProperty("value", self.av_im_1) - self.parameter_widget.qsb_av_im_1.setEnabled(self.av_im_1_enabled) + self.parameter_widget.qsb_av_im_1.setEnabled(self.av_1_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_1).bind(self.obj, "AV_im_1") self.parameter_widget.qsb_av_im_2.setProperty("value", self.av_im_2) - self.parameter_widget.qsb_av_im_2.setEnabled(self.av_im_2_enabled) + self.parameter_widget.qsb_av_im_2.setEnabled(self.av_2_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_2).bind(self.obj, "AV_im_2") self.parameter_widget.qsb_av_im_3.setProperty("value", self.av_im_3) - self.parameter_widget.qsb_av_im_3.setEnabled(self.av_im_3_enabled) + self.parameter_widget.qsb_av_im_3.setEnabled(self.av_3_enabled) FreeCADGui.ExpressionBinding(self.parameter_widget.qsb_av_im_3).bind(self.obj, "AV_im_3") - self.parameter_widget.ckb_av_re.setChecked(self.av_re_enabled) - self.parameter_widget.ckb_av_re_1.setChecked(self.av_re_1_enabled) - self.parameter_widget.ckb_av_re_2.setChecked(self.av_re_2_enabled) - self.parameter_widget.ckb_av_re_3.setChecked(self.av_re_3_enabled) - self.parameter_widget.ckb_av_im.setChecked(self.av_im_enabled) - self.parameter_widget.ckb_av_im_1.setChecked(self.av_im_1_enabled) - self.parameter_widget.ckb_av_im_2.setChecked(self.av_im_2_enabled) - self.parameter_widget.ckb_av_im_3.setChecked(self.av_im_3_enabled) + self.parameter_widget.ckb_av.setChecked(self.av_enabled) + self.parameter_widget.ckb_av_1.setChecked(self.av_1_enabled) + self.parameter_widget.ckb_av_2.setChecked(self.av_2_enabled) + self.parameter_widget.ckb_av_3.setChecked(self.av_3_enabled) self.parameter_widget.ckb_potential_constant.setChecked(self.potential_constant) @@ -358,16 +326,7 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.parameter_widget.cb_boundary_condition.setCurrentIndex(index) # start with electromagnetic inputs hidden if no field is set - if not ( - self.av_re_enabled - or self.av_im_enabled - or self.av_re_1_enabled - or self.av_re_2_enabled - or self.av_re_3_enabled - or self.av_im_1_enabled - or self.av_im_2_enabled - or self.av_im_3_enabled - ): + if not (self.av_enabled or self.av_1_enabled or self.av_2_enabled or self.av_3_enabled): self.parameter_widget.ckb_electromagnetic.setChecked(False) def potential_changed(self, value): @@ -380,36 +339,24 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): def electromagnetic_enabled_changed(self, value): self.parameter_widget.gb_electromagnetic.setVisible(value) - def av_re_enabled_changed(self, value): - self.av_re_enabled = value + def av_enabled_changed(self, value): + self.av_enabled = value self.parameter_widget.qsb_av_re.setEnabled(value) - - def av_re_1_enabled_changed(self, value): - self.av_re_1_enabled = value - self.parameter_widget.qsb_av_re_1.setEnabled(value) - - def av_re_2_enabled_changed(self, value): - self.av_re_2_enabled = value - self.parameter_widget.qsb_av_re_2.setEnabled(value) - - def av_re_3_enabled_changed(self, value): - self.av_re_3_enabled = value - self.parameter_widget.qsb_av_re_3.setEnabled(value) - - def av_im_enabled_changed(self, value): - self.av_im_enabled = value self.parameter_widget.qsb_av_im.setEnabled(value) - def av_im_1_enabled_changed(self, value): - self.av_im_1_enabled = value + def av_1_enabled_changed(self, value): + self.av_1_enabled = value + self.parameter_widget.qsb_av_re_1.setEnabled(value) self.parameter_widget.qsb_av_im_1.setEnabled(value) - def av_im_2_enabled_changed(self, value): - self.av_im_2_enabled = value + def av_2_enabled_changed(self, value): + self.av_2_enabled = value + self.parameter_widget.qsb_av_re_2.setEnabled(value) self.parameter_widget.qsb_av_im_2.setEnabled(value) - def av_im_3_enabled_changed(self, value): - self.av_im_3_enabled = value + def av_3_enabled_changed(self, value): + self.av_3_enabled = value + self.parameter_widget.qsb_av_re_3.setEnabled(value) self.parameter_widget.qsb_av_im_3.setEnabled(value) def av_re_changed(self, value): From b888c2ffc0ab755c46790a6e9b38cb059be36fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Thu, 3 Oct 2024 21:28:55 +0200 Subject: [PATCH 012/224] [Gui] Add ability to change axis colors --- src/Gui/PreferencePackTemplates/View.cfg | 3 + src/Gui/PreferencePages/DlgSettings3DView.ui | 111 ++++++++++++++++++ .../PreferencePages/DlgSettings3DViewImp.cpp | 8 ++ 3 files changed, 122 insertions(+) diff --git a/src/Gui/PreferencePackTemplates/View.cfg b/src/Gui/PreferencePackTemplates/View.cfg index a7357e70cb..8c2392fb2c 100644 --- a/src/Gui/PreferencePackTemplates/View.cfg +++ b/src/Gui/PreferencePackTemplates/View.cfg @@ -14,6 +14,9 @@ + + + diff --git a/src/Gui/PreferencePages/DlgSettings3DView.ui b/src/Gui/PreferencePages/DlgSettings3DView.ui index bac76fd636..a37f8cbc28 100644 --- a/src/Gui/PreferencePages/DlgSettings3DView.ui +++ b/src/Gui/PreferencePages/DlgSettings3DView.ui @@ -122,6 +122,117 @@ in the corner -- in % of height/width of viewport
+ + + + + + X-axis color + + + + + + + + + + AxisXColor + + + View + + + + 204 + 51 + 51 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Y-axis color + + + + + + + + + + AxisYColor + + + View + + + + 51 + 204 + 51 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Z-axis color + + + + + + + + + + AxisZColor + + + View + + + + 51 + 51 + 204 + + + + + + diff --git a/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp b/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp index 47775784ba..35112bc81c 100644 --- a/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp +++ b/src/Gui/PreferencePages/DlgSettings3DViewImp.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "DlgSettings3DViewImp.h" #include "ui_DlgSettings3DView.h" @@ -74,6 +75,9 @@ void DlgSettings3DViewImp::saveSettings() ui->sliderIntensity->onSave(); ui->radioPerspective->onSave(); ui->radioOrthographic->onSave(); + ui->xAxisColor->onSave(); + ui->yAxisColor->onSave(); + ui->zAxisColor->onSave(); } void DlgSettings3DViewImp::loadSettings() @@ -92,6 +96,9 @@ void DlgSettings3DViewImp::loadSettings() ui->radioPerspective->onRestore(); ui->radioOrthographic->onRestore(); ui->comboTransparentRender->onRestore(); + ui->xAxisColor->onRestore(); + ui->yAxisColor->onRestore(); + ui->zAxisColor->onRestore(); loadAntiAliasing(); loadRenderCache(); @@ -240,3 +247,4 @@ void DlgSettings3DViewImp::onAliasingChanged(int index) #include "moc_DlgSettings3DViewImp.cpp" + From f4f902e4a31a4e367f3d4e0267af724f1292f798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Thu, 3 Oct 2024 22:30:45 +0200 Subject: [PATCH 013/224] [Gui] Make NaviCube axis colors changeable --- src/Gui/NaviCube.cpp | 27 ++++++++++++++++++++++++--- src/Gui/NaviCube.h | 1 + src/Gui/View3DSettings.cpp | 8 ++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 354cbabf8f..918b8c46c8 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -56,6 +56,7 @@ #include "MainWindow.h" #include "View3DInventorViewer.h" #include "View3DInventor.h" +#include "ViewParams.h" using namespace Eigen; @@ -179,6 +180,10 @@ public: float m_InactiveOpacity = 0.5; SbVec2s m_PosOffset = SbVec2s(0,0); + App::Color m_xColor; + App::Color m_yColor; + App::Color m_zColor; + bool m_Prepared = false; static vector m_commands; bool m_Draggable = false; @@ -212,6 +217,7 @@ int NaviCube::getNaviCubeSize() NaviCube::NaviCube(Gui::View3DInventorViewer* viewer) { m_NaviCubeImplementation = new NaviCubeImplementation(viewer); + updateColors(); } NaviCube::~NaviCube() { @@ -828,13 +834,16 @@ void NaviCubeImplementation::drawNaviCube(bool pickMode, float opacity) a, a, a // 0 }; glVertexPointer(3, GL_FLOAT, 0, pointData); - glColor4f(1, 0, 0, opacity); + + glColor4f(m_xColor.r, m_xColor.g, m_xColor.b, opacity); glDrawArrays(GL_LINES, 0, 2); glDrawArrays(GL_POINTS, 0, 2); - glColor4f(0, 1, 0, opacity); + + glColor4f(m_yColor.r, m_yColor.g, m_yColor.b, opacity); glDrawArrays(GL_LINES, 2, 2); glDrawArrays(GL_POINTS, 2, 2); - glColor4f(0, 0, 1, opacity); + + glColor4f(m_zColor.r, m_zColor.g, m_zColor.b, opacity); glDrawArrays(GL_LINES, 4, 2); glDrawArrays(GL_POINTS, 4, 2); } @@ -1167,6 +1176,18 @@ QString NaviCubeImplementation::str(const char* str) { return QString::fromLatin1(str); } +void NaviCube::updateColors() +{ + unsigned long colorLong; + + colorLong = Gui::ViewParams::instance()->getAxisXColor(); + m_NaviCubeImplementation->m_xColor = App::Color(static_cast(colorLong)); + colorLong = Gui::ViewParams::instance()->getAxisYColor(); + m_NaviCubeImplementation->m_yColor = App::Color(static_cast(colorLong)); + colorLong = Gui::ViewParams::instance()->getAxisZColor(); + m_NaviCubeImplementation->m_zColor = App::Color(static_cast(colorLong)); +} + void NaviCube::setNaviCubeCommands(const std::vector& cmd) { NaviCubeImplementation::m_commands = cmd; diff --git a/src/Gui/NaviCube.h b/src/Gui/NaviCube.h index 8802e192de..f9412011f6 100644 --- a/src/Gui/NaviCube.h +++ b/src/Gui/NaviCube.h @@ -51,6 +51,7 @@ public: void setCorner(Corner); void setOffset(int x, int y); bool isDraggable(); + void updateColors(); void setDraggable(bool draggable); void setSize(int size); void setChamfer(float size); diff --git a/src/Gui/View3DSettings.cpp b/src/Gui/View3DSettings.cpp index b3aa7fe6d7..e4ac1c2036 100644 --- a/src/Gui/View3DSettings.cpp +++ b/src/Gui/View3DSettings.cpp @@ -86,6 +86,9 @@ void View3DSettings::applySettings() OnChange(*hGrp,"UseBackgroundColorMid"); OnChange(*hGrp,"ShowFPS"); OnChange(*hGrp,"ShowNaviCube"); + OnChange(*hGrp,"AxisXColor"); + OnChange(*hGrp,"AxisYColor"); + OnChange(*hGrp,"AxisZColor"); OnChange(*hGrp,"UseVBO"); OnChange(*hGrp,"RenderCache"); OnChange(*hGrp,"Orthographic"); @@ -341,6 +344,11 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M _viewer->setEnabledNaviCube(rGrp.GetBool("ShowNaviCube", true)); } } + else if (strcmp(Reason,"AxisXColor") == 0 || strcmp(Reason,"AxisYColor") == 0 || strcmp(Reason,"AxisZColor") == 0) { + for (auto _viewer : _viewers) { + _viewer->getNaviCube()->updateColors(); + } + } else if (strcmp(Reason,"UseVBO") == 0) { if (!ignoreVBO) { for (auto _viewer : _viewers) { From c6e590ce9dfb5d5d6f74d4a08ea3202edc490c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Thu, 3 Oct 2024 23:44:40 +0200 Subject: [PATCH 014/224] [Gui] Make axis colors of axis kit (world origin axis) changeable --- src/Gui/Inventor/SoAxisCrossKit.cpp | 33 +++++++++++++++++++++++------ src/Gui/View3DSettings.cpp | 4 ++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Gui/Inventor/SoAxisCrossKit.cpp b/src/Gui/Inventor/SoAxisCrossKit.cpp index e894ff1ae2..ec95db0f03 100644 --- a/src/Gui/Inventor/SoAxisCrossKit.cpp +++ b/src/Gui/Inventor/SoAxisCrossKit.cpp @@ -29,6 +29,8 @@ # include # endif +#include + # include # include # include @@ -50,6 +52,9 @@ # include #endif +#include +#include + #include "SoAxisCrossKit.h" #include "SoDevicePixelRatioElement.h" @@ -218,12 +223,28 @@ SoAxisCrossKit::createAxes() set("xAxis.appearance.drawStyle", "lineWidth 1"); set("yAxis.appearance.drawStyle", "lineWidth 1"); set("zAxis.appearance.drawStyle", "lineWidth 1"); - set("xAxis.appearance.material", "diffuseColor 0.5 0.125 0.125"); - set("xHead.appearance.material", "diffuseColor 0.5 0.125 0.125"); - set("yAxis.appearance.material", "diffuseColor 0.125 0.5 0.125"); - set("yHead.appearance.material", "diffuseColor 0.125 0.5 0.125"); - set("zAxis.appearance.material", "diffuseColor 0.125 0.125 0.5"); - set("zHead.appearance.material", "diffuseColor 0.125 0.125 0.5"); + + unsigned long colorLong; + App::Color color; + std::stringstream parameterstring; + + colorLong = Gui::ViewParams::instance()->getAxisXColor(); + color = App::Color(static_cast(colorLong)); + parameterstring << "diffuseColor " << color.r << " " << color.g << " " << color.b; + set("xAxis.appearance.material", parameterstring.str().c_str()); + set("xHead.appearance.material", parameterstring.str().c_str()); + + colorLong = Gui::ViewParams::instance()->getAxisYColor(); + color = App::Color(static_cast(colorLong)); + parameterstring << "diffuseColor " << color.r << " " << color.g << " " << color.b; + set("yAxis.appearance.material", parameterstring.str().c_str()); + set("yHead.appearance.material", parameterstring.str().c_str()); + + colorLong = Gui::ViewParams::instance()->getAxisZColor(); + color = App::Color(static_cast(colorLong)); + parameterstring << "diffuseColor " << color.r << " " << color.g << " " << color.b; + set("zAxis.appearance.material", parameterstring.str().c_str()); + set("zHead.appearance.material", parameterstring.str().c_str()); // Make unpickable set("xAxis.pickStyle", "style UNPICKABLE"); diff --git a/src/Gui/View3DSettings.cpp b/src/Gui/View3DSettings.cpp index e4ac1c2036..bad335a762 100644 --- a/src/Gui/View3DSettings.cpp +++ b/src/Gui/View3DSettings.cpp @@ -347,6 +347,10 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M else if (strcmp(Reason,"AxisXColor") == 0 || strcmp(Reason,"AxisYColor") == 0 || strcmp(Reason,"AxisZColor") == 0) { for (auto _viewer : _viewers) { _viewer->getNaviCube()->updateColors(); + if(_viewer->hasAxisCross()) { + _viewer->setAxisCross(false); // Force redraw + _viewer->setAxisCross(true); + } } } else if (strcmp(Reason,"UseVBO") == 0) { From 44e3a94f29e0a3f6641e3f00ad1ad55ec2b381b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Fri, 4 Oct 2024 00:06:31 +0200 Subject: [PATCH 015/224] [Gui] Make axis colors of corner axis changeable --- src/Gui/View3DInventorViewer.cpp | 31 ++++++++++++++++++++++++++----- src/Gui/View3DInventorViewer.h | 7 +++++++ src/Gui/View3DSettings.cpp | 6 +----- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index ff57cede1b..5ccacd7bd3 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -588,6 +588,8 @@ void View3DInventorViewer::init() naviCube = new NaviCube(this); naviCubeEnabled = true; + + updateColors(); } View3DInventorViewer::~View3DInventorViewer() @@ -3706,6 +3708,25 @@ void View3DInventorViewer::setAxisLetterColor(const SbColor& color) recolor(ZPM_PIXEL_MASK, ZPM_pixel_data, ZPM_WIDTH, ZPM_HEIGHT, ZPM_BYTES_PER_PIXEL); } +void View3DInventorViewer::updateColors() +{ + unsigned long colorLong; + + colorLong = Gui::ViewParams::instance()->getAxisXColor(); + m_xColor = App::Color(static_cast(colorLong)); + colorLong = Gui::ViewParams::instance()->getAxisYColor(); + m_yColor = App::Color(static_cast(colorLong)); + colorLong = Gui::ViewParams::instance()->getAxisZColor(); + m_zColor = App::Color(static_cast(colorLong)); + + naviCube->updateColors(); + + if(hasAxisCross()) { + setAxisCross(false); // Force redraw + setAxisCross(true); + } +} + void View3DInventorViewer::drawAxisCross() { // NOLINTBEGIN @@ -3813,10 +3834,10 @@ void View3DInventorViewer::drawAxisCross() glPushMatrix(); if (i == XAXIS) { // X axis. - if (stereoMode() != Quarter::SoQTQuarterAdaptor::MONO) - glColor3f(0.500F, 0.5F, 0.5F); + if (stereoMode() != Quarter::SoQTQuarterAdaptor::MONO) // What is this + glColor3f(0.500F, 0.5F, 0.5F); // Why different colors?? else - glColor3f(0.500F, 0.125F, 0.125F); + glColor3f(m_xColor.r, m_xColor.g, m_xColor.b); } else if (i == YAXIS) { // Y axis. glRotatef(90, 0, 0, 1); @@ -3824,7 +3845,7 @@ void View3DInventorViewer::drawAxisCross() if (stereoMode() != Quarter::SoQTQuarterAdaptor::MONO) glColor3f(0.400F, 0.4F, 0.4F); else - glColor3f(0.125F, 0.500F, 0.125F); + glColor3f(m_yColor.r, m_yColor.g, m_yColor.b); } else { // Z axis. glRotatef(-90, 0, 1, 0); @@ -3832,7 +3853,7 @@ void View3DInventorViewer::drawAxisCross() if (stereoMode() != Quarter::SoQTQuarterAdaptor::MONO) glColor3f(0.300F, 0.3F, 0.3F); else - glColor3f(0.125F, 0.125F, 0.500F); + glColor3f(m_zColor.r, m_zColor.g, m_zColor.b); } drawArrow(); diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 1a520e616c..b19f23e2ed 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -434,6 +434,9 @@ public: bool isEnabledVBO() const; void setRenderCache(int); + //! Update colors of axis in corner to match preferences + void updateColors(); + void getDimensions(float& fHeight, float& fWidth) const; float getMaxDimension() const; SbVec3f getCenterPointOnFocalPlane() const; @@ -531,6 +534,10 @@ private: bool vboEnabled; bool naviCubeEnabled; + App::Color m_xColor; + App::Color m_yColor; + App::Color m_zColor; + bool editing; QCursor editCursor, zoomCursor, panCursor, spinCursor; bool redirected; diff --git a/src/Gui/View3DSettings.cpp b/src/Gui/View3DSettings.cpp index bad335a762..a91c21709c 100644 --- a/src/Gui/View3DSettings.cpp +++ b/src/Gui/View3DSettings.cpp @@ -346,11 +346,7 @@ void View3DSettings::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M } else if (strcmp(Reason,"AxisXColor") == 0 || strcmp(Reason,"AxisYColor") == 0 || strcmp(Reason,"AxisZColor") == 0) { for (auto _viewer : _viewers) { - _viewer->getNaviCube()->updateColors(); - if(_viewer->hasAxisCross()) { - _viewer->setAxisCross(false); // Force redraw - _viewer->setAxisCross(true); - } + _viewer->updateColors(); } } else if (strcmp(Reason,"UseVBO") == 0) { From 16b07c148519436d770a8c678f54dcd67ef7ab3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Fri, 4 Oct 2024 20:30:38 +0200 Subject: [PATCH 016/224] [Sketcher] Make axis colors changeable --- .../Gui/EditModeCoinManagerParameters.cpp | 16 ++++++++++++++-- .../Gui/EditModeCoinManagerParameters.h | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp index 7f044b589f..0f61ab81e1 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp +++ b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp @@ -24,6 +24,9 @@ #include "Mod/Sketcher/App/ExternalGeometryFacade.h" +#include +#include + #include "EditModeCoinManagerParameters.h" @@ -52,8 +55,17 @@ int GeometryLayerParameters::getSubLayerIndex(const int geoId, SbColor DrawingParameters::InformationColor(0.0f, 1.0f, 0.0f); // #00FF00 -> ( 0,255, 0) SbColor DrawingParameters::CreateCurveColor(0.5f, 0.5f, 0.5f); // ##7f7f7f -> (127,127,127) -SbColor DrawingParameters::CrossColorH(0.8f, 0.4f, 0.4f); // #CC6666 -> (204,102,102) -SbColor DrawingParameters::CrossColorV(0.47f, 1.0f, 0.51f); // #83FF83 -> (120,255,131) + +namespace { // Anonymous namespace to avoid making those variables global + unsigned long HColorLong = Gui::ViewParams::instance()->getAxisXColor(); + App::Color Hcolor = App::Color(static_cast(HColorLong)); + + unsigned long VColorLong = Gui::ViewParams::instance()->getAxisYColor(); + App::Color Vcolor = App::Color(static_cast(VColorLong)); +} +SbColor DrawingParameters::CrossColorH(Hcolor.r, Hcolor.g, Hcolor.b); +SbColor DrawingParameters::CrossColorV(Vcolor.r, Vcolor.g, Vcolor.b); + SbColor DrawingParameters::InvalidSketchColor(1.0f, 0.42f, 0.0f); // #FF6D00 -> (255,109, 0) SbColor DrawingParameters::FullyConstrainedColor(0.0f, 1.0f, 0.0f); // #00FF00 -> ( 0,255, 0) SbColor diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h index 877144c050..938589dbb5 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h +++ b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h @@ -40,6 +40,8 @@ #include #include +#include +#include #include #include @@ -101,7 +103,7 @@ struct DrawingParameters //@{ static SbColor InformationColor; // Information Overlay Color static SbColor CreateCurveColor; // Color for Edit Curves during creation - static SbColor CrossColorH; // Color for the Horizontal Axis + static SbColor CrossColorH; // Color for the Horizontal Axis static SbColor CrossColorV; // Color for the Vertical Axis static SbColor InvalidSketchColor; // Color for rendering an invalid sketch static SbColor FullyConstrainedColor; // Color for a fully constrained sketch @@ -147,6 +149,19 @@ struct DrawingParameters unsigned int InternalPattern = 0b1111110011111100; // pattern of internal edges unsigned int ExternalPattern = 0b1111110011111100; // pattern of external edges //@} + + DrawingParameters() { + unsigned long colorLong; + App::Color color; + + colorLong = Gui::ViewParams::instance()->getAxisXColor(); + color = App::Color(static_cast(colorLong)); + CrossColorH = SbColor(color.r, color.g, color.b); + + colorLong = Gui::ViewParams::instance()->getAxisYColor(); + color = App::Color(static_cast(colorLong)); + CrossColorV = SbColor(color.r, color.g, color.b); + } }; /** @brief Struct for storing references to the scenegraph nodes necessary for geometry layers From aec8772c13ce10da2d3f3c5de866f8faf4335332 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:57:46 +0000 Subject: [PATCH 017/224] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../Gui/EditModeCoinManagerParameters.cpp | 19 ++++++++++--------- .../Gui/EditModeCoinManagerParameters.h | 5 +++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp index 0f61ab81e1..9710afacf6 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp +++ b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp @@ -53,16 +53,17 @@ int GeometryLayerParameters::getSubLayerIndex(const int geoId, : SubLayer::Normal); } -SbColor DrawingParameters::InformationColor(0.0f, 1.0f, 0.0f); // #00FF00 -> ( 0,255, 0) -SbColor DrawingParameters::CreateCurveColor(0.5f, 0.5f, 0.5f); // ##7f7f7f -> (127,127,127) +SbColor DrawingParameters::InformationColor(0.0f, 1.0f, 0.0f); // #00FF00 -> ( 0,255, 0) +SbColor DrawingParameters::CreateCurveColor(0.5f, 0.5f, 0.5f); // ##7f7f7f -> (127,127,127) -namespace { // Anonymous namespace to avoid making those variables global - unsigned long HColorLong = Gui::ViewParams::instance()->getAxisXColor(); - App::Color Hcolor = App::Color(static_cast(HColorLong)); - - unsigned long VColorLong = Gui::ViewParams::instance()->getAxisYColor(); - App::Color Vcolor = App::Color(static_cast(VColorLong)); -} +namespace +{ // Anonymous namespace to avoid making those variables global +unsigned long HColorLong = Gui::ViewParams::instance()->getAxisXColor(); +App::Color Hcolor = App::Color(static_cast(HColorLong)); + +unsigned long VColorLong = Gui::ViewParams::instance()->getAxisYColor(); +App::Color Vcolor = App::Color(static_cast(VColorLong)); +} // namespace SbColor DrawingParameters::CrossColorH(Hcolor.r, Hcolor.g, Hcolor.b); SbColor DrawingParameters::CrossColorV(Vcolor.r, Vcolor.g, Vcolor.b); diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h index 938589dbb5..0e1082f417 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h +++ b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h @@ -103,7 +103,7 @@ struct DrawingParameters //@{ static SbColor InformationColor; // Information Overlay Color static SbColor CreateCurveColor; // Color for Edit Curves during creation - static SbColor CrossColorH; // Color for the Horizontal Axis + static SbColor CrossColorH; // Color for the Horizontal Axis static SbColor CrossColorV; // Color for the Vertical Axis static SbColor InvalidSketchColor; // Color for rendering an invalid sketch static SbColor FullyConstrainedColor; // Color for a fully constrained sketch @@ -150,7 +150,8 @@ struct DrawingParameters unsigned int ExternalPattern = 0b1111110011111100; // pattern of external edges //@} - DrawingParameters() { + DrawingParameters() + { unsigned long colorLong; App::Color color; From 2bc9f2ea1ff69126ecf6a40fa5c36ce0be9099c6 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 24 Jan 2025 13:04:00 -0500 Subject: [PATCH 018/224] [TD]allow showing units on individual dimensions --- src/Mod/TechDraw/App/DrawViewDimension.cpp | 4 ++- src/Mod/TechDraw/App/DrawViewDimension.h | 2 ++ src/Mod/TechDraw/App/Preferences.cpp | 8 ++++++ src/Mod/TechDraw/App/Preferences.h | 2 ++ .../Gui/DlgPrefsTechDrawDimensions.ui | 25 +++++++++++-------- src/Mod/TechDraw/Gui/QGIViewDimension.cpp | 13 ---------- src/Mod/TechDraw/Gui/QGIViewDimension.h | 1 - 7 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index ce421aab3b..3e68441592 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -231,6 +231,8 @@ DrawViewDimension::DrawViewDimension() "If true, area dimensions return the area of the face minus the areas of any enclosed faces. \ If false, the area of the face's outer boundary is returned."); + ADD_PROPERTY_TYPE(ShowUnits, (Preferences::showUnits()), "Format", App::Prop_None, + "Show or hide the units."); measurement = new Measure::Measurement(); // TODO: should have better initial datumLabel position than (0, 0) in the DVP?? something // closer to the object being measured? @@ -2076,7 +2078,7 @@ bool DrawViewDimension::hasOverUnderTolerance() const bool DrawViewDimension::showUnits() const { - return Preferences::getPreferenceGroup("Dimensions")->GetBool("ShowUnits", false); + return ShowUnits.getValue(); } bool DrawViewDimension::useDecimals() const diff --git a/src/Mod/TechDraw/App/DrawViewDimension.h b/src/Mod/TechDraw/App/DrawViewDimension.h index c45ab4f0d1..5ee5380e34 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.h +++ b/src/Mod/TechDraw/App/DrawViewDimension.h @@ -94,6 +94,8 @@ public: App::PropertyVectorList BoxCorners; App::PropertyBool UseActualArea; + App::PropertyBool ShowUnits; + enum RefType { invalidRef, diff --git a/src/Mod/TechDraw/App/Preferences.cpp b/src/Mod/TechDraw/App/Preferences.cpp index 6577a700fe..ef2c5b625e 100644 --- a/src/Mod/TechDraw/App/Preferences.cpp +++ b/src/Mod/TechDraw/App/Preferences.cpp @@ -682,3 +682,11 @@ bool Preferences::useLegacySvgScaling() { return getPreferenceGroup("General")->GetBool("LegacySvgScaling", false); } + + +bool Preferences::showUnits() +{ + return Preferences::getPreferenceGroup("Dimensions")->GetBool("ShowUnits", false); +} + + diff --git a/src/Mod/TechDraw/App/Preferences.h b/src/Mod/TechDraw/App/Preferences.h index 2a62f585bc..33243531ea 100644 --- a/src/Mod/TechDraw/App/Preferences.h +++ b/src/Mod/TechDraw/App/Preferences.h @@ -159,6 +159,8 @@ public: static bool useLegacySvgScaling(); + static bool showUnits(); + }; diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui index d5c885c36c..ace78652d9 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui @@ -6,8 +6,8 @@ 0 0 - 440 - 508 + 495 + 692 @@ -35,7 +35,7 @@ - + 0 @@ -45,7 +45,7 @@ Arrowhead size - + 5.000000000000000 @@ -156,6 +156,11 @@ 0 + + + true + + Append unit to dimension values @@ -183,7 +188,7 @@ - + 0 @@ -193,7 +198,7 @@ Dimension text font size - + 4.000000000000000 @@ -544,7 +549,7 @@ Multiplier of 'Font Size' - + Select the type of dimensioning tools for your toolbar: @@ -562,7 +567,7 @@ This setting is only for the toolbar. Whichever you choose, all tools are always - + While using the Dimension tool you may choose how to handle circles and arcs: @@ -627,9 +632,7 @@ This setting is only for the toolbar. Whichever you choose, all tools are always
Gui/PrefWidgets.h
- - - + cbGlobalDecimals diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index f426d0969e..d636e74ad5 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -548,19 +548,6 @@ void QGIDatumLabel::setToleranceString() updateFrameRect(); } -void QGIDatumLabel::setUnitString(QString text) -{ - prepareGeometryChange(); - if (text.isEmpty()) { - m_unitText->hide(); - } - else { - m_unitText->setPlainText(text); - m_unitText->show(); - } - updateFrameRect(); -} - int QGIDatumLabel::getPrecision() { diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.h b/src/Mod/TechDraw/Gui/QGIViewDimension.h index 7dcb13660a..d14733e8a9 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.h +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.h @@ -83,7 +83,6 @@ public: QFont getFont() const { return m_dimText->font(); } void setDimString(QString text); void setDimString(QString text, qreal maxWidth); - void setUnitString(QString text); void setToleranceString(); void setPrettySel(); void setPrettyPre(); From dbf2e85f6f9302337fdc883bbbacff79bfbc8d62 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 24 Jan 2025 16:34:18 -0500 Subject: [PATCH 019/224] [TD]control svg scaling at object level --- src/Mod/TechDraw/Gui/DlgPrefsTechDrawScale.ui | 157 ++++++++++-------- .../TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp | 2 + src/Mod/TechDraw/Gui/QGIViewSymbol.cpp | 18 +- src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp | 23 +++ src/Mod/TechDraw/Gui/ViewProviderSymbol.h | 3 + 5 files changed, 129 insertions(+), 74 deletions(-) diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScale.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScale.ui index 4a4c6549ac..3402bb854f 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScale.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScale.ui @@ -6,8 +6,8 @@ 0 0 - 440 - 342 + 457 + 481
@@ -49,6 +49,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -61,49 +74,15 @@ - - - - - 0 - 0 - - - - - 174 - 0 - - - - Default scale for new pages - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 2 - - - 1.000000000000000 - - - DefaultScale - - - Mod/TechDraw/General - - - - - + + true - View Scale Type + View Custom Scale @@ -150,30 +129,39 @@
- - - - - true - + + + + + 0 + 0 + - - View Custom Scale - - - - - - - Qt::Horizontal - - + - 40 - 20 + 174 + 0 - + + Default scale for new pages + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 2 + + + 1.000000000000000 + + + DefaultScale + + + Mod/TechDraw/General + + @@ -215,6 +203,39 @@
+ + + + + true + + + + View Scale Type + + + + + + + + true + + + + <html><head/><body><p>If checked, Svg symbols, spreadsheet views and Draft views will use the original (incorrect) scaling method as used in v1.0 and earlier. If unchecked, a more accurate method will be used. </p></body></html> + + + Legacy Symbol Scaling + + + LegacySvgScaling + + + Mod/TechDraw/General + + +
@@ -306,7 +327,7 @@
- + @@ -351,7 +372,7 @@ - + 0 @@ -367,10 +388,7 @@ Size of template field click handles - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + 3.000000000000000 @@ -410,7 +428,7 @@ -
+
@@ -424,7 +442,7 @@ - <html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Note:</span> Items in <span style=" font-style:italic;">italics</span> are default values for new objects. They have no effect on existing objects.</p></body></html> true @@ -452,6 +470,11 @@ QWidget
Gui/QuantitySpinBox.h
+ + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
Gui::PrefComboBox QComboBox diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp index 11c9ad0052..010f000f74 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp @@ -67,6 +67,7 @@ void DlgPrefsTechDrawScaleImp::saveSettings() ui->pdsbCenterScale->onSave(); ui->pdsbTemplateMark->onSave(); ui->pdsbSymbolScale->onSave(); + ui->cbLegacyScale->onSave(); } void DlgPrefsTechDrawScaleImp::loadSettings() @@ -80,6 +81,7 @@ void DlgPrefsTechDrawScaleImp::loadSettings() ui->pdsbTemplateMark->setValue(markDefault); ui->pdsbTemplateMark->onRestore(); ui->pdsbSymbolScale->onRestore(); + ui->cbLegacyScale->onRestore(); } /** diff --git a/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp b/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp index aa5c9fccbf..133cb82451 100644 --- a/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp @@ -42,6 +42,7 @@ #include "QGCustomSvg.h" #include "QGDisplayArea.h" #include "Rez.h" +#include "ViewProviderSymbol.h" using namespace TechDrawGui; @@ -110,8 +111,14 @@ void QGIViewSymbol::drawSvg() return; } + auto vp = getViewProvider(viewSymbol); + auto vps = dynamic_cast(vp); + if (!vp || !vps) { + return; + } + double scaling{1}; - if (Preferences::useLegacySvgScaling()) { + if (vps->LegacyScaling.getValue()) { scaling = legacyScaler(viewSymbol); } else { scaling = symbolScaler(viewSymbol); @@ -206,18 +213,15 @@ double QGIViewSymbol::symbolScaler(TechDraw::DrawViewSymbol* feature) const matchUnits = matchHeight.captured(1); } - if (matchUnits.isEmpty() || - matchUnits == pxToken) { - scaling *= rezfactor; - } + // if there are no units specified, or the units are px, we just draw the symbol if (matchUnits == mmToken) { auto svgSize = m_svgItem->renderer()->defaultSize(); - auto vpSize = m_svgItem->renderer()->viewBox(); + auto vportSize = m_svgItem->renderer()->viewBox(); // wf: this calculation works, but I don't know why. :( // hints here: https://stackoverflow.com/questions/49866474/get-svg-size-from-qsvgrenderer // and here: https://stackoverflow.com/questions/7544921/qt-qgraphicssvgitem-renders-too-big-0-5-unit-on-each-side - scaling *= rezfactor * vpSize.width() / svgSize.width(); + scaling *= rezfactor * vportSize.width() / svgSize.width(); } return scaling; diff --git a/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp b/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp index d15b5f2adb..d41d311588 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderSymbol.cpp @@ -24,9 +24,15 @@ #include "PreCompiled.h" #include + +#include + +#include "QGIViewSymbol.h" #include "ViewProviderSymbol.h" using namespace TechDrawGui; +using namespace TechDraw; + PROPERTY_SOURCE(TechDrawGui::ViewProviderSymbol, TechDrawGui::ViewProviderDrawingView) @@ -36,6 +42,11 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderSymbol, TechDrawGui::ViewProviderDrawin ViewProviderSymbol::ViewProviderSymbol() { sPixmap = "TechDraw_TreeSymbol"; + + ADD_PROPERTY_TYPE(LegacyScaling, (Preferences::useLegacySvgScaling()), "Svg Scaling", App::Prop_None, + "If true, Svg will be scaled using the original (v1.0 and earlier) scaling method.\ + If false, a more accurate method will be used."); + } ViewProviderSymbol::~ViewProviderSymbol() @@ -55,6 +66,18 @@ void ViewProviderSymbol::updateData(const App::Property* prop) ViewProviderDrawingView::updateData(prop); } +void ViewProviderSymbol::onChanged(const App::Property* prop) +{ + if (prop == &(LegacyScaling)) { + QGIView* qgiv = getQView(); + if (qgiv) { + qgiv->updateView(true); + } + } + + ViewProviderDrawingView::onChanged(prop); +} + TechDraw::DrawViewSymbol* ViewProviderSymbol::getViewObject() const { return dynamic_cast(pcObject); diff --git a/src/Mod/TechDraw/Gui/ViewProviderSymbol.h b/src/Mod/TechDraw/Gui/ViewProviderSymbol.h index 23053c601f..67e31603ab 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderSymbol.h +++ b/src/Mod/TechDraw/Gui/ViewProviderSymbol.h @@ -43,8 +43,11 @@ public: /// destructor ~ViewProviderSymbol() override; + App::PropertyBool LegacyScaling; + bool useNewSelectionModel() const override {return false;} void updateData(const App::Property*) override; + void onChanged(const App::Property* prop) override; TechDraw::DrawViewSymbol* getViewObject() const override; }; From 4c93a14fea002da093b7fbe1e3cdb07b11298635 Mon Sep 17 00:00:00 2001 From: tritao Date: Fri, 24 Jan 2025 14:13:36 +0000 Subject: [PATCH 020/224] Gui: Reorganize the dialog files into a top `Dialogs` folder. --- src/Gui/Action.cpp | 2 +- src/Gui/ApplicationPy.cpp | 2 +- src/Gui/CMakeLists.txt | 267 +++++++++--------- src/Gui/Command.cpp | 2 +- src/Gui/CommandDoc.cpp | 6 +- src/Gui/CommandMacro.cpp | 4 +- src/Gui/CommandStd.cpp | 10 +- src/Gui/CommandView.cpp | 2 +- src/Gui/CommandWindow.cpp | 2 +- src/Gui/{ => Dialogs}/AboutApplication.ui | 4 +- src/Gui/{ => Dialogs}/DlgAbout.cpp | 2 +- src/Gui/{ => Dialogs}/DlgAbout.h | 0 src/Gui/{ => Dialogs}/DlgActions.ui | 0 src/Gui/{ => Dialogs}/DlgActionsImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgActionsImp.h | 0 src/Gui/{ => Dialogs}/DlgActivateWindow.ui | 0 .../{ => Dialogs}/DlgActivateWindowImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgActivateWindowImp.h | 0 src/Gui/{ => Dialogs}/DlgAddProperty.cpp | 2 +- src/Gui/{ => Dialogs}/DlgAddProperty.h | 0 src/Gui/{ => Dialogs}/DlgAddProperty.ui | 0 .../{ => Dialogs}/DlgAddPropertyVarSet.cpp | 2 +- src/Gui/{ => Dialogs}/DlgAddPropertyVarSet.h | 0 src/Gui/{ => Dialogs}/DlgAddPropertyVarSet.ui | 0 src/Gui/{ => Dialogs}/DlgAuthorization.ui | 0 .../{ => Dialogs}/DlgCheckableMessageBox.cpp | 2 +- .../{ => Dialogs}/DlgCheckableMessageBox.h | 0 .../{ => Dialogs}/DlgCheckableMessageBox.ui | 0 src/Gui/{ => Dialogs}/DlgChooseIcon.ui | 0 .../DlgCreateNewPreferencePack.ui | 0 .../DlgCreateNewPreferencePackImp.cpp | 2 +- .../DlgCreateNewPreferencePackImp.h | 0 src/Gui/{ => Dialogs}/DlgCustomizeImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgCustomizeImp.h | 0 .../DlgCustomizeSpNavSettings.cpp | 2 +- .../{ => Dialogs}/DlgCustomizeSpNavSettings.h | 0 .../DlgCustomizeSpNavSettings.ui | 14 +- .../{ => Dialogs}/DlgCustomizeSpaceball.cpp | 2 +- src/Gui/{ => Dialogs}/DlgCustomizeSpaceball.h | 0 .../DlgEditFileIncludePropertyExternal.cpp | 2 +- .../DlgEditFileIncludePropertyExternal.h | 2 +- src/Gui/{ => Dialogs}/DlgExpressionInput.cpp | 2 +- src/Gui/{ => Dialogs}/DlgExpressionInput.h | 0 src/Gui/{ => Dialogs}/DlgExpressionInput.ui | 0 src/Gui/{ => Dialogs}/DlgInputDialog.ui | 0 src/Gui/{ => Dialogs}/DlgInputDialogImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgInputDialogImp.h | 0 src/Gui/{ => Dialogs}/DlgKeyboard.ui | 0 src/Gui/{ => Dialogs}/DlgKeyboardImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgKeyboardImp.h | 2 +- src/Gui/{ => Dialogs}/DlgLocationAngle.ui | 0 src/Gui/{ => Dialogs}/DlgLocationPos.ui | 0 src/Gui/{ => Dialogs}/DlgMacroExecute.ui | 0 src/Gui/{ => Dialogs}/DlgMacroExecuteImp.cpp | 6 +- src/Gui/{ => Dialogs}/DlgMacroExecuteImp.h | 0 src/Gui/{ => Dialogs}/DlgMacroRecord.ui | 0 src/Gui/{ => Dialogs}/DlgMacroRecordImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgMacroRecordImp.h | 0 .../{ => Dialogs}/DlgMaterialProperties.ui | 0 .../DlgMaterialPropertiesImp.cpp | 2 +- .../{ => Dialogs}/DlgMaterialPropertiesImp.h | 0 src/Gui/{ => Dialogs}/DlgObjectSelection.cpp | 2 +- src/Gui/{ => Dialogs}/DlgObjectSelection.h | 0 src/Gui/{ => Dialogs}/DlgObjectSelection.ui | 0 src/Gui/{ => Dialogs}/DlgOnlineHelp.ui | 0 src/Gui/{ => Dialogs}/DlgOnlineHelpImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgOnlineHelpImp.h | 0 src/Gui/{ => Dialogs}/DlgParameter.ui | 0 src/Gui/{ => Dialogs}/DlgParameterFind.cpp | 4 +- src/Gui/{ => Dialogs}/DlgParameterFind.h | 0 src/Gui/{ => Dialogs}/DlgParameterFind.ui | 0 src/Gui/{ => Dialogs}/DlgParameterImp.cpp | 6 +- src/Gui/{ => Dialogs}/DlgParameterImp.h | 0 .../DlgPreferencePackManagement.ui | 0 .../DlgPreferencePackManagementImp.cpp | 2 +- .../DlgPreferencePackManagementImp.h | 0 src/Gui/{ => Dialogs}/DlgPreferences.ui | 0 src/Gui/{ => Dialogs}/DlgPreferencesImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgPreferencesImp.h | 0 .../{ => Dialogs}/DlgProjectInformation.ui | 0 .../DlgProjectInformationImp.cpp | 2 +- .../{ => Dialogs}/DlgProjectInformationImp.h | 0 src/Gui/{ => Dialogs}/DlgProjectUtility.cpp | 2 +- src/Gui/{ => Dialogs}/DlgProjectUtility.h | 0 src/Gui/{ => Dialogs}/DlgProjectUtility.ui | 0 src/Gui/{ => Dialogs}/DlgPropertyLink.cpp | 2 +- src/Gui/{ => Dialogs}/DlgPropertyLink.h | 0 src/Gui/{ => Dialogs}/DlgPropertyLink.ui | 0 .../{ => Dialogs}/DlgRevertToBackupConfig.ui | 0 .../DlgRevertToBackupConfigImp.cpp | 2 +- .../DlgRevertToBackupConfigImp.h | 0 src/Gui/{ => Dialogs}/DlgRunExternal.cpp | 2 +- src/Gui/{ => Dialogs}/DlgRunExternal.h | 0 src/Gui/{ => Dialogs}/DlgRunExternal.ui | 0 .../{ => Dialogs}/DlgSettingsColorGradient.ui | 0 .../DlgSettingsColorGradientImp.cpp | 2 +- .../DlgSettingsColorGradientImp.h | 0 src/Gui/{ => Dialogs}/DlgSettingsImage.ui | 0 src/Gui/{ => Dialogs}/DlgSettingsImageImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgSettingsImageImp.h | 0 src/Gui/{ => Dialogs}/DlgToolbars.ui | 10 +- src/Gui/{ => Dialogs}/DlgToolbarsImp.cpp | 4 +- src/Gui/{ => Dialogs}/DlgToolbarsImp.h | 0 src/Gui/{ => Dialogs}/DlgTreeWidget.ui | 0 src/Gui/{ => Dialogs}/DlgUndoRedo.cpp | 2 +- src/Gui/{ => Dialogs}/DlgUndoRedo.h | 0 src/Gui/{ => Dialogs}/DlgUnitsCalculator.ui | 0 .../{ => Dialogs}/DlgUnitsCalculatorImp.cpp | 2 +- src/Gui/{ => Dialogs}/DlgUnitsCalculatorImp.h | 0 src/Gui/DocumentRecovery.cpp | 2 +- src/Gui/DownloadItem.cpp | 2 +- src/Gui/MainWindow.cpp | 2 +- src/Gui/NetworkRetriever.cpp | 2 +- .../PreferencePages/DlgSettingsGeneral.cpp | 8 +- .../ListWidgetDragBugFix.cpp | 0 .../ListWidgetDragBugFix.h | 0 src/Gui/QuantitySpinBox.cpp | 2 +- src/Gui/SoFCColorGradient.cpp | 2 +- src/Gui/SpinBox.cpp | 2 +- src/Gui/StartupProcess.cpp | 2 +- src/Gui/TaskDlgRelocation.cpp | 4 +- src/Gui/ViewProviderLink.cpp | 2 +- src/Gui/ViewProviderVarSet.h | 2 +- src/Gui/WidgetFactory.h | 4 +- src/Gui/Widgets.cpp | 4 +- src/Gui/WorkbenchSelector.cpp | 2 +- src/Gui/propertyeditor/PropertyEditor.cpp | 2 +- src/Gui/propertyeditor/PropertyItem.cpp | 2 +- src/Gui/resource.cpp | 12 +- .../Material/Gui/DlgDisplayPropertiesImp.cpp | 2 +- src/Mod/Part/Gui/AppPartGui.cpp | 2 +- src/Mod/Part/Gui/TaskFaceAppearances.cpp | 2 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 2 +- 133 files changed, 237 insertions(+), 236 deletions(-) rename src/Gui/{ => Dialogs}/AboutApplication.ui (99%) rename src/Gui/{ => Dialogs}/DlgAbout.cpp (99%) rename src/Gui/{ => Dialogs}/DlgAbout.h (100%) rename src/Gui/{ => Dialogs}/DlgActions.ui (100%) rename src/Gui/{ => Dialogs}/DlgActionsImp.cpp (97%) rename src/Gui/{ => Dialogs}/DlgActionsImp.h (100%) rename src/Gui/{ => Dialogs}/DlgActivateWindow.ui (100%) rename src/Gui/{ => Dialogs}/DlgActivateWindowImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgActivateWindowImp.h (100%) rename src/Gui/{ => Dialogs}/DlgAddProperty.cpp (97%) rename src/Gui/{ => Dialogs}/DlgAddProperty.h (100%) rename src/Gui/{ => Dialogs}/DlgAddProperty.ui (100%) rename src/Gui/{ => Dialogs}/DlgAddPropertyVarSet.cpp (99%) rename src/Gui/{ => Dialogs}/DlgAddPropertyVarSet.h (100%) rename src/Gui/{ => Dialogs}/DlgAddPropertyVarSet.ui (100%) rename src/Gui/{ => Dialogs}/DlgAuthorization.ui (100%) rename src/Gui/{ => Dialogs}/DlgCheckableMessageBox.cpp (99%) rename src/Gui/{ => Dialogs}/DlgCheckableMessageBox.h (100%) rename src/Gui/{ => Dialogs}/DlgCheckableMessageBox.ui (100%) rename src/Gui/{ => Dialogs}/DlgChooseIcon.ui (100%) rename src/Gui/{ => Dialogs}/DlgCreateNewPreferencePack.ui (100%) rename src/Gui/{ => Dialogs}/DlgCreateNewPreferencePackImp.cpp (99%) rename src/Gui/{ => Dialogs}/DlgCreateNewPreferencePackImp.h (100%) rename src/Gui/{ => Dialogs}/DlgCustomizeImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgCustomizeImp.h (100%) rename src/Gui/{ => Dialogs}/DlgCustomizeSpNavSettings.cpp (99%) rename src/Gui/{ => Dialogs}/DlgCustomizeSpNavSettings.h (100%) rename src/Gui/{ => Dialogs}/DlgCustomizeSpNavSettings.ui (96%) rename src/Gui/{ => Dialogs}/DlgCustomizeSpaceball.cpp (99%) rename src/Gui/{ => Dialogs}/DlgCustomizeSpaceball.h (100%) rename src/Gui/{ => Dialogs}/DlgEditFileIncludePropertyExternal.cpp (95%) rename src/Gui/{ => Dialogs}/DlgEditFileIncludePropertyExternal.h (96%) rename src/Gui/{ => Dialogs}/DlgExpressionInput.cpp (99%) rename src/Gui/{ => Dialogs}/DlgExpressionInput.h (100%) rename src/Gui/{ => Dialogs}/DlgExpressionInput.ui (100%) rename src/Gui/{ => Dialogs}/DlgInputDialog.ui (100%) rename src/Gui/{ => Dialogs}/DlgInputDialogImp.cpp (95%) rename src/Gui/{ => Dialogs}/DlgInputDialogImp.h (100%) rename src/Gui/{ => Dialogs}/DlgKeyboard.ui (100%) rename src/Gui/{ => Dialogs}/DlgKeyboardImp.cpp (97%) rename src/Gui/{ => Dialogs}/DlgKeyboardImp.h (97%) rename src/Gui/{ => Dialogs}/DlgLocationAngle.ui (100%) rename src/Gui/{ => Dialogs}/DlgLocationPos.ui (100%) rename src/Gui/{ => Dialogs}/DlgMacroExecute.ui (100%) rename src/Gui/{ => Dialogs}/DlgMacroExecuteImp.cpp (97%) rename src/Gui/{ => Dialogs}/DlgMacroExecuteImp.h (100%) rename src/Gui/{ => Dialogs}/DlgMacroRecord.ui (100%) rename src/Gui/{ => Dialogs}/DlgMacroRecordImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgMacroRecordImp.h (100%) rename src/Gui/{ => Dialogs}/DlgMaterialProperties.ui (100%) rename src/Gui/{ => Dialogs}/DlgMaterialPropertiesImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgMaterialPropertiesImp.h (100%) rename src/Gui/{ => Dialogs}/DlgObjectSelection.cpp (99%) rename src/Gui/{ => Dialogs}/DlgObjectSelection.h (100%) rename src/Gui/{ => Dialogs}/DlgObjectSelection.ui (100%) rename src/Gui/{ => Dialogs}/DlgOnlineHelp.ui (100%) rename src/Gui/{ => Dialogs}/DlgOnlineHelpImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgOnlineHelpImp.h (100%) rename src/Gui/{ => Dialogs}/DlgParameter.ui (100%) rename src/Gui/{ => Dialogs}/DlgParameterFind.cpp (99%) rename src/Gui/{ => Dialogs}/DlgParameterFind.h (100%) rename src/Gui/{ => Dialogs}/DlgParameterFind.ui (100%) rename src/Gui/{ => Dialogs}/DlgParameterImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgParameterImp.h (100%) rename src/Gui/{ => Dialogs}/DlgPreferencePackManagement.ui (100%) rename src/Gui/{ => Dialogs}/DlgPreferencePackManagementImp.cpp (99%) rename src/Gui/{ => Dialogs}/DlgPreferencePackManagementImp.h (100%) rename src/Gui/{ => Dialogs}/DlgPreferences.ui (100%) rename src/Gui/{ => Dialogs}/DlgPreferencesImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgPreferencesImp.h (100%) rename src/Gui/{ => Dialogs}/DlgProjectInformation.ui (100%) rename src/Gui/{ => Dialogs}/DlgProjectInformationImp.cpp (97%) rename src/Gui/{ => Dialogs}/DlgProjectInformationImp.h (100%) rename src/Gui/{ => Dialogs}/DlgProjectUtility.cpp (96%) rename src/Gui/{ => Dialogs}/DlgProjectUtility.h (100%) rename src/Gui/{ => Dialogs}/DlgProjectUtility.ui (100%) rename src/Gui/{ => Dialogs}/DlgPropertyLink.cpp (99%) rename src/Gui/{ => Dialogs}/DlgPropertyLink.h (100%) rename src/Gui/{ => Dialogs}/DlgPropertyLink.ui (100%) rename src/Gui/{ => Dialogs}/DlgRevertToBackupConfig.ui (100%) rename src/Gui/{ => Dialogs}/DlgRevertToBackupConfigImp.cpp (98%) rename src/Gui/{ => Dialogs}/DlgRevertToBackupConfigImp.h (100%) rename src/Gui/{ => Dialogs}/DlgRunExternal.cpp (96%) rename src/Gui/{ => Dialogs}/DlgRunExternal.h (100%) rename src/Gui/{ => Dialogs}/DlgRunExternal.ui (100%) rename src/Gui/{ => Dialogs}/DlgSettingsColorGradient.ui (100%) rename src/Gui/{ => Dialogs}/DlgSettingsColorGradientImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgSettingsColorGradientImp.h (100%) rename src/Gui/{ => Dialogs}/DlgSettingsImage.ui (100%) rename src/Gui/{ => Dialogs}/DlgSettingsImageImp.cpp (96%) rename src/Gui/{ => Dialogs}/DlgSettingsImageImp.h (100%) rename src/Gui/{ => Dialogs}/DlgToolbars.ui (97%) rename src/Gui/{ => Dialogs}/DlgToolbarsImp.cpp (97%) rename src/Gui/{ => Dialogs}/DlgToolbarsImp.h (100%) rename src/Gui/{ => Dialogs}/DlgTreeWidget.ui (100%) rename src/Gui/{ => Dialogs}/DlgUndoRedo.cpp (96%) rename src/Gui/{ => Dialogs}/DlgUndoRedo.h (100%) rename src/Gui/{ => Dialogs}/DlgUnitsCalculator.ui (100%) rename src/Gui/{ => Dialogs}/DlgUnitsCalculatorImp.cpp (99%) rename src/Gui/{ => Dialogs}/DlgUnitsCalculatorImp.h (100%) rename src/Gui/{ => PreferencePages}/ListWidgetDragBugFix.cpp (100%) rename src/Gui/{ => PreferencePages}/ListWidgetDragBugFix.h (100%) diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index ecf1c143fe..f340f7fbb6 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -46,7 +46,7 @@ #include "Action.h" #include "BitmapFactory.h" #include "Command.h" -#include "DlgUndoRedo.h" +#include "Dialogs/DlgUndoRedo.h" #include "PreferencePages/DlgSettingsWorkbenchesImp.h" #include "Document.h" #include "EditorView.h" diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index 1db7e93df4..fbe522eef1 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -48,7 +48,7 @@ #include "ApplicationPy.h" #include "BitmapFactory.h" #include "Command.h" -#include "DlgPreferencesImp.h" +#include "Dialogs/DlgPreferencesImp.h" #include "Document.h" #include "DocumentObserverPython.h" #include "DownloadManager.h" diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 45053fa6b4..c87c17e8c6 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -48,6 +48,7 @@ include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Quarter + ${CMAKE_CURRENT_SOURCE_DIR}/PreferencePages ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/.. @@ -354,37 +355,37 @@ set_property(SOURCE GraphvizView.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURR set_property(SOURCE GraphvizView.h APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_GraphvizView.cpp) SET(Gui_UIC_SRCS - AboutApplication.ui + Dialogs/AboutApplication.ui Clipping.ui DemoMode.ui - DlgActions.ui - DlgActivateWindow.ui - DlgUnitsCalculator.ui - DlgAuthorization.ui - DlgChooseIcon.ui - DlgCreateNewPreferencePack.ui - DlgInputDialog.ui - DlgKeyboard.ui - DlgMacroExecute.ui - DlgRunExternal.ui - DlgMacroRecord.ui - DlgMaterialProperties.ui - DlgOnlineHelp.ui - DlgParameter.ui - DlgParameterFind.ui - DlgPreferencePackManagement.ui - DlgPreferences.ui - DlgProjectInformation.ui - DlgProjectUtility.ui - DlgPropertyLink.ui - DlgRevertToBackupConfig.ui + Dialogs/DlgActions.ui + Dialogs/DlgActivateWindow.ui + Dialogs/DlgUnitsCalculator.ui + Dialogs/DlgAuthorization.ui + Dialogs/DlgChooseIcon.ui + Dialogs/DlgCreateNewPreferencePack.ui + Dialogs/DlgInputDialog.ui + Dialogs/DlgKeyboard.ui + Dialogs/DlgMacroExecute.ui + Dialogs/DlgRunExternal.ui + Dialogs/DlgMacroRecord.ui + Dialogs/DlgMaterialProperties.ui + Dialogs/DlgOnlineHelp.ui + Dialogs/DlgParameter.ui + Dialogs/DlgParameterFind.ui + Dialogs/DlgPreferencePackManagement.ui + Dialogs/DlgPreferences.ui + Dialogs/DlgProjectInformation.ui + Dialogs/DlgProjectUtility.ui + Dialogs/DlgPropertyLink.ui + Dialogs/DlgRevertToBackupConfig.ui PreferencePages/DlgSettings3DView.ui PreferencePages/DlgSettingsCacheDirectory.ui - DlgSettingsColorGradient.ui + Dialogs/DlgSettingsColorGradient.ui PreferencePages/DlgSettingsDocument.ui PreferencePages/DlgSettingsEditor.ui PreferencePages/DlgSettingsGeneral.ui - DlgSettingsImage.ui + Dialogs/DlgSettingsImage.ui PreferencePages/DlgSettingsLightSources.ui PreferencePages/DlgSettingsMacro.ui PreferencePages/DlgSettingsNavigation.ui @@ -395,15 +396,15 @@ SET(Gui_UIC_SRCS PreferencePages/DlgSettingsUI.ui PreferencePages/DlgSettingsViewColor.ui PreferencePages/DlgSettingsWorkbenches.ui - DlgCheckableMessageBox.ui - DlgToolbars.ui - DlgTreeWidget.ui - DlgLocationAngle.ui - DlgLocationPos.ui + Dialogs/DlgCheckableMessageBox.ui + Dialogs/DlgToolbars.ui + Dialogs/DlgTreeWidget.ui + Dialogs/DlgLocationAngle.ui + Dialogs/DlgLocationPos.ui DocumentRecovery.ui DownloadManager.ui DownloadItem.ui - DlgExpressionInput.ui + Dialogs/DlgExpressionInput.ui MouseButtons.ui SceneInspector.ui InputVector.ui @@ -415,14 +416,14 @@ SET(Gui_UIC_SRCS TaskView/TaskImage.ui TaskView/TaskSelectLinkProperty.ui TaskElementColors.ui - DlgObjectSelection.ui - DlgAddProperty.ui - DlgAddPropertyVarSet.ui + Dialogs/DlgObjectSelection.ui + Dialogs/DlgAddProperty.ui + Dialogs/DlgAddPropertyVarSet.ui VectorListEditor.ui ) if(FREECAD_USE_3DCONNEXION_LEGACY) - list(APPEND Gui_UIC_SRCS DlgCustomizeSpNavSettings.ui) + list(APPEND Gui_UIC_SRCS Dialogs/DlgCustomizeSpNavSettings.ui) endif(FREECAD_USE_3DCONNEXION_LEGACY) set (FreeCAD_TR_QRC ${CMAKE_CURRENT_BINARY_DIR}/Language/FreeCAD_translation.qrc) @@ -475,28 +476,28 @@ SOURCE_GROUP("Command" FILES ${Command_SRCS}) SET(Dialog_CPP_SRCS Clipping.cpp DemoMode.cpp - DlgAbout.cpp - DlgActivateWindowImp.cpp - DlgCreateNewPreferencePackImp.cpp - DlgUnitsCalculatorImp.cpp - DlgInputDialogImp.cpp - DlgMacroExecuteImp.cpp - DlgRunExternal.cpp - DlgEditFileIncludePropertyExternal.cpp - DlgMacroRecordImp.cpp - DlgMaterialPropertiesImp.cpp - DlgParameterImp.cpp - DlgParameterFind.cpp - DlgPreferencePackManagementImp.cpp - DlgProjectInformationImp.cpp - DlgProjectUtility.cpp - DlgPropertyLink.cpp - DlgRevertToBackupConfigImp.cpp - DlgExpressionInput.cpp + Dialogs/DlgAbout.cpp + Dialogs/DlgActivateWindowImp.cpp + Dialogs/DlgCreateNewPreferencePackImp.cpp + Dialogs/DlgUnitsCalculatorImp.cpp + Dialogs/DlgInputDialogImp.cpp + Dialogs/DlgMacroExecuteImp.cpp + Dialogs/DlgRunExternal.cpp + Dialogs/DlgEditFileIncludePropertyExternal.cpp + Dialogs/DlgMacroRecordImp.cpp + Dialogs/DlgMaterialPropertiesImp.cpp + Dialogs/DlgParameterImp.cpp + Dialogs/DlgParameterFind.cpp + Dialogs/DlgPreferencePackManagementImp.cpp + Dialogs/DlgProjectInformationImp.cpp + Dialogs/DlgProjectUtility.cpp + Dialogs/DlgPropertyLink.cpp + Dialogs/DlgRevertToBackupConfigImp.cpp + Dialogs/DlgExpressionInput.cpp TaskDlgRelocation.cpp - DlgCheckableMessageBox.cpp + Dialogs/DlgCheckableMessageBox.cpp TaskCSysDragger.cpp - DlgUndoRedo.cpp + Dialogs/DlgUndoRedo.cpp InputVector.cpp Placement.cpp PropertyPage.cpp @@ -507,37 +508,37 @@ SET(Dialog_CPP_SRCS DownloadManager.cpp DocumentRecovery.cpp TaskElementColors.cpp - DlgObjectSelection.cpp - DlgAddProperty.cpp - DlgAddPropertyVarSet.cpp + Dialogs/DlgObjectSelection.cpp + Dialogs/DlgAddProperty.cpp + Dialogs/DlgAddPropertyVarSet.cpp VectorListEditor.cpp ) SET(Dialog_HPP_SRCS Clipping.h DemoMode.h - DlgAbout.h - DlgActivateWindowImp.h - DlgCreateNewPreferencePackImp.h - DlgUnitsCalculatorImp.h - DlgInputDialogImp.h - DlgMacroExecuteImp.h - DlgRunExternal.h - DlgEditFileIncludePropertyExternal.h - DlgMacroRecordImp.h - DlgMaterialPropertiesImp.h - DlgParameterImp.h - DlgParameterFind.h - DlgPreferencePackManagementImp.h - DlgProjectInformationImp.h - DlgProjectUtility.h - DlgPropertyLink.h - DlgRevertToBackupConfigImp.h - DlgCheckableMessageBox.h - DlgExpressionInput.h + Dialogs/DlgAbout.h + Dialogs/DlgActivateWindowImp.h + Dialogs/DlgCreateNewPreferencePackImp.h + Dialogs/DlgUnitsCalculatorImp.h + Dialogs/DlgInputDialogImp.h + Dialogs/DlgMacroExecuteImp.h + Dialogs/DlgRunExternal.h + Dialogs/DlgEditFileIncludePropertyExternal.h + Dialogs/DlgMacroRecordImp.h + Dialogs/DlgMaterialPropertiesImp.h + Dialogs/DlgParameterImp.h + Dialogs/DlgParameterFind.h + Dialogs/DlgPreferencePackManagementImp.h + Dialogs/DlgProjectInformationImp.h + Dialogs/DlgProjectUtility.h + Dialogs/DlgPropertyLink.h + Dialogs/DlgRevertToBackupConfigImp.h + Dialogs/DlgCheckableMessageBox.h + Dialogs/DlgExpressionInput.h TaskDlgRelocation.h TaskCSysDragger.h - DlgUndoRedo.h + Dialogs/DlgUndoRedo.h InputVector.h Placement.h PropertyPage.h @@ -548,40 +549,40 @@ SET(Dialog_HPP_SRCS DownloadManager.h DocumentRecovery.h TaskElementColors.h - DlgObjectSelection.h - DlgAddProperty.h - DlgAddPropertyVarSet.h + Dialogs/DlgObjectSelection.h + Dialogs/DlgAddProperty.h + Dialogs/DlgAddPropertyVarSet.h VectorListEditor.h ) SET(Dialog_SRCS ${Dialog_CPP_SRCS} ${Dialog_HPP_SRCS} - AboutApplication.ui + Dialogs/AboutApplication.ui Clipping.ui DemoMode.ui - DlgActivateWindow.ui - DlgUnitsCalculator.ui - DlgAuthorization.ui - DlgInputDialog.ui - DlgAddProperty.ui - DlgLocationAngle.ui - DlgLocationPos.ui - DlgMacroExecute.ui - DlgRunExternal.ui - DlgMacroRecord.ui - DlgMaterialProperties.ui - DlgParameter.ui - DlgParameterFind.ui - DlgPreferencePackManagement.ui - DlgProjectInformation.ui - DlgProjectUtility.ui - DlgPropertyLink.ui - DlgRevertToBackupConfig.ui - DlgCheckableMessageBox.ui - DlgTreeWidget.ui - DlgExpressionInput.ui - DlgCreateNewPreferencePack.ui + Dialogs/DlgActivateWindow.ui + Dialogs/DlgUnitsCalculator.ui + Dialogs/DlgAuthorization.ui + Dialogs/DlgInputDialog.ui + Dialogs/DlgAddProperty.ui + Dialogs/DlgLocationAngle.ui + Dialogs/DlgLocationPos.ui + Dialogs/DlgMacroExecute.ui + Dialogs/DlgRunExternal.ui + Dialogs/DlgMacroRecord.ui + Dialogs/DlgMaterialProperties.ui + Dialogs/DlgParameter.ui + Dialogs/DlgParameterFind.ui + Dialogs/DlgPreferencePackManagement.ui + Dialogs/DlgProjectInformation.ui + Dialogs/DlgProjectUtility.ui + Dialogs/DlgPropertyLink.ui + Dialogs/DlgRevertToBackupConfig.ui + Dialogs/DlgCheckableMessageBox.ui + Dialogs/DlgTreeWidget.ui + Dialogs/DlgExpressionInput.ui + Dialogs/DlgCreateNewPreferencePack.ui DownloadManager.ui DownloadItem.ui DocumentRecovery.ui @@ -591,58 +592,58 @@ SET(Dialog_SRCS SceneInspector.ui TextureMapping.ui TaskElementColors.ui - DlgObjectSelection.ui + Dialogs/DlgObjectSelection.ui VectorListEditor.ui ) SOURCE_GROUP("Dialog" FILES ${Dialog_SRCS}) # The customize dialog sources SET(Dialog_Customize_CPP_SRCS - DlgActionsImp.cpp - DlgCustomizeImp.cpp - DlgKeyboardImp.cpp - DlgToolbarsImp.cpp - ListWidgetDragBugFix.cpp + Dialogs/DlgActionsImp.cpp + Dialogs/DlgCustomizeImp.cpp + Dialogs/DlgKeyboardImp.cpp + Dialogs/DlgToolbarsImp.cpp + PreferencePages/ListWidgetDragBugFix.cpp ) SET(Dialog_Customize_HPP_SRCS - DlgActionsImp.h - DlgCustomizeImp.h - DlgKeyboardImp.h - DlgToolbarsImp.h - ListWidgetDragBugFix.h + Dialogs/DlgActionsImp.h + Dialogs/DlgCustomizeImp.h + Dialogs/DlgKeyboardImp.h + Dialogs/DlgToolbarsImp.h + PreferencePages/ListWidgetDragBugFix.h ) if(FREECAD_USE_3DCONNEXION_LEGACY) - list(APPEND Dialog_Customize_CPP_SRCS DlgCustomizeSpaceball.cpp DlgCustomizeSpNavSettings.cpp) - list(APPEND Dialog_Customize_HPP_SRCS DlgCustomizeSpaceball.h DlgCustomizeSpNavSettings.h) + list(APPEND Dialog_Customize_CPP_SRCS Dialogs/DlgCustomizeSpaceball.cpp Dialogs/DlgCustomizeSpNavSettings.cpp) + list(APPEND Dialog_Customize_HPP_SRCS Dialogs/DlgCustomizeSpaceball.h Dialogs/DlgCustomizeSpNavSettings.h) endif(FREECAD_USE_3DCONNEXION_LEGACY) SET(Dialog_Customize_SRCS ${Dialog_Customize_CPP_SRCS} ${Dialog_Customize_HPP_SRCS} - DlgActions.ui - DlgChooseIcon.ui - DlgKeyboard.ui - DlgToolbars.ui + Dialogs/DlgActions.ui + Dialogs/DlgChooseIcon.ui + Dialogs/DlgKeyboard.ui + Dialogs/DlgToolbars.ui ) if(FREECAD_USE_3DCONNEXION_LEGACY) - list(APPEND Dialog_Customize_SRCS DlgCustomizeSpNavSettings.ui) + list(APPEND Dialog_Customize_SRCS Dialogs/DlgCustomizeSpNavSettings.ui) endif(FREECAD_USE_3DCONNEXION_LEGACY) SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS}) # The settings dialog sources SET(Dialog_Settings_CPP_SRCS - DlgOnlineHelpImp.cpp - DlgPreferencesImp.cpp + Dialogs/DlgOnlineHelpImp.cpp + Dialogs/DlgPreferencesImp.cpp PreferencePages/DlgSettings3DViewImp.cpp PreferencePages/DlgSettingsCacheDirectory.cpp - DlgSettingsColorGradientImp.cpp + Dialogs/DlgSettingsColorGradientImp.cpp PreferencePages/DlgSettingsDocumentImp.cpp PreferencePages/DlgSettingsEditor.cpp PreferencePages/DlgSettingsGeneral.cpp - DlgSettingsImageImp.cpp + Dialogs/DlgSettingsImageImp.cpp PreferencePages/DlgSettingsLightSources.cpp PreferencePages/DlgSettingsMacroImp.cpp PreferencePages/DlgSettingsNavigation.cpp @@ -656,15 +657,15 @@ SET(Dialog_Settings_CPP_SRCS PreferencePages/DlgSettingsAdvanced.cpp ) SET(Dialog_Settings_HPP_SRCS - DlgOnlineHelpImp.h - DlgPreferencesImp.h + Dialogs/DlgOnlineHelpImp.h + Dialogs/DlgPreferencesImp.h PreferencePages/DlgSettings3DViewImp.h PreferencePages/DlgSettingsCacheDirectory.h - DlgSettingsColorGradientImp.h + Dialogs/DlgSettingsColorGradientImp.h PreferencePages/DlgSettingsDocumentImp.h PreferencePages/DlgSettingsEditor.h PreferencePages/DlgSettingsGeneral.h - DlgSettingsImageImp.h + Dialogs/DlgSettingsImageImp.h PreferencePages/DlgSettingsLightSources.h PreferencePages/DlgSettingsMacroImp.h PreferencePages/DlgSettingsNavigation.h @@ -680,15 +681,15 @@ SET(Dialog_Settings_HPP_SRCS SET(Dialog_Settings_SRCS ${Dialog_Settings_CPP_SRCS} ${Dialog_Settings_HPP_SRCS} - DlgOnlineHelp.ui - DlgPreferences.ui + Dialogs/DlgOnlineHelp.ui + Dialogs/DlgPreferences.ui PreferencePages/DlgSettings3DView.ui PreferencePages/DlgSettingsCacheDirectory.ui - DlgSettingsColorGradient.ui + Dialogs/DlgSettingsColorGradient.ui PreferencePages/DlgSettingsDocument.ui PreferencePages/DlgSettingsEditor.ui PreferencePages/DlgSettingsGeneral.ui - DlgSettingsImage.ui + Dialogs/DlgSettingsImage.ui PreferencePages/DlgSettingsLightSources.ui PreferencePages/DlgSettingsMacro.ui PreferencePages/DlgSettingsNavigation.ui diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 750cd4fbf0..848e71a1e8 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -50,7 +50,7 @@ #include "Application.h" #include "BitmapFactory.h" #include "Control.h" -#include "DlgUndoRedo.h" +#include "Dialogs/DlgUndoRedo.h" #include "Document.h" #include "frameobject.h" #include "Macro.h" diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index a61512d16c..73d746c5de 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -55,9 +55,9 @@ #include "FileDialog.h" #include "MainWindow.h" #include "Selection.h" -#include "DlgObjectSelection.h" -#include "DlgProjectInformationImp.h" -#include "DlgProjectUtility.h" +#include "Dialogs/DlgObjectSelection.h" +#include "Dialogs/DlgProjectInformationImp.h" +#include "Dialogs/DlgProjectUtility.h" #include "GraphvizView.h" #include "ManualAlignment.h" #include "MergeDocuments.h" diff --git a/src/Gui/CommandMacro.cpp b/src/Gui/CommandMacro.cpp index f192213ae8..ed022cde1a 100644 --- a/src/Gui/CommandMacro.cpp +++ b/src/Gui/CommandMacro.cpp @@ -29,8 +29,8 @@ #include "Action.h" #include "Application.h" #include "BitmapFactory.h" -#include "DlgMacroExecuteImp.h" -#include "DlgMacroRecordImp.h" +#include "Dialogs/DlgMacroExecuteImp.h" +#include "Dialogs/DlgMacroRecordImp.h" #include "Macro.h" #include "MainWindow.h" #include "PythonDebugger.h" diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index 67536d6d62..fca4486f29 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -42,11 +42,11 @@ #include "Action.h" #include "BitmapFactory.h" #include "Command.h" -#include "DlgAbout.h" -#include "DlgCustomizeImp.h" -#include "DlgParameterImp.h" -#include "DlgPreferencesImp.h" -#include "DlgUnitsCalculatorImp.h" +#include "Dialogs/DlgAbout.h" +#include "Dialogs/DlgCustomizeImp.h" +#include "Dialogs/DlgParameterImp.h" +#include "Dialogs/DlgPreferencesImp.h" +#include "Dialogs/DlgUnitsCalculatorImp.h" #include "GuiConsole.h" #include "MainWindow.h" #include "OnlineDocumentation.h" diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 672c4862c6..4182446f56 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -61,7 +61,7 @@ #include "Control.h" #include "Clipping.h" #include "DemoMode.h" -#include "DlgSettingsImageImp.h" +#include "Dialogs/DlgSettingsImageImp.h" #include "Document.h" #include "FileDialog.h" #include "ImageView.h" diff --git a/src/Gui/CommandWindow.cpp b/src/Gui/CommandWindow.cpp index c8ee5c24ed..b4e925aee5 100644 --- a/src/Gui/CommandWindow.cpp +++ b/src/Gui/CommandWindow.cpp @@ -34,7 +34,7 @@ #include "MainWindow.h" #include "View.h" #include "Document.h" -#include "DlgActivateWindowImp.h" +#include "Dialogs/DlgActivateWindowImp.h" #include "DockWindowManager.h" #include "ToolBarManager.h" diff --git a/src/Gui/AboutApplication.ui b/src/Gui/Dialogs/AboutApplication.ui similarity index 99% rename from src/Gui/AboutApplication.ui rename to src/Gui/Dialogs/AboutApplication.ui index 61787e56c1..d8b4daa7fd 100644 --- a/src/Gui/AboutApplication.ui +++ b/src/Gui/Dialogs/AboutApplication.ui @@ -33,7 +33,7 @@
- :/icons/freecadsplash.png + :/icons/freecadsplash.png Qt::AlignCenter @@ -398,7 +398,7 @@ p, li { white-space: pre-wrap; } - + diff --git a/src/Gui/DlgAbout.cpp b/src/Gui/Dialogs/DlgAbout.cpp similarity index 99% rename from src/Gui/DlgAbout.cpp rename to src/Gui/Dialogs/DlgAbout.cpp index 74ec04eaee..d1d5e5316d 100644 --- a/src/Gui/DlgAbout.cpp +++ b/src/Gui/Dialogs/DlgAbout.cpp @@ -52,7 +52,7 @@ #include #include "BitmapFactory.h" -#include "DlgAbout.h" +#include "Dialogs/DlgAbout.h" #include "MainWindow.h" #include "SplashScreen.h" #include "ui_AboutApplication.h" diff --git a/src/Gui/DlgAbout.h b/src/Gui/Dialogs/DlgAbout.h similarity index 100% rename from src/Gui/DlgAbout.h rename to src/Gui/Dialogs/DlgAbout.h diff --git a/src/Gui/DlgActions.ui b/src/Gui/Dialogs/DlgActions.ui similarity index 100% rename from src/Gui/DlgActions.ui rename to src/Gui/Dialogs/DlgActions.ui diff --git a/src/Gui/DlgActionsImp.cpp b/src/Gui/Dialogs/DlgActionsImp.cpp similarity index 97% rename from src/Gui/DlgActionsImp.cpp rename to src/Gui/Dialogs/DlgActionsImp.cpp index a1c72702e5..0bd33c804a 100644 --- a/src/Gui/DlgActionsImp.cpp +++ b/src/Gui/Dialogs/DlgActionsImp.cpp @@ -33,7 +33,7 @@ #include #endif -#include "DlgActionsImp.h" +#include "Dialogs/DlgActionsImp.h" #include "ui_DlgActions.h" #include "Action.h" #include "Application.h" diff --git a/src/Gui/DlgActionsImp.h b/src/Gui/Dialogs/DlgActionsImp.h similarity index 100% rename from src/Gui/DlgActionsImp.h rename to src/Gui/Dialogs/DlgActionsImp.h diff --git a/src/Gui/DlgActivateWindow.ui b/src/Gui/Dialogs/DlgActivateWindow.ui similarity index 100% rename from src/Gui/DlgActivateWindow.ui rename to src/Gui/Dialogs/DlgActivateWindow.ui diff --git a/src/Gui/DlgActivateWindowImp.cpp b/src/Gui/Dialogs/DlgActivateWindowImp.cpp similarity index 96% rename from src/Gui/DlgActivateWindowImp.cpp rename to src/Gui/Dialogs/DlgActivateWindowImp.cpp index 1a7abd4829..8449fe9069 100644 --- a/src/Gui/DlgActivateWindowImp.cpp +++ b/src/Gui/Dialogs/DlgActivateWindowImp.cpp @@ -26,7 +26,7 @@ # include #endif -#include "DlgActivateWindowImp.h" +#include "Dialogs/DlgActivateWindowImp.h" #include "ui_DlgActivateWindow.h" #include "MainWindow.h" #include "MDIView.h" diff --git a/src/Gui/DlgActivateWindowImp.h b/src/Gui/Dialogs/DlgActivateWindowImp.h similarity index 100% rename from src/Gui/DlgActivateWindowImp.h rename to src/Gui/Dialogs/DlgActivateWindowImp.h diff --git a/src/Gui/DlgAddProperty.cpp b/src/Gui/Dialogs/DlgAddProperty.cpp similarity index 97% rename from src/Gui/DlgAddProperty.cpp rename to src/Gui/Dialogs/DlgAddProperty.cpp index 1454fec98a..f307dbf8bd 100644 --- a/src/Gui/DlgAddProperty.cpp +++ b/src/Gui/Dialogs/DlgAddProperty.cpp @@ -31,7 +31,7 @@ #include #include -#include "DlgAddProperty.h" +#include "Dialogs/DlgAddProperty.h" #include "ui_DlgAddProperty.h" #include "MainWindow.h" #include "ViewProviderDocumentObject.h" diff --git a/src/Gui/DlgAddProperty.h b/src/Gui/Dialogs/DlgAddProperty.h similarity index 100% rename from src/Gui/DlgAddProperty.h rename to src/Gui/Dialogs/DlgAddProperty.h diff --git a/src/Gui/DlgAddProperty.ui b/src/Gui/Dialogs/DlgAddProperty.ui similarity index 100% rename from src/Gui/DlgAddProperty.ui rename to src/Gui/Dialogs/DlgAddProperty.ui diff --git a/src/Gui/DlgAddPropertyVarSet.cpp b/src/Gui/Dialogs/DlgAddPropertyVarSet.cpp similarity index 99% rename from src/Gui/DlgAddPropertyVarSet.cpp rename to src/Gui/Dialogs/DlgAddPropertyVarSet.cpp index adbd4a3504..9588527464 100644 --- a/src/Gui/DlgAddPropertyVarSet.cpp +++ b/src/Gui/Dialogs/DlgAddPropertyVarSet.cpp @@ -34,7 +34,7 @@ #include #include -#include "DlgAddPropertyVarSet.h" +#include "Dialogs/DlgAddPropertyVarSet.h" #include "ui_DlgAddPropertyVarSet.h" #include "MainWindow.h" #include "ViewProviderVarSet.h" diff --git a/src/Gui/DlgAddPropertyVarSet.h b/src/Gui/Dialogs/DlgAddPropertyVarSet.h similarity index 100% rename from src/Gui/DlgAddPropertyVarSet.h rename to src/Gui/Dialogs/DlgAddPropertyVarSet.h diff --git a/src/Gui/DlgAddPropertyVarSet.ui b/src/Gui/Dialogs/DlgAddPropertyVarSet.ui similarity index 100% rename from src/Gui/DlgAddPropertyVarSet.ui rename to src/Gui/Dialogs/DlgAddPropertyVarSet.ui diff --git a/src/Gui/DlgAuthorization.ui b/src/Gui/Dialogs/DlgAuthorization.ui similarity index 100% rename from src/Gui/DlgAuthorization.ui rename to src/Gui/Dialogs/DlgAuthorization.ui diff --git a/src/Gui/DlgCheckableMessageBox.cpp b/src/Gui/Dialogs/DlgCheckableMessageBox.cpp similarity index 99% rename from src/Gui/DlgCheckableMessageBox.cpp rename to src/Gui/Dialogs/DlgCheckableMessageBox.cpp index 815281ec2b..072be58316 100644 --- a/src/Gui/DlgCheckableMessageBox.cpp +++ b/src/Gui/Dialogs/DlgCheckableMessageBox.cpp @@ -35,7 +35,7 @@ #include -#include "DlgCheckableMessageBox.h" +#include "Dialogs/DlgCheckableMessageBox.h" #include "ui_DlgCheckableMessageBox.h" #include "MainWindow.h" diff --git a/src/Gui/DlgCheckableMessageBox.h b/src/Gui/Dialogs/DlgCheckableMessageBox.h similarity index 100% rename from src/Gui/DlgCheckableMessageBox.h rename to src/Gui/Dialogs/DlgCheckableMessageBox.h diff --git a/src/Gui/DlgCheckableMessageBox.ui b/src/Gui/Dialogs/DlgCheckableMessageBox.ui similarity index 100% rename from src/Gui/DlgCheckableMessageBox.ui rename to src/Gui/Dialogs/DlgCheckableMessageBox.ui diff --git a/src/Gui/DlgChooseIcon.ui b/src/Gui/Dialogs/DlgChooseIcon.ui similarity index 100% rename from src/Gui/DlgChooseIcon.ui rename to src/Gui/Dialogs/DlgChooseIcon.ui diff --git a/src/Gui/DlgCreateNewPreferencePack.ui b/src/Gui/Dialogs/DlgCreateNewPreferencePack.ui similarity index 100% rename from src/Gui/DlgCreateNewPreferencePack.ui rename to src/Gui/Dialogs/DlgCreateNewPreferencePack.ui diff --git a/src/Gui/DlgCreateNewPreferencePackImp.cpp b/src/Gui/Dialogs/DlgCreateNewPreferencePackImp.cpp similarity index 99% rename from src/Gui/DlgCreateNewPreferencePackImp.cpp rename to src/Gui/Dialogs/DlgCreateNewPreferencePackImp.cpp index 5f0656ea38..e9b0577ca5 100644 --- a/src/Gui/DlgCreateNewPreferencePackImp.cpp +++ b/src/Gui/Dialogs/DlgCreateNewPreferencePackImp.cpp @@ -29,7 +29,7 @@ # include #endif -#include "DlgCreateNewPreferencePackImp.h" +#include "Dialogs/DlgCreateNewPreferencePackImp.h" #include "ui_DlgCreateNewPreferencePack.h" #include "FileDialog.h" diff --git a/src/Gui/DlgCreateNewPreferencePackImp.h b/src/Gui/Dialogs/DlgCreateNewPreferencePackImp.h similarity index 100% rename from src/Gui/DlgCreateNewPreferencePackImp.h rename to src/Gui/Dialogs/DlgCreateNewPreferencePackImp.h diff --git a/src/Gui/DlgCustomizeImp.cpp b/src/Gui/Dialogs/DlgCustomizeImp.cpp similarity index 96% rename from src/Gui/DlgCustomizeImp.cpp rename to src/Gui/Dialogs/DlgCustomizeImp.cpp index c1109d25c5..df6614d84b 100644 --- a/src/Gui/DlgCustomizeImp.cpp +++ b/src/Gui/Dialogs/DlgCustomizeImp.cpp @@ -29,7 +29,7 @@ # include #endif -#include "DlgCustomizeImp.h" +#include "Dialogs/DlgCustomizeImp.h" #include "MainWindow.h" #include "WidgetFactory.h" diff --git a/src/Gui/DlgCustomizeImp.h b/src/Gui/Dialogs/DlgCustomizeImp.h similarity index 100% rename from src/Gui/DlgCustomizeImp.h rename to src/Gui/Dialogs/DlgCustomizeImp.h diff --git a/src/Gui/DlgCustomizeSpNavSettings.cpp b/src/Gui/Dialogs/DlgCustomizeSpNavSettings.cpp similarity index 99% rename from src/Gui/DlgCustomizeSpNavSettings.cpp rename to src/Gui/Dialogs/DlgCustomizeSpNavSettings.cpp index 3840d0b20e..8ee96ead45 100644 --- a/src/Gui/DlgCustomizeSpNavSettings.cpp +++ b/src/Gui/Dialogs/DlgCustomizeSpNavSettings.cpp @@ -22,7 +22,7 @@ #include "PreCompiled.h" -#include "DlgCustomizeSpNavSettings.h" +#include "Dialogs/DlgCustomizeSpNavSettings.h" #include "ui_DlgCustomizeSpNavSettings.h" #include "Application.h" #include "GuiApplicationNativeEventAware.h" diff --git a/src/Gui/DlgCustomizeSpNavSettings.h b/src/Gui/Dialogs/DlgCustomizeSpNavSettings.h similarity index 100% rename from src/Gui/DlgCustomizeSpNavSettings.h rename to src/Gui/Dialogs/DlgCustomizeSpNavSettings.h diff --git a/src/Gui/DlgCustomizeSpNavSettings.ui b/src/Gui/Dialogs/DlgCustomizeSpNavSettings.ui similarity index 96% rename from src/Gui/DlgCustomizeSpNavSettings.ui rename to src/Gui/Dialogs/DlgCustomizeSpNavSettings.ui index 6784470029..06665c5de3 100644 --- a/src/Gui/DlgCustomizeSpNavSettings.ui +++ b/src/Gui/Dialogs/DlgCustomizeSpNavSettings.ui @@ -140,7 +140,7 @@ - :/icons/SpNav-PanLR + :/icons/SpNav-PanLR @@ -150,7 +150,7 @@ - :/icons/SpNav-PanUD + :/icons/SpNav-PanUD @@ -160,7 +160,7 @@ - :/icons/SpNav-Zoom + :/icons/SpNav-Zoom @@ -170,7 +170,7 @@ - :/icons/SpNav-Tilt + :/icons/SpNav-Tilt @@ -180,7 +180,7 @@ - :/icons/SpNav-Roll + :/icons/SpNav-Roll @@ -190,7 +190,7 @@ - :/icons/SpNav-Spin + :/icons/SpNav-Spin @@ -528,7 +528,7 @@ - + diff --git a/src/Gui/DlgCustomizeSpaceball.cpp b/src/Gui/Dialogs/DlgCustomizeSpaceball.cpp similarity index 99% rename from src/Gui/DlgCustomizeSpaceball.cpp rename to src/Gui/Dialogs/DlgCustomizeSpaceball.cpp index aa4a00cca6..8630d7a688 100644 --- a/src/Gui/DlgCustomizeSpaceball.cpp +++ b/src/Gui/Dialogs/DlgCustomizeSpaceball.cpp @@ -39,7 +39,7 @@ #include "Base/Console.h" #include "Command.h" -#include "DlgCustomizeSpaceball.h" +#include "Dialogs/DlgCustomizeSpaceball.h" #include "Application.h" #include "BitmapFactory.h" #include "GuiApplicationNativeEventAware.h" diff --git a/src/Gui/DlgCustomizeSpaceball.h b/src/Gui/Dialogs/DlgCustomizeSpaceball.h similarity index 100% rename from src/Gui/DlgCustomizeSpaceball.h rename to src/Gui/Dialogs/DlgCustomizeSpaceball.h diff --git a/src/Gui/DlgEditFileIncludePropertyExternal.cpp b/src/Gui/Dialogs/DlgEditFileIncludePropertyExternal.cpp similarity index 95% rename from src/Gui/DlgEditFileIncludePropertyExternal.cpp rename to src/Gui/Dialogs/DlgEditFileIncludePropertyExternal.cpp index f273a21611..803372e5b2 100644 --- a/src/Gui/DlgEditFileIncludePropertyExternal.cpp +++ b/src/Gui/Dialogs/DlgEditFileIncludePropertyExternal.cpp @@ -22,7 +22,7 @@ #include "PreCompiled.h" -#include "DlgEditFileIncludePropertyExternal.h" +#include "Dialogs/DlgEditFileIncludePropertyExternal.h" #include "Application.h" #include "FileDialog.h" diff --git a/src/Gui/DlgEditFileIncludePropertyExternal.h b/src/Gui/Dialogs/DlgEditFileIncludePropertyExternal.h similarity index 96% rename from src/Gui/DlgEditFileIncludePropertyExternal.h rename to src/Gui/Dialogs/DlgEditFileIncludePropertyExternal.h index 9826c4c047..d31101ce5b 100644 --- a/src/Gui/DlgEditFileIncludePropertyExternal.h +++ b/src/Gui/Dialogs/DlgEditFileIncludePropertyExternal.h @@ -24,7 +24,7 @@ #ifndef GUI_DIALOG_DlgEditFileIncludePropertyExternal_H #define GUI_DIALOG_DlgEditFileIncludePropertyExternal_H -#include "DlgRunExternal.h" +#include "Dialogs/DlgRunExternal.h" #include namespace Gui { diff --git a/src/Gui/DlgExpressionInput.cpp b/src/Gui/Dialogs/DlgExpressionInput.cpp similarity index 99% rename from src/Gui/DlgExpressionInput.cpp rename to src/Gui/Dialogs/DlgExpressionInput.cpp index 61798c8fa4..98e279af6a 100644 --- a/src/Gui/DlgExpressionInput.cpp +++ b/src/Gui/Dialogs/DlgExpressionInput.cpp @@ -37,7 +37,7 @@ #include #include -#include "DlgExpressionInput.h" +#include "Dialogs/DlgExpressionInput.h" #include "ui_DlgExpressionInput.h" #include "Application.h" #include "Command.h" diff --git a/src/Gui/DlgExpressionInput.h b/src/Gui/Dialogs/DlgExpressionInput.h similarity index 100% rename from src/Gui/DlgExpressionInput.h rename to src/Gui/Dialogs/DlgExpressionInput.h diff --git a/src/Gui/DlgExpressionInput.ui b/src/Gui/Dialogs/DlgExpressionInput.ui similarity index 100% rename from src/Gui/DlgExpressionInput.ui rename to src/Gui/Dialogs/DlgExpressionInput.ui diff --git a/src/Gui/DlgInputDialog.ui b/src/Gui/Dialogs/DlgInputDialog.ui similarity index 100% rename from src/Gui/DlgInputDialog.ui rename to src/Gui/Dialogs/DlgInputDialog.ui diff --git a/src/Gui/DlgInputDialogImp.cpp b/src/Gui/Dialogs/DlgInputDialogImp.cpp similarity index 95% rename from src/Gui/DlgInputDialogImp.cpp rename to src/Gui/Dialogs/DlgInputDialogImp.cpp index 5f70de8a6c..b386dd0151 100644 --- a/src/Gui/DlgInputDialogImp.cpp +++ b/src/Gui/Dialogs/DlgInputDialogImp.cpp @@ -26,7 +26,7 @@ # include #endif -#include "DlgInputDialogImp.h" +#include "Dialogs/DlgInputDialogImp.h" #include "ui_DlgInputDialog.h" #include "SpinBox.h" diff --git a/src/Gui/DlgInputDialogImp.h b/src/Gui/Dialogs/DlgInputDialogImp.h similarity index 100% rename from src/Gui/DlgInputDialogImp.h rename to src/Gui/Dialogs/DlgInputDialogImp.h diff --git a/src/Gui/DlgKeyboard.ui b/src/Gui/Dialogs/DlgKeyboard.ui similarity index 100% rename from src/Gui/DlgKeyboard.ui rename to src/Gui/Dialogs/DlgKeyboard.ui diff --git a/src/Gui/DlgKeyboardImp.cpp b/src/Gui/Dialogs/DlgKeyboardImp.cpp similarity index 97% rename from src/Gui/DlgKeyboardImp.cpp rename to src/Gui/Dialogs/DlgKeyboardImp.cpp index fe703f5a44..6a90b7950c 100644 --- a/src/Gui/DlgKeyboardImp.cpp +++ b/src/Gui/Dialogs/DlgKeyboardImp.cpp @@ -34,7 +34,7 @@ #include #include -#include "DlgKeyboardImp.h" +#include "Dialogs/DlgKeyboardImp.h" #include "ui_DlgKeyboard.h" #include "Action.h" #include "Application.h" diff --git a/src/Gui/DlgKeyboardImp.h b/src/Gui/Dialogs/DlgKeyboardImp.h similarity index 97% rename from src/Gui/DlgKeyboardImp.h rename to src/Gui/Dialogs/DlgKeyboardImp.h index a52a67282a..1cdc954439 100644 --- a/src/Gui/DlgKeyboardImp.h +++ b/src/Gui/Dialogs/DlgKeyboardImp.h @@ -24,7 +24,7 @@ #ifndef GUI_DIALOG_DLGKEYBOARD_IMP_H #define GUI_DIALOG_DLGKEYBOARD_IMP_H -#include +#include #include #include #include diff --git a/src/Gui/DlgLocationAngle.ui b/src/Gui/Dialogs/DlgLocationAngle.ui similarity index 100% rename from src/Gui/DlgLocationAngle.ui rename to src/Gui/Dialogs/DlgLocationAngle.ui diff --git a/src/Gui/DlgLocationPos.ui b/src/Gui/Dialogs/DlgLocationPos.ui similarity index 100% rename from src/Gui/DlgLocationPos.ui rename to src/Gui/Dialogs/DlgLocationPos.ui diff --git a/src/Gui/DlgMacroExecute.ui b/src/Gui/Dialogs/DlgMacroExecute.ui similarity index 100% rename from src/Gui/DlgMacroExecute.ui rename to src/Gui/Dialogs/DlgMacroExecute.ui diff --git a/src/Gui/DlgMacroExecuteImp.cpp b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp similarity index 97% rename from src/Gui/DlgMacroExecuteImp.cpp rename to src/Gui/Dialogs/DlgMacroExecuteImp.cpp index 24ac9e982d..2b8401b61a 100644 --- a/src/Gui/DlgMacroExecuteImp.cpp +++ b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp @@ -34,13 +34,13 @@ #include #include -#include "DlgMacroExecuteImp.h" +#include "Dialogs/DlgMacroExecuteImp.h" #include "ui_DlgMacroExecute.h" #include "Application.h" #include "BitmapFactory.h" #include "Command.h" -#include "DlgCustomizeImp.h" -#include "DlgToolbarsImp.h" +#include "Dialogs/DlgCustomizeImp.h" +#include "Dialogs/DlgToolbarsImp.h" #include "Document.h" #include "EditorView.h" #include "Macro.h" diff --git a/src/Gui/DlgMacroExecuteImp.h b/src/Gui/Dialogs/DlgMacroExecuteImp.h similarity index 100% rename from src/Gui/DlgMacroExecuteImp.h rename to src/Gui/Dialogs/DlgMacroExecuteImp.h diff --git a/src/Gui/DlgMacroRecord.ui b/src/Gui/Dialogs/DlgMacroRecord.ui similarity index 100% rename from src/Gui/DlgMacroRecord.ui rename to src/Gui/Dialogs/DlgMacroRecord.ui diff --git a/src/Gui/DlgMacroRecordImp.cpp b/src/Gui/Dialogs/DlgMacroRecordImp.cpp similarity index 96% rename from src/Gui/DlgMacroRecordImp.cpp rename to src/Gui/Dialogs/DlgMacroRecordImp.cpp index 9e0f6b3d1b..01ae153a2b 100644 --- a/src/Gui/DlgMacroRecordImp.cpp +++ b/src/Gui/Dialogs/DlgMacroRecordImp.cpp @@ -28,7 +28,7 @@ #include #endif -#include "DlgMacroRecordImp.h" +#include "Dialogs/DlgMacroRecordImp.h" #include "ui_DlgMacroRecord.h" #include "Application.h" #include "FileDialog.h" diff --git a/src/Gui/DlgMacroRecordImp.h b/src/Gui/Dialogs/DlgMacroRecordImp.h similarity index 100% rename from src/Gui/DlgMacroRecordImp.h rename to src/Gui/Dialogs/DlgMacroRecordImp.h diff --git a/src/Gui/DlgMaterialProperties.ui b/src/Gui/Dialogs/DlgMaterialProperties.ui similarity index 100% rename from src/Gui/DlgMaterialProperties.ui rename to src/Gui/Dialogs/DlgMaterialProperties.ui diff --git a/src/Gui/DlgMaterialPropertiesImp.cpp b/src/Gui/Dialogs/DlgMaterialPropertiesImp.cpp similarity index 96% rename from src/Gui/DlgMaterialPropertiesImp.cpp rename to src/Gui/Dialogs/DlgMaterialPropertiesImp.cpp index 77defe6836..a121928968 100644 --- a/src/Gui/DlgMaterialPropertiesImp.cpp +++ b/src/Gui/Dialogs/DlgMaterialPropertiesImp.cpp @@ -24,7 +24,7 @@ #include -#include "DlgMaterialPropertiesImp.h" +#include "Dialogs/DlgMaterialPropertiesImp.h" #include "ui_DlgMaterialProperties.h" #include "ViewProvider.h" diff --git a/src/Gui/DlgMaterialPropertiesImp.h b/src/Gui/Dialogs/DlgMaterialPropertiesImp.h similarity index 100% rename from src/Gui/DlgMaterialPropertiesImp.h rename to src/Gui/Dialogs/DlgMaterialPropertiesImp.h diff --git a/src/Gui/DlgObjectSelection.cpp b/src/Gui/Dialogs/DlgObjectSelection.cpp similarity index 99% rename from src/Gui/DlgObjectSelection.cpp rename to src/Gui/Dialogs/DlgObjectSelection.cpp index 1392ab3b47..89869fc7f8 100644 --- a/src/Gui/DlgObjectSelection.cpp +++ b/src/Gui/Dialogs/DlgObjectSelection.cpp @@ -30,7 +30,7 @@ #include #include -#include "DlgObjectSelection.h" +#include "Dialogs/DlgObjectSelection.h" #include "ui_DlgObjectSelection.h" #include "Application.h" #include "MainWindow.h" diff --git a/src/Gui/DlgObjectSelection.h b/src/Gui/Dialogs/DlgObjectSelection.h similarity index 100% rename from src/Gui/DlgObjectSelection.h rename to src/Gui/Dialogs/DlgObjectSelection.h diff --git a/src/Gui/DlgObjectSelection.ui b/src/Gui/Dialogs/DlgObjectSelection.ui similarity index 100% rename from src/Gui/DlgObjectSelection.ui rename to src/Gui/Dialogs/DlgObjectSelection.ui diff --git a/src/Gui/DlgOnlineHelp.ui b/src/Gui/Dialogs/DlgOnlineHelp.ui similarity index 100% rename from src/Gui/DlgOnlineHelp.ui rename to src/Gui/Dialogs/DlgOnlineHelp.ui diff --git a/src/Gui/DlgOnlineHelpImp.cpp b/src/Gui/Dialogs/DlgOnlineHelpImp.cpp similarity index 96% rename from src/Gui/DlgOnlineHelpImp.cpp rename to src/Gui/Dialogs/DlgOnlineHelpImp.cpp index a16cf2ec1e..e0b8e9982a 100644 --- a/src/Gui/DlgOnlineHelpImp.cpp +++ b/src/Gui/Dialogs/DlgOnlineHelpImp.cpp @@ -28,7 +28,7 @@ #include -#include "DlgOnlineHelpImp.h" +#include "Dialogs/DlgOnlineHelpImp.h" #include "ui_DlgOnlineHelp.h" diff --git a/src/Gui/DlgOnlineHelpImp.h b/src/Gui/Dialogs/DlgOnlineHelpImp.h similarity index 100% rename from src/Gui/DlgOnlineHelpImp.h rename to src/Gui/Dialogs/DlgOnlineHelpImp.h diff --git a/src/Gui/DlgParameter.ui b/src/Gui/Dialogs/DlgParameter.ui similarity index 100% rename from src/Gui/DlgParameter.ui rename to src/Gui/Dialogs/DlgParameter.ui diff --git a/src/Gui/DlgParameterFind.cpp b/src/Gui/Dialogs/DlgParameterFind.cpp similarity index 99% rename from src/Gui/DlgParameterFind.cpp rename to src/Gui/Dialogs/DlgParameterFind.cpp index 9ec5c46dbf..1fb2dcdc8c 100644 --- a/src/Gui/DlgParameterFind.cpp +++ b/src/Gui/Dialogs/DlgParameterFind.cpp @@ -26,9 +26,9 @@ #include #endif -#include "DlgParameterFind.h" +#include "Dialogs/DlgParameterFind.h" #include "ui_DlgParameterFind.h" -#include "DlgParameterImp.h" +#include "Dialogs/DlgParameterImp.h" using namespace Gui::Dialog; diff --git a/src/Gui/DlgParameterFind.h b/src/Gui/Dialogs/DlgParameterFind.h similarity index 100% rename from src/Gui/DlgParameterFind.h rename to src/Gui/Dialogs/DlgParameterFind.h diff --git a/src/Gui/DlgParameterFind.ui b/src/Gui/Dialogs/DlgParameterFind.ui similarity index 100% rename from src/Gui/DlgParameterFind.ui rename to src/Gui/Dialogs/DlgParameterFind.ui diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/Dialogs/DlgParameterImp.cpp similarity index 96% rename from src/Gui/DlgParameterImp.cpp rename to src/Gui/Dialogs/DlgParameterImp.cpp index 51cc3e861f..50a5e1501b 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/Dialogs/DlgParameterImp.cpp @@ -36,11 +36,11 @@ #include #include -#include "DlgParameterImp.h" +#include "Dialogs/DlgParameterImp.h" #include "ui_DlgParameter.h" #include "BitmapFactory.h" -#include "DlgParameterFind.h" -#include "DlgInputDialogImp.h" +#include "Dialogs/DlgParameterFind.h" +#include "Dialogs/DlgInputDialogImp.h" #include "FileDialog.h" #include "SpinBox.h" diff --git a/src/Gui/DlgParameterImp.h b/src/Gui/Dialogs/DlgParameterImp.h similarity index 100% rename from src/Gui/DlgParameterImp.h rename to src/Gui/Dialogs/DlgParameterImp.h diff --git a/src/Gui/DlgPreferencePackManagement.ui b/src/Gui/Dialogs/DlgPreferencePackManagement.ui similarity index 100% rename from src/Gui/DlgPreferencePackManagement.ui rename to src/Gui/Dialogs/DlgPreferencePackManagement.ui diff --git a/src/Gui/DlgPreferencePackManagementImp.cpp b/src/Gui/Dialogs/DlgPreferencePackManagementImp.cpp similarity index 99% rename from src/Gui/DlgPreferencePackManagementImp.cpp rename to src/Gui/Dialogs/DlgPreferencePackManagementImp.cpp index 437f6105ba..11b7f15a15 100644 --- a/src/Gui/DlgPreferencePackManagementImp.cpp +++ b/src/Gui/Dialogs/DlgPreferencePackManagementImp.cpp @@ -25,7 +25,7 @@ # include #endif -#include "DlgPreferencePackManagementImp.h" +#include "Dialogs/DlgPreferencePackManagementImp.h" #include "ui_DlgPreferencePackManagement.h" #include "Application.h" #include "Command.h" diff --git a/src/Gui/DlgPreferencePackManagementImp.h b/src/Gui/Dialogs/DlgPreferencePackManagementImp.h similarity index 100% rename from src/Gui/DlgPreferencePackManagementImp.h rename to src/Gui/Dialogs/DlgPreferencePackManagementImp.h diff --git a/src/Gui/DlgPreferences.ui b/src/Gui/Dialogs/DlgPreferences.ui similarity index 100% rename from src/Gui/DlgPreferences.ui rename to src/Gui/Dialogs/DlgPreferences.ui diff --git a/src/Gui/DlgPreferencesImp.cpp b/src/Gui/Dialogs/DlgPreferencesImp.cpp similarity index 96% rename from src/Gui/DlgPreferencesImp.cpp rename to src/Gui/Dialogs/DlgPreferencesImp.cpp index c4e2c95eb6..23d968e365 100644 --- a/src/Gui/DlgPreferencesImp.cpp +++ b/src/Gui/Dialogs/DlgPreferencesImp.cpp @@ -47,7 +47,7 @@ #include #include -#include "DlgPreferencesImp.h" +#include "Dialogs/DlgPreferencesImp.h" #include "ui_DlgPreferences.h" #include "BitmapFactory.h" #include "MainWindow.h" diff --git a/src/Gui/DlgPreferencesImp.h b/src/Gui/Dialogs/DlgPreferencesImp.h similarity index 100% rename from src/Gui/DlgPreferencesImp.h rename to src/Gui/Dialogs/DlgPreferencesImp.h diff --git a/src/Gui/DlgProjectInformation.ui b/src/Gui/Dialogs/DlgProjectInformation.ui similarity index 100% rename from src/Gui/DlgProjectInformation.ui rename to src/Gui/Dialogs/DlgProjectInformation.ui diff --git a/src/Gui/DlgProjectInformationImp.cpp b/src/Gui/Dialogs/DlgProjectInformationImp.cpp similarity index 97% rename from src/Gui/DlgProjectInformationImp.cpp rename to src/Gui/Dialogs/DlgProjectInformationImp.cpp index 7505fb2ed4..7909f1612e 100644 --- a/src/Gui/DlgProjectInformationImp.cpp +++ b/src/Gui/Dialogs/DlgProjectInformationImp.cpp @@ -32,7 +32,7 @@ #include #include -#include "DlgProjectInformationImp.h" +#include "Dialogs/DlgProjectInformationImp.h" #include "ui_DlgProjectInformation.h" #include "MainWindow.h" diff --git a/src/Gui/DlgProjectInformationImp.h b/src/Gui/Dialogs/DlgProjectInformationImp.h similarity index 100% rename from src/Gui/DlgProjectInformationImp.h rename to src/Gui/Dialogs/DlgProjectInformationImp.h diff --git a/src/Gui/DlgProjectUtility.cpp b/src/Gui/Dialogs/DlgProjectUtility.cpp similarity index 96% rename from src/Gui/DlgProjectUtility.cpp rename to src/Gui/Dialogs/DlgProjectUtility.cpp index 75de3e8fe1..1a3da5315f 100644 --- a/src/Gui/DlgProjectUtility.cpp +++ b/src/Gui/Dialogs/DlgProjectUtility.cpp @@ -29,7 +29,7 @@ #include -#include "DlgProjectUtility.h" +#include "Dialogs/DlgProjectUtility.h" #include "ui_DlgProjectUtility.h" #include "Application.h" #include "Command.h" diff --git a/src/Gui/DlgProjectUtility.h b/src/Gui/Dialogs/DlgProjectUtility.h similarity index 100% rename from src/Gui/DlgProjectUtility.h rename to src/Gui/Dialogs/DlgProjectUtility.h diff --git a/src/Gui/DlgProjectUtility.ui b/src/Gui/Dialogs/DlgProjectUtility.ui similarity index 100% rename from src/Gui/DlgProjectUtility.ui rename to src/Gui/Dialogs/DlgProjectUtility.ui diff --git a/src/Gui/DlgPropertyLink.cpp b/src/Gui/Dialogs/DlgPropertyLink.cpp similarity index 99% rename from src/Gui/DlgPropertyLink.cpp rename to src/Gui/Dialogs/DlgPropertyLink.cpp index 869d541670..1c41b465cc 100644 --- a/src/Gui/DlgPropertyLink.cpp +++ b/src/Gui/Dialogs/DlgPropertyLink.cpp @@ -36,7 +36,7 @@ #include #include -#include "DlgPropertyLink.h" +#include "Dialogs/DlgPropertyLink.h" #include "ui_DlgPropertyLink.h" #include "Application.h" #include "Document.h" diff --git a/src/Gui/DlgPropertyLink.h b/src/Gui/Dialogs/DlgPropertyLink.h similarity index 100% rename from src/Gui/DlgPropertyLink.h rename to src/Gui/Dialogs/DlgPropertyLink.h diff --git a/src/Gui/DlgPropertyLink.ui b/src/Gui/Dialogs/DlgPropertyLink.ui similarity index 100% rename from src/Gui/DlgPropertyLink.ui rename to src/Gui/Dialogs/DlgPropertyLink.ui diff --git a/src/Gui/DlgRevertToBackupConfig.ui b/src/Gui/Dialogs/DlgRevertToBackupConfig.ui similarity index 100% rename from src/Gui/DlgRevertToBackupConfig.ui rename to src/Gui/Dialogs/DlgRevertToBackupConfig.ui diff --git a/src/Gui/DlgRevertToBackupConfigImp.cpp b/src/Gui/Dialogs/DlgRevertToBackupConfigImp.cpp similarity index 98% rename from src/Gui/DlgRevertToBackupConfigImp.cpp rename to src/Gui/Dialogs/DlgRevertToBackupConfigImp.cpp index 2910fbea26..d82f4f6921 100644 --- a/src/Gui/DlgRevertToBackupConfigImp.cpp +++ b/src/Gui/Dialogs/DlgRevertToBackupConfigImp.cpp @@ -26,7 +26,7 @@ # include #endif -#include "DlgRevertToBackupConfigImp.h" +#include "Dialogs/DlgRevertToBackupConfigImp.h" #include "ui_DlgRevertToBackupConfig.h" #include "Application.h" #include "PreferencePackManager.h" diff --git a/src/Gui/DlgRevertToBackupConfigImp.h b/src/Gui/Dialogs/DlgRevertToBackupConfigImp.h similarity index 100% rename from src/Gui/DlgRevertToBackupConfigImp.h rename to src/Gui/Dialogs/DlgRevertToBackupConfigImp.h diff --git a/src/Gui/DlgRunExternal.cpp b/src/Gui/Dialogs/DlgRunExternal.cpp similarity index 96% rename from src/Gui/DlgRunExternal.cpp rename to src/Gui/Dialogs/DlgRunExternal.cpp index 0bcdfe6bf5..2d82690a20 100644 --- a/src/Gui/DlgRunExternal.cpp +++ b/src/Gui/Dialogs/DlgRunExternal.cpp @@ -25,7 +25,7 @@ #include #endif -#include "DlgRunExternal.h" +#include "Dialogs/DlgRunExternal.h" #include "ui_DlgRunExternal.h" #include "FileDialog.h" diff --git a/src/Gui/DlgRunExternal.h b/src/Gui/Dialogs/DlgRunExternal.h similarity index 100% rename from src/Gui/DlgRunExternal.h rename to src/Gui/Dialogs/DlgRunExternal.h diff --git a/src/Gui/DlgRunExternal.ui b/src/Gui/Dialogs/DlgRunExternal.ui similarity index 100% rename from src/Gui/DlgRunExternal.ui rename to src/Gui/Dialogs/DlgRunExternal.ui diff --git a/src/Gui/DlgSettingsColorGradient.ui b/src/Gui/Dialogs/DlgSettingsColorGradient.ui similarity index 100% rename from src/Gui/DlgSettingsColorGradient.ui rename to src/Gui/Dialogs/DlgSettingsColorGradient.ui diff --git a/src/Gui/DlgSettingsColorGradientImp.cpp b/src/Gui/Dialogs/DlgSettingsColorGradientImp.cpp similarity index 96% rename from src/Gui/DlgSettingsColorGradientImp.cpp rename to src/Gui/Dialogs/DlgSettingsColorGradientImp.cpp index 5979f363f2..f63a5fc0fc 100644 --- a/src/Gui/DlgSettingsColorGradientImp.cpp +++ b/src/Gui/Dialogs/DlgSettingsColorGradientImp.cpp @@ -31,7 +31,7 @@ #include #endif -#include "DlgSettingsColorGradientImp.h" +#include "Dialogs/DlgSettingsColorGradientImp.h" #include "ui_DlgSettingsColorGradient.h" #include "SpinBox.h" #include "Tools.h" diff --git a/src/Gui/DlgSettingsColorGradientImp.h b/src/Gui/Dialogs/DlgSettingsColorGradientImp.h similarity index 100% rename from src/Gui/DlgSettingsColorGradientImp.h rename to src/Gui/Dialogs/DlgSettingsColorGradientImp.h diff --git a/src/Gui/DlgSettingsImage.ui b/src/Gui/Dialogs/DlgSettingsImage.ui similarity index 100% rename from src/Gui/DlgSettingsImage.ui rename to src/Gui/Dialogs/DlgSettingsImage.ui diff --git a/src/Gui/DlgSettingsImageImp.cpp b/src/Gui/Dialogs/DlgSettingsImageImp.cpp similarity index 96% rename from src/Gui/DlgSettingsImageImp.cpp rename to src/Gui/Dialogs/DlgSettingsImageImp.cpp index 659c34f9b1..85692b9246 100644 --- a/src/Gui/DlgSettingsImageImp.cpp +++ b/src/Gui/Dialogs/DlgSettingsImageImp.cpp @@ -26,7 +26,7 @@ #include #endif -#include "DlgSettingsImageImp.h" +#include "Dialogs/DlgSettingsImageImp.h" #include "ui_DlgSettingsImage.h" diff --git a/src/Gui/DlgSettingsImageImp.h b/src/Gui/Dialogs/DlgSettingsImageImp.h similarity index 100% rename from src/Gui/DlgSettingsImageImp.h rename to src/Gui/Dialogs/DlgSettingsImageImp.h diff --git a/src/Gui/DlgToolbars.ui b/src/Gui/Dialogs/DlgToolbars.ui similarity index 97% rename from src/Gui/DlgToolbars.ui rename to src/Gui/Dialogs/DlgToolbars.ui index 910985b748..0a4700fbc3 100644 --- a/src/Gui/DlgToolbars.ui +++ b/src/Gui/Dialogs/DlgToolbars.ui @@ -113,7 +113,7 @@ - + :/icons/button_right.svg:/icons/button_right.svg @@ -139,7 +139,7 @@ - + :/icons/button_left.svg:/icons/button_left.svg @@ -171,7 +171,7 @@ - + :/icons/button_up.svg:/icons/button_up.svg @@ -197,7 +197,7 @@ - + :/icons/button_down.svg:/icons/button_down.svg @@ -352,7 +352,7 @@ deleteButton - + diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/Dialogs/DlgToolbarsImp.cpp similarity index 97% rename from src/Gui/DlgToolbarsImp.cpp rename to src/Gui/Dialogs/DlgToolbarsImp.cpp index b317d4c9e8..65ce63c0e2 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/Dialogs/DlgToolbarsImp.cpp @@ -30,8 +30,8 @@ #include #endif -#include "DlgToolbarsImp.h" -#include "DlgKeyboardImp.h" +#include "Dialogs/DlgToolbarsImp.h" +#include "Dialogs/DlgKeyboardImp.h" #include "ui_DlgToolbars.h" #include "Application.h" #include "BitmapFactory.h" diff --git a/src/Gui/DlgToolbarsImp.h b/src/Gui/Dialogs/DlgToolbarsImp.h similarity index 100% rename from src/Gui/DlgToolbarsImp.h rename to src/Gui/Dialogs/DlgToolbarsImp.h diff --git a/src/Gui/DlgTreeWidget.ui b/src/Gui/Dialogs/DlgTreeWidget.ui similarity index 100% rename from src/Gui/DlgTreeWidget.ui rename to src/Gui/Dialogs/DlgTreeWidget.ui diff --git a/src/Gui/DlgUndoRedo.cpp b/src/Gui/Dialogs/DlgUndoRedo.cpp similarity index 96% rename from src/Gui/DlgUndoRedo.cpp rename to src/Gui/Dialogs/DlgUndoRedo.cpp index 64190bcc13..439c0a1532 100644 --- a/src/Gui/DlgUndoRedo.cpp +++ b/src/Gui/Dialogs/DlgUndoRedo.cpp @@ -27,7 +27,7 @@ #include #endif -#include "DlgUndoRedo.h" +#include "Dialogs/DlgUndoRedo.h" #include "Application.h" #include "MainWindow.h" #include "MDIView.h" diff --git a/src/Gui/DlgUndoRedo.h b/src/Gui/Dialogs/DlgUndoRedo.h similarity index 100% rename from src/Gui/DlgUndoRedo.h rename to src/Gui/Dialogs/DlgUndoRedo.h diff --git a/src/Gui/DlgUnitsCalculator.ui b/src/Gui/Dialogs/DlgUnitsCalculator.ui similarity index 100% rename from src/Gui/DlgUnitsCalculator.ui rename to src/Gui/Dialogs/DlgUnitsCalculator.ui diff --git a/src/Gui/DlgUnitsCalculatorImp.cpp b/src/Gui/Dialogs/DlgUnitsCalculatorImp.cpp similarity index 99% rename from src/Gui/DlgUnitsCalculatorImp.cpp rename to src/Gui/Dialogs/DlgUnitsCalculatorImp.cpp index c1a0276c72..255b4d5704 100644 --- a/src/Gui/DlgUnitsCalculatorImp.cpp +++ b/src/Gui/Dialogs/DlgUnitsCalculatorImp.cpp @@ -28,7 +28,7 @@ #include #endif -#include "DlgUnitsCalculatorImp.h" +#include "Dialogs/DlgUnitsCalculatorImp.h" #include "ui_DlgUnitsCalculator.h" #include diff --git a/src/Gui/DlgUnitsCalculatorImp.h b/src/Gui/Dialogs/DlgUnitsCalculatorImp.h similarity index 100% rename from src/Gui/DlgUnitsCalculatorImp.h rename to src/Gui/Dialogs/DlgUnitsCalculatorImp.h diff --git a/src/Gui/DocumentRecovery.cpp b/src/Gui/DocumentRecovery.cpp index c839a42481..9685f25393 100644 --- a/src/Gui/DocumentRecovery.cpp +++ b/src/Gui/DocumentRecovery.cpp @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index 8831de1868..1ef9e9d0ed 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -45,7 +45,7 @@ #include "DownloadManager.h" #include "FileDialog.h" #include "MainWindow.h" -#include "ui_DlgAuthorization.h" +#include "Dialogs/ui_DlgAuthorization.h" #include "Tools.h" #include diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 6c1b1a7fa6..18ae3e4455 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -114,7 +114,7 @@ #include "SpaceballEvent.h" #include "View3DInventor.h" #include "View3DInventorViewer.h" -#include "DlgObjectSelection.h" +#include "Dialogs/DlgObjectSelection.h" #include FC_LOG_LEVEL_INIT("MainWindow",false,true,true) diff --git a/src/Gui/NetworkRetriever.cpp b/src/Gui/NetworkRetriever.cpp index 8b71ff0951..47ffa5856f 100644 --- a/src/Gui/NetworkRetriever.cpp +++ b/src/Gui/NetworkRetriever.cpp @@ -39,7 +39,7 @@ #include "BitmapFactory.h" #include "FileDialog.h" #include "MainWindow.h" -#include "ui_DlgAuthorization.h" +#include "Dialogs/ui_DlgAuthorization.h" using namespace Gui; diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp index 4ae81c7de1..6f370c719f 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp @@ -45,10 +45,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/src/Gui/ListWidgetDragBugFix.cpp b/src/Gui/PreferencePages/ListWidgetDragBugFix.cpp similarity index 100% rename from src/Gui/ListWidgetDragBugFix.cpp rename to src/Gui/PreferencePages/ListWidgetDragBugFix.cpp diff --git a/src/Gui/ListWidgetDragBugFix.h b/src/Gui/PreferencePages/ListWidgetDragBugFix.h similarity index 100% rename from src/Gui/ListWidgetDragBugFix.h rename to src/Gui/PreferencePages/ListWidgetDragBugFix.h diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index 1ab6a81e84..e881db68a2 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -48,7 +48,7 @@ #include "QuantitySpinBox.h" #include "QuantitySpinBox_p.h" #include "Command.h" -#include "DlgExpressionInput.h" +#include "Dialogs/DlgExpressionInput.h" #include "Tools.h" diff --git a/src/Gui/SoFCColorGradient.cpp b/src/Gui/SoFCColorGradient.cpp index e0f4ee8321..706d067a14 100644 --- a/src/Gui/SoFCColorGradient.cpp +++ b/src/Gui/SoFCColorGradient.cpp @@ -39,7 +39,7 @@ #include #include "SoFCColorGradient.h" #include "SoTextLabel.h" -#include "DlgSettingsColorGradientImp.h" +#include "Dialogs/DlgSettingsColorGradientImp.h" #include "MainWindow.h" #include "MDIView.h" #include "ViewProvider.h" diff --git a/src/Gui/SpinBox.cpp b/src/Gui/SpinBox.cpp index 2d65a55d17..df16236b5d 100644 --- a/src/Gui/SpinBox.cpp +++ b/src/Gui/SpinBox.cpp @@ -38,7 +38,7 @@ #include "SpinBox.h" #include "Command.h" -#include "DlgExpressionInput.h" +#include "Dialogs/DlgExpressionInput.h" #include "QuantitySpinBox_p.h" diff --git a/src/Gui/StartupProcess.cpp b/src/Gui/StartupProcess.cpp index 0e1a011209..e992c2d37c 100644 --- a/src/Gui/StartupProcess.cpp +++ b/src/Gui/StartupProcess.cpp @@ -37,7 +37,7 @@ #include "StartupProcess.h" #include "Application.h" #include "AutoSaver.h" -#include "DlgCheckableMessageBox.h" +#include "Dialogs/DlgCheckableMessageBox.h" #include "FileDialog.h" #include "GuiApplication.h" #include "MainWindow.h" diff --git a/src/Gui/TaskDlgRelocation.cpp b/src/Gui/TaskDlgRelocation.cpp index 01d90432c7..c6008264a4 100644 --- a/src/Gui/TaskDlgRelocation.cpp +++ b/src/Gui/TaskDlgRelocation.cpp @@ -22,8 +22,8 @@ #include "PreCompiled.h" -#include "ui_DlgLocationAngle.h" -#include "ui_DlgLocationPos.h" +#include "Dialogs/ui_DlgLocationAngle.h" +#include "Dialogs/ui_DlgLocationPos.h" #include "TaskDlgRelocation.h" #include "BitmapFactory.h" diff --git a/src/Gui/ViewProviderLink.cpp b/src/Gui/ViewProviderLink.cpp index 9ee4e070cc..68b61e2c52 100644 --- a/src/Gui/ViewProviderLink.cpp +++ b/src/Gui/ViewProviderLink.cpp @@ -74,7 +74,7 @@ #include "ActionFunction.h" #include "Command.h" -#include "DlgObjectSelection.h" +#include "Dialogs/DlgObjectSelection.h" FC_LOG_LEVEL_INIT("App::Link", true, true) diff --git a/src/Gui/ViewProviderVarSet.h b/src/Gui/ViewProviderVarSet.h index 715a05a438..6afa7b975e 100644 --- a/src/Gui/ViewProviderVarSet.h +++ b/src/Gui/ViewProviderVarSet.h @@ -24,7 +24,7 @@ #define GUI_ViewProviderVarSet_H #include "ViewProviderDocumentObject.h" -#include "DlgAddPropertyVarSet.h" +#include "Dialogs/DlgAddPropertyVarSet.h" namespace Gui { diff --git a/src/Gui/WidgetFactory.h b/src/Gui/WidgetFactory.h index 3a6e5fe76d..71418c48d5 100644 --- a/src/Gui/WidgetFactory.h +++ b/src/Gui/WidgetFactory.h @@ -27,8 +27,8 @@ #include #include -#include "DlgCustomizeImp.h" -#include "DlgPreferencesImp.h" +#include "Dialogs/DlgCustomizeImp.h" +#include "Dialogs/DlgPreferencesImp.h" #include "PropertyPage.h" #include diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 990fe61310..cdac6c55e3 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -50,11 +50,11 @@ #include "Application.h" #include "BitmapFactory.h" #include "Command.h" -#include "DlgExpressionInput.h" +#include "Dialogs/DlgExpressionInput.h" #include "PrefWidgets.h" #include "QuantitySpinBox_p.h" #include "Tools.h" -#include "ui_DlgTreeWidget.h" +#include "Dialogs/ui_DlgTreeWidget.h" using namespace Gui; using namespace App; diff --git a/src/Gui/WorkbenchSelector.cpp b/src/Gui/WorkbenchSelector.cpp index a96a530702..88c552adc6 100644 --- a/src/Gui/WorkbenchSelector.cpp +++ b/src/Gui/WorkbenchSelector.cpp @@ -38,7 +38,7 @@ #include "Action.h" #include "BitmapFactory.h" #include "Command.h" -#include "DlgPreferencesImp.h" +#include "Dialogs/DlgPreferencesImp.h" #include "MainWindow.h" #include "WorkbenchSelector.h" #include "ToolBarAreaWidget.h" diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 561c7f9916..4b4822708d 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -39,7 +39,7 @@ #include #include "PropertyEditor.h" -#include "DlgAddProperty.h" +#include "Dialogs/DlgAddProperty.h" #include "MainWindow.h" #include "PropertyItemDelegate.h" #include "PropertyModel.h" diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index e506926b5b..de4de21865 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Gui/resource.cpp b/src/Gui/resource.cpp index 41d6c35e3d..cdf3485ccd 100644 --- a/src/Gui/resource.cpp +++ b/src/Gui/resource.cpp @@ -29,7 +29,7 @@ // INCLUDE YOUR PREFERENCE PAGES HERE // -#include "DlgPreferencesImp.h" +#include "Dialogs/DlgPreferencesImp.h" #include "PreferencePages/DlgSettings3DViewImp.h" #include "PreferencePages/DlgSettingsCacheDirectory.h" #include "PreferencePages/DlgSettingsDocumentImp.h" @@ -47,13 +47,13 @@ #include "PreferencePages/DlgSettingsWorkbenchesImp.h" #include "PreferencePages/DlgSettingsAdvanced.h" -#include "DlgToolbarsImp.h" -#include "DlgActionsImp.h" -#include "DlgKeyboardImp.h" +#include "Dialogs/DlgToolbarsImp.h" +#include "Dialogs/DlgActionsImp.h" +#include "Dialogs/DlgKeyboardImp.h" #if defined(_USE_3DCONNEXION_SDK) || defined(SPNAV_FOUND) -#include "DlgCustomizeSpaceball.h" -#include "DlgCustomizeSpNavSettings.h" +#include "Dialogs/DlgCustomizeSpaceball.h" +#include "Dialogs/DlgCustomizeSpNavSettings.h" #endif #include "InputField.h" diff --git a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp index a41899b6e4..090d723e24 100644 --- a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index 3c6cc8845f..04b50bdedf 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Part/Gui/TaskFaceAppearances.cpp b/src/Mod/Part/Gui/TaskFaceAppearances.cpp index f1983229ba..a8a5b17748 100644 --- a/src/Mod/Part/Gui/TaskFaceAppearances.cpp +++ b/src/Mod/Part/Gui/TaskFaceAppearances.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 82af650761..0b5963acd9 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include From add93323d718bf887937cb573cde0e785fc98d54 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 24 Jan 2025 17:29:22 -0500 Subject: [PATCH 021/224] [TD]fix cosmetic circle arc handling --- src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp | 48 ++++++++++++++++++--- src/Mod/TechDraw/Gui/TaskCosmeticCircle.h | 3 ++ src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui | 43 +++++++++--------- 3 files changed, 68 insertions(+), 26 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp index f9aa011f31..0a145bc904 100644 --- a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp +++ b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp @@ -72,6 +72,8 @@ TaskCosmeticCircle::TaskCosmeticCircle(TechDraw::DrawViewPart* partFeat, connect(ui->qsbRadius, qOverload(&QuantitySpinBox::valueChanged), this, &TaskCosmeticCircle::radiusChanged); + connect(ui->rbArc, &QRadioButton::clicked, this, &TaskCosmeticCircle::arcButtonClicked); + } @@ -91,6 +93,11 @@ TaskCosmeticCircle::TaskCosmeticCircle(TechDraw::DrawViewPart* partFeat, ui->setupUi(this); setUiPrimary(); + + connect(ui->qsbRadius, qOverload(&QuantitySpinBox::valueChanged), + this, &TaskCosmeticCircle::radiusChanged); + connect(ui->rbArc, &QRadioButton::clicked, this, &TaskCosmeticCircle::arcButtonClicked); + } TaskCosmeticCircle::~TaskCosmeticCircle() @@ -154,8 +161,13 @@ void TaskCosmeticCircle::setUiPrimary() double radius = (mathPoints[1] - mathPoints[0]).Length() / m_partFeat->getScale(); ui->qsbRadius->setValue(radius); - ui->qsbStartAngle->setValue(Base::toDegrees(DU::angleWithX(mathPoints[1] - mathPoints[0]))); - ui->qsbEndAngle->setValue(Base::toDegrees(DU::angleWithX(mathPoints[2] - mathPoints[0]))); + ui->qsbStartAngle->setValue(0); + ui->qsbEndAngle->setValue(360); + + enableArcWidgets(false); + ui->qsbStartAngle->setEnabled(false); + ui->qsbEndAngle->setEnabled(false); + ui->cbClockwise->setEnabled(false); } void TaskCosmeticCircle::setUiEdit() @@ -174,6 +186,15 @@ void TaskCosmeticCircle::setUiEdit() ui->qsbStartAngle->setValue(Base::toDegrees(m_ce->m_geometry->getStartAngle())); ui->qsbEndAngle->setValue(Base::toDegrees(m_ce->m_geometry->getEndAngle())); + + if (m_ce->m_geometry->getGeomType() == GeomType::ARCOFCIRCLE) { + ui->rbArc->setChecked(true); + enableArcWidgets(true); + } else { + ui->rbArc->setChecked(false); + enableArcWidgets(false); + } + } void TaskCosmeticCircle::radiusChanged() @@ -184,6 +205,23 @@ void TaskCosmeticCircle::radiusChanged() } } +void TaskCosmeticCircle::arcButtonClicked() +{ + if (ui->rbArc->isChecked()) { + enableArcWidgets(true); + } else { + enableArcWidgets(false); + } +} + +void TaskCosmeticCircle::enableArcWidgets(bool newState) +{ + ui->qsbStartAngle->setEnabled(newState); + ui->qsbEndAngle->setEnabled(newState); + ui->cbClockwise->setEnabled(newState); + +} + //****************************************************************************** void TaskCosmeticCircle::createCosmeticCircle(void) @@ -205,8 +243,7 @@ void TaskCosmeticCircle::createCosmeticCircle(void) } TechDraw::BaseGeomPtr bg; - if (ui->qsbStartAngle->value().getValue() == 0.0 && - ui->qsbEndAngle->value().getValue() == 0.0) { + if (!ui->rbArc->isChecked()) { bg = std::make_shared (center, ui->qsbRadius->value().getValue()); } else { bg = std::make_shared(center, ui->qsbRadius->value().getValue(), @@ -234,8 +271,7 @@ void TaskCosmeticCircle::updateCosmeticCircle(void) m_ce->permaRadius = ui->qsbRadius->value().getValue(); TechDraw::BaseGeomPtr bg; - if (ui->qsbStartAngle->value().getValue() == 0.0 && - ui->qsbEndAngle->value().getValue() == 0.0) { + if (!ui->rbArc->isChecked()) { bg = std::make_shared (p0, m_ce->permaRadius); } else { bg = std::make_shared(p0, ui->qsbRadius->value().getValue(), diff --git a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.h b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.h index 55ce1ecac9..c65597d77a 100644 --- a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.h +++ b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.h @@ -66,6 +66,7 @@ public: protected Q_SLOTS: void radiusChanged(); + void arcButtonClicked(); protected: void changeEvent(QEvent *e) override; @@ -76,6 +77,8 @@ protected: void createCosmeticCircle(); void updateCosmeticCircle(); + void enableArcWidgets(bool newState); + private: std::unique_ptr ui; diff --git a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui index 3e54cbf3d0..b238e20ad5 100644 --- a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui +++ b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.ui @@ -7,7 +7,7 @@ 0 0 350 - 390 + 409 @@ -103,7 +103,7 @@ - + @@ -117,7 +117,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -149,14 +149,14 @@ - + - + 0.000000000000000 - + 10.000000000000000 @@ -166,7 +166,7 @@ - + Start angle (conventional) of arc in degrees. @@ -175,13 +175,6 @@ - - - - Arc of Circle - - - @@ -189,8 +182,18 @@ + + + + Check this box to make an arc from start angle to end angle in a clockwise direction. + + + Clockwise Angle + + + - + End angle (conventional) of arc in degrees. @@ -206,13 +209,13 @@ - - + + - Check this box to make an arc from start angle to end angle in a clockwise direction. + Select to enter angles and create a circular arc. - Clockwise Angle + Arc of Circle From 87ed2bb6dc38de5cc911f5988cdeee036cac6895 Mon Sep 17 00:00:00 2001 From: Andrea Date: Sat, 25 Jan 2025 12:27:26 +0100 Subject: [PATCH 022/224] Clean importCSG.py Clean code Update importCSG.py --- src/Mod/OpenSCAD/importCSG.py | 55 ++++------------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/src/Mod/OpenSCAD/importCSG.py b/src/Mod/OpenSCAD/importCSG.py index 816fc7289d..8ed53b1ea2 100644 --- a/src/Mod/OpenSCAD/importCSG.py +++ b/src/Mod/OpenSCAD/importCSG.py @@ -139,7 +139,6 @@ def insert(filename, docname): original_root_objects.append(obj) except NameError: doc = FreeCAD.newDocument(docname) - #importgroup = doc.addObject("App::DocumentObjectGroup",groupname) if filename.lower().endswith('.scad'): tmpfile = callopenscad(filename) pathName = os.path.dirname(os.path.normpath(filename)) @@ -167,14 +166,11 @@ def processcsg(filename): # as it requires a writable location parser = yacc.yacc(debug=False, write_tables=False) if printverbose: print('Parser Loaded') - # Give the lexer some input - #f=open('test.scad', 'r') + f = io.open(filename, 'r', encoding="utf8") - #lexer.input(f.read()) if printverbose: print('Start Parser') - # Swap statements to enable Parser debugging - #result = parser.parse(f.read(),debug=1) + result = parser.parse(f.read()) f.close() if printverbose: @@ -195,15 +191,12 @@ def p_block_list_(p): | statementwithmod | block_list statementwithmod ''' - #if printverbose: print("Block List") - #if printverbose: print(p[1]) + if(len(p) > 2): if printverbose: print(p[2]) p[0] = p[1] + p[2] else: p[0] = p[1] - #if printverbose: print("End Block List") - def p_render_action(p): 'render_action : render LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE' @@ -242,10 +235,6 @@ def p_boolean(p): ''' p[0] = p[1] -#def p_string(p): -# 'string : QUOTE ID QUOTE' -# p[0] = p[2] - def p_stripped_string(p): 'stripped_string : STRING' @@ -316,9 +305,6 @@ def p_points_list_2d(p): | points_list_2d 2d_point ''' if p[2] == ',': - #if printverbose: - # print("Start List") - # print(p[1]) p[0] = [p[1]] else: if printverbose: @@ -326,7 +312,6 @@ def p_points_list_2d(p): print(p[2]) p[1].append(p[2]) p[0] = p[1] - #if printverbose: print(p[0]) def p_3d_point(p): @@ -359,24 +344,16 @@ def p_path_points(p): | path_points NUMBER COMMA | path_points NUMBER ''' - #if printverbose: print("Path point") + if p[2] == ',': - #if printverbose: print('Start list') - #if printverbose: print(p[1]) p[0] = [int(p[1])] else: - #if printverbose: print(p[1]) - #if printverbose: print(len(p[1])) - #if printverbose: print(p[2]) p[1].append(int(p[2])) p[0] = p[1] - #if printverbose: print(p[0]) def p_path_list(p): 'path_list : OSQUARE path_points ESQUARE' - #if printverbose: print('Path List ') - #if printverbose: print(p[2]) p[0] = p[2] @@ -385,14 +362,11 @@ def p_path_set(p): path_set : path_list | path_set COMMA path_list ''' - #if printverbose: print('Path Set') - #if printverbose: print(len(p)) if len(p) == 2: p[0] = [p[1]] else: p[1].append(p[3]) p[0] = p[1] - #if printverbose: print(p[0]) def p_operation(p): ''' @@ -468,12 +442,6 @@ def p_offset_action(p): newobj.Document.recompute() if gui: subobj.ViewObject.hide() -# if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD").\ -# GetBool('useViewProviderTree'): -# from OpenSCADFeatures import ViewProviderTree -# ViewProviderTree(newobj.ViewObject) -# else: -# newobj.ViewObject.Proxy = 0 p[0] = [newobj] def checkObjShape(obj): @@ -905,8 +873,6 @@ def processSVG(fname, ext): if printverbose: print(obj.Name) if printverbose: print(obj.Shape) shapes.append(obj.Shape) - #compoundSVG = Part.makeCompound(shapes) - #compoundSVG = Draft.join(objects) FreeCAD.closeDocument(docSVG.Name) FreeCAD.ActiveDocument=doc obj=doc.addObject('Part::Feature',fname) @@ -930,14 +896,11 @@ def process_mesh_file(fname,ext): sh.makeShapeFromMesh(mesh1.Mesh.Topology,0.1) solid = Part.Solid(sh) obj = doc.addObject('Part::Feature',"Mesh") - #ImportObject(obj,mesh1) #This object is not mutable from the GUI - #ViewProviderTree(obj.ViewObject) + solid = solid.removeSplitter() if solid.Volume < 0: - #sh.reverse() - #sh = sh.copy() solid.complement() - obj.Shape = solid#.removeSplitter() + obj.Shape = solid else: #mesh1 is None FreeCAD.Console.PrintError('Mesh not imported %s.%s %s\n' % \ (objname,ext,filename)) @@ -1127,7 +1090,6 @@ def p_cylinder_action(p): h = float(p[3]['h']) r1 = float(p[3]['r1']) r2 = float(p[3]['r2']) - #n = int(p[3]['$fn']) n = int(round(float(p[3]['$fn']))) fnmax = FreeCAD.ParamGet(\ "User parameter:BaseApp/Preferences/Mod/OpenSCAD").\ @@ -1155,7 +1117,6 @@ def p_cylinder_action(p): if printverbose: print("Draft makePolygon Failed, falling back on manual polygon") mycyl.Base = myPolygon(n,r1) - # mycyl.Solid = True else : pass @@ -1252,10 +1213,7 @@ def p_circle_action(p) : mycircle.MakeFace = True mycircle = Draft.makeCircle(r,face=True) # would call doc.recompute FreeCAD.ActiveDocument.recompute() - #mycircle = doc.addObject('Part::Circle',p[1]) #would not create a face - #mycircle.Radius = r else : - #mycircle = Draft.makePolygon(n,r) # would call doc.recompute mycircle = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",'polygon') Draft._Polygon(mycircle) mycircle.FacesNumber = n @@ -1390,7 +1348,6 @@ def p_polyhedron_action(p) : except Exception: secWireList = w.Edges[:] f = Part.makeFilledFace(Part.__sortEdges__(secWireList)) - #f = make_face(v[int(i[0])],v[int(i[1])],v[int(i[2])]) faces_list.append(f) shell=Part.makeShell(faces_list) solid=Part.Solid(shell).removeSplitter() From feaf59bb8d42653e4f3b0874fed135fbad605ba4 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Sat, 25 Jan 2025 21:30:27 +0100 Subject: [PATCH 023/224] PrefPacks: Add spreadsheet colors to classic theme Fixes #17984. --- src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg b/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg index f1b0e88734..d32f6eafea 100644 --- a/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg @@ -71,6 +71,12 @@ + + #feff9e + #000000 + #000000 + #000000 + From 0db1a2e034867af3ef737591667c1bb1914c19a5 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 26 Jan 2025 20:45:14 +0800 Subject: [PATCH 024/224] [AddonManager] Fix construct_git_url return urls with '.git'. (#19242) * [AddonManager] Fix construct_git_url return urls with '.git'. --- src/Mod/AddonManager/addonmanager_utilities.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Mod/AddonManager/addonmanager_utilities.py b/src/Mod/AddonManager/addonmanager_utilities.py index b0e66ca00b..a82f29f6d7 100644 --- a/src/Mod/AddonManager/addonmanager_utilities.py +++ b/src/Mod/AddonManager/addonmanager_utilities.py @@ -198,19 +198,20 @@ def construct_git_url(repo, filename): """Returns a direct download link to a file in an online Git repo""" parsed_url = urlparse(repo.url) + repo_url = repo.url[:-4] if repo.url.endswith(".git") else repo.url if parsed_url.netloc == "github.com": - return f"{repo.url}/raw/{repo.branch}/{filename}" + return f"{repo_url}/raw/{repo.branch}/{filename}" if parsed_url.netloc in ["gitlab.com", "framagit.org", "salsa.debian.org"]: - return f"{repo.url}/-/raw/{repo.branch}/{filename}" + return f"{repo_url}/-/raw/{repo.branch}/{filename}" if parsed_url.netloc in ["codeberg.org"]: - return f"{repo.url}/raw/branch/{repo.branch}/{filename}" + return f"{repo_url}/raw/branch/{repo.branch}/{filename}" fci.Console.PrintLog( "Debug: addonmanager_utilities.construct_git_url: Unknown git host:" + parsed_url.netloc + f" for file {filename}\n" ) # Assume it's some kind of local GitLab instance... - return f"{repo.url}/-/raw/{repo.branch}/{filename}" + return f"{repo_url}/-/raw/{repo.branch}/{filename}" def get_readme_url(repo): From 6e361b8bd187f4817615d41c3cdd9685271c5568 Mon Sep 17 00:00:00 2001 From: jffmichi <> Date: Fri, 24 Jan 2025 02:02:34 +0100 Subject: [PATCH 025/224] Sketcher: fix seg-fault on loading sketch with redundant constraints --- src/Mod/Sketcher/App/planegcs/GCS.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 6bf522a210..9607fa2126 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -5751,12 +5751,12 @@ void System::identifyConflictingRedundantConstraints( std::vector> conflictGroupsOrig = conflictGroups; conflictGroups.clear(); for (int i = conflictGroupsOrig.size() - 1; i >= 0; i--) { - auto iterRedundantEntry = std::find_if(conflictGroups[i].begin(), - conflictGroups[i].end(), + auto iterRedundantEntry = std::find_if(conflictGroupsOrig[i].begin(), + conflictGroupsOrig[i].end(), [this](const auto item) { return (this->redundant.count(item) > 0); }); - bool hasRedundant = (iterRedundantEntry != conflictGroups[i].end()); + bool hasRedundant = (iterRedundantEntry != conflictGroupsOrig[i].end()); if (!hasRedundant) { conflictGroups.push_back(conflictGroupsOrig[i]); continue; From 33816bd82b40eaca204b0f453f5577d4eed4d5f2 Mon Sep 17 00:00:00 2001 From: Julien Masnada Date: Mon, 27 Jan 2025 09:21:30 +0100 Subject: [PATCH 026/224] Improve decoration of walls, floors and ceilings. Improve creation of floor's slab --- .../Resources/ui/preferences-sh3d-import.ui | 37 +- src/Mod/BIM/importers/importSH3DHelper.py | 895 ++++++++++++------ 2 files changed, 629 insertions(+), 303 deletions(-) diff --git a/src/Mod/BIM/Resources/ui/preferences-sh3d-import.ui b/src/Mod/BIM/Resources/ui/preferences-sh3d-import.ui index d916e0bde7..14a6d5efa5 100644 --- a/src/Mod/BIM/Resources/ui/preferences-sh3d-import.ui +++ b/src/Mod/BIM/Resources/ui/preferences-sh3d-import.ui @@ -37,6 +37,9 @@ Mod/Arch + + true + @@ -96,6 +99,9 @@ Mod/Arch + + true + @@ -112,6 +118,9 @@ Mod/Arch + + true + @@ -261,9 +270,9 @@ - 255 - 255 - 255 + 246 + 246 + 246 @@ -306,6 +315,9 @@ Mod/Arch + + true + @@ -388,6 +400,25 @@ + + + + Create Facebinders, Baseboards for walls, floors and ceilings for Rooms + + + Decorate surfaces + + + sh3dDecorateSurfaces + + + Mod/Arch + + + true + + + diff --git a/src/Mod/BIM/importers/importSH3DHelper.py b/src/Mod/BIM/importers/importSH3DHelper.py index 52f10c12b9..d4e16fe834 100644 --- a/src/Mod/BIM/importers/importSH3DHelper.py +++ b/src/Mod/BIM/importers/importSH3DHelper.py @@ -19,6 +19,8 @@ # * * # *************************************************************************** """Helper functions that are used by SH3D importer.""" +import itertools +import numpy as np import math import os import re @@ -28,14 +30,15 @@ import xml.etree.ElementTree as ET import zipfile import Arch +import BOPTools.SplitFeatures +import BOPTools.BOPFeatures import Draft import DraftGeomUtils import DraftVecUtils import Mesh import MeshPart -import numpy import Part -from draftobjects.facebinder import Facebinder + from draftutils.messages import _err, _log, _msg, _wrn from draftutils.params import get_param_arch @@ -44,7 +47,6 @@ import FreeCAD as App if App.GuiUp: import FreeCADGui as Gui from draftutils.translate import translate - from draftviewproviders.view_facebinder import ViewProviderFacebinder else: # \cond def translate(_, text): @@ -86,7 +88,7 @@ Z_NORM = App.Vector(0, 0, 1) # "Sliding 4-pane", "Awning"] # unzip -p all-windows.sh3d Home.xml | \ # grep 'catalogId=' | \ -# sed -e 's/.*catalogId=//;s/ name=.*/: ("Open 2-pane","Window"),/' | sort -u +# sed -e 's/.*catalogId=//;s/ name=.*/: ("Fixed","Window"),/' | sort -u # unzip -p all-doors.sh3d Home.xml | \ # grep 'catalogId=' | \ # sed -e 's/.*catalogId=//;s/ name=.*/: ("Simple door","Door")/' | sort -u @@ -115,39 +117,51 @@ DOOR_MODELS = { 'Scopia#glass_door': ("Glass door","Door"), 'Scopia#puerta': ("Simple door","Door"), - 'eTeks#doubleFrenchWindow126x200': ("Open 2-pane","Window"), - 'eTeks#doubleHungWindow80x122': ("Open 2-pane","Window"), - 'eTeks#doubleOutwardOpeningWindow': ("Open 2-pane","Window"), - 'eTeks#doubleWindow126x123': ("Open 2-pane","Window"), - 'eTeks#doubleWindow126x163': ("Open 2-pane","Window"), - 'eTeks#fixedTriangleWindow85x85': ("Open 2-pane","Window"), - 'eTeks#fixedWindow85x123': ("Open 2-pane","Window"), - 'eTeks#frenchWindow85x200': ("Open 2-pane","Window"), - 'eTeks#halfRoundWindow': ("Open 2-pane","Window"), - 'eTeks#roundWindow': ("Open 2-pane","Window"), - 'eTeks#sliderWindow126x200': ("Open 2-pane","Window"), - 'eTeks#window85x123': ("Open 2-pane","Window"), - 'eTeks#window85x163': ("Open 2-pane","Window"), - 'Kator Legaz#window-01': ("Open 2-pane","Window"), - 'Kator Legaz#window-08-02': ("Open 2-pane","Window"), - 'Kator Legaz#window-08': ("Open 2-pane","Window"), - 'Scopia#turn-window': ("Open 2-pane","Window"), - 'Scopia#window_2x1_medium_with_large_pane': ("Open 2-pane","Window"), - 'Scopia#window_2x1_with_sliders': ("Open 2-pane","Window"), - 'Scopia#window_2x3_arched': ("Open 2-pane","Window"), - 'Scopia#window_2x3': ("Open 2-pane","Window"), - 'Scopia#window_2x3_regular': ("Open 2-pane","Window"), - 'Scopia#window_2x4_arched': ("Open 2-pane","Window"), - 'Scopia#window_2x4': ("Open 2-pane","Window"), - 'Scopia#window_2x6': ("Open 2-pane","Window"), - 'Scopia#window_3x1': ("Open 2-pane","Window"), - 'Scopia#window_4x1': ("Open 2-pane","Window"), - 'Scopia#window_4x3_arched': ("Open 2-pane","Window"), - 'Scopia#window_4x3': ("Open 2-pane","Window"), - 'Scopia#window_4x5': ("Open 2-pane","Window"), + 'eTeks#doubleFrenchWindow126x200': ("Fixed","Window"), + 'eTeks#doubleHungWindow80x122': ("Fixed","Window"), + 'eTeks#doubleOutwardOpeningWindow': ("Fixed","Window"), + 'eTeks#doubleWindow126x123': ("Fixed","Window"), + 'eTeks#doubleWindow126x163': ("Fixed","Window"), + 'eTeks#fixedTriangleWindow85x85': ("Fixed","Window"), + 'eTeks#fixedWindow85x123': ("Fixed","Window"), + 'eTeks#frenchWindow85x200': ("Fixed","Window"), + 'eTeks#halfRoundWindow': ("Fixed","Window"), + 'eTeks#roundWindow': ("Fixed","Window"), + 'eTeks#sliderWindow126x200': ("Fixed","Window"), + 'eTeks#window85x123': ("Fixed","Window"), + 'eTeks#window85x163': ("Fixed","Window"), + 'Kator Legaz#window-01': ("Fixed","Window"), + 'Kator Legaz#window-08-02': ("Fixed","Window"), + 'Kator Legaz#window-08': ("Fixed","Window"), + 'Scopia#turn-window': ("Fixed","Window"), + 'Scopia#window_2x1_medium_with_large_pane': ("Fixed","Window"), + 'Scopia#window_2x1_with_sliders': ("Fixed","Window"), + 'Scopia#window_2x3_arched': ("Fixed","Window"), + 'Scopia#window_2x3': ("Fixed","Window"), + 'Scopia#window_2x3_regular': ("Fixed","Window"), + 'Scopia#window_2x4_arched': ("Fixed","Window"), + 'Scopia#window_2x4': ("Fixed","Window"), + 'Scopia#window_2x6': ("Fixed","Window"), + 'Scopia#window_3x1': ("Fixed","Window"), + 'Scopia#window_4x1': ("Fixed","Window"), + 'Scopia#window_4x3_arched': ("Fixed","Window"), + 'Scopia#window_4x3': ("Fixed","Window"), + 'Scopia#window_4x5': ("Fixed","Window"), } + +ET_XPATH_LEVEL = 'level' +ET_XPATH_ROOM = 'room' +ET_XPATH_WALL = 'wall' +ET_XPATH_DOOR_OR_WINDOWS = './/doorOrWindow' +ET_XPATH_PIECE_OF_FURNITURE = './/pieceOfFurniture' +ET_XPATH_LIGHT = 'light' +ET_XPATH_OBSERVER_CAMERA = 'observerCamera' +ET_XPATH_CAMERA = 'camera' +ET_XPATH_DUMMY_SLAB = 'DummySlab' +ET_XPATH_DUMMY_DECORATE = 'DummyDecorate' + class SH3DImporter: """The main class to import an SH3D file. @@ -179,8 +193,8 @@ class SH3DImporter: self.building = None self.default_floor = None self.floors = {} - self.walls = [] - self.space_upper_faces = [] + self.walls = {} + self.spaces = {} def import_sh3d_from_string(self, home:str): """Import the SH3D Home from a String. @@ -234,17 +248,15 @@ class SH3DImporter: # Get all the FreeCAD object in the active doc, in order to allow # for merge of existing object if self.preferences["MERGE"]: - for object in doc.Objects: - if hasattr(object, 'id'): - self.fc_objects[object.id] = object + list(map(lambda o2: self.add_fc_objects(o2), list(filter(lambda o1: hasattr(o1, 'id'), doc.Objects)))) # Let's create the project and site for this import self._setup_project(home) # Import the element if any. If none are defined # create a default one. - if home.find(path='level') != None: - self._import_elements(home, 'level') + if home.find(ET_XPATH_LEVEL) != None: + self._import_elements(home, ET_XPATH_LEVEL) else: # Has the default floor already been created from a # previous import? @@ -252,54 +264,47 @@ class SH3DImporter: self.default_floor = self.fc_objects.get('Level') if 'Level' in self.fc_objects else self._create_default_floor() # Importing elements ... - self._import_elements(home, 'room') + self._import_elements(home, ET_XPATH_ROOM) # Importing elements ... - self._import_elements(home, 'wall') + self._import_elements(home, ET_XPATH_WALL) + self._refresh() + # Walls&Rooms have been imported. Created the floor slabs + self._create_slabs() self._refresh() if self.preferences["CREATE_GROUND_MESH"]: self._create_ground_mesh(home) + self._refresh() - self._refresh() if App.GuiUp and self.preferences["FIT_VIEW"]: Gui.SendMsgToActiveView("ViewFit") # Importing elements ... if self.preferences["IMPORT_DOORS_AND_WINDOWS"]: - self._import_elements(home, 'doorOrWindow') - for furniture_group in home.findall('furnitureGroup'): - self._import_elements(furniture_group, 'doorOrWindow', False) + self._import_elements(home, ET_XPATH_DOOR_OR_WINDOWS) self._refresh() - group = App.ActiveDocument.Facebinders - for element in group.Group: - faces = [] - new_sel_subshapes = [] - for (sel_object, sel_subshapes) in element.Faces: - for sel_subshape in sel_subshapes: - sel_subshape = sel_subshape[1:] if sel_subshape.startswith('?') else sel_subshape - new_sel_subshapes.append(sel_subshape) - faces.append((sel_object, new_sel_subshapes)) - element.Faces = faces + + # Door&Windows have been imported. Now we can decorate... + if self.preferences["DECORATE_SURFACES"]: + self._decorate_surfaces() self._refresh() # Importing && elements ... if self.preferences["IMPORT_FURNITURES"]: - self._import_elements(home, 'pieceOfFurniture') - for furniture_group in home.findall('furnitureGroup'): - self._import_elements(furniture_group, 'pieceOfFurniture', False) + self._import_elements(home, ET_XPATH_PIECE_OF_FURNITURE) self._refresh() # Importing elements ... if self.preferences["IMPORT_LIGHTS"]: - self._import_elements(home, 'light') + self._import_elements(home, ET_XPATH_LIGHT) self._refresh() # Importing elements ... if self.preferences["IMPORT_CAMERAS"]: - self._import_elements(home, 'observerCamera') - self._import_elements(home, 'camera') + self._import_elements(home, ET_XPATH_OBSERVER_CAMERA) + self._import_elements(home, ET_XPATH_CAMERA) self._refresh() if self.preferences["CREATE_RENDER_PROJECT"] and self.site: @@ -338,29 +343,32 @@ class SH3DImporter: 'CREATE_GROUND_MESH': get_param_arch("sh3dCreateGroundMesh"), 'DEFAULT_GROUND_COLOR': color_fc2sh(get_param_arch("sh3dDefaultGroundColor")), 'DEFAULT_SKY_COLOR': color_fc2sh(get_param_arch("sh3dDefaultSkyColor")), + 'DECORATE_SURFACES': get_param_arch("sh3dDecorateSurfaces"), } def _setup_handlers(self): self.handlers = { - 'level': LevelHandler(self), - 'room': RoomHandler(self), - 'wall': WallHandler(self), + ET_XPATH_LEVEL: LevelHandler(self), + ET_XPATH_ROOM: RoomHandler(self), + ET_XPATH_WALL: WallHandler(self), + ET_XPATH_DUMMY_SLAB : None, } if self.preferences["IMPORT_DOORS_AND_WINDOWS"]: - self.handlers['doorOrWindow'] = DoorOrWindowHandler(self) - self.handlers['furnitureGroup'] = None + self.handlers[ET_XPATH_DOOR_OR_WINDOWS] = DoorOrWindowHandler(self) + + if self.preferences["DECORATE_SURFACES"]: + self.handlers[ET_XPATH_DUMMY_DECORATE] = None, if self.preferences["IMPORT_FURNITURES"]: - self.handlers['pieceOfFurniture'] = FurnitureHandler(self) - self.handlers['furnitureGroup'] = None + self.handlers[ET_XPATH_PIECE_OF_FURNITURE] = FurnitureHandler(self) if self.preferences["IMPORT_LIGHTS"]: - self.handlers['light'] = LightHandler(self) + self.handlers[ET_XPATH_LIGHT] = LightHandler(self) if self.preferences["IMPORT_CAMERAS"]: camera_handler = CameraHandler(self) - self.handlers['observerCamera'] = camera_handler - self.handlers['camera'] = camera_handler + self.handlers[ET_XPATH_OBSERVER_CAMERA] = camera_handler + self.handlers[ET_XPATH_CAMERA] = camera_handler def _refresh(self): App.ActiveDocument.recompute() @@ -392,10 +400,14 @@ class SH3DImporter: value = str(value.get(name, "")) elif type_ == "App::PropertyFloat": value = float(value.get(name, 0)) + elif type_ == "App::PropertyQuantity": + value = float(value.get(name, 0)) elif type_ == "App::PropertyInteger": value = int(value.get(name, 0)) + elif type_ == "App::PropertyPercent": + value = int(value.get(name, 0)) elif type_ == "App::PropertyBool": - value = bool(value.get(name, True)) + value = value.get(name, "true") == "true" if self.preferences["DEBUG"]: _log(f"Setting @{obj}.{name} = {value}") setattr(obj, name, value) @@ -414,6 +426,17 @@ class SH3DImporter: if name not in obj.PropertiesList: obj.addProperty(property_type, name, group, description) + def add_fc_objects(self, obj): + """Register `obj`. + + This object can then be referenced later on by + other objects (i.e. light, etc.) + + Args: + obj (AppDocumentObject): the object to register + """ + self.fc_objects[obj.id] = obj + def get_fc_object(self, id, sh_type): """Returns the FC doc element corresponding to the imported id and sh_type @@ -455,6 +478,14 @@ class SH3DImporter: return self.default_floor return self.floors.get(level_id, None) + def add_space(self, floor, space): + if floor.id not in self.spaces: + self.spaces[floor.id] = [] + self.spaces[floor.id].append(space) + + def get_spaces(self, floor): + return self.spaces.get(floor.id, []) + def get_space(self, floor, p): """Returns the Space this point belongs to. @@ -468,26 +499,35 @@ class SH3DImporter: Space: the space the object belongs to or None """ closest_space = None - for (space_floor, space, space_face) in self.space_upper_faces: - if not space_face: #?!? - continue - space_face_z = space_face.CenterOfMass.z - projection = App.Vector(p.x, p.y, space_face_z) + for space in self.spaces.get(floor.id, []): + space_face = space.Base.Shape + space_z = space_face.CenterOfMass.z + projection = App.Vector(p.x, p.y, space_z) # Checks that: # - the point's projection is inside the face # - the point is above the face # - the point's parent and the face's are on the same level # NOTE: If two rooms overlap on the same level, the result is # undefined... - if space_face.isInside(projection, 1, True) and space_face_z < p.z and space_floor.id == floor.id: + if space_face.isInside(projection, 1, True) and space_z < p.z: closest_space = space return closest_space - def add_wall(self, wall): - self.walls.append(wall) + def add_wall(self, floor, wall): + if floor.id not in self.walls: + self.walls[floor.id] = [] + self.walls[floor.id].append(wall) - def get_walls(self): - return self.walls + def get_walls(self, floor): + """Returns the wall belonging to the specified level + + Args: + floor (Arch.Level): the level for which to return the list of wall + + Returns: + list: the list of Arch.Wall + """ + return self.walls.get(floor.id, []) def _create_groups(self): """Create FreeCAD Group for the different imported elements @@ -507,10 +547,6 @@ class SH3DImporter: elm (str): the element """ - if 'Project' in self.fc_objects: - self.project = self.fc_objects.get('Project') - elif self.preferences["CREATE_IFC_PROJECT"]: - self.project = self._create_project() if 'Site' in self.fc_objects: self.site = self.fc_objects.get('Site') else: @@ -522,11 +558,15 @@ class SH3DImporter: else: self.building = self._create_building(elm) - if self.preferences["CREATE_IFC_PROJECT"]: - self.project.addObject(self.site) - self.site.addObject(self.building) + if 'Project' in self.fc_objects: + self.project = self.fc_objects.get('Project') + elif self.preferences["CREATE_IFC_PROJECT"]: + self.project = self._create_project() + if self.project: + self.project.addObject(self.site) + def _create_project(self): """Create a default Arch::Project object """ @@ -589,7 +629,7 @@ class SH3DImporter: self.site.addObject(ground) - def _import_elements(self, parent, tag, update_progress=True): + def _import_elements(self, parent, xpath): """Generic function to import a specific element. This function will lookup the handler registered for the elements @@ -599,31 +639,40 @@ class SH3DImporter: Args: parent (Element): the parent of the elements to be imported. Usually the element. - tag (str): the tag of the elements to be imported. + xpath (str): the xpath of the elements to be imported. update_progress (bool, optional): whether to update the progress. Set to false when importing a group of elements. Defaults to True. """ - tags = list(self.handlers.keys()) - elements = parent.findall(tag) - if update_progress and self.progress_bar: + xpaths = list(self.handlers.keys()) + elements = parent.findall(xpath) + tag_name = xpath[3:] if xpath.startswith('.') else xpath + + total_steps, current_step, total_elements = self._get_progress_info(xpath, elements) + if self.progress_bar: self.progress_bar.stop() - self.progress_bar.start(f"Step {tags.index(tag)+1}/{len(tags)}: importing {len(elements)} '{tag}' elements. Please wait ...", len(elements)) - _msg(f"Importing {len(elements)} '{tag}' elements ...") + self.progress_bar.start(f"Step {current_step}/{total_steps}: importing {total_elements} '{tag_name}' elements. Please wait ...", total_elements) + _msg(f"Importing {total_elements} '{tag_name}' elements ...") def _process(tuple): (i, elm) = tuple - _msg(f"Importing {tag}#{i} ({self.current_object_count + 1}/{self.total_object_count}) ...") + _msg(f"Importing {tag_name}#{i} ({self.current_object_count + 1}/{self.total_object_count}) ...") try: - self.handlers[tag].process(parent, i, elm) + self.handlers[xpath].process(parent, i, elm) except Exception as e: - _err(f"Failed to import <{tag}>#{i} ({elm.get('id', elm.get('name'))}):") + _err(f"Failed to import <{tag_name}>#{i} ({elm.get('id', elm.get('name'))}):") _err(str(e)) _err(traceback.format_exc()) - if update_progress and self.progress_bar: + if self.progress_bar: self.progress_bar.next() self.current_object_count = self.current_object_count + 1 list(map(_process, enumerate(elements))) + def _get_progress_info(self, xpath, elements): + xpaths = list(self.handlers.keys()) + total_steps = len(xpaths) + current_step = xpaths.index(xpath)+1 + return total_steps, current_step, len(elements) + def _set_site_properties(self, elm): # All information in environment?, backgroundImage?, print?, compass # are added to the site object. Some are furthermore added to the ground @@ -691,6 +740,52 @@ class SH3DImporter: else: _msg(f"No tag found in <{elm.tag}>") + def _create_slabs(self): + floors = self.floors.values() + total_steps, current_step, total_elements = self._get_progress_info(ET_XPATH_DUMMY_SLAB, floors) + if self.progress_bar: + self.progress_bar.stop() + self.progress_bar.start(f"Step {current_step}/{total_steps}: Creating {total_elements} 'slab' elements. Please wait ...", total_elements) + _msg(f"Creating {total_elements} 'slab' elements ...") + handler = self.handlers[ET_XPATH_LEVEL] + def _create_slab(tuple): + (i, floor) = tuple + _msg(f"Creating slab#{i} for floor '{floor.Label}' ...") + try: + handler.create_slabs(floor) + except Exception as e: + _err(f"Failed to create slab#{i} for floor '{floor.Label}':") + _err(str(e)) + _err(traceback.format_exc()) + if self.progress_bar: + self.progress_bar.next() + list(map(_create_slab, enumerate(floors))) + + def _decorate_surfaces(self): + + all_spaces = self.spaces.values() + all_spaces = list(itertools.chain(*all_spaces)) + all_walls = self.walls.values() + all_walls = list(itertools.chain(*all_walls)) + + total_elements = len(all_spaces)+len(all_walls) + + if self.progress_bar: + self.progress_bar.stop() + self.progress_bar.start(f"Decorating {total_elements} elements. Please wait ...", total_elements) + _msg(f"Decorating {total_elements} elements ...") + + handler = self.handlers[ET_XPATH_ROOM] + for i, space in enumerate(all_spaces): + handler.post_process(space) + if self.progress_bar: self.progress_bar.next() + + handler = self.handlers[ET_XPATH_WALL] + for i, wall in enumerate(all_walls): + handler.post_process(wall) + if self.progress_bar: self.progress_bar.next() + if self.progress_bar: self.progress_bar.stop() + class BaseHandler: """The base class for all importers.""" @@ -741,6 +836,9 @@ class BaseHandler: """ return self.importer.get_floor(level_id) + def get_spaces(self, floor): + return self.importer.get_spaces(floor) + def get_space(self, floor, p): """Returns the Space this point belongs to. @@ -755,47 +853,30 @@ class BaseHandler: """ return self.importer.get_space(floor, p) - def _get_upper_face(self, faces): - """Returns the upper face of a given list of faces + def get_walls(self, floor): + return self.importer.get_walls(floor) - More specifically returns the face with the highest z. - It is used to figure out which space a furniture belongs to. + def _ps(self, section, print_z: bool = False): + # Pretty print a Section in a condensed way + if hasattr(section, 'Shape'): + v = section.Shape.Vertexes + else: + # a Part.Face + v = section.Vertexes + return f"[{self._pv(v[0].Point, print_z)}, {self._pv(v[1].Point, print_z)}, {self._pv(v[2].Point, print_z)}, {self._pv(v[3].Point, print_z)}]" - Args: - faces (list): The list of faces + def _pe(self, edge, print_z: bool = False): + # Print an Edge in a condensed way + v = edge.Vertexes + return f"[{self._pv(v[0].Point, print_z)}, {self._pv(v[1].Point, print_z)}]" - Returns: - Face: the upper face - """ - upper_face = None - com_max_z = -float('inf') - for face in faces: - com = face.CenterOfMass - if com.z > com_max_z: - upper_face = face - com_max_z = com.z - return upper_face - - def _get_lower_face(self, faces): - """Returns the lower face of a given list of faces - - More specifically returns the face with the lowest z. - It is used to figure out which space a furniture belongs to. - - Args: - faces (list): The list of faces - - Returns: - Face: the lower face - """ - lower_face = None - com_min_z = float('inf') - for face in faces: - com = face.CenterOfMass - if com.z < com_min_z: - lower_face = face - com_min_z = com.z - return lower_face + def _pv(self, v, print_z: bool = False, ndigits: None = None): + # Print an Vector in a condensed way + if hasattr(v,'X'): + return f"({round(getattr(v, 'X'), ndigits)},{round(getattr(v, 'Y'), ndigits)}{',' + str(round(getattr(v, 'Z'), ndigits)) if print_z else ''})" + elif hasattr(v,'x'): + return f"({round(getattr(v, 'x'), ndigits)},{round(getattr(v, 'y'), ndigits)}{',' + str(round(getattr(v, 'z'), ndigits)) if print_z else ''})" + raise ValueError(f"Expected a Point or Vector, got {type(v)}") class LevelHandler(BaseHandler): @@ -822,9 +903,8 @@ class LevelHandler(BaseHandler): floor.Placement.Base.z = dim_sh2fc(float(elm.get('elevation'))) floor.Height = dim_sh2fc(float(elm.get('height'))) self._set_properties(floor, elm) - - floor.ViewObject.Visibility = elm.get('visible', 'true') == 'true' - self._add_groups(floor) + floor.Visibility = elm.get('visible', 'true') == 'true' + self._create_groups(floor) self.importer.add_floor(floor) def create_default_floor(self): @@ -833,8 +913,8 @@ class LevelHandler(BaseHandler): floor.Placement.Base.z = 0 floor.Height = 2500 - self._set_properties(floor, dict({'shType': 'level', 'id':'Level', 'floorThickness':dim_fc2sh(250), 'elevationIndex': 0, 'viewable': True})) - self._add_groups(floor) + self._set_properties(floor, dict({'shType': 'level', 'id':'Level', 'floorThickness':25, 'elevationIndex': 0, 'viewable': True})) + self._create_groups(floor) self.importer.add_floor(floor) return floor @@ -842,20 +922,126 @@ class LevelHandler(BaseHandler): def _set_properties(self, obj, elm): self.setp(obj, "App::PropertyString", "shType", "The element type", 'level') self.setp(obj, "App::PropertyString", "id", "The floor's id", elm) - self.setp(obj, "App::PropertyFloat", "floorThickness", "The floor's slab thickness", dim_sh2fc(float(elm.get('floorThickness')))) + self.setp(obj, "App::PropertyQuantity", "floorThickness", "The floor's slab thickness", dim_sh2fc(float(elm.get('floorThickness')))) self.setp(obj, "App::PropertyInteger", "elevationIndex", "The floor number", elm) self.setp(obj, "App::PropertyBool", "viewable", "Whether the floor is viewable", elm) + def _create_groups(self, floor): + # This is a special group that does not appear in the TreeView. + group = floor.newObject("App::DocumentObjectGroup") + group.Label = f"References-{floor.Label}" + self.setp(floor, "App::PropertyString", "ReferenceFacesGroupName", "The DocumentObjectGroup name for all Reference Faces on this floor", group.Name) + group.Visibility = False + group.ViewObject.ShowInTree = False - def _add_groups(self, floor): - group = floor.newObject("App::DocumentObjectGroup", "Facebinders") - self.setp(floor, "App::PropertyString", "FacebinderGroupName", "The DocumentObjectGroup name for all Facebinders on this floor", group.Name) + if self.importer.preferences["DECORATE_SURFACES"]: + group = floor.newObject("App::DocumentObjectGroup") + group.Label = f"Decoration-{floor.Label}-Walls" + self.setp(floor, "App::PropertyString", "DecorationWallsGroupName", "The DocumentObjectGroup name for all wall decorations on this floor", group.Name) + group = floor.newObject("App::DocumentObjectGroup") + group.Label = f"Decoration-{floor.Label}-Ceilings" + self.setp(floor, "App::PropertyString", "DecorationCeilingsGroupName", "The DocumentObjectGroup name for all ceilings decoration on this floor", group.Name) + group = floor.newObject("App::DocumentObjectGroup") + group.Label = f"Decoration-{floor.Label}-Floors" + self.setp(floor, "App::PropertyString", "DecorationFloorsGroupName", "The DocumentObjectGroup name for all floors decoration on this floor", group.Name) + group = floor.newObject("App::DocumentObjectGroup") + group.Label = f"Decoration-{floor.Label}-Baseboards" + self.setp(floor, "App::PropertyString", "DecorationBaseboardsGroupName", "The DocumentObjectGroup name for all baseboards on this floor", group.Name) if self.importer.preferences["IMPORT_FURNITURES"]: - group = floor.newObject("App::DocumentObjectGroup", "Furnitures") + group = floor.newObject("App::DocumentObjectGroup", f"Furnitures-{floor.Label}") self.setp(floor, "App::PropertyString", "FurnitureGroupName", "The DocumentObjectGroup name for all furnitures in this floor", group.Name) - group = floor.newObject("App::DocumentObjectGroup", "Baseboards") - self.setp(floor, "App::PropertyString", "BaseboardGroupName", "The DocumentObjectGroup name for all baseboards on this floor", group.Name) + + def create_slabs(self, floor): + """Creates a Arch.Slab for the given floor. + + Creating a slab consists in projecting all the structures of that + floor into a plane, then create a extrusion for each one and then + fuse thogether (in order to simplify the slab geometry). + + Args: + floor (Arch.Floor): the Arch Floor for which to create the Slab + """ + # Take the walls and only the spaces whose floor is actually visible. + objects_to_project = list(filter(lambda s: s.floorVisible, self.get_spaces(floor))) + objects_to_project.extend(self.get_walls(floor)) + objects_to_fuse = self._get_object_to_fuse(floor, objects_to_project) + if len(objects_to_fuse) > 0: + if len(objects_to_fuse) > 1: + bf = BOPTools.BOPFeatures.BOPFeatures(App.ActiveDocument) + slab_base = bf.make_multi_fuse([ o.Name for o in objects_to_fuse]) + slab_base.Label = f"{floor.Label}-footprint" + else: + slab_base = objects_to_fuse[0] + slab_base.Label = f"{floor.Label}-footprint" + + slab = Arch.makeStructure(slab_base) + slab.Label = f"{floor.Label}-slab" + slab.setExpression('Height', f"{slab_base.Name}.Shape.BoundBox.ZLength") + slab.Normal = -Z_NORM + floor.addObject(slab) + else: + _wrn(f"No object found for floor {floor.Label}. No slab created.") + + def _get_object_to_fuse(self, floor, objects_to_project): + group = floor.newObject("App::DocumentObjectGroup", f"SlabObjects-{floor.Label}") + group.Visibility = False + group.ViewObject.ShowInTree = False + + objects_to_fuse = [] + for object in objects_to_project: + # Project the floor's objects onto the XY plane + sv = Draft.make_shape2dview(object, Z_NORM) + sv.Label = f"SV-{floor.Label}-{object.Label}" + sv.Placement.Base.z = floor.Placement.Base.z + sv.Visibility = False + sv.recompute() + group.addObject(sv) + + wire = Part.Wire(sv.Shape.Edges) + if not wire.isClosed(): + # Sometimes the wire is not closed because the edges are + # not sorted and do not form a "chain". Therefore, sort them, + # recreate the wire while also rounding the precision of the + # Vertices in order to avoid not closing because the points + # are not close enougth + wire = Part.Wire(Part.__sortEdges__(self._round(sv.Shape.Edges))) + if not wire.isClosed(): + _wrn(f"Projected Face for {object.Label} does not produce a closed wire. Not adding to slab construction ...") + continue + + face = Part.Face(wire) + extrude = face.extrude(-Z_NORM*floor.floorThickness.Value) + part = Part.show(extrude, "Footprint") + part.Label = f"Extrude-{floor.Label}-{object.Label}-footprint" + part.recompute() + part.Visibility = False + part.ViewObject.ShowInTree = False + objects_to_fuse.append(part) + return objects_to_fuse + + def _round(self, edges, decimals=2): + """ + Rounds the coordinates of all vertices in a list of edges to the specified number of decimals. + + :param edges: A list of Part.Edge objects. + :param decimals: Number of decimal places to round to (default: 2). + :return: A list of edges with rounded vertices. + """ + new_edges = [] + + for edge in edges: + vertices = edge.Vertexes + if len(vertices) != 2: # Line or similar + raise ValueError("Unsupported edge type: Only straight edges are handled.") + new_vertices = [ + App.Vector(round(v.X, decimals), round(v.Y, decimals), round(v.Z, decimals)) + for v in vertices + ] + # Create a new edge with the rounded vertices + new_edge = Part.Edge(Part.LineSegment(new_vertices[0], new_vertices[1])) + new_edges.append(new_edge) + return new_edges class RoomHandler(BaseHandler): @@ -878,57 +1064,43 @@ class RoomHandler(BaseHandler): floor = self.get_floor(level_id) assert floor != None, f"Missing floor '{level_id}' for '{elm.get('id')}' ..." - # A Room is composed of a space with the slab as the base object - - points = [] - for point in elm.findall('point'): - x = float(point.get('x')) - y = float(point.get('y')) - z = dim_fc2sh(floor.Placement.Base.z) - points.append(coord_sh2fc(App.Vector(x, y, z))) - - slab = None + space = face = None if self.importer.preferences["MERGE"]: - slab = self.get_fc_object(elm.get("id"), 'room') - - if not slab: - line = Draft.make_wire(points, placement=App.Placement(), closed=True, face=True, support=None) - slab = Arch.makeStructure(line, height=floor.floorThickness) - - slab.Label = elm.get('name', 'Room') + '-slab' - slab.IfcType = "Slab" - slab.Normal = -Z_NORM - - color = elm.get('floorColor', self.importer.preferences["DEFAULT_FLOOR_COLOR"]) - set_color_and_transparency(slab, color) - self._set_properties(slab, elm) - - slab.recompute(True) - - # No 1-to-1 correspondance between SH3D and FC element. - # Creating a fake SH3D elemement in order to take advantage of the - # different lookup facilities. NOTE the suffix '-space' for both - # the sh_type and id... - space = None - if self.importer.preferences["MERGE"]: - space = self.get_fc_object(elm.get("id")+"-space", 'room-space') + space = self.get_fc_object(elm.get("id"), 'room') + # A Room is composed of a space with a Face as the base object if not space: - space = Arch.makeSpace(slab) + floor_z = dim_fc2sh(floor.Placement.Base.z) + points = [ coord_sh2fc(App.Vector(float(p.get('x')), float(p.get('y')), floor_z)) for p in elm.findall('point') ] + # remove consecutive identical points + points = [points[i] for i in range(len(points)) if i == 0 or points[i] != points[i - 1]] + + # Create a reference face that can be used later on to create + # the floor & ceiling decoration... + reference_face = Draft.make_wire(points, closed=True, face=True, support=None) + reference_face.Label = elm.get('name', 'Room') + '-reference' + reference_face.Visibility = False + reference_face.recompute() + floor.getObject(floor.ReferenceFacesGroupName).addObject(reference_face) + + # NOTE: for room to properly display and calculate the area, the + # Base object can not be a face but must have a height... + footprint = App.ActiveDocument.addObject("Part::Feature", "Footprint") + footprint.Shape = reference_face.Shape.extrude(Z_NORM) + footprint.Label = elm.get('name', 'Room') + '-footprint' + + space = Arch.makeSpace(footprint) space.IfcType = "Space" space.Label = elm.get('name', 'Room') - self._set_space_properties(space, elm) + self._set_properties(space, elm) - self.importer.fc_objects[slab.id] = slab - self.importer.fc_objects[space.id] = space + space.setExpression('ElevationWithFlooring', f"{footprint.Name}.Shape.BoundBox.ZMin") + self.setp(space, "App::PropertyLink", "ReferenceFace", "The Reference Part.Face", reference_face) + self.setp(space, "App::PropertyString", "ReferenceFloorName", "The name of the Arch.Floor this room belongs to", floor.Name) - upper_face = self._get_upper_face(slab.Shape.Faces) - if not upper_face: - _wrn(f"Couldn't find the upper face of slab {slab.Label} on level {floor.Label}!") - else: - self.importer.space_upper_faces.append((floor, space, upper_face)) + self.importer.add_space(floor, space) - slab.Visibility = True + space.Visibility = True if space.floorVisible else False floor.addObject(space) @@ -947,15 +1119,41 @@ class RoomHandler(BaseHandler): self.setp(obj, "App::PropertyFloat", "areaYOffset", "The room's area annotation y offset", elm) self.setp(obj, "App::PropertyBool", "floorVisible", "Whether the floor of the room is displayed", elm) self.setp(obj, "App::PropertyString", "floorColor", "The room's floor color", floor_color) - self.setp(obj, "App::PropertyFloat", "floorShininess", "The room's floor shininess", elm) + self.setp(obj, "App::PropertyPercent", "floorShininess", "The room's floor shininess", percent_sh2fc(elm.get('floorShininess', 0))) self.setp(obj, "App::PropertyBool", "ceilingVisible", "Whether the ceiling of the room is displayed", elm) self.setp(obj, "App::PropertyString", "ceilingColor", "The room's ceiling color", ceiling_color) - self.setp(obj, "App::PropertyFloat", "ceilingShininess", "The room's ceiling shininess", elm) + self.setp(obj, "App::PropertyPercent", "ceilingShininess", "The room's ceiling shininess", percent_sh2fc(elm.get('ceilingShininess', 0))) self.setp(obj, "App::PropertyBool", "ceilingFlat", "", elm) - def _set_space_properties(self, obj, elm): - self.setp(obj, "App::PropertyString", "shType", "The element type", 'room-space') - self.setp(obj, "App::PropertyString", "id", "The slab's id", elm.get('id', str(uuid.uuid4()))+"-space") + def post_process(self, obj): + if self.importer.preferences["DECORATE_SURFACES"]: + floor = App.ActiveDocument.getObject(obj.ReferenceFloorName) + self._add_facebinder(floor, obj, "floor") + self._add_facebinder(floor, obj, "ceiling") + + def _add_facebinder(self, floor, space, side): + facebinder_id = f"{floor.id}-{space.id}-{side}-facebinder" + facebinder = None + if self.importer.preferences["MERGE"]: + facebinder = self.get_fc_object(facebinder_id, 'facebinder') + + if not facebinder: + # NOTE: always use Face1 as this is a 2D object + facebinder = Draft.make_facebinder(( space.ReferenceFace, ("Face1", ) )) + facebinder.Extrusion = 1 + facebinder.Label = space.Label + f" {side} finish" + + facebinder.Placement.Base.z = 1 if (side == "floor") else floor.Height.Value-1 + facebinder.Visibility = getattr(space, f"{side}Visible") + set_color_and_transparency(facebinder, getattr(space, f"{side}Color")) + set_shininess(facebinder, getattr(space, f"{side}Shininess", 0)) + + self.setp(facebinder, "App::PropertyString", "shType", "The element type", 'facebinder') + self.setp(facebinder, "App::PropertyString", "id", "The element's id", facebinder_id) + self.setp(facebinder, "App::PropertyString", "ReferenceRoomName", "The Reference Arch.Space", space.Name) + + group_name = getattr(floor, "DecorationFloorsGroupName") if (side == "floor") else getattr(floor, "DecorationCeilingsGroupName") + floor.getObject(group_name).addObject(facebinder) class WallHandler(BaseHandler): @@ -991,24 +1189,20 @@ class WallHandler(BaseHandler): wall.IfcType = "Wall" wall.Label = f"wall{i}" + wall.Base.Label = f"wall{i}-wallshape" self._set_properties(wall, elm) + self._set_baseboard_properties(wall, elm) + self.setp(wall, "App::PropertyString", "ReferenceFloorName", "The Name of the Arch.Floor this walls belongs to", floor.Name) + wall.recompute(True) - self._create_facebinders(floor, wall, elm) - - if self.importer.preferences["IMPORT_FURNITURES"]: - for baseboard in elm.findall('baseboard'): - space = self._import_baseboard(floor, wall, baseboard) - if space: - space.Boundaries = space.Boundaries + [wall] - floor.addObject(wall) if base_object: floor.addObject(base_object) base_object.Visibility = False base_object.Label = base_object.Label + "-" + wall.Label - self.importer.add_wall(wall) + self.importer.add_wall(floor, wall) def _get_sibling_wall(self, parent, wall, sibling_attribute_name): sibling_wall_id = wall.get(sibling_attribute_name, None) @@ -1021,11 +1215,32 @@ class WallHandler(BaseHandler): return sibling_wall def _set_properties(self, obj, elm): + + top_color = elm.get('topColor', self.importer.preferences["DEFAULT_FLOOR_COLOR"]) + left_side_color = elm.get('leftSideColor', self.importer.preferences["DEFAULT_FLOOR_COLOR"]) + right_side_color = elm.get('rightSideColor', self.importer.preferences["DEFAULT_FLOOR_COLOR"]) + self.setp(obj, "App::PropertyString", "shType", "The element type", 'wall') self.setp(obj, "App::PropertyString", "id", "The wall's id", elm) self.setp(obj, "App::PropertyString", "wallAtStart", "The Id of the contiguous wall at the start of this wall", elm) self.setp(obj, "App::PropertyString", "wallAtEnd", "The Id of the contiguous wall at the end of this wall", elm) self.setp(obj, "App::PropertyString", "pattern", "The pattern of this wall in plan view", elm) + self.setp(obj, "App::PropertyString", "topColor", "The wall inner color", top_color) + self.setp(obj, "App::PropertyString", "leftSideColor", "The wall inner color", left_side_color) + self.setp(obj, "App::PropertyPercent","leftSideShininess", "The room's ceiling shininess", percent_sh2fc(elm.get('leftSideShininess', 0))) + self.setp(obj, "App::PropertyString", "rightSideColor", "The wall inner color", right_side_color) + self.setp(obj, "App::PropertyPercent","rightSideShininess", "The room's ceiling shininess", percent_sh2fc(elm.get('rightSideShininess', 0))) + + def _set_baseboard_properties(self, obj, elm): + # Baseboard are a little bit special: + # Since their placement and other characteristics are dependant of + # the wall elements to be created (such as Door&Windows), their + # creation is delayed until the + for baseboard in elm.findall('baseboard'): + side = baseboard.get('attribute') + self.setp(obj, "App::PropertyQuantity", f"{side}Thickness", f"The thickness of the {side} baseboard", dim_sh2fc(float(baseboard.get("thickness")))) + self.setp(obj, "App::PropertyQuantity", f"{side}Height", f"The height of the {side} baseboard", dim_sh2fc(float(baseboard.get("height")))) + self.setp(obj, "App::PropertyString", f"{side}Color", f"The color of the {side} baseboard", baseboard.get("color")) def _create_wall(self, floor, prev, next, elm): """Create an Arch::Structure from an SH3D Element. @@ -1070,7 +1285,7 @@ class WallHandler(BaseHandler): # object based on ruled surface instead. # See https://github.com/FreeCAD/FreeCAD/issues/18658 and related OCCT # ticket - if (sweep.Shape.isNull() or not sweep.Shape.isValid()): + if sweep.Shape.isNull() or not sweep.Shape.isValid(): if is_wall_straight: _log(f"Sweep's shape is invalid, using ruled surface instead ...") App.ActiveDocument.removeObject(sweep.Label) @@ -1082,13 +1297,13 @@ class WallHandler(BaseHandler): else: wall = Arch.makeWall(sweep) - # Keep track of base object. Used for baseboard import + # Keep track of base objects. Used to decorate walls self.importer.set_property(wall, "App::PropertyLinkList", "BaseObjects", "The different base objects whose sweep failed. Kept for compatibility reasons", [section_start, section_end, spine]) # TODO: Width is incorrect when joining walls - wall.setExpression('Length', f'{spine.Label}.Length') - wall.setExpression('Width', f'({section_start.Label}.Length + {section_end.Label}.Length) / 2') - wall.setExpression('Height', f'({section_start.Label}.Height + {section_end.Label}.Height) / 2') + wall.setExpression('Length', f'{spine.Name}.Length') + wall.setExpression('Width', f'({section_start.Name}.Length + {section_end.Name}.Length) / 2') + wall.setExpression('Height', f'({section_start.Name}.Height + {section_end.Name}.Height) / 2') return wall, base_object @@ -1104,7 +1319,7 @@ class WallHandler(BaseHandler): Part::Sweep: the Part::Sweep """ App.ActiveDocument.recompute([section_start, section_end, spine]) - sweep = App.ActiveDocument.addObject('Part::Sweep') + sweep = App.ActiveDocument.addObject('Part::Sweep', "WallShape") sweep.Sections = [section_start, section_end] sweep.Spine = spine sweep.Solid = True @@ -1137,7 +1352,7 @@ class WallHandler(BaseHandler): compound.Links = [ruled_surface, section_start, section_end, spine] compound.recompute() - compound_solid = App.ActiveDocument.addObject("Part::Feature") + compound_solid = App.ActiveDocument.addObject("Part::Feature", "WallShape") compound_solid.Shape = Part.Solid(Part.Shell(compound.Shape.Faces)) return compound_solid, compound @@ -1170,11 +1385,6 @@ class WallHandler(BaseHandler): height_start = dim_sh2fc(elm.get('height', dim_fc2sh(floor.Height))) height_end = dim_sh2fc(elm.get('heightAtEnd', dim_fc2sh(height_start))) - # NOTE: the wall height is adjusted with the floor thickness - # BUG: It should be adjusted for all floor except the last one. - height_start = height_start + floor.floorThickness - height_end = height_end + floor.floorThickness - start = coord_sh2fc(App.Vector(x_start, y_start, z)) end = coord_sh2fc(App.Vector(x_end, y_end, z)) @@ -1197,6 +1407,7 @@ class WallHandler(BaseHandler): section_end = self._get_section(wall_details, False, next_wall_details) spine = Draft.makeLine(start, end) + spine.Label = f"Spine" App.ActiveDocument.recompute([section_start, section_end, spine]) if self.importer.preferences["DEBUG"]: _log(f"_create_straight_segment(): wall {self._pv(start)}->{self._pv(end)} => section_start={self._ps(section_start)}, section_end={self._ps(section_end)}") @@ -1237,7 +1448,12 @@ class WallHandler(BaseHandler): # The Length property is used in the Wall to calculate volume, etc... # Since make Circle does not calculate this Length I calculate it here... self.importer.set_property(spine, "App::PropertyFloat", "Length", "The length of the Arc", length, group="Draft") + # The Start and End property are used in the Wall to determine Facebinders + # characteristics... + self.importer.set_property(spine, "App::PropertyVector", "Start", "The start point of the Arc", start, group="Draft") + self.importer.set_property(spine, "App::PropertyVector", "End", "The end point of the Arc", end, group="Draft") + spine.Label = f"Spine" App.ActiveDocument.recompute([section_start, section_end, spine]) if self.importer.preferences["DEBUG"]: _log(f"_create_curved_segment(): wall {self._pv(start)}->{self._pv(end)} => section_start={self._ps(section_start)}, section_end={self._ps(section_end)}") @@ -1301,6 +1517,7 @@ class WallHandler(BaseHandler): section.recompute() _color_section(section) + section.Label = "Section-start" if at_start else "Section-end" return section def _get_intersection_edge(self, lside, rside, sibling_lside, sibling_rside): @@ -1359,7 +1576,7 @@ class WallHandler(BaseHandler): # We take the center that preserve the arc_extent orientation (in FC # coordinate). The orientation is calculated from start to end center = circles[0].Center - if numpy.sign(arc_extent) != numpy.sign(DraftVecUtils.angle(start-center, end-center, Z_NORM)): + if np.sign(arc_extent) != np.sign(DraftVecUtils.angle(start-center, end-center, Z_NORM)): invert_angle = True center = circles[1].Center @@ -1410,85 +1627,87 @@ class WallHandler(BaseHandler): """ return (b - a).cross(c - a).normalize() - def _ps(self, section, print_z: bool = False): - # Pretty print a Section in a condensed way - if hasattr(section, 'Shape'): - v = section.Shape.Vertexes - else: - # a Part.Face - v = section.Vertexes - return f"[{self._pv(v[0].Point, print_z)}, {self._pv(v[1].Point, print_z)}, {self._pv(v[2].Point, print_z)}, {self._pv(v[3].Point, print_z)}]" + def post_process(self, obj): + if self.importer.preferences["DECORATE_SURFACES"]: + floor = App.ActiveDocument.getObject(obj.ReferenceFloorName) - def _pe(self, edge, print_z: bool = False): - # Print an Edge in a condensed way - v = edge.Vertexes - return f"[{self._pv(v[0].Point, print_z)}, {self._pv(v[1].Point, print_z)}]" + (left_face_name, left_face, right_face_name, right_face) = self._get_faces(obj) - def _pv(self, v, print_z: bool = False, ndigits: None = None): - # Print an Vector in a condensed way - if hasattr(v,'X'): - return f"({round(getattr(v, 'X'), ndigits)},{round(getattr(v, 'Y'), ndigits)}{',' + str(round(getattr(v, 'Z'), ndigits)) if print_z else ''})" - elif hasattr(v,'x'): - return f"({round(getattr(v, 'x'), ndigits)},{round(getattr(v, 'y'), ndigits)}{',' + str(round(getattr(v, 'z'), ndigits)) if print_z else ''})" - raise ValueError(f"Expected a Point or Vector, got {type(v)}") + self._create_facebinders(floor, obj, left_face_name, right_face_name) - def _create_facebinders(self, floor, wall, elm): + self._create_baseboards(floor, obj, left_face, right_face) + + def _create_facebinders(self, floor, wall, left_face_name, right_face_name): """Set the wall's colors taken from `elm`. Creates 2 FaceBinders (left and right) and sets the corresponding color and the shininess of the wall. Args: + floor (Arch::Level): the level the wall belongs to. Used to group + the resulting Facebinders wall (Arch::Wall): the wall to paint elm (Element): the xml element for the wall to be imported + left_face_name (str): the name of the left face suitable for selecting + right_face_name (str): the name of the right face suitable for selecting """ # The top color is the color of the "mass" of the wall - top_color = elm.get('topColor', self.importer.preferences["DEFAULT_FLOOR_COLOR"]) + top_color = wall.topColor set_color_and_transparency(wall, top_color) + self._create_facebinder(floor, wall,left_face_name, "left") + self._create_facebinder(floor, wall, right_face_name, "right") - left_facebinder = Draft.make_facebinder(( wall, ("Face2", ) )) - left_facebinder.Extrusion = 1 - left_facebinder.Label = wall.Label + "-fb-left" - left_side_color = elm.get('leftSideColor', top_color) - set_color_and_transparency(left_facebinder, left_side_color) - left_side_shininess = elm.get('leftSideShininess', 0) - set_shininess(left_facebinder, left_side_shininess) - floor.getObject(floor.FacebinderGroupName).addObject(left_facebinder) + def _create_facebinder(self, floor, wall, face_name, side): + if face_name: + facebinder_id = f"{wall.id}-{side}-facebinder" + facebinder = None + if self.importer.preferences["MERGE"]: + facebinder = self.get_fc_object(facebinder_id, 'facebinder') - right_facebinder = Draft.make_facebinder(( wall, ("Face4", ) )) - right_facebinder.Extrusion = 1 - right_facebinder.Label = wall.Label + "-fb-right" - right_side_color = elm.get('rightSideColor', top_color) - set_color_and_transparency(right_facebinder, right_side_color) - right_side_shininess = elm.get('rightSideShininess', 0) - set_shininess(right_facebinder, right_side_shininess) - floor.getObject(floor.FacebinderGroupName).addObject(right_facebinder) + if not facebinder: + facebinder = Draft.make_facebinder(( wall, (face_name, ) )) + facebinder.Extrusion = 1 + facebinder.Label = wall.Label + f" {side} side finish" - def _import_baseboard(self, floor, wall, elm): + color = getattr(wall, f"{side}SideColor") + set_color_and_transparency(facebinder, color) + shininess = getattr(wall, f"{side}SideShininess", 0) + set_shininess(facebinder, shininess) + self.setp(facebinder, "App::PropertyString", "shType", "The element type", 'facebinder') + self.setp(facebinder, "App::PropertyString", "id", "The element's id", facebinder_id) + self.setp(facebinder, "App::PropertyString", "ReferenceWallName", "The element's wall Name", wall.Name) + + floor.getObject(floor.DecorationWallsGroupName).addObject(facebinder) + else: + _wrn(f"Failed to determine {side} face for wall {wall.Label}!") + + def _create_baseboards(self, floor, wall, left_face, right_face): """Creates and returns a Part::Extrusion from the imported_baseboard object Args: floor (Slab): the Slab the wall belongs to wall (Wall): the Arch wall - elm (Element): the wall being imported + elm (Element): the wall being imported (with child baseboards) + left_face (Part.Face): the left hand side of the wall + right_face (Part.Face): the right hand side of the wall Returns: Part::Extrusion: the newly created object """ - wall_width = float(wall.Width) + for side in ["leftSideBaseboard", "rightSideBaseboard"]: + if hasattr(wall, f"{side}Height"): + face = left_face if side == "leftSideBaseboard" else right_face + self._create_baseboard(floor, wall, side, face) - baseboard_width = dim_sh2fc(elm.get('thickness')) - baseboard_height = dim_sh2fc(elm.get('height')) + def _create_baseboard(self, floor, wall, side, face): - # This is brittle in case the wall is merged and the there are already - # some doors, windows, etc... - side = elm.get('attribute') - faces = wall.Base.Shape.Faces - face = faces[1] if side == 'leftSideBaseboard' else faces[3] + baseboard_width = getattr(wall, f"{side}Thickness").Value + baseboard_height = getattr(wall, f"{side}Height").Value # Once I have the face, I get the lowest edge. lowest_z = float('inf') bottom_edge = None + for edge in face.Edges: if edge and edge.CenterOfMass and edge.CenterOfMass.z < lowest_z: lowest_z = edge.CenterOfMass.z @@ -1512,16 +1731,16 @@ class WallHandler(BaseHandler): for edge in [edge0, edge1, edge2, edge3]: edge.Vertexes[0].Point.z = edge.Vertexes[1].Point.z = ref_z - baseboard_id = f"{wall.id}-{side}" + baseboard_id = f"{wall.id} {side}" baseboard = None if self.importer.preferences["MERGE"]: baseboard = self.get_fc_object(baseboard_id, 'baseboard') if not baseboard: - base = App.ActiveDocument.addObject("Part::Feature", "baseboard-base") + base = App.ActiveDocument.addObject("Part::Feature", f"{wall.Label} {side} base") base.Shape = Part.makeFace([ Part.Wire([edge0, edge1, edge2, edge3]) ]) base.Visibility = False - baseboard = App.ActiveDocument.addObject('Part::Extrusion', f"{wall.Label}-{side}") + baseboard = App.ActiveDocument.addObject('Part::Extrusion', f"{wall.Label} {side}") baseboard.Base = base baseboard.DirMode = "Custom" @@ -1535,23 +1754,79 @@ class WallHandler(BaseHandler): baseboard.TaperAngle = 0 baseboard.TaperAngleRev = 0 - set_color_and_transparency(baseboard, elm.get('color')) + set_color_and_transparency(baseboard, getattr(wall, f"{side}Color")) self.setp(baseboard, "App::PropertyString", "shType", "The element type", 'baseboard') self.setp(baseboard, "App::PropertyString", "id", "The element's id", baseboard_id) - self.setp(baseboard, "App::PropertyLink", "parent", "The element parent", wall) + self.setp(baseboard, "App::PropertyString", "ReferenceWallName", "The element's wall Name", wall.Name) baseboard.recompute(True) + floor.getObject(floor.DecorationBaseboardsGroupName).addObject(baseboard) - space = self.get_space(floor, baseboard.Shape.BoundBox.Center) - if space: - space.Group = space.Group + [baseboard] - else: - _log(f"No space found to enclose {baseboard.Label}. Adding to generic group.") - floor.getObject(floor.BaseboardGroupName).addObject(baseboard) + def _get_faces(self, wall): + """Returns the name of the left and right face for `wall` - # Returns the Space for the wall to be added to the space.Boundaries - return space + The face names are suitable for selection later on when creating + the Facebinders and baseboards. Note, that this must be executed + once the wall has been completly been constructued. If a window + or door is added afterward, this will have an impact on what is + considered the left and right side of the wall + + Args: + wall (Arch.Wall): the wall for which we have to determine + the left and right side. + + Returns: + tuple: a tuple of string containing the name of the left and + right side of the wall + """ + # In order to handle curved walls, take the oriented line (from + # start to end) that pass throuh the center of gravity of the wall + # Hopefully the COG of the face will always be on the correct side + # of the COG of the wall + wall_start = wall.BaseObjects[2].Start + wall_end = wall.BaseObjects[2].End + wall_cog_start = wall.Shape.CenterOfGravity + wall_cog_end = wall_cog_start + wall_end - wall_start + + left_face_name = right_face_name = None + left_face = right_face = None + for (i, face) in enumerate(wall.Shape.Faces): + face_cog = face.CenterOfGravity + + # The face COG is not on the same z as the wall COG + # just skipping. + if not math.isclose(face_cog.z, wall_cog_start.z, abs_tol=1): + continue + + side = self._get_face_side(wall_cog_start, wall_cog_end, face_cog) + # NOTE: face names start at 1... + if side > 0: + left_face_name = f"Face{i+1}" + left_face = face + elif side < 0: + right_face_name = f"Face{i+1}" + right_face = face + if left_face_name and right_face_name: + # Optimization. Is it always true? + break + return (left_face_name, left_face, right_face_name, right_face) + + def _get_face_side(self, start:App.Vector, end:App.Vector, cog:App.Vector): + # Compute vectors + ab = end - start # Vector from start to end + ac = cog - start # Vector from start to CenterOfGravity + + ab.z = 0 + ac.z = 0 + + # Compute the cross product (z-component is enough for 2D test) + cross_z = ab.x * ac.y - ab.y * ac.x + + # Determine the position of point cog + if math.isclose(cross_z, 0, abs_tol=1): + return 0 + return cross_z class BaseFurnitureHandler(BaseHandler): @@ -1594,7 +1869,7 @@ class BaseFurnitureHandler(BaseHandler): self.setp(obj, "App::PropertyBool", "deformable", "Whether the object is deformable", elm) self.setp(obj, "App::PropertyBool", "texturable", "Whether the object is texturable", elm) self.setp(obj, "App::PropertyString", "staircaseCutOutShape", "", elm) - self.setp(obj, "App::PropertyFloat", "shininess", "The object's shininess", elm) + self.setp(obj, "App::PropertyPercent", "shininess", "The object's shininess", percent_sh2fc(elm.get('shininess', 0))) self.setp(obj, "App::PropertyFloat", "valueAddedTaxPercentage", "The object's VAT percentage", elm) self.setp(obj, "App::PropertyString", "currency", "The object's price currency", str(elm.get('currency', 'EUR'))) @@ -1696,18 +1971,27 @@ class DoorOrWindowHandler(BaseFurnitureHandler): corner = center.add(App.Vector(-width/2, -depth/2, -height/2)) + # Then create a box that represent the BoundingBox of the windows + # to find out which wall contains the window. solid = Part.makeBox(width, depth, height) solid.rotate(solid.CenterOfMass, Z_NORM, math.degrees(ang_sh2fc(angle))) solid.translate(corner) # Get all the walls hosting that door/window... wall_width = -DEFAULT_WALL_WIDTH - walls = self._get_containing_walls(solid) + walls = self._get_containing_walls(floor, solid) if len(walls) == 0: _err(f"Missing wall for {elm.get('id')}. Defaulting to width {DEFAULT_WALL_WIDTH} ...") else: - wall_width = walls[0].Width - + # NOTE: + # The main host (the one defining the width of the door/window) is + # the one that contains the CenterOfMass of the windows, or maybe + # the one that has the same normal? + wall_width = float(walls[0].Width) + com = solid.CenterOfMass + for wall in walls: + if wall.Shape.isInside(com, 1, False): + wall_width = float(wall.Width) center2corner = App.Vector(-width/2, -wall_width/2, 0) rotation = App.Rotation(Z_NORM, math.degrees(ang_sh2fc(angle))) @@ -1730,13 +2014,14 @@ class DoorOrWindowHandler(BaseFurnitureHandler): (windowtype, ifc_type) = ('Simple door', 'Door') # See the https://wiki.freecad.org/Arch_Window for details about these values - h1 = 50 - h2 = 50 - h3 = 50 - o1 = 40 - w1 = float(wall_width)-o1 # make sure the door takes the whole wall (facebinder+baseboard) - w2 = 40 - o2 = (w1-w2) / 2 + # Only using Opening / Fixed / Simple Door + h1 = min(50,height*.025) # 2.5% of frame + h2 = h1 + h3 = 0 + w1 = wall_width + w2 = min(20.0,wall_width*.2) # 20% of width + o1 = 0 + o2 = (wall_width-w2)/2 window = Arch.makeWindowPreset(windowtype, width, height, h1, h2, h3, w1, w2, o1, o2, pl) window.IfcType = ifc_type @@ -1752,10 +2037,11 @@ class DoorOrWindowHandler(BaseFurnitureHandler): window.Hosts = walls return window - def _get_containing_walls(self, solid): + def _get_containing_walls(self, floor, solid): """Returns the wall(s) intersecting with the door/window. Args: + floor (Arch.Level): the level the solid must belongs to solid (Part.Solid): the solid to test against each wall's bounding box @@ -1763,7 +2049,7 @@ class DoorOrWindowHandler(BaseFurnitureHandler): list(Arch::Wall): the wall(s) containing the given solid """ host_walls = [] - for wall in self.importer.get_walls(): + for wall in self.importer.get_walls(floor): if solid.common(wall.Shape).Volume > 0: host_walls.append(wall) return host_walls @@ -1821,7 +2107,7 @@ class FurnitureHandler(BaseFurnitureHandler): # We add the object to the list of known object that can then # be referenced elsewhere in the SH3D model (i.e. lights). - self.importer.fc_objects[feature.id] = feature + self.importer.add_fc_objects(feature) def _create_equipment(self, floor, elm): width = dim_sh2fc(float(elm.get('width'))) @@ -1852,7 +2138,7 @@ class FurnitureHandler(BaseFurnitureHandler): App.Vector(rij[3], rij[4], rij[5]), App.Vector(rij[6], rij[7], rij[8]) ) - _msg(f"model_rotation is not yet implemented ...") + _msg(f"{elm.get('id')}: modelRotation is not yet implemented ...") transform.scale(width/bb.XLength, height/bb.YLength, depth/bb.ZLength) # NOTE: the model is facing up, thus y and z are inverted transform.rotateX(math.pi/2) @@ -2093,8 +2379,17 @@ def _color_section(section): def set_shininess(obj, shininess): + # TODO: it seems a shininess of 0 means the wall loose its + # color. We leave it at the default setting untill a later time + return if not App.GuiUp or not shininess: return - if hasattr(obj.ViewObject, "Shininess"): - # Shininess goes from 0 -> 0.25 in SH3d and 0 -> 100 in FC - obj.ViewObject.Shininess = int((100*shininess)/0.25) + if hasattr(obj.ViewObject, "ShapeAppearance"): + mat = obj.ViewObject.ShapeAppearance[0] + mat.Shininess = float(shininess)/100 + obj.ViewObject.ShapeAppearance = mat + + +def percent_sh2fc(percent): + # percent goes from 0 -> 1 in SH3d and 0 -> 100 in FC + return int(float(percent)*100) From 27732fdf509fbc3a0d449073ea1a243646e926ff Mon Sep 17 00:00:00 2001 From: Paul Lee Date: Sat, 25 Jan 2025 01:15:01 +0800 Subject: [PATCH 027/224] [ArchWall] Fix Regression Single-edge Wall w/ Multi-Material Forum Discussion - https://forum.freecad.org/viewtopic.php?t=93610&start=10#p806296 Github Issues - https://github.com/FreeCAD/FreeCAD/issues/19147#issuecomment-2607946858 --- src/Mod/BIM/ArchWall.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Mod/BIM/ArchWall.py b/src/Mod/BIM/ArchWall.py index 14b3319312..c839b3e9ca 100644 --- a/src/Mod/BIM/ArchWall.py +++ b/src/Mod/BIM/ArchWall.py @@ -547,6 +547,8 @@ class _Wall(ArchComponent.Component): for e in self.connectEdges: l += e.Length l = l / 2 + if self.layersNum: + l = l / self.layersNum if obj.Length.Value != l: obj.Length = l self.oldLength = None # delete the stored value to prevent triggering base change below @@ -986,6 +988,9 @@ class _Wall(ArchComponent.Component): if self.basewires: if (len(self.basewires) == 1) and layers: self.basewires = [self.basewires[0] for l in layers] + self.layersNum = len(layers) + else: + self.layersNum = 0 layeroffset = 0 baseface = None self.connectEdges = [] From 02aa90f6c71aefee9158495fc968d5f1a6d35197 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Fri, 17 Jan 2025 21:38:22 +0100 Subject: [PATCH 028/224] Export subclasses of Part::Feature --- src/Mod/Part/App/FeatureCompound.h | 2 +- src/Mod/Part/App/FeaturePartBoolean.h | 2 +- src/Mod/Part/App/FeaturePartCommon.h | 2 +- src/Mod/Part/App/FeaturePartFuse.h | 2 +- src/Mod/Part/App/PartFeature.h | 2 +- src/Mod/Part/App/PartFeatures.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Part/App/FeatureCompound.h b/src/Mod/Part/App/FeatureCompound.h index 8e3f8ec4b0..916c1ec6d5 100644 --- a/src/Mod/Part/App/FeatureCompound.h +++ b/src/Mod/Part/App/FeatureCompound.h @@ -30,7 +30,7 @@ namespace Part { -class Compound : public Part::Feature +class PartExport Compound : public Part::Feature { PROPERTY_HEADER_WITH_OVERRIDE(Part::Compound); diff --git a/src/Mod/Part/App/FeaturePartBoolean.h b/src/Mod/Part/App/FeaturePartBoolean.h index 5c0d28950e..32092b35ac 100644 --- a/src/Mod/Part/App/FeaturePartBoolean.h +++ b/src/Mod/Part/App/FeaturePartBoolean.h @@ -32,7 +32,7 @@ class FCBRepAlgoAPI_BooleanOperation; namespace Part { -class Boolean : public Part::Feature +class PartExport Boolean : public Part::Feature { PROPERTY_HEADER_WITH_OVERRIDE(Part::Boolean); diff --git a/src/Mod/Part/App/FeaturePartCommon.h b/src/Mod/Part/App/FeaturePartCommon.h index 5a30a1ee26..b04c028306 100644 --- a/src/Mod/Part/App/FeaturePartCommon.h +++ b/src/Mod/Part/App/FeaturePartCommon.h @@ -45,7 +45,7 @@ protected: //@} }; -class MultiCommon : public Part::Feature +class PartExport MultiCommon : public Part::Feature { PROPERTY_HEADER_WITH_OVERRIDE(Part::MultiCommon); diff --git a/src/Mod/Part/App/FeaturePartFuse.h b/src/Mod/Part/App/FeaturePartFuse.h index 97ef64bde8..18f659bb29 100644 --- a/src/Mod/Part/App/FeaturePartFuse.h +++ b/src/Mod/Part/App/FeaturePartFuse.h @@ -45,7 +45,7 @@ protected: //@} }; -class MultiFuse : public Part::Feature +class PartExport MultiFuse : public Part::Feature { PROPERTY_HEADER_WITH_OVERRIDE(Part::MultiFuse); diff --git a/src/Mod/Part/App/PartFeature.h b/src/Mod/Part/App/PartFeature.h index c865f0ab4c..50abe520cd 100644 --- a/src/Mod/Part/App/PartFeature.h +++ b/src/Mod/Part/App/PartFeature.h @@ -201,7 +201,7 @@ private: std::vector> _elementCachePrefixMap; }; -class FilletBase : public Part::Feature +class PartExport FilletBase : public Part::Feature { PROPERTY_HEADER_WITH_OVERRIDE(Part::FilletBase); diff --git a/src/Mod/Part/App/PartFeatures.h b/src/Mod/Part/App/PartFeatures.h index 2d6f7d14e6..6eef704111 100644 --- a/src/Mod/Part/App/PartFeatures.h +++ b/src/Mod/Part/App/PartFeatures.h @@ -128,7 +128,7 @@ private: static const char* TransitionEnums[]; }; -class Thickness : public Part::Feature +class PartExport Thickness : public Part::Feature { PROPERTY_HEADER_WITH_OVERRIDE(Part::Thickness); From 6a3eb2ab49514706590a3e9d3e48a373175b7d89 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Wed, 15 Jan 2025 22:31:36 +0100 Subject: [PATCH 029/224] Use is() when possible --- src/Mod/Assembly/Gui/ViewProviderAssembly.cpp | 10 +++----- .../Inspection/Gui/ViewProviderInspection.cpp | 2 +- src/Mod/Sandbox/Gui/AppSandboxGui.cpp | 4 +-- .../App/ExternalGeometryFacadePyImp.cpp | 2 +- src/Mod/Sketcher/App/GeometryFacade.h | 2 +- src/Mod/Sketcher/App/PythonConverter.cpp | 25 +++++++++++-------- src/Mod/Sketcher/App/SketchObject.cpp | 18 +++++++------ .../Sketcher/Gui/DrawSketchHandlerOffset.h | 5 ++-- .../Sketcher/Gui/DrawSketchHandlerSplitting.h | 11 ++++++-- src/Mod/Spreadsheet/App/Sheet.cpp | 6 ++--- 10 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp index e3b78445b2..b9a59e29a0 100644 --- a/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp +++ b/src/Mod/Assembly/Gui/ViewProviderAssembly.cpp @@ -160,10 +160,7 @@ bool ViewProviderAssembly::doubleClicked() bool ViewProviderAssembly::canDragObject(App::DocumentObject* obj) const { // The user should not be able to drag the joint group out of the assembly - if (!obj || obj->getTypeId() == Assembly::JointGroup::getClassTypeId()) { - return false; - } - return true; + return obj && !obj->is(); } bool ViewProviderAssembly::canDragObjectToTarget(App::DocumentObject* obj, @@ -1028,9 +1025,8 @@ bool ViewProviderAssembly::onDelete(const std::vector& subNames) { // Delete the assembly groups when assembly is deleted for (auto obj : getObject()->getOutList()) { - if (obj->getTypeId() == Assembly::JointGroup::getClassTypeId() - || obj->getTypeId() == Assembly::ViewGroup::getClassTypeId() - || obj->getTypeId() == Assembly::BomGroup::getClassTypeId()) { + if (obj->is() || obj->is() + || obj->is()) { // Delete the group content first. Gui::Command::doCommand(Gui::Command::Doc, diff --git a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp index 4dd4d784b3..b296fd94fa 100644 --- a/src/Mod/Inspection/Gui/ViewProviderInspection.cpp +++ b/src/Mod/Inspection/Gui/ViewProviderInspection.cpp @@ -385,7 +385,7 @@ void ViewProviderInspection::setDistances() SoDebugError::post("ViewProviderInspection::setDistances", "Unknown property 'Distances'"); return; } - if (pDistances->getTypeId() != Inspection::PropertyDistanceList::getClassTypeId()) { + if (!pDistances->is()) { SoDebugError::post( "ViewProviderInspection::setDistances", "Property 'Distances' has type %s (Inspection::PropertyDistanceList was expected)", diff --git a/src/Mod/Sandbox/Gui/AppSandboxGui.cpp b/src/Mod/Sandbox/Gui/AppSandboxGui.cpp index 848ec3169f..210dada07f 100644 --- a/src/Mod/Sandbox/Gui/AppSandboxGui.cpp +++ b/src/Mod/Sandbox/Gui/AppSandboxGui.cpp @@ -73,9 +73,9 @@ private: return; Part::Geometry* g1 = items[0]; Part::Geometry* g2 = items[1]; - if (!g1 || g1->getTypeId() != Part::GeomArcOfCircle::getClassTypeId()) + if (!g1 || !g1->is()) return; - if (!g2 || g2->getTypeId() != Part::GeomLineSegment::getClassTypeId()) + if (!g2 || !g2->is()) return; Part::GeomArcOfCircle* arc = static_cast(g1); Part::GeomLineSegment* seg = static_cast(g2); diff --git a/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp b/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp index 1127d31f4d..cebe5f27b1 100644 --- a/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp +++ b/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp @@ -510,7 +510,7 @@ Py::Boolean ExternalGeometryFacadePy::getConstruction() const void ExternalGeometryFacadePy::setConstruction(Py::Boolean arg) { - if (getExternalGeometryFacadePtr()->getTypeId() != Part::GeomPoint::getClassTypeId()) { + if (!getExternalGeometryFacadePtr()->is()) { getExternalGeometryFacadePtr()->setConstruction(arg); } } diff --git a/src/Mod/Sketcher/App/GeometryFacade.h b/src/Mod/Sketcher/App/GeometryFacade.h index 43da4bc8ec..1b8e218484 100644 --- a/src/Mod/Sketcher/App/GeometryFacade.h +++ b/src/Mod/Sketcher/App/GeometryFacade.h @@ -87,7 +87,7 @@ class GeometryFacadePy; * * Part::Geometry* copy = v->copy(); * - * if(construction && copy->getTypeId() != Part::GeomPoint::getClassTypeId()) { + * if(construction && !copy->is()) { * GeometryFacade::setConstruction(copy, construction); * } * diff --git a/src/Mod/Sketcher/App/PythonConverter.cpp b/src/Mod/Sketcher/App/PythonConverter.cpp index 8e2c05b7b0..7c7dbdae19 100644 --- a/src/Mod/Sketcher/App/PythonConverter.cpp +++ b/src/Mod/Sketcher/App/PythonConverter.cpp @@ -46,15 +46,16 @@ std::string PythonConverter::convert(const Part::Geometry* geo, Mode mode) command = boost::str(boost::format("addGeometry(%s,%s)\n") % sg.creation % (sg.construction ? "True" : "False")); - if ((geo->getTypeId() != Part::GeomEllipse::getClassTypeId() - || geo->getTypeId() != Part::GeomArcOfEllipse::getClassTypeId() - || geo->getTypeId() != Part::GeomArcOfHyperbola::getClassTypeId() - || geo->getTypeId() != Part::GeomArcOfParabola::getClassTypeId() - || geo->getTypeId() != Part::GeomBSplineCurve::getClassTypeId()) - && mode == Mode::CreateInternalGeometry) { + // clang-format off: keep line breaks for readability + if ((!geo->is() + || !geo->is() + || !geo->is() + || !geo->is() + || !geo->is()) && mode == Mode::CreateInternalGeometry) { command += boost::str(boost::format("exposeInternalGeometry(len(ActiveSketch.Geometry))\n")); } + // clang-format on return command; } @@ -149,15 +150,17 @@ std::string PythonConverter::convert(const std::string& doc, if (mode == Mode::CreateInternalGeometry) { for (auto geo : geos) { index++; - if (geo->getTypeId() != Part::GeomEllipse::getClassTypeId() - || geo->getTypeId() != Part::GeomArcOfEllipse::getClassTypeId() - || geo->getTypeId() != Part::GeomArcOfHyperbola::getClassTypeId() - || geo->getTypeId() != Part::GeomArcOfParabola::getClassTypeId() - || geo->getTypeId() != Part::GeomBSplineCurve::getClassTypeId()) { + // clang-format off: keep line breaks for readability + if (!geo->is() + || !geo->is() + || !geo->is() + || !geo->is() + || !geo->is()) { std::string newcommand = boost::str(boost::format("exposeInternalGeometry(lastGeoId + %d)\n") % (index)); command += newcommand; } + // clang-format on } } diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 8c14ad1e7d..fd4dbbbca4 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -2480,8 +2480,8 @@ void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int ge // TODO: Add support for curved lines. const Part::Geometry* geo1 = getGeometry(geoId1); const Part::Geometry* geo2 = getGeometry(geoId2); - if (geo1->getTypeId() != Part::GeomLineSegment::getClassTypeId() - || geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { + if (!geo1->is() + || !geo2->is()) { delConstraintOnPoint(geoId1, posId1, false); delConstraintOnPoint(geoId2, posId2, false); return; @@ -4458,7 +4458,7 @@ bool SketchObject::isCarbonCopyAllowed(App::Document* pDoc, App::DocumentObject* std::string sketchArchType ("Sketcher::SketchObjectPython"); // Only applicable to sketches - if (pObj->getTypeId() != Sketcher::SketchObject::getClassTypeId() + if (!pObj->is() && sketchArchType != pObj->getTypeId().getName()) { if (rsn) { *rsn = rlNotASketch; @@ -6913,13 +6913,15 @@ bool SketchObject::increaseBSplineDegree(int GeoId, int degreeincrement /*= 1*/) // no need to check input data validity as this is an sketchobject managed operation. Base::StateLocker lock(managedoperation, true); - if (GeoId < 0 || GeoId > getHighestCurveIndex()) + if (GeoId < 0 || GeoId > getHighestCurveIndex()) { return false; + } const Part::Geometry* geo = getGeometry(GeoId); - if (geo->getTypeId() != Part::GeomBSplineCurve::getClassTypeId()) + if (!geo->is()) { return false; + } const auto* bsp = static_cast(geo); @@ -6960,7 +6962,7 @@ bool SketchObject::decreaseBSplineDegree(int GeoId, int degreedecrement /*= 1*/) const Part::Geometry* geo = getGeometry(GeoId); - if (geo->getTypeId() != Part::GeomBSplineCurve::getClassTypeId()) + if (!geo->is()) return false; const auto* bsp = static_cast(geo); @@ -7449,7 +7451,7 @@ int SketchObject::carbonCopy(App::DocumentObject* pObj, bool construction) for (std::vector::const_iterator it = svals.begin(); it != svals.end(); ++it) { Part::Geometry* geoNew = (*it)->copy(); generateId(geoNew); - if (construction && geoNew->getTypeId() != Part::GeomPoint::getClassTypeId()) { + if (construction && !geoNew->is()) { GeometryFacade::setConstruction(geoNew, true); } newVals.push_back(geoNew); @@ -10111,7 +10113,7 @@ void SketchObject::onChanged(const App::Property* prop) if (ext->testMigrationType(Part::GeometryMigrationExtension::Construction)) { bool oldconstr = ext->getConstruction(); - if (geometryValue->getTypeId() == Part::GeomPoint::getClassTypeId() + if (geometryValue->is() && !gf->isInternalAligned()) { oldconstr = true; } diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h index 81ee64b6db..f098cb7160 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerOffset.h @@ -735,9 +735,8 @@ private: break; } } - else if (isLineSegment(*geo2) - || geo2->getTypeId() == Part::GeomArcOfConic::getClassTypeId() - || isBSplineCurve(*geo2)) { + else if (isLineSegment(*geo2) || isBSplineCurve(*geo2) + || geo2->is()) { // cases where arc is created by arc join mode. Base::Vector3d p2, p3; diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h index a40752e237..5ad102ec25 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h @@ -65,12 +65,16 @@ public: int GeoId = std::atoi(element.substr(4, 4000).c_str()) - 1; Sketcher::SketchObject* Sketch = static_cast(object); const Part::Geometry* geom = Sketch->getGeometry(GeoId); - if (geom->is() || geom->is() + + // clang-format off: keep line breaks for readability + if (geom->is() + || geom->is() || geom->is() || geom->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId()) || geom->is()) { return true; } + // clang-format on } else if (element.substr(0, 6) == "Vertex") { int VertId = std::atoi(element.substr(6, 4000).c_str()) - 1; @@ -114,12 +118,15 @@ public: int curveGeoId = getPreselectCurve(); if (curveGeoId >= 0) { const Part::Geometry* geom = sketchgui->getSketchObject()->getGeometry(curveGeoId); - if (geom->is() || geom->is() + // clang-format off: keep line breaks for readability + if (geom->is() + || geom->is() || geom->is() || geom->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId()) || geom->is()) { GeoId = curveGeoId; } + // clang-format on } else { // No curve of interest is pre-selected. Try pre-selected point. diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index 88376404dd..cfd800dd36 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -573,7 +573,7 @@ Property* Sheet::setFloatProperty(CellAddress key, double value) Property* prop = props.getDynamicPropertyByName(name.c_str()); PropertyFloat* floatProp; - if (!prop || prop->getTypeId() != PropertyFloat::getClassTypeId()) { + if (!prop || !prop->is()) { if (prop) { this->removeDynamicProperty(name.c_str()); propAddress.erase(prop); @@ -601,7 +601,7 @@ Property* Sheet::setIntegerProperty(CellAddress key, long value) Property* prop = props.getDynamicPropertyByName(name.c_str()); PropertyInteger* intProp; - if (!prop || prop->getTypeId() != PropertyInteger::getClassTypeId()) { + if (!prop || !prop->is()) { if (prop) { this->removeDynamicProperty(name.c_str()); propAddress.erase(prop); @@ -641,7 +641,7 @@ Property* Sheet::setQuantityProperty(CellAddress key, double value, const Base:: Property* prop = props.getDynamicPropertyByName(name.c_str()); PropertySpreadsheetQuantity* quantityProp; - if (!prop || prop->getTypeId() != PropertySpreadsheetQuantity::getClassTypeId()) { + if (!prop || !prop->is()) { if (prop) { this->removeDynamicProperty(name.c_str()); propAddress.erase(prop); From 6f535f19fb0946a700c9074ade5a68bdab3570de Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Thu, 16 Jan 2025 21:27:50 +0100 Subject: [PATCH 030/224] Prefer to use BaseClass's isDerivedFrom over non template or Base::Type's Regex based changes, manually verified --- src/App/Datums.cpp | 10 +-- src/App/Document.cpp | 8 +-- src/App/DocumentObject.cpp | 2 +- src/App/DocumentObjectExtension.cpp | 4 +- src/App/DocumentObserver.cpp | 2 +- src/App/Expression.cpp | 6 +- src/App/GeoFeatureGroupExtension.cpp | 10 +-- src/App/Graphviz.cpp | 8 +-- src/App/GroupExtension.cpp | 4 +- src/App/Link.cpp | 4 +- src/App/ObjectIdentifier.cpp | 2 +- src/App/OriginGroupExtension.cpp | 8 +-- src/App/Part.cpp | 2 +- src/App/PropertyContainerPyImp.cpp | 4 +- src/App/PropertyFile.cpp | 2 +- src/App/PropertyLinks.cpp | 34 ++++----- src/Gui/AutoSaver.cpp | 8 +-- src/Gui/Command.cpp | 2 +- src/Gui/Command.h | 2 +- src/Gui/CommandDoc.cpp | 2 +- src/Gui/CommandView.cpp | 16 ++--- src/Gui/DAGView/DAGModel.cpp | 2 +- src/Gui/Dialogs/DlgPropertyLink.cpp | 12 ++-- src/Gui/Document.cpp | 22 +++--- src/Gui/ManualAlignment.cpp | 4 +- src/Gui/NaviCube.cpp | 2 +- src/Gui/PropertyView.cpp | 2 +- src/Gui/SelectionFilter.cpp | 2 +- src/Gui/SelectionObject.cpp | 2 +- src/Gui/TextureMapping.cpp | 2 +- src/Gui/ToolHandler.cpp | 2 +- src/Gui/Tree.cpp | 4 +- src/Gui/View3DInventor.cpp | 2 +- src/Gui/View3DPy.cpp | 4 +- src/Gui/ViewProviderDragger.cpp | 2 +- src/Gui/ViewProviderExtension.cpp | 4 +- src/Gui/ViewProviderGeometryObject.cpp | 4 +- src/Gui/ViewProviderInventorObject.cpp | 2 +- src/Gui/ViewProviderLink.cpp | 4 +- src/Gui/ViewProviderVRMLObject.cpp | 2 +- src/Gui/Widgets.cpp | 2 +- src/Gui/propertyeditor/PropertyEditor.cpp | 4 +- src/Gui/propertyeditor/PropertyItem.cpp | 6 +- src/Mod/CAM/App/AppPathPy.cpp | 2 +- src/Mod/CAM/App/FeatureArea.cpp | 6 +- src/Mod/CAM/App/FeaturePathShape.cpp | 2 +- src/Mod/CAM/App/PropertyPath.cpp | 2 +- src/Mod/Fem/App/AppFemPy.cpp | 3 +- src/Mod/Fem/App/FemPostPipeline.cpp | 2 +- src/Mod/Fem/App/FemVTKTools.cpp | 4 +- src/Mod/Fem/App/PropertyPostDataObject.cpp | 4 +- src/Mod/Fem/Gui/Command.cpp | 6 +- src/Mod/Fem/Gui/TaskCreateElementSet.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemMesh.cpp | 2 +- .../Fem/Gui/ViewProviderFemPostFunction.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp | 2 +- src/Mod/Import/App/ExportOCAF.cpp | 4 +- src/Mod/Import/App/ImportOCAF2.cpp | 2 +- src/Mod/Import/Gui/ExportOCAFGui.cpp | 2 +- src/Mod/Inspection/Gui/Command.cpp | 2 +- src/Mod/Measure/App/MeasureBase.cpp | 2 +- src/Mod/Measure/Gui/Command.cpp | 2 +- src/Mod/Measure/Gui/QuickMeasure.cpp | 2 +- src/Mod/Mesh/App/Exporter.cpp | 2 +- src/Mod/Mesh/Gui/Command.cpp | 16 ++--- src/Mod/Mesh/Gui/MeshSelection.cpp | 2 +- src/Mod/MeshPart/Gui/Tessellation.cpp | 2 +- src/Mod/Part/App/FeatureExtrusion.cpp | 2 +- src/Mod/Part/App/FeatureMirroring.cpp | 4 +- src/Mod/Part/App/Geometry.cpp | 22 +++--- src/Mod/Part/App/MeasureClient.cpp | 2 +- src/Mod/Part/App/PartFeature.cpp | 14 ++-- src/Mod/Part/App/PropertyTopoShape.cpp | 4 +- src/Mod/Part/App/TopoShapeExpansion.cpp | 22 +++--- src/Mod/Part/Gui/Command.cpp | 2 +- src/Mod/Part/Gui/CommandFilter.cpp | 2 +- src/Mod/Part/Gui/Mirroring.cpp | 4 +- src/Mod/Part/Gui/SectionCutting.cpp | 33 ++++----- src/Mod/Part/Gui/TaskOffset.cpp | 2 +- src/Mod/Part/Gui/TaskShapeBuilder.cpp | 2 +- src/Mod/PartDesign/App/Body.cpp | 18 ++--- src/Mod/PartDesign/App/BodyPyImp.cpp | 2 +- src/Mod/PartDesign/App/Feature.cpp | 10 +-- src/Mod/PartDesign/App/FeatureBase.cpp | 2 +- src/Mod/PartDesign/App/FeatureBoolean.cpp | 4 +- src/Mod/PartDesign/App/FeatureDressUp.cpp | 4 +- src/Mod/PartDesign/App/FeatureLoft.cpp | 2 +- src/Mod/PartDesign/App/FeaturePipe.cpp | 6 +- src/Mod/PartDesign/App/FeatureSketchBased.cpp | 18 ++--- src/Mod/PartDesign/App/ShapeBinder.cpp | 2 +- src/Mod/PartDesign/Gui/Command.cpp | 26 +++---- src/Mod/PartDesign/Gui/CommandBody.cpp | 12 ++-- src/Mod/PartDesign/Gui/ReferenceSelection.cpp | 2 +- src/Mod/PartDesign/Gui/SketchWorkflow.cpp | 2 +- .../PartDesign/Gui/TaskDatumParameters.cpp | 2 +- src/Mod/PartDesign/Gui/TaskFeaturePick.cpp | 20 +++--- .../Gui/TaskRevolutionParameters.cpp | 4 +- src/Mod/PartDesign/Gui/TaskShapeBinder.cpp | 2 +- .../Gui/TaskSketchBasedParameters.cpp | 2 +- src/Mod/PartDesign/Gui/ViewProvider.cpp | 4 +- src/Mod/PartDesign/Gui/ViewProviderBody.cpp | 14 ++-- src/Mod/PartDesign/Gui/ViewProviderHelix.cpp | 2 +- src/Mod/PartDesign/Gui/ViewProviderLoft.cpp | 4 +- src/Mod/PartDesign/Gui/ViewProviderPipe.cpp | 6 +- .../Gui/ViewProviderShapeBinder.cpp | 2 +- .../Gui/ViewProviderSketchBased.cpp | 2 +- .../Gui/ViewProviderTransformed.cpp | 2 +- src/Mod/Points/App/AppPointsPy.cpp | 3 +- src/Mod/ReverseEngineering/Gui/Command.cpp | 6 +- src/Mod/Sketcher/App/SketchObject.cpp | 6 +- src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp | 2 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 4 +- .../Sketcher/Gui/CommandSketcherBSpline.cpp | 2 +- .../Gui/CommandSketcherVirtualSpace.cpp | 4 +- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 8 +-- src/Mod/Sketcher/Gui/Utils.cpp | 6 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 10 +-- src/Mod/Spreadsheet/App/Cell.cpp | 8 +-- src/Mod/Spreadsheet/App/PropertySheet.cpp | 4 +- src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp | 4 +- src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp | 6 +- src/Mod/Spreadsheet/Gui/SheetModel.cpp | 12 ++-- src/Mod/Surface/Gui/TaskFilling.cpp | 2 +- src/Mod/Surface/Gui/TaskFillingEdge.cpp | 2 +- src/Mod/Surface/Gui/TaskFillingVertex.cpp | 2 +- src/Mod/Surface/Gui/TaskGeomFillSurface.cpp | 2 +- src/Mod/Surface/Gui/TaskSections.cpp | 2 +- src/Mod/TechDraw/App/AppTechDrawPy.cpp | 10 +-- src/Mod/TechDraw/App/DimensionReferences.cpp | 8 +-- src/Mod/TechDraw/App/DrawLeaderLine.cpp | 2 +- src/Mod/TechDraw/App/DrawPage.cpp | 10 +-- src/Mod/TechDraw/App/DrawPagePyImp.cpp | 12 ++-- src/Mod/TechDraw/App/DrawProjGroup.cpp | 2 +- src/Mod/TechDraw/App/DrawSVGTemplate.cpp | 4 +- src/Mod/TechDraw/App/DrawView.cpp | 2 +- src/Mod/TechDraw/App/DrawViewClip.cpp | 4 +- src/Mod/TechDraw/App/DrawViewCollection.cpp | 4 +- src/Mod/TechDraw/App/DrawViewDetail.cpp | 2 +- src/Mod/TechDraw/App/DrawViewDimExtent.cpp | 2 +- src/Mod/TechDraw/App/DrawViewDimension.cpp | 14 ++-- src/Mod/TechDraw/App/DrawViewSpreadsheet.cpp | 8 +-- src/Mod/TechDraw/App/ShapeExtractor.cpp | 4 +- src/Mod/TechDraw/Gui/Command.cpp | 70 +++++++++---------- src/Mod/TechDraw/Gui/CommandAnnotate.cpp | 22 +++--- src/Mod/TechDraw/Gui/CommandExtensionDims.cpp | 12 ++-- src/Mod/TechDraw/Gui/CommandExtensionPack.cpp | 2 +- src/Mod/TechDraw/Gui/CommandHelpers.cpp | 16 ++--- src/Mod/TechDraw/Gui/DimensionValidators.cpp | 6 +- src/Mod/TechDraw/Gui/MDIViewPage.cpp | 8 +-- src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp | 2 +- src/Mod/TechDraw/Gui/QGIEdge.cpp | 2 +- src/Mod/TechDraw/Gui/QGISVGTemplate.cpp | 2 +- src/Mod/TechDraw/Gui/QGIViewBalloon.cpp | 2 +- src/Mod/TechDraw/Gui/QGIViewPart.cpp | 4 +- src/Mod/TechDraw/Gui/QGIViewSymbol.cpp | 4 +- src/Mod/TechDraw/Gui/QGSPage.cpp | 6 +- src/Mod/TechDraw/Gui/QGVPage.cpp | 2 +- src/Mod/TechDraw/Gui/TaskComplexSection.cpp | 6 +- src/Mod/TechDraw/Gui/TaskLeaderLine.cpp | 4 +- src/Mod/TechDraw/Gui/TaskRichAnno.cpp | 6 +- src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp | 2 +- .../TechDraw/Gui/ViewProviderDimension.cpp | 2 +- .../Gui/ViewProviderPageExtension.cpp | 8 +-- src/Mod/TechDraw/Gui/ViewProviderTemplate.cpp | 2 +- src/Mod/TechDraw/Gui/ViewProviderViewClip.cpp | 6 +- src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp | 2 +- 166 files changed, 484 insertions(+), 497 deletions(-) diff --git a/src/App/Datums.cpp b/src/App/Datums.cpp index 1d08929297..251f347111 100644 --- a/src/App/Datums.cpp +++ b/src/App/Datums.cpp @@ -156,7 +156,7 @@ App::DatumElement* LocalCoordinateSystem::getDatumElement(const char* role) cons { const auto& features = OriginFeatures.getValues(); auto featIt = std::find_if(features.begin(), features.end(), [role](App::DocumentObject* obj) { - return obj->isDerivedFrom(App::DatumElement::getClassTypeId()) + return obj->isDerivedFrom() && strcmp(static_cast(obj)->Role.getValue(), role) == 0; }); if (featIt != features.end()) { @@ -171,7 +171,7 @@ App::DatumElement* LocalCoordinateSystem::getDatumElement(const char* role) cons App::Line* LocalCoordinateSystem::getAxis(const char* role) const { App::DatumElement* feat = getDatumElement(role); - if (feat->isDerivedFrom(App::Line::getClassTypeId())) { + if (feat->isDerivedFrom()) { return static_cast(feat); } std::stringstream err; @@ -183,7 +183,7 @@ App::Line* LocalCoordinateSystem::getAxis(const char* role) const App::Plane* LocalCoordinateSystem::getPlane(const char* role) const { App::DatumElement* feat = getDatumElement(role); - if (feat->isDerivedFrom(App::Plane::getClassTypeId())) { + if (feat->isDerivedFrom()) { return static_cast(feat); } std::stringstream err; @@ -195,7 +195,7 @@ App::Plane* LocalCoordinateSystem::getPlane(const char* role) const App::Point* LocalCoordinateSystem::getPoint(const char* role) const { App::DatumElement* feat = getDatumElement(role); - if (feat->isDerivedFrom(App::Point::getClassTypeId())) { + if (feat->isDerivedFrom()) { return static_cast(feat); } std::stringstream err; @@ -262,7 +262,7 @@ DatumElement* LocalCoordinateSystem::createDatum(const SetupData& data) std::string objName = doc->getUniqueObjectName(data.role); App::DocumentObject* featureObj = doc->addObject(data.type.getName(), objName.c_str()); - assert(featureObj && featureObj->isDerivedFrom(App::DatumElement::getClassTypeId())); + assert(featureObj && featureObj->isDerivedFrom()); QByteArray byteArray = data.label.toUtf8(); featureObj->Label.setValue(byteArray.constData()); diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 6dc25c8fe3..a67312fe0f 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -835,7 +835,7 @@ void Document::onChanged(const Property* prop) void Document::onBeforeChangeProperty(const TransactionalObject* Who, const Property* What) { - if (Who->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (Who->isDerivedFrom()) { signalBeforeChangeObject(*static_cast(Who), *What); } if (!d->rollback && !globalIsRelabeling) { @@ -4338,7 +4338,7 @@ std::vector Document::getObjectsOfType(const Base::Type& typeId { std::vector Objects; for (auto it : d->objectArray) { - if (it->getTypeId().isDerivedFrom(typeId)) { + if (it->isDerivedFrom(typeId)) { Objects.push_back(it); } } @@ -4376,7 +4376,7 @@ Document::findObjects(const Base::Type& typeId, const char* objname, const char* std::vector Objects; DocumentObject* found = nullptr; for (auto it : d->objectArray) { - if (it->getTypeId().isDerivedFrom(typeId)) { + if (it->isDerivedFrom(typeId)) { found = it; if (!rx_name.empty() && !boost::regex_search(it->getNameInDocument(), what, rx_name)) { @@ -4398,7 +4398,7 @@ Document::findObjects(const Base::Type& typeId, const char* objname, const char* int Document::countObjectsOfType(const Base::Type& typeId) const { return std::count_if(d->objectMap.begin(), d->objectMap.end(), [&](const auto& it) { - return it.second->getTypeId().isDerivedFrom(typeId); + return it.second->isDerivedFrom(typeId); }); } diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index bd2b3b395e..17f2b83ce8 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -759,7 +759,7 @@ bool DocumentObject::removeDynamicProperty(const char* name) return false; } - if (prop->isDerivedFrom(PropertyLinkBase::getClassTypeId())) { + if (prop->isDerivedFrom()) { clearOutListCache(); } diff --git a/src/App/DocumentObjectExtension.cpp b/src/App/DocumentObjectExtension.cpp index 85e3922839..c98e0d9f74 100644 --- a/src/App/DocumentObjectExtension.cpp +++ b/src/App/DocumentObjectExtension.cpp @@ -76,14 +76,14 @@ PyObject* DocumentObjectExtension::getExtensionPyObject() const DocumentObject* DocumentObjectExtension::getExtendedObject() const { - assert(getExtendedContainer()->isDerivedFrom(DocumentObject::getClassTypeId())); + assert(getExtendedContainer()->isDerivedFrom()); return static_cast(getExtendedContainer()); } DocumentObject* DocumentObjectExtension::getExtendedObject() { - assert(getExtendedContainer()->isDerivedFrom(DocumentObject::getClassTypeId())); + assert(getExtendedContainer()->isDerivedFrom()); return static_cast(getExtendedContainer()); } diff --git a/src/App/DocumentObserver.cpp b/src/App/DocumentObserver.cpp index 78b8574302..0bbb616a52 100644 --- a/src/App/DocumentObserver.cpp +++ b/src/App/DocumentObserver.cpp @@ -177,7 +177,7 @@ void DocumentObjectT::operator=(const DocumentObject* obj) void DocumentObjectT::operator=(const Property* prop) { if (!prop || !prop->hasName() || !prop->getContainer() - || !prop->getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + || !prop->getContainer()->isDerivedFrom()) { object.clear(); label.clear(); document.clear(); diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp index a6169b9697..596930a0bc 100644 --- a/src/App/Expression.cpp +++ b/src/App/Expression.cpp @@ -2016,7 +2016,7 @@ Py::Object FunctionExpression::evalAggregate( } for (auto &arg : args) { - if (arg->isDerivedFrom(RangeExpression::getClassTypeId())) { + if (arg->isDerivedFrom()) { Range range(static_cast(*arg).getRange()); do { @@ -2159,7 +2159,7 @@ Py::Object FunctionExpression::evaluate(const Expression *expr, int f, const std switch (f) { case LIST: { - if (args.size() == 1 && args[0]->isDerivedFrom(RangeExpression::getClassTypeId())) + if (args.size() == 1 && args[0]->isDerivedFrom()) return args[0]->getPyValue(); Py::List list(args.size()); int i = 0; @@ -2168,7 +2168,7 @@ Py::Object FunctionExpression::evaluate(const Expression *expr, int f, const std return list; } case TUPLE: { - if (args.size() == 1 && args[0]->isDerivedFrom(RangeExpression::getClassTypeId())) + if (args.size() == 1 && args[0]->isDerivedFrom()) return Py::Tuple(args[0]->getPyValue()); Py::Tuple tuple(args.size()); int i = 0; diff --git a/src/App/GeoFeatureGroupExtension.cpp b/src/App/GeoFeatureGroupExtension.cpp index dc8808adf9..c7bc8252e3 100644 --- a/src/App/GeoFeatureGroupExtension.cpp +++ b/src/App/GeoFeatureGroupExtension.cpp @@ -55,7 +55,7 @@ GeoFeatureGroupExtension::~GeoFeatureGroupExtension() = default; void GeoFeatureGroupExtension::initExtension(ExtensionContainer* obj) { - if (!obj->isDerivedFrom(App::GeoFeature::getClassTypeId())) { + if (!obj->isDerivedFrom()) { throw Base::RuntimeError("GeoFeatureGroupExtension can only be applied to GeoFeatures"); } @@ -88,7 +88,7 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject* } // we will find origins, but not origin features - if (obj->isDerivedFrom(App::DatumElement::getClassTypeId())) { + if (obj->isDerivedFrom()) { return OriginGroupExtension::getGroupOfObject(obj); } @@ -307,8 +307,8 @@ void GeoFeatureGroupExtension::getCSOutList(const App::DocumentObject* obj, //we remove all links to origin features and origins, they belong to a CS too and can't be moved result.erase(std::remove_if(result.begin(), result.end(), [](App::DocumentObject* obj)->bool { - return (obj->isDerivedFrom(App::DatumElement::getClassTypeId()) || - obj->isDerivedFrom(App::Origin::getClassTypeId())); + return (obj->isDerivedFrom() || + obj->isDerivedFrom()); }), result.end()); vec.insert(vec.end(), result.begin(), result.end()); @@ -483,7 +483,7 @@ bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) } // get the object that holds the property - if (!prop->getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (!prop->getContainer()->isDerivedFrom()) { return true; // this link comes not from a document object, scopes are meaningless } auto obj = static_cast(prop->getContainer()); diff --git a/src/App/Graphviz.cpp b/src/App/Graphviz.cpp index 5a09a9e3ee..f2765da4b3 100644 --- a/src/App/Graphviz.cpp +++ b/src/App/Graphviz.cpp @@ -301,7 +301,7 @@ void Document::exportGraphviz(std::ostream& out) const if (!sgraph) { auto group = GeoFeatureGroupExtension::getGroupOfObject(docObj); if (group) { - if (docObj->isDerivedFrom(App::DatumElement::getClassTypeId())) { + if (docObj->isDerivedFrom()) { sgraph = GraphList[group->getExtensionByType() ->Origin.getValue()]; } @@ -311,7 +311,7 @@ void Document::exportGraphviz(std::ostream& out) const } } if (!sgraph) { - if (docObj->isDerivedFrom(DatumElement::getClassTypeId())) { + if (docObj->isDerivedFrom()) { auto* lcs = static_cast(docObj)->getLCS(); if (lcs) { sgraph = GraphList[lcs]; @@ -453,7 +453,7 @@ void Document::exportGraphviz(std::ostream& out) const // ignore groups inside other groups, these will be processed in one of the next // recursive calls. App::Origin now has the GeoFeatureGroupExtension but it // should not move its group symbol outside its parent - if (!objectIt->isDerivedFrom(Origin::getClassTypeId()) + if (!objectIt->isDerivedFrom() && objectIt->hasExtension( GeoFeatureGroupExtension::getExtensionClassTypeId()) && GeoFeatureGroupExtension::getGroupOfObject(objectIt) == nullptr) { @@ -571,7 +571,7 @@ void Document::exportGraphviz(std::ostream& out) const // Add edges between document objects for (const auto& It : d->objectMap) { - if (omitGeoFeatureGroups && It.second->isDerivedFrom(Origin::getClassTypeId())) { + if (omitGeoFeatureGroups && It.second->isDerivedFrom()) { continue; } diff --git a/src/App/GroupExtension.cpp b/src/App/GroupExtension.cpp index 6e017b82f9..ed10599419 100644 --- a/src/App/GroupExtension.cpp +++ b/src/App/GroupExtension.cpp @@ -296,7 +296,7 @@ std::vector GroupExtension::getObjectsOfType(const Base::Type& std::vector type; const std::vector& grp = Group.getValues(); for (auto it : grp) { - if (it->getTypeId().isDerivedFrom(typeId)) { + if (it->isDerivedFrom(typeId)) { type.push_back(it); } } @@ -309,7 +309,7 @@ int GroupExtension::countObjectsOfType(const Base::Type& typeId) const int type = 0; const std::vector& grp = Group.getValues(); for (auto it : grp) { - if (it->getTypeId().isDerivedFrom(typeId)) { + if (it->isDerivedFrom(typeId)) { type++; } } diff --git a/src/App/Link.cpp b/src/App/Link.cpp index c520d43a20..658668775e 100644 --- a/src/App/Link.cpp +++ b/src/App/Link.cpp @@ -1167,7 +1167,7 @@ int LinkBaseExtension::extensionIsElementVisible(const char* element) const DocumentObject* LinkBaseExtension::getContainer() const { auto ext = getExtendedContainer(); - if (!ext || !ext->isDerivedFrom(DocumentObject::getClassTypeId())) { + if (!ext || !ext->isDerivedFrom()) { LINK_THROW(Base::RuntimeError, "Link: container not derived from document object"); } return static_cast(ext); @@ -1176,7 +1176,7 @@ const DocumentObject* LinkBaseExtension::getContainer() const DocumentObject* LinkBaseExtension::getContainer() { auto ext = getExtendedContainer(); - if (!ext || !ext->isDerivedFrom(DocumentObject::getClassTypeId())) { + if (!ext || !ext->isDerivedFrom()) { LINK_THROW(Base::RuntimeError, "Link: container not derived from document object"); } return static_cast(ext); diff --git a/src/App/ObjectIdentifier.cpp b/src/App/ObjectIdentifier.cpp index 92593f0a80..fd4d2871d3 100644 --- a/src/App/ObjectIdentifier.cpp +++ b/src/App/ObjectIdentifier.cpp @@ -1828,7 +1828,7 @@ ObjectIdentifier::access(const ResolveResults& result, Py::Object* value, Depend auto container = result.resolvedProperty->getContainer(); if (container && container != result.resolvedDocumentObject && container != result.resolvedSubObject) { - if (!container->isDerivedFrom(DocumentObject::getClassTypeId())) { + if (!container->isDerivedFrom()) { FC_WARN("Invalid property container"); } else { diff --git a/src/App/OriginGroupExtension.cpp b/src/App/OriginGroupExtension.cpp index 369db51bad..e709e38a1d 100644 --- a/src/App/OriginGroupExtension.cpp +++ b/src/App/OriginGroupExtension.cpp @@ -62,7 +62,7 @@ App::Origin* OriginGroupExtension::getOrigin() const err << "Can't find Origin for \"" << getExtendedObject()->getFullName() << "\""; throw Base::RuntimeError(err.str().c_str()); } - else if (!originObj->isDerivedFrom(App::Origin::getClassTypeId())) { + else if (!originObj->isDerivedFrom()) { std::stringstream err; err << "Bad object \"" << originObj->getFullName() << "\"(" << originObj->getTypeId().getName() << ") linked to the Origin of \"" @@ -114,7 +114,7 @@ App::DocumentObject* OriginGroupExtension::getGroupOfObject(const DocumentObject return nullptr; } - bool isOriginFeature = obj->isDerivedFrom(App::DatumElement::getClassTypeId()); + bool isOriginFeature = obj->isDerivedFrom(); auto list = obj->getInList(); for (auto o : list) { @@ -122,7 +122,7 @@ App::DocumentObject* OriginGroupExtension::getGroupOfObject(const DocumentObject return o; } else if (isOriginFeature - && o->isDerivedFrom(App::LocalCoordinateSystem::getClassTypeId())) { + && o->isDerivedFrom()) { auto result = getGroupOfObject(o); if (result) { return result; @@ -170,7 +170,7 @@ void OriginGroupExtension::onExtendedSetupObject() App::DocumentObject* originObj = getLocalizedOrigin(doc); - assert(originObj && originObj->isDerivedFrom(App::Origin::getClassTypeId())); + assert(originObj && originObj->isDerivedFrom()); Origin.setValue(originObj); GeoFeatureGroupExtension::onExtendedSetupObject(); diff --git a/src/App/Part.cpp b/src/App/Part.cpp index 68feeaa88b..b43b60db24 100644 --- a/src/App/Part.cpp +++ b/src/App/Part.cpp @@ -75,7 +75,7 @@ static App::Part* _getPartOfObject(const DocumentObject* obj, } auto group = inObj->getExtensionByType(true); if (group && group->hasObject(obj)) { - if (inObj->isDerivedFrom(App::Part::getClassTypeId())) { + if (inObj->isDerivedFrom()) { return static_cast(inObj); } else if (objset) { diff --git a/src/App/PropertyContainerPyImp.cpp b/src/App/PropertyContainerPyImp.cpp index 4700b5a090..31913df300 100644 --- a/src/App/PropertyContainerPyImp.cpp +++ b/src/App/PropertyContainerPyImp.cpp @@ -86,7 +86,7 @@ PyObject* PropertyContainerPy::getPropertyTouchList(PyObject* args) } App::Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr); - if (prop && prop->isDerivedFrom(PropertyLists::getClassTypeId())) { + if (prop && prop->isDerivedFrom()) { const auto& touched = static_cast(prop)->getTouchList(); Py::Tuple ret(touched.size()); int i = 0; @@ -647,7 +647,7 @@ PyObject* PropertyContainerPy::getCustomAttributes(const char* attr) const } /// FIXME: For v0.20: Do not use stuff from Part module here! if (Base::streq(attr, "Shape") - && getPropertyContainerPtr()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + && getPropertyContainerPtr()->isDerivedFrom()) { // Special treatment of Shape property static PyObject* _getShape = nullptr; if (!_getShape) { diff --git a/src/App/PropertyFile.cpp b/src/App/PropertyFile.cpp index eec521f391..103e7d5246 100644 --- a/src/App/PropertyFile.cpp +++ b/src/App/PropertyFile.cpp @@ -78,7 +78,7 @@ std::string PropertyFileIncluded::getDocTransientPath() const { std::string path; PropertyContainer* co = getContainer(); - if (co->isDerivedFrom(DocumentObject::getClassTypeId())) { + if (co->isDerivedFrom()) { path = static_cast(co)->getDocument()->TransientDir.getValue(); std::replace(path.begin(), path.end(), '\\', '/'); } diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 3ba3b5984f..4e62852138 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -99,7 +99,7 @@ bool PropertyLinkBase::isSame(const Property& other) const if (&other == this) { return true; } - if (other.isDerivedFrom(PropertyLinkBase::getClassTypeId()) + if (other.isDerivedFrom() || getScope() != static_cast(&other)->getScope()) { return false; } @@ -692,7 +692,7 @@ void PropertyLink::resetLink() #ifndef USE_OLD_DAG // maintain the back link in the DocumentObject class if it is from a document object if (_pcScope != LinkScope::Hidden && _pcLink && getContainer() - && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + && getContainer()->isDerivedFrom()) { App::DocumentObject* parent = static_cast(getContainer()); // before accessing internals make sure the object is not about to be destroyed // otherwise the backlink contains dangling pointers @@ -741,7 +741,7 @@ App::DocumentObject* PropertyLink::getValue() const App::DocumentObject* PropertyLink::getValue(Base::Type t) const { - return (_pcLink && _pcLink->getTypeId().isDerivedFrom(t)) ? _pcLink : nullptr; + return (_pcLink && _pcLink->isDerivedFrom(t)) ? _pcLink : nullptr; } PyObject* PropertyLink::getPyObject() @@ -817,7 +817,7 @@ Property* PropertyLink::Copy() const void PropertyLink::Paste(const Property& from) { - if (!from.isDerivedFrom(PropertyLink::getClassTypeId())) { + if (!from.isDerivedFrom()) { throw Base::TypeError("Incompatible property to paste to"); } @@ -897,7 +897,7 @@ PropertyLinkList::~PropertyLinkList() #ifndef USE_OLD_DAG // maintain the back link in the DocumentObject class if (_pcScope != LinkScope::Hidden && !_lValueList.empty() && getContainer() - && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + && getContainer()->isDerivedFrom()) { App::DocumentObject* parent = static_cast(getContainer()); // before accessing internals make sure the object is not about to be destroyed // otherwise the backlink contains dangling pointers @@ -955,7 +955,7 @@ void PropertyLinkList::set1Value(int idx, DocumentObject* const& value) _nameMap.clear(); #ifndef USE_OLD_DAG - if (getContainer() && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (getContainer() && getContainer()->isDerivedFrom()) { App::DocumentObject* parent = static_cast(getContainer()); // before accessing internals make sure the object is not about to be destroyed // otherwise the backlink contains dangling pointers @@ -1150,7 +1150,7 @@ Property* PropertyLinkList::Copy() const void PropertyLinkList::Paste(const Property& from) { - if (!from.isDerivedFrom(PropertyLinkList::getClassTypeId())) { + if (!from.isDerivedFrom()) { throw Base::TypeError("Incompatible property to paste to"); } @@ -1299,7 +1299,7 @@ PropertyLinkSub::~PropertyLinkSub() // in case this property is dynamically removed #ifndef USE_OLD_DAG if (_pcLinkSub && getContainer() - && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + && getContainer()->isDerivedFrom()) { App::DocumentObject* parent = static_cast(getContainer()); // before accessing internals make sure the object is not about to be destroyed // otherwise the backlink contains dangling pointers @@ -1430,7 +1430,7 @@ std::vector PropertyLinkSub::getSubValuesStartsWith(const char* sta App::DocumentObject* PropertyLinkSub::getValue(Base::Type t) const { - return (_pcLinkSub && _pcLinkSub->getTypeId().isDerivedFrom(t)) ? _pcLinkSub : nullptr; + return (_pcLinkSub && _pcLinkSub->isDerivedFrom(t)) ? _pcLinkSub : nullptr; } PyObject* PropertyLinkSub::getPyObject() @@ -2054,7 +2054,7 @@ Property* PropertyLinkSub::Copy() const void PropertyLinkSub::Paste(const Property& from) { - if (!from.isDerivedFrom(PropertyLinkSub::getClassTypeId())) { + if (!from.isDerivedFrom()) { throw Base::TypeError("Incompatible property to paste to"); } auto& link = static_cast(from); @@ -2178,7 +2178,7 @@ PropertyLinkSubList::~PropertyLinkSubList() #ifndef USE_OLD_DAG // maintain backlinks if (!_lValueList.empty() && getContainer() - && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + && getContainer()->isDerivedFrom()) { App::DocumentObject* parent = static_cast(getContainer()); // before accessing internals make sure the object is not about to be destroyed // otherwise the backlink contains dangling pointers @@ -3112,7 +3112,7 @@ Property* PropertyLinkSubList::Copy() const void PropertyLinkSubList::Paste(const Property& from) { - if (!from.isDerivedFrom(PropertyLinkSubList::getClassTypeId())) { + if (!from.isDerivedFrom()) { throw Base::TypeError("Incompatible property to paste to"); } auto& link = static_cast(from); @@ -4430,7 +4430,7 @@ Property* PropertyXLink::Copy() const void PropertyXLink::Paste(const Property& from) { - if (!from.isDerivedFrom(PropertyXLink::getClassTypeId())) { + if (!from.isDerivedFrom()) { throw Base::TypeError("Incompatible property to paste to"); } @@ -4461,9 +4461,9 @@ void PropertyXLink::Paste(const Property& from) bool PropertyXLink::supportXLink(const App::Property* prop) { - return prop->isDerivedFrom(PropertyXLink::getClassTypeId()) - || prop->isDerivedFrom(PropertyXLinkSubList::getClassTypeId()) - || prop->isDerivedFrom(PropertyXLinkContainer::getClassTypeId()); + return prop->isDerivedFrom() + || prop->isDerivedFrom() + || prop->isDerivedFrom(); } bool PropertyXLink::hasXLink(const App::Document* doc) @@ -5299,7 +5299,7 @@ Property* PropertyXLinkSubList::Copy() const void PropertyXLinkSubList::Paste(const Property& from) { - if (!from.isDerivedFrom(PropertyXLinkSubList::getClassTypeId())) { + if (!from.isDerivedFrom()) { throw Base::TypeError("Incompatible property to paste to"); } diff --git a/src/Gui/AutoSaver.cpp b/src/Gui/AutoSaver.cpp index 8ff9a9013f..d583ec2fe7 100644 --- a/src/Gui/AutoSaver.cpp +++ b/src/Gui/AutoSaver.cpp @@ -293,13 +293,13 @@ bool RecoveryWriter::shouldWrite(const std::string& name, const Base::Persistenc { // Property files of a view provider can always be written because // these are rather small files. - if (object->isDerivedFrom(App::Property::getClassTypeId())) { + if (object->isDerivedFrom()) { const auto* prop = static_cast(object); const App::PropertyContainer* parent = prop->getContainer(); - if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId())) + if (parent && parent->isDerivedFrom()) return true; } - else if (object->isDerivedFrom(Gui::Document::getClassTypeId())) { + else if (object->isDerivedFrom()) { return true; } @@ -385,7 +385,7 @@ void RecoveryWriter::writeFiles() } // For properties a copy can be created and then this can be written to disk in a thread - if (entry.Object->isDerivedFrom(App::Property::getClassTypeId())) { + if (entry.Object->isDerivedFrom()) { const auto* prop = static_cast(entry.Object); QThreadPool::globalInstance()->start(new RecoveryRunnable(getModes(), DirName.c_str(), entry.FileName.c_str(), prop)); } diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 848e71a1e8..6e9c9da4bf 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -251,7 +251,7 @@ bool Command::isViewOfType(Base::Type t) const Gui::BaseView *v = d->getActiveView(); if (!v) return false; - if (v->getTypeId().isDerivedFrom(t)) + if (v->isDerivedFrom(t)) return true; else return false; diff --git a/src/Gui/Command.h b/src/Gui/Command.h index b8f975eeca..661d1b1c75 100644 --- a/src/Gui/Command.h +++ b/src/Gui/Command.h @@ -1117,7 +1117,7 @@ protected: \ virtual bool isActive(void)\ {\ Gui::MDIView* view = Gui::getMainWindow()->activeWindow();\ - return view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId());\ + return view && view->isDerivedFrom();\ }\ private:\ X(const X&) = delete;\ diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 73d746c5de..f5d2a00fb5 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1728,7 +1728,7 @@ void StdCmdEdit::activated(int iMsg) { Q_UNUSED(iMsg); Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); if (viewer->isEditingViewProvider()) { doCommand(Command::Gui,"Gui.activeDocument().resetEdit()"); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 4182446f56..92fe52fd28 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -931,7 +931,7 @@ void StdCmdToggleTransparency::activated(int iMsg) App::Document* doc = obj->getDocument(); Gui::ViewProvider* view = Application::Instance->getDocument(doc)->getViewProvider(obj); App::Property* prop = view->getPropertyByName("Transparency"); - if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) { + if (prop && prop->isDerivedFrom()) { // To prevent toggling the tip of a PD body (see #11353), we check if the parent has a // Tip prop. const std::vector parents = obj->getInList(); @@ -942,7 +942,7 @@ void StdCmdToggleTransparency::activated(int iMsg) if (parentProp) { // Make sure it has a transparency prop too parentProp = parentView->getPropertyByName("Transparency"); - if (parentProp && parentProp->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) { + if (parentProp && parentProp->isDerivedFrom()) { view = parentView; } } @@ -967,7 +967,7 @@ void StdCmdToggleTransparency::activated(int iMsg) bool oneTransparent = false; for (auto* view : viewsToToggle) { App::Property* prop = view->getPropertyByName("Transparency"); - if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) { + if (prop && prop->isDerivedFrom()) { auto* transparencyProp = dynamic_cast(prop); int transparency = transparencyProp->getValue(); if (transparency != 0) { @@ -984,7 +984,7 @@ void StdCmdToggleTransparency::activated(int iMsg) for (auto* view : viewsToToggle) { App::Property* prop = view->getPropertyByName("Transparency"); - if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) { + if (prop && prop->isDerivedFrom()) { auto* transparencyProp = dynamic_cast(prop); transparencyProp->setValue(transparency); } @@ -1033,7 +1033,7 @@ void StdCmdToggleSelectability::activated(int iMsg) for (const auto & ft : sel) { ViewProvider *pr = pcDoc->getViewProviderByName(ft->getNameInDocument()); - if (pr && pr->isDerivedFrom(ViewProviderGeometryObject::getClassTypeId())){ + if (pr && pr->isDerivedFrom()){ if (static_cast(pr)->Selectable.getValue()) doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=False" , doc->getName(), ft->getNameInDocument()); @@ -2187,7 +2187,7 @@ void StdCmdToggleNavigation::activated(int iMsg) { Q_UNUSED(iMsg); Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); SbBool toggle = viewer->isRedirectedToSceneGraph(); viewer->setRedirectToSceneGraph(!toggle); @@ -2203,7 +2203,7 @@ bool StdCmdToggleNavigation::isActive() if (Gui::Control().activeDialog()) return false; Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return viewer->isEditing() && viewer->isRedirectToSceneGraphEnabled(); } @@ -3203,7 +3203,7 @@ void StdCmdTextureMapping::activated(int iMsg) bool StdCmdTextureMapping::isActive() { Gui::MDIView* view = getMainWindow()->activeWindow(); - return view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId()) + return view && view->isDerivedFrom() && (!(Gui::Control().activeDialog())); } diff --git a/src/Gui/DAGView/DAGModel.cpp b/src/Gui/DAGView/DAGModel.cpp index 2db0d5fea4..3b05faba97 100644 --- a/src/Gui/DAGView/DAGModel.cpp +++ b/src/Gui/DAGView/DAGModel.cpp @@ -315,7 +315,7 @@ void Model::slotChangeObject(const ViewProviderDocumentObject &VPDObjectIn, cons text->setPlainText(QString::fromUtf8(record.DObject->Label.getValue())); } } - else if (propertyIn.isDerivedFrom(App::PropertyLinkBase::getClassTypeId())) + else if (propertyIn.isDerivedFrom()) { if (hasRecord(&VPDObjectIn, *graphLink)) { diff --git a/src/Gui/Dialogs/DlgPropertyLink.cpp b/src/Gui/Dialogs/DlgPropertyLink.cpp index 1c41b465cc..4736c86ac9 100644 --- a/src/Gui/Dialogs/DlgPropertyLink.cpp +++ b/src/Gui/Dialogs/DlgPropertyLink.cpp @@ -289,15 +289,15 @@ void DlgPropertyLink::init(const App::DocumentObjectT& prop, bool tryFilter) std::vector docs; singleSelect = false; - if (propLink->isDerivedFrom(App::PropertyXLinkSub::getClassTypeId()) - || propLink->isDerivedFrom(App::PropertyLinkSub::getClassTypeId())) { + if (propLink->isDerivedFrom() + || propLink->isDerivedFrom()) { allowSubObject = true; singleParent = true; } - else if (propLink->isDerivedFrom(App::PropertyLink::getClassTypeId())) { + else if (propLink->isDerivedFrom()) { singleSelect = true; } - else if (propLink->isDerivedFrom(App::PropertyLinkSubList::getClassTypeId())) { + else if (propLink->isDerivedFrom()) { allowSubObject = true; } @@ -310,8 +310,8 @@ void DlgPropertyLink::init(const App::DocumentObjectT& prop, bool tryFilter) } bool isLinkList = false; - if (propLink->isDerivedFrom(App::PropertyXLinkList::getClassTypeId()) - || propLink->isDerivedFrom(App::PropertyLinkList::getClassTypeId())) { + if (propLink->isDerivedFrom() + || propLink->isDerivedFrom()) { isLinkList = true; allowSubObject = false; } diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 00a800cffd..a07fe8d2aa 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -695,7 +695,7 @@ void Document::_resetEdit() // the editing object gets deleted inside the above call to // 'finishEditing()', which will trigger our slotDeletedObject(), which // nullifies _editViewProvider. - if (d->_editViewProvider && d->_editViewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if (d->_editViewProvider && d->_editViewProvider->isDerivedFrom()) { auto vpd = static_cast(d->_editViewProvider); vpd->getDocument()->signalResetEdit(*vpd); } @@ -823,7 +823,7 @@ std::vector Document::getViewProvidersOfType(const Base::Type& ty std::vector Objects; for (std::map::const_iterator it = d->_ViewProviderMap.begin(); it != d->_ViewProviderMap.end(); ++it ) { - if (it->second->getTypeId().isDerivedFrom(typeId)) + if (it->second->isDerivedFrom(typeId)) Objects.push_back(it->second); } return Objects; @@ -993,7 +993,7 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj) handleChildren3D(viewProvider,true); - if (viewProvider && viewProvider->getTypeId().isDerivedFrom + if (viewProvider && viewProvider->isDerivedFrom (ViewProviderDocumentObject::getClassTypeId())) { // go through the views for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) { @@ -1034,7 +1034,7 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop if(d->_editingViewer && d->_editingObject && d->_editViewProviderParent - && (Prop.isDerivedFrom(App::PropertyPlacement::getClassTypeId()) + && (Prop.isDerivedFrom() // Issue ID 0004230 : getName() can return null in which case strstr() crashes || (Prop.getName() && strstr(Prop.getName(),"Scale"))) && d->_editObjs.count(&Obj)) @@ -1063,7 +1063,7 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop handleChildren3D(viewProvider); - if (viewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) + if (viewProvider->isDerivedFrom()) signalChangedObject(static_cast(*viewProvider), Prop); } @@ -1079,7 +1079,7 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop void Document::slotRelabelObject(const App::DocumentObject& Obj) { ViewProvider* viewProvider = getViewProvider(&Obj); - if (viewProvider && viewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if (viewProvider && viewProvider->isDerivedFrom()) { signalRelabelObject(*(static_cast(viewProvider))); } } @@ -1087,7 +1087,7 @@ void Document::slotRelabelObject(const App::DocumentObject& Obj) void Document::slotTransactionAppend(const App::DocumentObject& obj, App::Transaction* transaction) { ViewProvider* viewProvider = getViewProvider(&obj); - if (viewProvider && viewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if (viewProvider && viewProvider->isDerivedFrom()) { transaction->addObjectDel(viewProvider); } } @@ -1116,7 +1116,7 @@ void Document::slotTransactionRemove(const App::DocumentObject& obj, App::Transa void Document::slotActivatedObject(const App::DocumentObject& Obj) { ViewProvider* viewProvider = getViewProvider(&Obj); - if (viewProvider && viewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if (viewProvider && viewProvider->isDerivedFrom()) { signalActivatedObject(*(static_cast(viewProvider))); } } @@ -1749,7 +1749,7 @@ void Document::slotFinishRestoreDocument(const App::Document& doc) App::DocumentObject* act = doc.getActiveObject(); if (act) { ViewProvider* viewProvider = getViewProvider(act); - if (viewProvider && viewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if (viewProvider && viewProvider->isDerivedFrom()) { signalActivatedObject(*(static_cast(viewProvider))); } } @@ -2389,7 +2389,7 @@ MDIView* Document::getActiveView() const // hidden page has view but not in the list. By right, the view will // self delete, but not the case for TechDraw, especially during // document restore. - if(windows.contains(*rit) || (*rit)->isDerivedFrom(View3DInventor::getClassTypeId())) + if(windows.contains(*rit) || (*rit)->isDerivedFrom()) return *rit; } return nullptr; @@ -2434,7 +2434,7 @@ MDIView *Document::setActiveView(const ViewProviderDocumentObject* vp, Base::Typ if (!view || (!typeId.isBad() && !view->isDerivedFrom(typeId))) { view = nullptr; for (auto *v : d->baseViews) { - if (v->isDerivedFrom(MDIView::getClassTypeId()) && + if (v->isDerivedFrom() && (typeId.isBad() || v->isDerivedFrom(typeId))) { view = static_cast(v); break; diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index 82a6bb0f94..f4e1f36ccf 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -136,7 +136,7 @@ void AlignmentGroup::setRandomColor() float r = /*(float)rand()/(float)RAND_MAX*/0.0f; float g = (float)rand()/(float)RAND_MAX; float b = (float)rand()/(float)RAND_MAX; - if ((*it)->isDerivedFrom(Gui::ViewProviderGeometryObject::getClassTypeId())) { + if ((*it)->isDerivedFrom()) { SoSearchAction searchAction; searchAction.setType(SoMaterial::getClassTypeId()); searchAction.setInterest(SoSearchAction::FIRST); @@ -239,7 +239,7 @@ Base::BoundBox3d AlignmentGroup::getBoundingBox() const Base::BoundBox3d box; std::vector::const_iterator it; for (it = this->_views.begin(); it != this->_views.end(); ++it) { - if ((*it)->isDerivedFrom(Gui::ViewProviderGeometryObject::getClassTypeId())) { + if ((*it)->isDerivedFrom()) { auto geo = (*it)->getObject(); const App::PropertyComplexGeoData* prop = geo->getPropertyOfGeometry(); if (prop) diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 354cbabf8f..c94cbdb2c9 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -1192,7 +1192,7 @@ void NaviCubeDraggableCmd::activated(int iMsg) bool NaviCubeDraggableCmd::isActive() { Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { bool check = _pcAction->isChecked(); auto view = qobject_cast(getMainWindow()->activeWindow()); bool mode = view->getViewer()->getNaviCube()->isDraggable(); diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp index 96c66f2b88..ee33bd8ca7 100644 --- a/src/Gui/PropertyView.cpp +++ b/src/Gui/PropertyView.cpp @@ -403,7 +403,7 @@ void PropertyView::onTimer() continue; } - if(vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if(vp->isDerivedFrom()) { auto cvp = static_cast(vp); if(vpLast && cvp!=vpLast) checkLink = false; diff --git a/src/Gui/SelectionFilter.cpp b/src/Gui/SelectionFilter.cpp index 51f0f5c716..991521fb1e 100644 --- a/src/Gui/SelectionFilter.cpp +++ b/src/Gui/SelectionFilter.cpp @@ -210,7 +210,7 @@ bool SelectionFilter::test(App::DocumentObject*pObj, const char*sSubName) return false; for (const auto& it : Ast->Objects) { - if (pObj->getTypeId().isDerivedFrom(it->ObjectType)) { + if (pObj->isDerivedFrom(it->ObjectType)) { if (!sSubName) return true; if (it->SubName.empty()) diff --git a/src/Gui/SelectionObject.cpp b/src/Gui/SelectionObject.cpp index c8450a24cf..4ff04a135b 100644 --- a/src/Gui/SelectionObject.cpp +++ b/src/Gui/SelectionObject.cpp @@ -85,7 +85,7 @@ App::DocumentObject * SelectionObject::getObject() bool SelectionObject::isObjectTypeOf(const Base::Type& typeId) const { const App::DocumentObject* obj = getObject(); - return (obj && obj->getTypeId().isDerivedFrom(typeId)); + return (obj && obj->isDerivedFrom(typeId)); } std::string SelectionObject::getAsPropertyLinkSubString()const diff --git a/src/Gui/TextureMapping.cpp b/src/Gui/TextureMapping.cpp index 4a928801ba..eefaeaa0a7 100644 --- a/src/Gui/TextureMapping.cpp +++ b/src/Gui/TextureMapping.cpp @@ -143,7 +143,7 @@ void TextureMapping::onFileChooserFileNameSelected(const QString& s) Gui::Document* doc = Gui::Application::Instance->activeDocument(); if (doc) { Gui::MDIView* mdi = doc->getActiveView(); - if (mdi && mdi->isDerivedFrom(View3DInventor::getClassTypeId())) { + if (mdi && mdi->isDerivedFrom()) { Gui::View3DInventorViewer* view = static_cast(mdi)->getViewer(); this->grp = static_cast(view->getSceneGraph()); this->grp->ref(); diff --git a/src/Gui/ToolHandler.cpp b/src/Gui/ToolHandler.cpp index bb20296449..30e92c705b 100644 --- a/src/Gui/ToolHandler.cpp +++ b/src/Gui/ToolHandler.cpp @@ -281,7 +281,7 @@ void ToolHandler::setWidgetCursor(QCursor cursor) Gui::View3DInventorViewer* ToolHandler::getViewer() { Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { return static_cast(view)->getViewer(); } return nullptr; diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index fa31e9a49b..6dc75a87ec 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -1075,7 +1075,7 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e) contextMenu.addAction(this->toggleVisibilityInTreeAction); if (!acrossDocuments) { // is only sensible for selections within one document - if (objitem->object()->getObject()->isDerivedFrom(App::DocumentObjectGroup::getClassTypeId())) + if (objitem->object()->getObject()->isDerivedFrom()) contextMenu.addAction(this->createGroupAction); // if there are dependent objects in the selection, add context menu to add them to selection if (CheckForDependents()) @@ -2885,7 +2885,7 @@ void TreeWidget::slotRenameDocument(const Gui::Document& Doc) void TreeWidget::slotChangedViewObject(const Gui::ViewProvider& vp, const App::Property& prop) { if (!App::GetApplication().isRestoring() - && vp.isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) + && vp.isDerivedFrom()) { const auto& vpd = static_cast(vp); if (&prop == &vpd.ShowInTree) { diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 603872b9d9..864f99dd66 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -808,7 +808,7 @@ RayPickInfo View3DInventor::getObjInfoRay(Base::Vector3d* startvec, Base::Vector ret.point = Base::convertTo(Point->getPoint()); ViewProvider* vp = getViewer()->getViewProviderByPath(Point->getPath()); - if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if (vp && vp->isDerivedFrom()) { if (!vp->isSelectable()) { return ret; } diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp index 138e457fc3..d5e623c273 100644 --- a/src/Gui/View3DPy.cpp +++ b/src/Gui/View3DPy.cpp @@ -1327,7 +1327,7 @@ Py::Object View3DInventorPy::getObjectInfo(const Py::Tuple& args) dict.setItem("z", Py::Float(pt[2])); ViewProvider *vp = getView3DInventorPtr()->getViewer()->getViewProviderByPath(Point->getPath()); - if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if (vp && vp->isDerivedFrom()) { if (!vp->isSelectable()) return ret; auto vpd = static_cast(vp); @@ -1437,7 +1437,7 @@ Py::Object View3DInventorPy::getObjectsInfo(const Py::Tuple& args) dict.setItem("z", Py::Float(pt[2])); ViewProvider *vp = getView3DInventorPtr()->getViewer()->getViewProviderByPath(point->getPath()); - if(vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + if(vp && vp->isDerivedFrom()) { if(!vp->isSelectable()) continue; auto vpd = static_cast(vp); diff --git a/src/Gui/ViewProviderDragger.cpp b/src/Gui/ViewProviderDragger.cpp index 50647c8f9f..70caa50b6b 100644 --- a/src/Gui/ViewProviderDragger.cpp +++ b/src/Gui/ViewProviderDragger.cpp @@ -66,7 +66,7 @@ ViewProviderDragger::~ViewProviderDragger() = default; void ViewProviderDragger::updateData(const App::Property* prop) { - if (prop->isDerivedFrom(App::PropertyPlacement::getClassTypeId()) + if (prop->isDerivedFrom() && strcmp(prop->getName(), "Placement") == 0) { // Note: If R is the rotation, c the rotation center and t the translation // vector then Inventor applies the following transformation: R*(x-c)+c+t diff --git a/src/Gui/ViewProviderExtension.cpp b/src/Gui/ViewProviderExtension.cpp index c7ac21bfc3..b2787019a3 100644 --- a/src/Gui/ViewProviderExtension.cpp +++ b/src/Gui/ViewProviderExtension.cpp @@ -46,13 +46,13 @@ ViewProviderExtension::~ViewProviderExtension() = default; const ViewProviderDocumentObject* ViewProviderExtension::getExtendedViewProvider() const{ - assert(getExtendedContainer()->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())); + assert(getExtendedContainer()->isDerivedFrom()); return static_cast(getExtendedContainer()); } ViewProviderDocumentObject* ViewProviderExtension::getExtendedViewProvider() { - assert(getExtendedContainer()->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())); + assert(getExtendedContainer()->isDerivedFrom()); return static_cast(getExtendedContainer()); } diff --git a/src/Gui/ViewProviderGeometryObject.cpp b/src/Gui/ViewProviderGeometryObject.cpp index 826cff4139..ad25dbface 100644 --- a/src/Gui/ViewProviderGeometryObject.cpp +++ b/src/Gui/ViewProviderGeometryObject.cpp @@ -175,13 +175,13 @@ void ViewProviderGeometryObject::attach(App::DocumentObject* pcObj) void ViewProviderGeometryObject::updateData(const App::Property* prop) { - if (prop->isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) { + if (prop->isDerivedFrom()) { Base::BoundBox3d box = static_cast(prop)->getBoundingBox(); pcBoundingBox->minBounds.setValue(box.MinX, box.MinY, box.MinZ); pcBoundingBox->maxBounds.setValue(box.MaxX, box.MaxY, box.MaxZ); } - else if (prop->isDerivedFrom(App::PropertyPlacement::getClassTypeId())) { + else if (prop->isDerivedFrom()) { auto geometry = getObject(); if (geometry && prop == &geometry->Placement) { const App::PropertyComplexGeoData* data = geometry->getPropertyOfGeometry(); diff --git a/src/Gui/ViewProviderInventorObject.cpp b/src/Gui/ViewProviderInventorObject.cpp index 19e55469bf..38cb578659 100644 --- a/src/Gui/ViewProviderInventorObject.cpp +++ b/src/Gui/ViewProviderInventorObject.cpp @@ -124,7 +124,7 @@ void ViewProviderInventorObject::updateData(const App::Property* prop) } } } - else if (prop->isDerivedFrom(App::PropertyPlacement::getClassTypeId()) && + else if (prop->isDerivedFrom() && strcmp(prop->getName(), "Placement") == 0) { // Note: If R is the rotation, c the rotation center and t the translation // vector then Inventor applies the following transformation: R*(x-c)+c+t diff --git a/src/Gui/ViewProviderLink.cpp b/src/Gui/ViewProviderLink.cpp index 68b61e2c52..55bdedd656 100644 --- a/src/Gui/ViewProviderLink.cpp +++ b/src/Gui/ViewProviderLink.cpp @@ -140,7 +140,7 @@ public: Document *pDoc = Application::Instance->getDocument(obj->getDocument()); if(pDoc) { ViewProvider *vp = pDoc->getViewProvider(obj); - if(vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) + if(vp && vp->isDerivedFrom()) return static_cast(vp); } } @@ -1685,7 +1685,7 @@ void ViewProviderLink::attach(App::DocumentObject *pcObj) { setDisplayMaskMode("Link"); inherited::attach(pcObj); checkIcon(); - if(pcObj->isDerivedFrom(App::LinkElement::getClassTypeId())) + if(pcObj->isDerivedFrom()) hide(); linkView->setOwner(this); diff --git a/src/Gui/ViewProviderVRMLObject.cpp b/src/Gui/ViewProviderVRMLObject.cpp index f99e8d98ed..044eeb021f 100644 --- a/src/Gui/ViewProviderVRMLObject.cpp +++ b/src/Gui/ViewProviderVRMLObject.cpp @@ -249,7 +249,7 @@ void ViewProviderVRMLObject::updateData(const App::Property* prop) SoInput::removeDirectory(subpath.constData()); } } - else if (prop->isDerivedFrom(App::PropertyPlacement::getClassTypeId()) && + else if (prop->isDerivedFrom() && strcmp(prop->getName(), "Placement") == 0) { // Note: If R is the rotation, c the rotation center and t the translation // vector then Inventor applies the following transformation: R*(x-c)+c+t diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index cdac6c55e3..0d9b7383a5 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -1603,7 +1603,7 @@ void ExpLineEdit::onChange() { if (getExpression()) { std::unique_ptr result(getExpression()->eval()); - if(result->isDerivedFrom(App::StringExpression::getClassTypeId())) + if(result->isDerivedFrom()) setText(QString::fromUtf8(static_cast( result.get())->getText().c_str())); else diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 4b4822708d..270f505c45 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -643,7 +643,7 @@ void PropertyEditor::buildUp(PropertyModel::PropertyList&& props, bool _checkDoc continue; } // Include document to get proper handling in PropertyView::slotDeleteDocument() - if (checkDocument && container->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (checkDocument && container->isDerivedFrom()) { propOwners.insert(static_cast(container)->getDocument()); } propOwners.insert(container); @@ -779,7 +779,7 @@ void PropertyEditor::contextMenuEvent(QContextMenuEvent*) if (props.size() == 1) { auto item = static_cast(contextIndex.internalPointer()); auto prop = *props.begin(); - if (item->isBound() && !prop->isDerivedFrom(App::PropertyExpressionEngine::getClassTypeId()) + if (item->isBound() && !prop->isDerivedFrom() && !prop->isReadOnly() && !prop->testStatus(App::Property::Immutable) && !(prop->getType() & App::Prop_ReadOnly)) { contextIndex = propertyModel->buddy(contextIndex); diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index de4de21865..5e35bbac25 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -611,17 +611,17 @@ void PropertyItem::setPropertyValue(const std::string& value) continue; } - if (parent->isDerivedFrom(App::Document::getClassTypeId())) { + if (parent->isDerivedFrom()) { auto doc = static_cast(parent); ss << "FreeCAD.getDocument('" << doc->getName() << "')."; } - else if (parent->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + else if (parent->isDerivedFrom()) { auto obj = static_cast(parent); App::Document* doc = obj->getDocument(); ss << "FreeCAD.getDocument('" << doc->getName() << "').getObject('" << obj->getNameInDocument() << "')."; } - else if (parent->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) { + else if (parent->isDerivedFrom()) { App::DocumentObject* obj = static_cast(parent)->getObject(); App::Document* doc = obj->getDocument(); diff --git a/src/Mod/CAM/App/AppPathPy.cpp b/src/Mod/CAM/App/AppPathPy.cpp index 8eb6e2db88..ac3f14c2a4 100644 --- a/src/Mod/CAM/App/AppPathPy.cpp +++ b/src/Mod/CAM/App/AppPathPy.cpp @@ -178,7 +178,7 @@ private: if (PyObject_TypeCheck(pObj, &(App::DocumentObjectPy::Type))) { App::DocumentObject* obj = static_cast(pObj)->getDocumentObjectPtr(); - if (obj->getTypeId().isDerivedFrom(Base::Type::fromName("Path::Feature"))) { + if (obj->isDerivedFrom()) { const Path::Toolpath& path = static_cast(obj)->Path.getValue(); std::string gcode = path.toGCode(); Base::ofstream ofile(file); diff --git a/src/Mod/CAM/App/FeatureArea.cpp b/src/Mod/CAM/App/FeatureArea.cpp index ad0937dc8c..280283ff41 100644 --- a/src/Mod/CAM/App/FeatureArea.cpp +++ b/src/Mod/CAM/App/FeatureArea.cpp @@ -82,7 +82,7 @@ App::DocumentObjectExecReturn* FeatureArea::execute() } for (std::vector::iterator it = links.begin(); it != links.end(); ++it) { - if (!(*it && (*it)->isDerivedFrom(Part::Feature::getClassTypeId()))) { + if (!(*it && (*it)->isDerivedFrom())) { return new App::DocumentObjectExecReturn( "Linked object is not a Part object (has no Shape)."); } @@ -202,7 +202,7 @@ std::list FeatureAreaView::getShapes() if (!pObj) { return shapes; } - if (!pObj->isDerivedFrom(FeatureArea::getClassTypeId())) { + if (!pObj->isDerivedFrom()) { return shapes; } @@ -250,7 +250,7 @@ App::DocumentObjectExecReturn* FeatureAreaView::execute() return new App::DocumentObjectExecReturn("No shape linked"); } - if (!pObj->isDerivedFrom(FeatureArea::getClassTypeId())) { + if (!pObj->isDerivedFrom()) { return new App::DocumentObjectExecReturn("Linked object is not a FeatureArea"); } diff --git a/src/Mod/CAM/App/FeaturePathShape.cpp b/src/Mod/CAM/App/FeaturePathShape.cpp index 815311765e..2940f5331e 100644 --- a/src/Mod/CAM/App/FeaturePathShape.cpp +++ b/src/Mod/CAM/App/FeaturePathShape.cpp @@ -66,7 +66,7 @@ App::DocumentObjectExecReturn* FeatureShape::execute() std::list shapes; for (std::vector::iterator it = links.begin(); it != links.end(); ++it) { - if (!(*it && (*it)->isDerivedFrom(Part::Feature::getClassTypeId()))) { + if (!(*it && (*it)->isDerivedFrom())) { continue; } const TopoDS_Shape& shape = static_cast(*it)->Shape.getShape().getShape(); diff --git a/src/Mod/CAM/App/PropertyPath.cpp b/src/Mod/CAM/App/PropertyPath.cpp index 36772e4cd0..f6757ec170 100644 --- a/src/Mod/CAM/App/PropertyPath.cpp +++ b/src/Mod/CAM/App/PropertyPath.cpp @@ -132,7 +132,7 @@ void PropertyPath::RestoreDocFile(Base::Reader& reader) { App::PropertyContainer* container = getContainer(); App::DocumentObject* obj = nullptr; - if (container->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (container->isDerivedFrom()) { obj = static_cast(container); } diff --git a/src/Mod/Fem/App/AppFemPy.cpp b/src/Mod/Fem/App/AppFemPy.cpp index 8ea2d2e254..37da55d573 100644 --- a/src/Mod/Fem/App/AppFemPy.cpp +++ b/src/Mod/Fem/App/AppFemPy.cpp @@ -203,13 +203,12 @@ private: "User parameter:BaseApp/Preferences/Mod/Fem"); Py::Sequence list(object); - Base::Type meshId = Base::Type::fromName("Fem::FemMeshObject"); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); - if (obj->getTypeId().isDerivedFrom(meshId)) { + if (obj->isDerivedFrom()) { auto femMesh = static_cast(obj)->FemMesh.getValue(); if (file.hasExtension({"vtk", "vtu"})) { // get VTK prefs diff --git a/src/Mod/Fem/App/FemPostPipeline.cpp b/src/Mod/Fem/App/FemPostPipeline.cpp index ecc57dc190..16b49c289f 100644 --- a/src/Mod/Fem/App/FemPostPipeline.cpp +++ b/src/Mod/Fem/App/FemPostPipeline.cpp @@ -225,7 +225,7 @@ void FemPostPipeline::load(FemResultObject* res) Base::Console().Log("Result mesh object is empty.\n"); return; } - if (!res->Mesh.getValue()->isDerivedFrom(Fem::FemMeshObject::getClassTypeId())) { + if (!res->Mesh.getValue()->isDerivedFrom()) { Base::Console().Log("Result mesh object is not derived from Fem::FemMeshObject.\n"); return; } diff --git a/src/Mod/Fem/App/FemVTKTools.cpp b/src/Mod/Fem/App/FemVTKTools.cpp index 1040c22625..f976c25251 100644 --- a/src/Mod/Fem/App/FemVTKTools.cpp +++ b/src/Mod/Fem/App/FemVTKTools.cpp @@ -550,7 +550,7 @@ App::DocumentObject* getObjectByType(const Base::Type type) if (obj->is()) { std::vector fem = (static_cast(obj))->Group.getValues(); for (const auto& it : fem) { - if (it->getTypeId().isDerivedFrom(type)) { + if (it->isDerivedFrom(type)) { return static_cast(it); // return the first of that type } } @@ -891,7 +891,7 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result, // vtk has more points. Vtk does not support point gaps, thus the gaps are // filled with points. Then the mapping must be correct) App::DocumentObject* meshObj = res->Mesh.getValue(); - if (!meshObj || !meshObj->isDerivedFrom(FemMeshObject::getClassTypeId())) { + if (!meshObj || !meshObj->isDerivedFrom()) { Base::Console().Error("Result object does not correctly link to mesh"); return; } diff --git a/src/Mod/Fem/App/PropertyPostDataObject.cpp b/src/Mod/Fem/App/PropertyPostDataObject.cpp index f416dd7aa2..41e5146569 100644 --- a/src/Mod/Fem/App/PropertyPostDataObject.cpp +++ b/src/Mod/Fem/App/PropertyPostDataObject.cpp @@ -337,7 +337,7 @@ void PropertyPostDataObject::SaveDocFile(Base::Writer& writer) const // We only print an error message but continue writing the next files to the // stream... App::PropertyContainer* father = this->getContainer(); - if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (father && father->isDerivedFrom()) { App::DocumentObject* obj = static_cast(father); Base::Console().Error("Dataset of '%s' cannot be written to vtk file '%s'\n", obj->Label.getValue(), @@ -412,7 +412,7 @@ void PropertyPostDataObject::RestoreDocFile(Base::Reader& reader) // We only print an error message but continue reading the next files from the // stream... App::PropertyContainer* father = this->getContainer(); - if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (father && father->isDerivedFrom()) { App::DocumentObject* obj = static_cast(father); Base::Console().Error("Dataset file '%s' with data of '%s' seems to be empty\n", fi.filePath().c_str(), diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index b7b763d55e..628a135517 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -1169,7 +1169,7 @@ bool CmdFemDefineNodesSet::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -1296,7 +1296,7 @@ void CmdFemDefineElementsSet::activated(int) if (it == docObj.begin()) { Gui::Document* doc = getActiveGuiDocument(); Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); viewer->setEditing(true); viewer->startSelection(Gui::View3DInventorViewer::Clip); @@ -1318,7 +1318,7 @@ bool CmdFemDefineElementsSet::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } diff --git a/src/Mod/Fem/Gui/TaskCreateElementSet.cpp b/src/Mod/Fem/Gui/TaskCreateElementSet.cpp index 3b811c7fe4..98acf23ce4 100644 --- a/src/Mod/Fem/Gui/TaskCreateElementSet.cpp +++ b/src/Mod/Fem/Gui/TaskCreateElementSet.cpp @@ -479,7 +479,7 @@ void TaskCreateElementSet::Poly(void) { Gui::Document* doc = Gui::Application::Instance->activeDocument(); Gui::MDIView* view = doc->getActiveView(); - if (view->getTypeId().isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = ((Gui::View3DInventor*)view)->getViewer(); viewer->setEditing(true); viewer->startSelection(Gui::View3DInventorViewer::Clip); diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index a8f7e7c446..6cbb27cd04 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -379,7 +379,7 @@ std::vector ViewProviderFemMesh::getDisplayModes() const void ViewProviderFemMesh::updateData(const App::Property* prop) { - if (prop->isDerivedFrom(Fem::PropertyFemMesh::getClassTypeId())) { + if (prop->isDerivedFrom()) { ViewProviderFEMMeshBuilder builder; resetColorByNodeId(); resetDisplacementByNodeId(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp index 7ad95d482a..15b3832b7a 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp @@ -122,7 +122,7 @@ void ViewProviderFemPostFunctionProvider::updateSize() { std::vector vec = claimChildren(); for (auto it : vec) { - if (!it->isDerivedFrom(Fem::FemPostFunction::getClassTypeId())) { + if (!it->isDerivedFrom()) { continue; } diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp index 5c1b179d4f..a63647ad27 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp @@ -1036,7 +1036,7 @@ void ViewProviderFemPostObject::hide() for (auto it : ObjectsList) { if (it->isDerivedFrom()) { if (!firstVisiblePostObject && it->Visibility.getValue() - && !it->isDerivedFrom(Fem::FemPostDataAtPointFilter::getClassTypeId())) { + && !it->isDerivedFrom()) { firstVisiblePostObject = it; break; } diff --git a/src/Mod/Import/App/ExportOCAF.cpp b/src/Mod/Import/App/ExportOCAF.cpp index 41b0549d1d..392ff68619 100644 --- a/src/Mod/Import/App/ExportOCAF.cpp +++ b/src/Mod/Import/App/ExportOCAF.cpp @@ -368,9 +368,7 @@ void ExportOCAF::reallocateFreeShape(std::vector hierarchi for (std::size_t i = 0; i < n; i++) { TDF_Label label = FreeLabels.at(i); // hierarchical part does contain only part currently and not node I should add node - if (hierarchical_part.at(part_id.at(i)) - ->getTypeId() - .isDerivedFrom(Part::Feature::getClassTypeId())) { + if (hierarchical_part.at(part_id.at(i))->isDerivedFrom()) { Part::Feature* part = static_cast(hierarchical_part.at(part_id.at(i))); aShapeTool->SetShape(label, part->Shape.getValue()); // Add color information diff --git a/src/Mod/Import/App/ImportOCAF2.cpp b/src/Mod/Import/App/ImportOCAF2.cpp index 0f8dfa7733..d4446afc4c 100644 --- a/src/Mod/Import/App/ImportOCAF2.cpp +++ b/src/Mod/Import/App/ImportOCAF2.cpp @@ -561,7 +561,7 @@ App::DocumentObject* ImportOCAF2::loadShapes() if (ret) { ret->recomputeFeature(true); } - if (options.merge && ret && !ret->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (options.merge && ret && !ret->isDerivedFrom()) { auto shape = Part::Feature::getTopoShape(ret); auto feature = static_cast(pDocument->addObject("Part::Feature", "Feature")); diff --git a/src/Mod/Import/Gui/ExportOCAFGui.cpp b/src/Mod/Import/Gui/ExportOCAFGui.cpp index db20afa4e5..21f27560ee 100644 --- a/src/Mod/Import/Gui/ExportOCAFGui.cpp +++ b/src/Mod/Import/Gui/ExportOCAFGui.cpp @@ -38,7 +38,7 @@ ExportOCAFGui::ExportOCAFGui(Handle(TDocStd_Document) hDoc, bool explicitPlaceme void ExportOCAFGui::findColors(Part::Feature* part, std::vector& colors) const { Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(part); - if (vp && vp->isDerivedFrom(PartGui::ViewProviderPartExt::getClassTypeId())) { + if (vp && vp->isDerivedFrom()) { colors = static_cast(vp)->ShapeAppearance.getDiffuseColors(); } } diff --git a/src/Mod/Inspection/Gui/Command.cpp b/src/Mod/Inspection/Gui/Command.cpp index 75f38975f7..4089a27955 100644 --- a/src/Mod/Inspection/Gui/Command.cpp +++ b/src/Mod/Inspection/Gui/Command.cpp @@ -104,7 +104,7 @@ bool CmdInspectElement::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } diff --git a/src/Mod/Measure/App/MeasureBase.cpp b/src/Mod/Measure/App/MeasureBase.cpp index ae2bd457cd..3b6660ba62 100644 --- a/src/Mod/Measure/App/MeasureBase.cpp +++ b/src/Mod/Measure/App/MeasureBase.cpp @@ -179,7 +179,7 @@ QString MeasureBase::getResultString() return QString(); } - if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) { + if (prop->isDerivedFrom()) { return QString::fromStdString( static_cast(prop)->getQuantityValue().getUserString()); } diff --git a/src/Mod/Measure/Gui/Command.cpp b/src/Mod/Measure/Gui/Command.cpp index 3fb84b0990..5a886fb2c9 100644 --- a/src/Mod/Measure/Gui/Command.cpp +++ b/src/Mod/Measure/Gui/Command.cpp @@ -69,7 +69,7 @@ bool StdCmdMeasure::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = dynamic_cast(view)->getViewer(); return !viewer->isEditing(); } diff --git a/src/Mod/Measure/Gui/QuickMeasure.cpp b/src/Mod/Measure/Gui/QuickMeasure.cpp index 07100f00e7..9a16a55059 100644 --- a/src/Mod/Measure/Gui/QuickMeasure.cpp +++ b/src/Mod/Measure/Gui/QuickMeasure.cpp @@ -134,7 +134,7 @@ bool QuickMeasure::shouldMeasure(const Gui::SelectionChanges& msg) const bool QuickMeasure::isObjAcceptable(App::DocumentObject* obj) { // only measure shapes - if (obj && obj->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (obj && obj->isDerivedFrom()) { return true; } diff --git a/src/Mod/Mesh/App/Exporter.cpp b/src/Mod/Mesh/App/Exporter.cpp index a576511db4..98518deb6e 100644 --- a/src/Mod/Mesh/App/Exporter.cpp +++ b/src/Mod/Mesh/App/Exporter.cpp @@ -110,7 +110,7 @@ int Exporter::addObject(App::DocumentObject* obj, float tol) auto linked = sobj->getLinkedObject(true, &matrix, false); auto it = meshCache.find(linked); if (it == meshCache.end()) { - if (linked->isDerivedFrom(Mesh::Feature::getClassTypeId())) { + if (linked->isDerivedFrom()) { it = meshCache.emplace(linked, static_cast(linked)->Mesh.getValue()) .first; it->second.setTransform(matrix); diff --git a/src/Mod/Mesh/Gui/Command.cpp b/src/Mod/Mesh/Gui/Command.cpp index 56d80b062f..6fc02710da 100644 --- a/src/Mod/Mesh/Gui/Command.cpp +++ b/src/Mod/Mesh/Gui/Command.cpp @@ -641,7 +641,7 @@ bool CmdMeshVertexCurvatureInfo::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -701,7 +701,7 @@ bool CmdMeshPolySegm::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -749,7 +749,7 @@ bool CmdMeshAddFacet::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -814,7 +814,7 @@ bool CmdMeshPolyCut::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -879,7 +879,7 @@ bool CmdMeshPolyTrim::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -1023,7 +1023,7 @@ bool CmdMeshPolySplit::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -1114,7 +1114,7 @@ bool CmdMeshEvaluateFacet::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } @@ -1601,7 +1601,7 @@ bool CmdMeshFillInteractiveHole::isActive() } Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } diff --git a/src/Mod/Mesh/Gui/MeshSelection.cpp b/src/Mod/Mesh/Gui/MeshSelection.cpp index 0779c77f92..0f7c9f59fc 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.cpp +++ b/src/Mod/Mesh/Gui/MeshSelection.cpp @@ -136,7 +136,7 @@ std::list MeshSelection::getViewProviders() const std::vector objs = getObjects(); std::list vps; for (auto obj : objs) { - if (obj->isDerivedFrom(Mesh::Feature::getClassTypeId())) { + if (obj->isDerivedFrom()) { Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(obj); if (vp->isVisible()) { vps.push_back(static_cast(vp)); diff --git a/src/Mod/MeshPart/Gui/Tessellation.cpp b/src/Mod/MeshPart/Gui/Tessellation.cpp index dfc2870134..0907fd8eb6 100644 --- a/src/Mod/MeshPart/Gui/Tessellation.cpp +++ b/src/Mod/MeshPart/Gui/Tessellation.cpp @@ -254,7 +254,7 @@ bool Tessellation::accept() shapeObjects.emplace_back(sel.pObject, sel.SubName); } else if (sel.pObject) { - if (sel.pObject->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (sel.pObject->isDerivedFrom()) { partWithNoFace = true; } if (auto body = dynamic_cast(sel.pObject)) { diff --git a/src/Mod/Part/App/FeatureExtrusion.cpp b/src/Mod/Part/App/FeatureExtrusion.cpp index 0df43b4d21..800199733c 100644 --- a/src/Mod/Part/App/FeatureExtrusion.cpp +++ b/src/Mod/Part/App/FeatureExtrusion.cpp @@ -266,7 +266,7 @@ Base::Vector3d Extrusion::calculateShapeNormal(const App::PropertyLink& shapeLin throw Base::ValueError("calculateShapeNormal: link is empty"); //special case for sketches and the like: no matter what shape they have, use their local Z axis. - if (docobj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (docobj->isDerivedFrom()) { Base::Vector3d OZ(0.0, 0.0, 1.0); Base::Vector3d result; Base::Rotation(mat).multVec(OZ, result); diff --git a/src/Mod/Part/App/FeatureMirroring.cpp b/src/Mod/Part/App/FeatureMirroring.cpp index bcc7cf7af9..94ce2bdca6 100644 --- a/src/Mod/Part/App/FeatureMirroring.cpp +++ b/src/Mod/Part/App/FeatureMirroring.cpp @@ -150,8 +150,8 @@ App::DocumentObjectExecReturn *Mirroring::execute() Can also be App::Links to such objects */ if (refObject){ - if (refObject->isDerivedFrom(Part::Plane::getClassTypeId()) || refObject->isDerivedFrom() || (strstr(refObject->getNameInDocument(), "Plane") - && refObject->isDerivedFrom(Part::Datum::getClassTypeId()))) { + if (refObject->isDerivedFrom() || refObject->isDerivedFrom() || (strstr(refObject->getNameInDocument(), "Plane") + && refObject->isDerivedFrom())) { Part::Feature* plane = static_cast(refObject); Base::Vector3d base = plane->Placement.getValue().getPosition(); axbase = gp_Pnt(base.x, base.y, base.z); diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index f786c75c68..b547e1c790 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -287,7 +287,7 @@ void Geometry::Save(Base::Writer &writer) const // Get the number of persistent extensions int counter = 0; for(const auto& att : extensions) { - if(att->isDerivedFrom(Part::GeometryPersistenceExtension::getClassTypeId())) + if(att->isDerivedFrom()) counter++; } @@ -296,7 +296,7 @@ void Geometry::Save(Base::Writer &writer) const writer.incInd(); for(const auto& att : extensions) { - if(att->isDerivedFrom(Part::GeometryPersistenceExtension::getClassTypeId())) + if(att->isDerivedFrom()) std::static_pointer_cast(att)->Save(writer); } @@ -764,7 +764,7 @@ GeomLineSegment* GeomCurve::toLineSegment(KeepTag clone) const return nullptr; Base::Vector3d start, end; - if (isDerivedFrom(GeomBoundedCurve::getClassTypeId())) { + if (isDerivedFrom()) { start = dynamic_cast(this)->getStartPoint(); end = dynamic_cast(this)->getEndPoint(); } else { @@ -2064,7 +2064,7 @@ PyObject *GeomBSplineCurve::getPyObject() bool GeomBSplineCurve::isSame(const Geometry &_other, double tol, double atol) const { if(_other.getTypeId() != getTypeId()) { - if (isLinear() && _other.isDerivedFrom(GeomCurve::getClassTypeId())) { + if (isLinear() && _other.isDerivedFrom()) { std::unique_ptr geo(toLineSegment()); if (geo) return geo->isSame(_other, tol, atol); @@ -2256,7 +2256,7 @@ GeomBSplineCurve* GeomConic::toNurbs(double first, double last) const bool GeomConic::isSame(const Geometry &_other, double tol, double atol) const { - if(!_other.isDerivedFrom(GeomConic::getClassTypeId())) + if(!_other.isDerivedFrom()) return false; auto &other = static_cast(_other); @@ -4526,7 +4526,7 @@ PyObject *GeomLine::getPyObject() bool GeomLine::isSame(const Geometry &_other, double tol, double atol) const { if(_other.getTypeId() != getTypeId()) { - if (_other.isDerivedFrom(GeomCurve::getClassTypeId())) { + if (_other.isDerivedFrom()) { std::unique_ptr geo(dynamic_cast(_other).toLine()); if (geo) return isSame(*geo, tol, atol); @@ -4816,7 +4816,7 @@ bool GeomSurface::isPlanar(const Handle(Geom_Surface) &s, gp_Pln *pln, double to GeomPlane* GeomSurface::toPlane(bool clone, double tol) const { - if (isDerivedFrom(GeomPlane::getClassTypeId())) { + if (isDerivedFrom()) { if (clone) { return dynamic_cast(this->clone()); } @@ -5145,7 +5145,7 @@ PyObject *GeomBSplineSurface::getPyObject() bool GeomBSplineSurface::isSame(const Geometry &_other, double tol, double atol) const { if(_other.getTypeId() != getTypeId()) { - if (_other.isDerivedFrom(GeomSurface::getClassTypeId()) && isPlanar()) { + if (_other.isDerivedFrom() && isPlanar()) { std::unique_ptr geo(toPlane()); if (geo) return geo->isSame(_other, tol, atol); @@ -5247,7 +5247,7 @@ Base::Vector3d GeomElementarySurface::getYDir(void) const bool GeomElementarySurface::isSame(const Geometry &_other, double tol, double atol) const { - if(!_other.isDerivedFrom(GeomElementarySurface::getClassTypeId())) + if(!_other.isDerivedFrom()) return false; auto &other = static_cast(_other); @@ -5684,7 +5684,7 @@ PyObject *GeomPlane::getPyObject() bool GeomPlane::isSame(const Geometry &_other, double tol, double atol) const { if(_other.getTypeId() != getTypeId()) { - if (_other.isDerivedFrom(GeomSurface::getClassTypeId())) { + if (_other.isDerivedFrom()) { std::unique_ptr geo(static_cast(_other).toPlane()); if (geo) return isSame(*geo, tol, atol); @@ -5940,7 +5940,7 @@ Base::Vector3d GeomSweptSurface::getDir(void) const bool GeomSweptSurface::isSame(const Geometry &_other, double tol, double atol) const { - if(!_other.isDerivedFrom(GeomSweptSurface::getClassTypeId())) + if(!_other.isDerivedFrom()) return false; auto &other = static_cast(_other); diff --git a/src/Mod/Part/App/MeasureClient.cpp b/src/Mod/Part/App/MeasureClient.cpp index c6ddb5fba6..e6f0479420 100644 --- a/src/Mod/Part/App/MeasureClient.cpp +++ b/src/Mod/Part/App/MeasureClient.cpp @@ -108,7 +108,7 @@ TopoDS_Shape getLocatedShape(const App::SubObjectT& subject, Base::Matrix4D* mat shape.setPlacement(placement); // Don't get the subShape from datum elements - if (obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) { + if (obj->isDerivedFrom()) { return shape.getShape(); } diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index 956468f18d..147f4c362b 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -521,7 +521,7 @@ static std::vector> getElementSource(App::Docu break; } } - if (owner->isDerivedFrom(App::GeoFeature::getClassTypeId())) { + if (owner->isDerivedFrom()) { auto ownerGeoFeature = static_cast(owner)->getElementOwner(ret.back().second); if (ownerGeoFeature) { @@ -624,7 +624,7 @@ std::list Feature::getElementHistory(App::DocumentObject* fea break; } } - if (feature->isDerivedFrom(App::GeoFeature::getClassTypeId())) { + if (feature->isDerivedFrom()) { auto ownerGeoFeature = static_cast(feature)->getElementOwner(element); if (ownerGeoFeature) { @@ -989,7 +989,7 @@ static TopoShape _getTopoShape(const App::DocumentObject* obj, } } else { - if (linked->isDerivedFrom(App::Line::getClassTypeId())) { + if (linked->isDerivedFrom()) { static TopoDS_Shape _shape; if (_shape.IsNull()) { auto line = static_cast(linked); @@ -1000,7 +1000,7 @@ static TopoShape _getTopoShape(const App::DocumentObject* obj, } shape = TopoShape(tag, hasher, _shape); } - else if (linked->isDerivedFrom(App::Plane::getClassTypeId())) { + else if (linked->isDerivedFrom()) { static TopoDS_Shape _shape; if (_shape.IsNull()) { auto plane = static_cast(linked); @@ -1011,7 +1011,7 @@ static TopoShape _getTopoShape(const App::DocumentObject* obj, } shape = TopoShape(tag, hasher, _shape); } - else if (linked->isDerivedFrom(App::Point::getClassTypeId())) { + else if (linked->isDerivedFrom()) { static TopoDS_Shape _shape; if (_shape.IsNull()) { BRepBuilderAPI_MakeVertex builder(gp_Pnt(0, 0, 0)); @@ -1019,7 +1019,7 @@ static TopoShape _getTopoShape(const App::DocumentObject* obj, } shape = TopoShape(tag, hasher, _shape); } - else if (linked->isDerivedFrom(App::Placement::getClassTypeId())) { + else if (linked->isDerivedFrom()) { auto element = Data::findElementName(subname); if (element) { if (boost::iequals("x", element) || boost::iequals("x-axis", element) @@ -1270,7 +1270,7 @@ TopoShape Feature::getTopoShape(const App::DocumentObject* obj, // to false. So we manually apply the top level transform if asked. if (needSubElement && (!pmat || *pmat == Base::Matrix4D()) - && obj->isDerivedFrom(Part::Feature::getClassTypeId()) + && obj->isDerivedFrom() && !obj->hasExtension(App::LinkBaseExtension::getExtensionClassTypeId())) { // Some OCC shape making is very sensitive to shape transformation. So // check here if a direct sub shape is required, and bypass all extra diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index 17c4123325..39d9283627 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -476,7 +476,7 @@ void PropertyPartShape::saveToFile(Base::Writer &writer) const // We only print an error message but continue writing the next files to the // stream... App::PropertyContainer* father = this->getContainer(); - if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (father && father->isDerivedFrom()) { App::DocumentObject* obj = static_cast(father); Base::Console().Error("Shape of '%s' cannot be written to BRep file '%s'\n", obj->Label.getValue(),fi.filePath().c_str()); @@ -528,7 +528,7 @@ void PropertyPartShape::loadFromFile(Base::Reader &reader) // We only print an error message but continue reading the next files from the // stream... App::PropertyContainer* father = this->getContainer(); - if (father && father->isDerivedFrom(App::DocumentObject::getClassTypeId())) { + if (father && father->isDerivedFrom()) { App::DocumentObject* obj = static_cast(father); Base::Console().Error("BRep file '%s' with shape of '%s' seems to be empty\n", fi.filePath().c_str(),obj->Label.getValue()); diff --git a/src/Mod/Part/App/TopoShapeExpansion.cpp b/src/Mod/Part/App/TopoShapeExpansion.cpp index 31f4f70105..133f8af8de 100644 --- a/src/Mod/Part/App/TopoShapeExpansion.cpp +++ b/src/Mod/Part/App/TopoShapeExpansion.cpp @@ -474,11 +474,11 @@ std::vector TopoShape::findSubShapesWithSharedVertex(const TopoShape& return res; } if (shapeType == TopAbs_EDGE) { - isLine = (geom->isDerivedFrom(GeomLine::getClassTypeId()) - || geom->isDerivedFrom(GeomLineSegment::getClassTypeId())); + isLine = (geom->isDerivedFrom() + || geom->isDerivedFrom()); } else { - isPlane = geom->isDerivedFrom(GeomPlane::getClassTypeId()); + isPlane = geom->isDerivedFrom(); } } @@ -491,8 +491,8 @@ std::vector TopoShape::findSubShapesWithSharedVertex(const TopoShape& // For lines, don't compare geometry, just check the // vertices below instead, because the exact same edge // may have different geometrical representation. - if (!g2->isDerivedFrom(GeomLine::getClassTypeId()) - && !g2->isDerivedFrom(GeomLineSegment::getClassTypeId())) { + if (!g2->isDerivedFrom() + && !g2->isDerivedFrom()) { return false; } } @@ -500,7 +500,7 @@ std::vector TopoShape::findSubShapesWithSharedVertex(const TopoShape& // For planes, don't compare geometry either, so that // we don't need to worry about orientation and so on. // Just check the edges. - if (!g2->isDerivedFrom(GeomPlane::getClassTypeId())) { + if (!g2->isDerivedFrom()) { return false; } } @@ -603,8 +603,8 @@ std::vector TopoShape::findSubShapesWithSharedVertex(const TopoShape& } bool isLine2 = false; gp_Pnt pt1, pt2; - if (geom2->isDerivedFrom(GeomLine::getClassTypeId()) - || geom2->isDerivedFrom(GeomLineSegment::getClassTypeId())) { + if (geom2->isDerivedFrom() + || geom2->isDerivedFrom()) { pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(edge))); pt2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(edge))); isLine2 = true; @@ -624,8 +624,8 @@ std::vector TopoShape::findSubShapesWithSharedVertex(const TopoShape& } } if (isLine2) { - if (g1->isDerivedFrom(GeomLine::getClassTypeId()) - || g1->isDerivedFrom(GeomLineSegment::getClassTypeId())) { + if (g1->isDerivedFrom() + || g1->isDerivedFrom()) { auto p1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(e1))); auto p2 = @@ -5751,7 +5751,7 @@ TopoShape& TopoShape::makeElementBoolean(const char* maker, bool TopoShape::isSame(const Data::ComplexGeoData& _other) const { - if (!_other.isDerivedFrom(TopoShape::getClassTypeId())) { + if (!_other.isDerivedFrom()) { return false; } diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index 996a1edc76..205b5addbe 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -1920,7 +1920,7 @@ bool CmdShapeInfo::isActive() return false; Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view && view->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(view)->getViewer(); return !viewer->isEditing(); } diff --git a/src/Mod/Part/Gui/CommandFilter.cpp b/src/Mod/Part/Gui/CommandFilter.cpp index b1e0fae6d3..c27f01f571 100644 --- a/src/Mod/Part/Gui/CommandFilter.cpp +++ b/src/Mod/Part/Gui/CommandFilter.cpp @@ -157,7 +157,7 @@ void PartCmdSelectFilter::languageChange() bool PartCmdSelectFilter::isActive() { Gui::MDIView* view = Gui::getMainWindow()->activeWindow(); - return view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId()); + return view && view->isDerivedFrom(); } diff --git a/src/Mod/Part/Gui/Mirroring.cpp b/src/Mod/Part/Gui/Mirroring.cpp index 5baf5bbe6f..1bed8f06ed 100644 --- a/src/Mod/Part/Gui/Mirroring.cpp +++ b/src/Mod/Part/Gui/Mirroring.cpp @@ -94,8 +94,8 @@ public: { std::string subString(sSubName); - if (pObj->isDerivedFrom(Part::Plane::getClassTypeId()) || pObj->isDerivedFrom() - || (strstr(pObj->getNameInDocument(), "Plane") && pObj->isDerivedFrom(Part::Datum::getClassTypeId()))) { + if (pObj->isDerivedFrom() || pObj->isDerivedFrom() + || (strstr(pObj->getNameInDocument(), "Plane") && pObj->isDerivedFrom())) { return true; // reference is an app::link or a part::feature or some subobject } else if (pObj->isDerivedFrom() || pObj->isDerivedFrom()) { diff --git a/src/Mod/Part/Gui/SectionCutting.cpp b/src/Mod/Part/Gui/SectionCutting.cpp index 3bcad2c2db..fbfa8b66c2 100644 --- a/src/Mod/Part/Gui/SectionCutting.cpp +++ b/src/Mod/Part/Gui/SectionCutting.cpp @@ -54,11 +54,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include "SectionCutting.h" @@ -855,18 +857,13 @@ bool SectionCut::findObjects(std::vector& objects) } // get all shapes that are also Part::Features if (object->getPropertyByName("Shape") != nullptr - && object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::Feature"))) { + && object->isDerivedFrom()) { // sort out 2D objects, datums, App:Parts, compounds and objects that are // part of a PartDesign body - if (!object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::Part2DObject")) - && !object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::Datum")) - && !object->getTypeId().isDerivedFrom( - Base::Type::fromName("PartDesign::Feature")) - && !object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::Compound")) + if (!object->isDerivedFrom() + && !object->isDerivedFrom() + && !object->isDerivedFrom(Base::Type::fromName("PartDesign::Feature")) + && !object->isDerivedFrom() && object->getTypeId() != Base::Type::fromName("App::Part")) { objects.push_back(object); } @@ -875,7 +872,7 @@ bool SectionCut::findObjects(std::vector& objects) if (auto pcLink = dynamic_cast(object)) { auto linkedObject = doc->getObject(pcLink->LinkedObject.getObjectName()); if (linkedObject != nullptr - && linkedObject->getTypeId().isDerivedFrom(Base::Type::fromName("Part::Feature"))) { + && linkedObject->isDerivedFrom()) { objects.push_back(object); } } @@ -894,15 +891,11 @@ void SectionCut::filterObjects(std::vector& objects) if (!object) { continue; } - if (object->getTypeId().isDerivedFrom(Base::Type::fromName("Part::Boolean")) - || object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::MultiCommon")) - || object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::MultiFuse")) - || object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::Thickness")) - || object->getTypeId().isDerivedFrom( - Base::Type::fromName("Part::FilletBase"))) { + if (object->isDerivedFrom() + || object->isDerivedFrom() + || object->isDerivedFrom() + || object->isDerivedFrom() + || object->isDerivedFrom()) { // get possible links auto subObjectList = object->getOutList(); // if there are links, delete them diff --git a/src/Mod/Part/Gui/TaskOffset.cpp b/src/Mod/Part/Gui/TaskOffset.cpp index 38e744d801..e582a116fe 100644 --- a/src/Mod/Part/Gui/TaskOffset.cpp +++ b/src/Mod/Part/Gui/TaskOffset.cpp @@ -67,7 +67,7 @@ OffsetWidget::OffsetWidget(Part::Offset* offset, QWidget* parent) d->ui.spinOffset->setSingleStep(0.1); d->ui.facesButton->hide(); - bool is_2d = d->offset->isDerivedFrom(Part::Offset2D::getClassTypeId()); + bool is_2d = d->offset->isDerivedFrom(); d->ui.selfIntersection->setVisible(!is_2d); if(is_2d) d->ui.modeType->removeItem(2);//remove Recto-Verso mode, not supported by 2d offset diff --git a/src/Mod/Part/Gui/TaskShapeBuilder.cpp b/src/Mod/Part/Gui/TaskShapeBuilder.cpp index 42846b66a5..7307188d60 100644 --- a/src/Mod/Part/Gui/TaskShapeBuilder.cpp +++ b/src/Mod/Part/Gui/TaskShapeBuilder.cpp @@ -67,7 +67,7 @@ namespace PartGui { } bool allow(App::Document*, App::DocumentObject* obj, const char*sSubName) override { - if (!obj || !obj->isDerivedFrom(Part::Feature::getClassTypeId())) + if (!obj || !obj->isDerivedFrom()) return false; if (!sSubName || sSubName[0] == '\0') return (mode == ALL); diff --git a/src/Mod/PartDesign/App/Body.cpp b/src/Mod/PartDesign/App/Body.cpp index dcc6a666cb..ab032aa702 100644 --- a/src/Mod/PartDesign/App/Body.cpp +++ b/src/Mod/PartDesign/App/Body.cpp @@ -255,12 +255,12 @@ std::vector Body::addObject(App::DocumentObject *feature) } if(feature->Visibility.getValue() - && feature->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + && feature->isDerivedFrom()) { for(auto obj : Group.getValues()) { if(obj->Visibility.getValue() && obj!=feature - && obj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + && obj->isDerivedFrom()) obj->Visibility.setValue(false); } } @@ -313,7 +313,7 @@ void Body::insertObject(App::DocumentObject* feature, App::DocumentObject* targe Group.setValues (model); - if(feature->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + if(feature->isDerivedFrom()) static_cast(feature)->_Body.setValue(this); // Set the BaseFeature property @@ -399,7 +399,7 @@ App::DocumentObjectExecReturn *Body::execute() Part::TopoShape tipShape; if ( tip ) { - if ( !tip->getTypeId().isDerivedFrom ( PartDesign::Feature::getClassTypeId() ) ) { + if ( !tip->isDerivedFrom() ) { return new App::DocumentObjectExecReturn (QT_TRANSLATE_NOOP("Exception", "Linked object is not a PartDesign feature" )); } @@ -441,7 +441,7 @@ void Body::onChanged(const App::Property* prop) { if (BaseFeature.getValue()) { //setup the FeatureBase if needed - if (!first || !first->isDerivedFrom(FeatureBase::getClassTypeId())) { + if (!first || !first->isDerivedFrom()) { bf = static_cast(getDocument()->addObject("PartDesign::FeatureBase", "BaseFeature")); insertObject(bf, first, false); @@ -460,7 +460,7 @@ void Body::onChanged(const App::Property* prop) { else if (prop == &Group) { //if the FeatureBase was deleted we set the BaseFeature link to nullptr if (BaseFeature.getValue() && - (Group.getValues().empty() || !Group.getValues().front()->isDerivedFrom(FeatureBase::getClassTypeId()))) { + (Group.getValues().empty() || !Group.getValues().front()->isDerivedFrom())) { BaseFeature.setValue(nullptr); } } @@ -532,7 +532,7 @@ App::DocumentObject *Body::getSubObject(const char *subname, const char* secondDot = strchr(firstDot + 1, '.'); if (secondDot) { auto firstObj = Group.find(std::string(subname, firstDot).c_str()); - if (!firstObj || firstObj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) { + if (!firstObj || firstObj->isDerivedFrom()) { auto secondObj = Group.find(std::string(firstDot + 1, secondDot).c_str()); if (secondObj) { // we support only one level of sibling grouping, so no @@ -564,7 +564,7 @@ App::DocumentObject *Body::getSubObject(const char *subname, // We return the shape only if there are feature visible inside for(auto obj : Group.getValues()) { if(obj->Visibility.getValue() && - obj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + obj->isDerivedFrom()) { return Part::BodyBase::getSubObject(subname,pyObj,pmat,transform,depth); } @@ -578,7 +578,7 @@ App::DocumentObject *Body::getSubObject(const char *subname, void Body::onDocumentRestored() { for(auto obj : Group.getValues()) { - if(obj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + if(obj->isDerivedFrom()) static_cast(obj)->_Body.setValue(this); } _GroupTouched.setStatus(App::Property::Output,true); diff --git a/src/Mod/PartDesign/App/BodyPyImp.cpp b/src/Mod/PartDesign/App/BodyPyImp.cpp index 63f4d5dcc9..beb77a62f7 100644 --- a/src/Mod/PartDesign/App/BodyPyImp.cpp +++ b/src/Mod/PartDesign/App/BodyPyImp.cpp @@ -87,7 +87,7 @@ PyObject* BodyPy::insertObject(PyObject *args) Py::Object BodyPy::getVisibleFeature() const { for(auto obj : getBodyPtr()->Group.getValues()) { - if(obj->Visibility.getValue() && obj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + if(obj->Visibility.getValue() && obj->isDerivedFrom()) return Py::Object(obj->getPyObject(),true); } return Py::Object(); diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index b0d60ab8cc..868c619e31 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -285,8 +285,8 @@ const TopoDS_Shape& Feature::getBaseShape() const { if (!BaseObject) throw Base::ValueError("Base feature's shape is not defined"); - if (BaseObject->isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId())|| - BaseObject->isDerivedFrom(PartDesign::SubShapeBinder::getClassTypeId())) + if (BaseObject->isDerivedFrom()|| + BaseObject->isDerivedFrom()) { throw Base::ValueError("Base shape of shape binder cannot be used"); } @@ -318,8 +318,8 @@ Part::TopoShape Feature::getBaseTopoShape(bool silent) const } throw Base::RuntimeError("Missing container body"); } - if (BaseObject->isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId()) - || BaseObject->isDerivedFrom(PartDesign::SubShapeBinder::getClassTypeId())) { + if (BaseObject->isDerivedFrom() + || BaseObject->isDerivedFrom()) { if (silent) { return result; } @@ -395,7 +395,7 @@ Body* Feature::getFeatureBody() const { auto list = getInList(); for (auto in : list) { - if(in->isDerivedFrom(Body::getClassTypeId()) && //is Body? + if(in->isDerivedFrom() && //is Body? static_cast(in)->hasObject(this)) { //is part of this Body? return static_cast(in); diff --git a/src/Mod/PartDesign/App/FeatureBase.cpp b/src/Mod/PartDesign/App/FeatureBase.cpp index add16252a6..497727f0fa 100644 --- a/src/Mod/PartDesign/App/FeatureBase.cpp +++ b/src/Mod/PartDesign/App/FeatureBase.cpp @@ -64,7 +64,7 @@ App::DocumentObjectExecReturn* FeatureBase::execute() QT_TRANSLATE_NOOP("Exception", "BaseFeature link is not set")); } - if (!BaseFeature.getValue()->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (!BaseFeature.getValue()->isDerivedFrom()) { return new App::DocumentObjectExecReturn( QT_TRANSLATE_NOOP("Exception", "BaseFeature must be a Part::Feature")); } diff --git a/src/Mod/PartDesign/App/FeatureBoolean.cpp b/src/Mod/PartDesign/App/FeatureBoolean.cpp index af9a4f35d3..ee260cb7e5 100644 --- a/src/Mod/PartDesign/App/FeatureBoolean.cpp +++ b/src/Mod/PartDesign/App/FeatureBoolean.cpp @@ -91,7 +91,7 @@ App::DocumentObjectExecReturn *Boolean::execute() baseTopShape = baseFeature->Shape.getShape(); else { auto feature = tools.back(); - if(!feature->isDerivedFrom(Part::Feature::getClassTypeId())) + if(!feature->isDerivedFrom()) return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Cannot do boolean with anything but Part::Feature and its derivatives")); baseTopShape = static_cast(feature)->Shape.getShape(); @@ -120,7 +120,7 @@ App::DocumentObjectExecReturn *Boolean::execute() Base::Placement bodyPlacement = baseBody->globalPlacement().inverse(); for (auto tool : tools) { - if(!tool->isDerivedFrom(Part::Feature::getClassTypeId())) + if(!tool->isDerivedFrom()) return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Cannot do boolean with anything but Part::Feature and its derivatives")); Part::TopoShape toolShape = static_cast(tool)->Shape.getShape(); diff --git a/src/Mod/PartDesign/App/FeatureDressUp.cpp b/src/Mod/PartDesign/App/FeatureDressUp.cpp index fe85d9a4e8..ed7d00e37e 100644 --- a/src/Mod/PartDesign/App/FeatureDressUp.cpp +++ b/src/Mod/PartDesign/App/FeatureDressUp.cpp @@ -86,7 +86,7 @@ Part::Feature *DressUp::getBaseObject(bool silent) const const char* err = nullptr; App::DocumentObject* base = Base.getValue(); if (base) { - if(base->isDerivedFrom(Part::Feature::getClassTypeId())) { + if(base->isDerivedFrom()) { rv = static_cast(base); } else { err = "Linked object is not a Part object"; @@ -314,7 +314,7 @@ void DressUp::getAddSubShape(Part::TopoShape &addShape, Part::TopoShape &subShap if(!base) FC_THROWM(Base::CADKernelError, "Cannot find additive or subtractive support for " << getFullName()); - if(!base->isDerivedFrom(DressUp::getClassTypeId())) + if(!base->isDerivedFrom()) break; } } diff --git a/src/Mod/PartDesign/App/FeatureLoft.cpp b/src/Mod/PartDesign/App/FeatureLoft.cpp index 70a7de5f19..378ba308ee 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.cpp +++ b/src/Mod/PartDesign/App/FeatureLoft.cpp @@ -75,7 +75,7 @@ Loft::getSectionShape(const char *name, // Be smart. If part of a sketch is selected, use the entire sketch unless it is a single vertex - // backward compatibility (#16630) auto subName = subs.empty() ? "" : subs.front(); - auto useEntireSketch = obj->isDerivedFrom(Part::Part2DObject::getClassTypeId()) && subName.find("Vertex") != 0; + auto useEntireSketch = obj->isDerivedFrom() && subName.find("Vertex") != 0; if (subs.empty() || std::find(subs.begin(), subs.end(), std::string()) != subs.end() || useEntireSketch ) { shapes.push_back(Part::Feature::getTopoShape(obj)); if (shapes.back().isNull()) diff --git a/src/Mod/PartDesign/App/FeaturePipe.cpp b/src/Mod/PartDesign/App/FeaturePipe.cpp index 6d7642f31e..a2ee7cf313 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.cpp +++ b/src/Mod/PartDesign/App/FeaturePipe.cpp @@ -112,14 +112,14 @@ App::DocumentObjectExecReturn *Pipe::execute() auto getSectionShape = [](App::DocumentObject* feature, const std::vector& subs) -> TopoDS_Shape { - if (!feature || !feature->isDerivedFrom(Part::Feature::getClassTypeId())) + if (!feature || !feature->isDerivedFrom()) throw Base::TypeError("Pipe: Invalid profile/section"); auto subName = subs.empty() ? "" : subs.front(); // only take the entire shape when we have a sketch selected, but // not a point of the sketch - if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) + if (feature->isDerivedFrom() && subName.compare(0, 6, "Vertex") != 0) return static_cast(feature)->Shape.getValue(); else { @@ -237,7 +237,7 @@ App::DocumentObjectExecReturn *Pipe::execute() // TODO: we need to order the sections to prevent occ from crashing, // as makepipeshell connects the sections in the order of adding for (auto& subSet : multisections) { - if (!subSet.first->isDerivedFrom(Part::Feature::getClassTypeId())) + if (!subSet.first->isDerivedFrom()) return new App::DocumentObjectExecReturn(QT_TRANSLATE_NOOP("Exception", "Pipe: All sections need to be part features")); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index d04833e39b..3c3afbb2ad 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -104,7 +104,7 @@ void ProfileBased::positionByPrevious() //no base. Use either Sketch support's placement, or sketch's placement itself. Part::Part2DObject* sketch = getVerifiedSketch(); App::DocumentObject* support = sketch->AttachmentSupport.getValue(); - if (support && support->isDerivedFrom(App::GeoFeature::getClassTypeId())) { + if (support && support->isDerivedFrom()) { this->Placement.setValue(static_cast(support)->Placement.getValue()); } else { @@ -202,7 +202,7 @@ TopoShape ProfileBased::getTopoShapeVerifiedFace(bool silent, } else { std::string sub; - if (!obj->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (!obj->isDerivedFrom()) { if (!subs.empty()) { sub = subs[0]; } @@ -304,7 +304,7 @@ TopoShape ProfileBased::getTopoShapeVerifiedFace(bool silent, } if (count > 1) { if (AllowMultiFace.getValue() - || obj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + || obj->isDerivedFrom()) { return shape; } FC_WARN("Found more than one face from profile"); @@ -431,11 +431,11 @@ TopoShape ProfileBased::getProfileShape() const std::vector ProfileBased::getProfileWires() const { std::vector result; - if (!Profile.getValue() || !Profile.getValue()->isDerivedFrom(Part::Feature::getClassTypeId())) + if (!Profile.getValue() || !Profile.getValue()->isDerivedFrom()) throw Base::TypeError("No valid profile linked"); TopoDS_Shape shape; - if (Profile.getValue()->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (Profile.getValue()->isDerivedFrom()) shape = Profile.getValue()->Shape.getValue(); else { if (Profile.getSubValues().empty()) @@ -613,7 +613,7 @@ Part::Feature* ProfileBased::getBaseObject(bool silent) const if (!obj) return nullptr; - if (!obj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (!obj->isDerivedFrom()) return obj; //due to former test we know we have a 2d object @@ -621,7 +621,7 @@ Part::Feature* ProfileBased::getBaseObject(bool silent) const const char* err = nullptr; App::DocumentObject* spt = sketch->AttachmentSupport.getValue(); if (spt) { - if (spt->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (spt->isDerivedFrom()) { rv = static_cast(spt); } else { @@ -657,7 +657,7 @@ void ProfileBased::getUpToFaceFromLinkSub(TopoShape& upToFace, const App::Proper throw Base::ValueError("SketchBased: No face selected"); } - if (ref->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) { + if (ref->isDerivedFrom()) { upToFace = makeShapeFromPlane(ref); return; } @@ -1397,7 +1397,7 @@ Base::Vector3d ProfileBased::getProfileNormal() const { return SketchVector; // get the Sketch plane - if (obj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (obj->isDerivedFrom()) { Base::Placement SketchPos = obj->Placement.getValue(); Base::Rotation SketchOrientation = SketchPos.getRotation(); SketchOrientation.multVec(SketchVector, SketchVector); diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index 8402df16c9..4bb358f3cb 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -838,7 +838,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) { for (auto& v : mats) { const char* name = cacheName(v.first); auto prop = getDynamicPropertyByName(name); - if (!prop || !prop->isDerivedFrom(App::PropertyMatrix::getClassTypeId())) { + if (!prop || !prop->isDerivedFrom()) { if (prop) removeDynamicProperty(name); prop = addDynamicProperty("App::PropertyMatrix", name, "Cache", nullptr, 0, false, true); diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 107a994b4c..dfc15d225a 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -292,7 +292,7 @@ void CmdPartDesignShapeBinder::activated(int iMsg) bool bEditSelected = false; if (support.getSize() == 1 && support.getValue() ){ - if (support.getValue()->isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId())) + if (support.getValue()->isDerivedFrom()) bEditSelected = true; } @@ -766,7 +766,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons { auto base_worker = [=](App::DocumentObject *feature, const std::vector &subs) { - if (!feature || !feature->isDerivedFrom(Part::Feature::getClassTypeId())) + if (!feature || !feature->isDerivedFrom()) return; // Related to #0002760: when an operation can't be performed due to a broken @@ -818,7 +818,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons // `ProfileBased::getProfileShape()` and other methods will return // just the sub-shapes if they are set. So when whole sketches are // desired, do not set sub-values. - if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) && + if (feature->isDerivedFrom() && subName.compare(0, 6, "Vertex") != 0) runProfileCmd(); else @@ -853,7 +853,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons // `ProfileBased::getProfileShape()` and other methods will return // just the sub-shapes if they are set. So when whole sketches are // desired, don't set sub-values. - if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) && + if (feature->isDerivedFrom() && subName.compare(0, 6, "Vertex") != 0) runProfileCmd(); else @@ -864,7 +864,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons if (selection.size() == 2) { //treat additional selected object as spine std::vector subnames = selection[1].getSubNames(); auto objCmdSpine = Gui::Command::getObjectCmd(selection[1].getObject()); - if (selection[1].getObject()->isDerivedFrom(Part::Part2DObject::getClassTypeId()) && subnames.empty()) { + if (selection[1].getObject()->isDerivedFrom() && subnames.empty()) { FCMD_OBJ_CMD(Feat,"Spine = " << objCmdSpine); } else { @@ -1048,7 +1048,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons void finishProfileBased(const Gui::Command* cmd, const Part::Feature* sketch, App::DocumentObject *Feat) { - if (sketch && sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (sketch && sketch->isDerivedFrom()) FCMD_OBJ_HIDE(sketch); finishFeature(cmd, Feat); } @@ -1217,7 +1217,7 @@ void CmdPartDesignRevolution::activated(int iMsg) if (!Feat) return; - if (sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (sketch->isDerivedFrom()) { FCMD_OBJ_CMD(Feat,"ReferenceAxis = (" << getObjectCmd(sketch) << ",['V_Axis'])"); } else { @@ -1273,7 +1273,7 @@ void CmdPartDesignGroove::activated(int iMsg) if (!Feat) return; - if (sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (sketch->isDerivedFrom()) { FCMD_OBJ_CMD(Feat,"ReferenceAxis = ("<isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (sketch->isDerivedFrom()) { FCMD_OBJ_CMD(Feat,"ReferenceAxis = (" << getObjectCmd(sketch) << ",['V_Axis'])"); } else { @@ -1605,7 +1605,7 @@ void CmdPartDesignSubtractiveHelix::activated(int iMsg) // specific parameters for helix Gui::Command::updateActive(); - if (sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (sketch->isDerivedFrom()) { FCMD_OBJ_CMD(Feat,"ReferenceAxis = (" << getObjectCmd(sketch) << ",['V_Axis'])"); } else { @@ -2022,7 +2022,7 @@ void CmdPartDesignMirrored::activated(int iMsg) Gui::Command* cmd = this; auto worker = [cmd, pcActiveBody](App::DocumentObject *Feat, std::vector features) { bool direction = false; - if (!features.empty() && features.front()->isDerivedFrom(PartDesign::ProfileBased::getClassTypeId())) { + if (!features.empty() && features.front()->isDerivedFrom()) { Part::Part2DObject* sketch = (static_cast(features.front()))->getVerifiedSketch(/* silent =*/ true); if (sketch) { FCMD_OBJ_CMD(Feat,"MirrorPlane = ("< features) { bool direction = false; - if (!features.empty() && features.front()->isDerivedFrom(PartDesign::ProfileBased::getClassTypeId())) { + if (!features.empty() && features.front()->isDerivedFrom()) { Part::Part2DObject *sketch = (static_cast(features.front()))->getVerifiedSketch(/* silent =*/ true); if (sketch) { FCMD_OBJ_CMD(Feat,"Direction = ("< features) { bool direction = false; - if (!features.empty() && features.front()->isDerivedFrom(PartDesign::ProfileBased::getClassTypeId())) { + if (!features.empty() && features.front()->isDerivedFrom()) { Part::Part2DObject *sketch = (static_cast(features.front()))->getVerifiedSketch(/* silent =*/ true); if (sketch) { FCMD_OBJ_CMD(Feat,"Axis = ("<Label.getValue()))); baseFeature = nullptr; } - else if (baseFeature->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) { + else if (baseFeature->isDerivedFrom()) { // Add sketcher to the body's group property addtogroup = true; } // if a standard Part feature (not a PartDesign feature) is selected then check // the number of solids/shells - else if (!baseFeature->isDerivedFrom(PartDesign::Feature::getClassTypeId())) { + else if (!baseFeature->isDerivedFrom()) { const TopoDS_Shape& shape = static_cast(baseFeature)->Shape.getValue(); if (!shape.IsNull()) { int numSolids = 0; @@ -544,7 +544,7 @@ void CmdPartDesignMoveTip::activated(int iMsg) if ( features.size() == 1 ) { selFeature = features.front(); - if ( selFeature->getTypeId().isDerivedFrom ( PartDesign::Body::getClassTypeId() ) ) { + if ( selFeature->isDerivedFrom() ) { body = static_cast ( selFeature ); } else { body = PartDesignGui::getBodyFor ( selFeature, /* messageIfNot =*/ false ); @@ -918,7 +918,7 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg) std::vector bodyFeatures; std::map orders; for(auto obj : body->Group.getValues()) { - if(obj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) { + if(obj->isDerivedFrom()) { orders.emplace(obj,bodyFeatures.size()); bodyFeatures.push_back(obj); } @@ -928,7 +928,7 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg) for(size_t i=0;igetOutList()) { - if(obj->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + if(obj->isDerivedFrom()) continue; for(auto dep : App::Document::getDependencyList({obj})) { auto it = orders.find(dep); @@ -956,7 +956,7 @@ void CmdPartDesignMoveFeatureInTree::activated(int iMsg) // user if they want the last object to be the new tip. // Only do this for features that can hold a tip (not for e.g. datums) if ( lastObject != target && body->Tip.getValue() == target - && lastObject->isDerivedFrom(PartDesign::Feature::getClassTypeId()) ) { + && lastObject->isDerivedFrom() ) { QMessageBox msgBox(Gui::getMainWindow()); msgBox.setIcon(QMessageBox::Question); msgBox.setWindowTitle(qApp->translate("PartDesign_MoveFeatureInTree", "Move tip")); diff --git a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp index 78cd679cdc..29fd2ee2b9 100644 --- a/src/Mod/PartDesign/Gui/ReferenceSelection.cpp +++ b/src/Mod/PartDesign/Gui/ReferenceSelection.cpp @@ -301,7 +301,7 @@ bool getReferencedSelection(const App::DocumentObject* thisObj, const Gui::Selec //of course only if thisObj is in a body, as otherwise the old workflow would not //be supported PartDesign::Body* body = PartDesignGui::getBodyFor(thisObj, false); - bool originfeature = selObj->isDerivedFrom(App::DatumElement::getClassTypeId()); + bool originfeature = selObj->isDerivedFrom(); if (!originfeature && body) { PartDesign::Body* selBody = PartDesignGui::getBodyFor(selObj, false); if (!selBody || body != selBody) { diff --git a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp index ce406019db..0eb889420f 100644 --- a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp +++ b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp @@ -105,7 +105,7 @@ public: // https://forum.freecad.org/viewtopic.php?f=3&t=37448 if (object == activeBody) { App::DocumentObject* tip = activeBody->Tip.getValue(); - if (tip && tip->isDerivedFrom(Part::Feature::getClassTypeId()) && elements.size() == 1) { + if (tip && tip->isDerivedFrom() && elements.size() == 1) { Gui::SelectionChanges msg; msg.pDocName = faceSelection.getDocName(); msg.pObjectName = tip->getNameInDocument(); diff --git a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp index 504240dac9..99094bd583 100644 --- a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp @@ -61,7 +61,7 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *ViewProvider,QWidget TaskDatumParameters::~TaskDatumParameters() { - if(this->ViewProvider && this->ViewProvider->isDerivedFrom(ViewProviderDatum::getClassTypeId())) + if(this->ViewProvider && this->ViewProvider->isDerivedFrom()) static_cast(this->ViewProvider)->setPickable(true); Gui::Selection().rmvSelectionGate(); } diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp index 022898cfdd..12144e2a23 100644 --- a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp +++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp @@ -137,10 +137,10 @@ TaskFeaturePick::TaskFeaturePick(std::vector& objects, if (*statusIt != invalidShape && datum) { App::Origin* origin = dynamic_cast(datum->getLCS()); if (origin) { - if ((*objIt)->isDerivedFrom(App::Plane::getClassTypeId())) { + if ((*objIt)->isDerivedFrom()) { originVisStatus[origin].setFlag(Gui::DatumElement::Planes, true); } - else if ((*objIt)->isDerivedFrom(App::Line::getClassTypeId())) { + else if ((*objIt)->isDerivedFrom()) { originVisStatus[origin].setFlag(Gui::DatumElement::Axes, true); } } @@ -346,8 +346,8 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe return copy; } if (independent - && (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId()) - || obj->isDerivedFrom(PartDesign::FeaturePrimitive::getClassTypeId()))) { + && (obj->isDerivedFrom() + || obj->isDerivedFrom())) { // we do know that the created instance is a document object, as obj is one. But we do not // know which exact type @@ -387,7 +387,7 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe // we are a independent copy, therefore no external geometry was copied. WE therefore // can delete all constraints - if (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) { + if (obj->isDerivedFrom()) { static_cast(copy)->delConstraintsToExternal(); } } @@ -411,11 +411,11 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe Part::PropertyPartShape* shapeProp = nullptr; // TODO Replace it with commands (2015-09-11, Fat-Zer) - if (obj->isDerivedFrom(Part::Datum::getClassTypeId())) { + if (obj->isDerivedFrom()) { copy = App::GetApplication().getActiveDocument()->addObject(obj->getTypeId().getName(), name.c_str()); - assert(copy->isDerivedFrom(Part::Datum::getClassTypeId())); + assert(copy->isDerivedFrom()); // we need to reference the individual datums and make again datums. This is important // as datum adjust their size dependent on the part size, hence simply copying the shape @@ -451,7 +451,7 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe } } else if (obj->is() - || obj->isDerivedFrom(Part::Feature::getClassTypeId())) { + || obj->isDerivedFrom()) { copy = App::GetApplication().getActiveDocument()->addObject("PartDesign::ShapeBinder", name.c_str()); @@ -463,8 +463,8 @@ TaskFeaturePick::makeCopy(App::DocumentObject* obj, std::string sub, bool indepe shapeProp = &static_cast(copy)->Shape; } } - else if (obj->isDerivedFrom(App::Plane::getClassTypeId()) - || obj->isDerivedFrom(App::Line::getClassTypeId())) { + else if (obj->isDerivedFrom() + || obj->isDerivedFrom()) { copy = App::GetApplication().getActiveDocument()->addObject("PartDesign::ShapeBinder", name.c_str()); diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp index 316abc9fb2..dd563b5c5f 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp @@ -560,10 +560,10 @@ void TaskRevolutionParameters::onAxisChanged(int num) oldSubRefAxis.size() != newSubRefAxis.size() || oldRefName != newRefName) { bool reversed = propReversed->getValue(); - if (pcRevolution->isDerivedFrom(PartDesign::Revolution::getClassTypeId())) { + if (pcRevolution->isDerivedFrom()) { reversed = static_cast(pcRevolution)->suggestReversed(); } - if (pcRevolution->isDerivedFrom(PartDesign::Groove::getClassTypeId())) { + if (pcRevolution->isDerivedFrom()) { reversed = static_cast(pcRevolution)->suggestReversed(); } diff --git a/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp b/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp index a4d072a0af..e0032a22cf 100644 --- a/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp @@ -302,7 +302,7 @@ bool TaskShapeBinder::referenceSelected(const SelectionChanges& msg) const // get selected object auto docObj = vp->getObject()->getDocument()->getObject(msg.pObjectName); - if (docObj && docObj->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (docObj && docObj->isDerivedFrom()) { selectedObj = static_cast(docObj); } diff --git a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp index eb891556db..b21f1a928a 100644 --- a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp @@ -238,7 +238,7 @@ QString TaskSketchBasedParameters::getFaceReference(const QString& obj, const QS QString TaskSketchBasedParameters::make2DLabel(const App::DocumentObject* section, const std::vector& subValues) { - if (section->isDerivedFrom(Part::Part2DObject::getClassTypeId())) { + if (section->isDerivedFrom()) { return QString::fromUtf8(section->Label.getValue()); } else if (subValues.empty()) { diff --git a/src/Mod/PartDesign/Gui/ViewProvider.cpp b/src/Mod/PartDesign/Gui/ViewProvider.cpp index 9da111e119..fe48ac3787 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.cpp +++ b/src/Mod/PartDesign/Gui/ViewProvider.cpp @@ -190,7 +190,7 @@ void ViewProvider::onChanged(const App::Property* prop) { //hide all features in the body other than this object for(App::DocumentObject* obj : body->Group.getValues()) { - if(obj->isDerivedFrom(PartDesign::Feature::getClassTypeId()) && obj != getObject()) { + if(obj->isDerivedFrom() && obj != getObject()) { auto vpd = Base::freecad_dynamic_cast( Gui::Application::Instance->getViewProvider(obj)); if(vpd && vpd->Visibility.getValue()) @@ -324,7 +324,7 @@ ViewProviderBody* ViewProvider::getBodyViewProvider() { auto doc = getDocument(); if(body && doc) { auto vp = doc->getViewProvider(body); - if(vp && vp->isDerivedFrom(ViewProviderBody::getClassTypeId())) + if(vp && vp->isDerivedFrom()) return static_cast(vp); } diff --git a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp index 604095e3a3..6312b84a0e 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp @@ -225,7 +225,7 @@ void ViewProviderBody::updateData(const App::Property* prop) // restore icons for (auto feature : features) { Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(feature); - if (vp && vp->isDerivedFrom(PartDesignGui::ViewProvider::getClassTypeId())) { + if (vp && vp->isDerivedFrom()) { static_cast(vp)->setTipIcon(feature == tip); } } @@ -300,7 +300,7 @@ void ViewProviderBody::unifyVisualProperty(const App::Property* prop) { auto features = body->Group.getValues(); for (auto feature : features) { - if (!feature->isDerivedFrom(PartDesign::Feature::getClassTypeId())) { + if (!feature->isDerivedFrom()) { continue; } @@ -321,7 +321,7 @@ void ViewProviderBody::setVisualBodyMode(bool bodymode) { auto features = body->Group.getValues(); for(auto feature : features) { - if(!feature->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + if(!feature->isDerivedFrom()) continue; auto* vp = static_cast(gdoc->getViewProvider(feature)); @@ -355,15 +355,15 @@ bool ViewProviderBody::canDropObject(App::DocumentObject* obj) const if (obj->isDerivedFrom()) { return true; } - else if (obj->isDerivedFrom(App::DatumElement::getClassTypeId())) { + else if (obj->isDerivedFrom()) { // accept only datums that are not part of a LCS. auto* lcs = static_cast(obj)->getLCS(); return !lcs; } - else if (obj->isDerivedFrom(App::LocalCoordinateSystem::getClassTypeId())) { - return !obj->isDerivedFrom(App::Origin::getClassTypeId()); + else if (obj->isDerivedFrom()) { + return !obj->isDerivedFrom(); } - else if (!obj->isDerivedFrom(Part::Feature::getClassTypeId())) { + else if (!obj->isDerivedFrom()) { return false; } else if (PartDesign::Body::findBodyOf(obj)) { diff --git a/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp b/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp index e4f95da958..9e547b47be 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp @@ -89,7 +89,7 @@ void ViewProviderHelix::unsetEdit(int ModNum) std::vector ViewProviderHelix::claimChildren() const { std::vector temp; App::DocumentObject* sketch = getObject()->Profile.getValue(); - if (sketch && sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (sketch && sketch->isDerivedFrom()) temp.push_back(sketch); return temp; diff --git a/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp index f8954bba11..ae3eeda6be 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp @@ -54,7 +54,7 @@ std::vector ViewProviderLoft::claimChildren()const temp.push_back(sketch); for(App::DocumentObject* obj : pcLoft->Sections.getValues()) { - if (obj && obj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (obj && obj->isDerivedFrom()) temp.push_back(obj); } @@ -118,7 +118,7 @@ void ViewProviderLoft::highlightSection(bool on) // only take the entire shape when we have a sketch selected, but // not a point of the sketch auto subName = it.second.empty() ? "" : it.second.front(); - if (it.first->isDerivedFrom(Part::Part2DObject::getClassTypeId()) && subName.compare(0, 6, "Vertex") != 0) { + if (it.first->isDerivedFrom() && subName.compare(0, 6, "Vertex") != 0) { it.second.clear(); } highlightReferences(dynamic_cast(it.first), it.second, on); diff --git a/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp b/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp index be4f6249ef..b49d60a8df 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp @@ -54,16 +54,16 @@ std::vector ViewProviderPipe::claimChildren()const temp.push_back(sketch); for(App::DocumentObject* obj : pcPipe->Sections.getValues()) { - if (obj && obj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (obj && obj->isDerivedFrom()) temp.push_back(obj); } App::DocumentObject* spine = pcPipe->Spine.getValue(); - if (spine && spine->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (spine && spine->isDerivedFrom()) temp.push_back(spine); App::DocumentObject* auxspine = pcPipe->AuxillerySpine.getValue(); - if (auxspine && auxspine->isDerivedFrom(Part::Part2DObject::getClassTypeId())) + if (auxspine && auxspine->isDerivedFrom()) temp.push_back(auxspine); return temp; diff --git a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp index df71902b73..ceffb62a5a 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp @@ -138,7 +138,7 @@ void ViewProviderShapeBinder::highlightReferences(bool on) App::GeoFeature* obj = nullptr; std::vector subs; - if (getObject()->isDerivedFrom(PartDesign::ShapeBinder::getClassTypeId())) + if (getObject()->isDerivedFrom()) PartDesign::ShapeBinder::getFilteredReferences(&getObject()->Support, obj, subs); else return; diff --git a/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp b/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp index fb3e600684..1f783c5ac6 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp @@ -43,7 +43,7 @@ ViewProviderSketchBased::~ViewProviderSketchBased() = default; std::vector ViewProviderSketchBased::claimChildren() const { std::vector temp; App::DocumentObject* sketch = getObject()->Profile.getValue(); - if (sketch && !sketch->isDerivedFrom(PartDesign::Feature::getClassTypeId())) + if (sketch && !sketch->isDerivedFrom()) temp.push_back(sketch); return temp; diff --git a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp index 0bd7ea5bfe..291747b366 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderTransformed.cpp @@ -81,7 +81,7 @@ Gui::ViewProvider *ViewProviderTransformed::startEditing(int ModNum) { PartDesign::Transformed* pcTransformed = getObject(); if(!pcTransformed->Originals.getSize()) { for(auto obj : pcTransformed->getInList()) { - if(obj->isDerivedFrom(PartDesign::MultiTransform::getClassTypeId())) { + if(obj->isDerivedFrom()) { auto vp = Gui::Application::Instance->getViewProvider(obj); if(vp) return vp->startEditing(ModNum); diff --git a/src/Mod/Points/App/AppPointsPy.cpp b/src/Mod/Points/App/AppPointsPy.cpp index 3f15ed8665..4fd98d8e86 100644 --- a/src/Mod/Points/App/AppPointsPy.cpp +++ b/src/Mod/Points/App/AppPointsPy.cpp @@ -329,13 +329,12 @@ private: } Py::Sequence list(object); - Base::Type pointsId = Base::Type::fromName("Points::Feature"); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { PyObject* item = (*it).ptr(); if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) { App::DocumentObject* obj = static_cast(item)->getDocumentObjectPtr(); - if (obj->getTypeId().isDerivedFrom(pointsId)) { + if (obj->isDerivedFrom()) { // get relative placement Points::Feature* fea = static_cast(obj); Base::Placement globalPlacement = fea->globalPlacement(); diff --git a/src/Mod/ReverseEngineering/Gui/Command.cpp b/src/Mod/ReverseEngineering/Gui/Command.cpp index c6b7fe7c76..08460e6ae8 100644 --- a/src/Mod/ReverseEngineering/Gui/Command.cpp +++ b/src/Mod/ReverseEngineering/Gui/Command.cpp @@ -77,7 +77,7 @@ void CmdApproxCurve::activated(int) { App::DocumentObjectT objT; auto obj = Gui::Selection().getObjectsOfType(App::GeoFeature::getClassTypeId()); - if (obj.size() != 1 || !(obj.at(0)->isDerivedFrom(Points::Feature::getClassTypeId()))) { + if (obj.size() != 1 || !(obj.at(0)->isDerivedFrom())) { QMessageBox::warning(Gui::getMainWindow(), qApp->translate("Reen_ApproxSurface", "Wrong selection"), qApp->translate("Reen_ApproxSurface", "Please select a point cloud.")); @@ -113,8 +113,8 @@ void CmdApproxSurface::activated(int) std::vector obj = Gui::Selection().getObjectsOfType(App::GeoFeature::getClassTypeId()); if (obj.size() != 1 - || !(obj.at(0)->isDerivedFrom(Points::Feature::getClassTypeId()) - || obj.at(0)->isDerivedFrom(Mesh::Feature::getClassTypeId()))) { + || !(obj.at(0)->isDerivedFrom() + || obj.at(0)->isDerivedFrom())) { QMessageBox::warning( Gui::getMainWindow(), qApp->translate("Reen_ApproxSurface", "Wrong selection"), diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index fd4dbbbca4..9b3c703250 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -6841,7 +6841,7 @@ bool SketchObject::convertToNURBS(int GeoId) try { bspline = geo1->toNurbs(geo1->getFirstParameter(), geo1->getLastParameter()); - if (geo1->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId())) { + if (geo1->isDerivedFrom()) { const auto* geoaoc = static_cast(geo1); if (geoaoc->isReversed()) @@ -10394,7 +10394,7 @@ void SketchObject::updateGeometryRefs() { legacyMap[key + Data::oldElementName(sub.c_str())] = i; - if (!obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) { + if (!obj->isDerivedFrom()) { key += Data::newElementName(sub.c_str()); } if (!originalRefs.empty() && originalRefs[i] != key) { @@ -11534,7 +11534,7 @@ Data::IndexedName SketchObject::shapeTypeFromGeoId(int geoId, PointPos posId) co if (posId == PointPos::none) { auto geo = getGeometry(geoId); - if (geo && geo->isDerivedFrom(Part::GeomPoint::getClassTypeId())) { + if (geo && geo->isDerivedFrom()) { posId = PointPos::start; } } diff --git a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp index a5fda2974d..f34f6b038c 100644 --- a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp +++ b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp @@ -49,7 +49,7 @@ bool isAlterGeoActive(Gui::Document* doc) if (doc) { // checks if a Sketch Viewprovider is in Edit if (doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { return true; } } diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 0b5963acd9..74c26fcad2 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -78,7 +78,7 @@ bool isCreateConstraintActive(Gui::Document* doc) if (doc) { // checks if a Sketch View provider is in Edit and is in no special mode if (doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { if (static_cast(doc->getInEdit())->getSketchMode() == ViewProviderSketch::STATUS_NONE) { if (Gui::Selection().countObjectsOfType() @@ -129,7 +129,7 @@ void finishDatumConstraint(Gui::Command* cmd, } if (doc && doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { SketcherGui::ViewProviderSketch* vp = static_cast(doc->getInEdit()); scaleFactor = vp->getScaleFactor(); diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index 50c8202e01..341ac092e6 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -54,7 +54,7 @@ void ActivateBSplineHandler(Gui::Document* doc, DrawSketchHandler* handler) std::unique_ptr ptr(handler); if (doc) { if (doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { SketcherGui::ViewProviderSketch* vp = static_cast(doc->getInEdit()); vp->purgeHandler(); diff --git a/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp b/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp index 0dff58da9d..95e854b732 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp @@ -55,7 +55,7 @@ bool isSketcherVirtualSpaceActive(Gui::Document* doc, bool actsOnSelection) if (doc) { // checks if a Sketch Viewprovider is in Edit and is in no special mode if (doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { if (static_cast(doc->getInEdit())->getSketchMode() == ViewProviderSketch::STATUS_NONE) { if (!actsOnSelection) { @@ -75,7 +75,7 @@ void ActivateVirtualSpaceHandler(Gui::Document* doc, DrawSketchHandler* handler) std::unique_ptr ptr(handler); if (doc) { if (doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { SketcherGui::ViewProviderSketch* vp = static_cast(doc->getInEdit()); vp->purgeHandler(); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index e7743885f8..3c6c65f8f1 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -194,16 +194,14 @@ std::vector CurveConverter::toVector2D(const Part::Geometry* geo { std::vector vector2d; - const auto type = geometry->getTypeId(); - auto emplaceasvector2d = [&vector2d](const Base::Vector3d& point) { vector2d.emplace_back(point.x, point.y); }; - auto isconic = type.isDerivedFrom(Part::GeomConic::getClassTypeId()); - auto isbounded = type.isDerivedFrom(Part::GeomBoundedCurve::getClassTypeId()); + auto isconic = geometry->isDerivedFrom(); + auto isbounded = geometry->isDerivedFrom(); - if (type == Part::GeomLineSegment::getClassTypeId()) { // add a line + if (geometry->is()) { // add a line auto geo = static_cast(geometry); emplaceasvector2d(geo->getStartPoint()); diff --git a/src/Mod/Sketcher/Gui/Utils.cpp b/src/Mod/Sketcher/Gui/Utils.cpp index 8ed9f24d35..91e460eaab 100644 --- a/src/Mod/Sketcher/Gui/Utils.cpp +++ b/src/Mod/Sketcher/Gui/Utils.cpp @@ -182,7 +182,7 @@ bool SketcherGui::ReleaseHandler(Gui::Document* doc) { if (doc) { if (doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { SketcherGui::ViewProviderSketch* vp = static_cast(doc->getInEdit()); @@ -479,7 +479,7 @@ void SketcherGui::ActivateHandler(Gui::Document* doc, std::unique_ptrgetInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { SketcherGui::ViewProviderSketch* vp = static_cast(doc->getInEdit()); vp->purgeHandler(); @@ -522,7 +522,7 @@ bool SketcherGui::isSketcherBSplineActive(Gui::Document* doc, bool actsOnSelecti if (doc) { // checks if a Sketch Viewprovider is in Edit and is in no special mode if (doc->getInEdit() - && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { + && doc->getInEdit()->isDerivedFrom()) { if (static_cast(doc->getInEdit())->getSketchMode() == ViewProviderSketch::STATUS_NONE) { if (!actsOnSelection) { diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 2bb70154b2..b1712bba12 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -2618,7 +2618,7 @@ float ViewProviderSketch::getScaleFactor() const assert(isInEditMode()); Gui::MDIView* mdi = Gui::Application::Instance->editViewOfNode(editCoinManager->getRootEditNode()); - if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (mdi && mdi->isDerivedFrom()) { Gui::View3DInventorViewer* viewer = static_cast(mdi)->getViewer(); SoCamera* camera = viewer->getSoRenderManager()->getCamera(); float scale = camera->getViewVolume(camera->aspectRatio.getValue()) @@ -2825,7 +2825,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationoverl } Gui::MDIView* mdi = this->getActiveView(); - if (mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (mdi && mdi->isDerivedFrom()) { static_cast(mdi)->getViewer()->redraw(); } } @@ -2889,7 +2889,7 @@ void ViewProviderSketch::slotSolverUpdate() + getSketchObject()->getHighestCurveIndex() + 1 == getSolvedSketch().getGeometrySize()) { Gui::MDIView* mdi = Gui::Application::Instance->editDocument()->getActiveView(); - if (mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) + if (mdi->isDerivedFrom()) draw(false, true); signalConstraintsChanged(); @@ -3943,7 +3943,7 @@ std::unique_ptr ViewProviderSketch::getRayPickAction() const assert(isInEditMode()); Gui::MDIView* mdi = Gui::Application::Instance->editViewOfNode(editCoinManager->getRootEditNode()); - if (!(mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId()))) + if (!(mdi && mdi->isDerivedFrom())) return nullptr; Gui::View3DInventorViewer* viewer = static_cast(mdi)->getViewer(); @@ -4027,7 +4027,7 @@ double ViewProviderSketch::getRotation(SbVec3f pos0, SbVec3f pos1) const Gui::MDIView* mdi = Gui::Application::Instance->editViewOfNode(editCoinManager->getRootEditNode()); - if (!(mdi && mdi->isDerivedFrom(Gui::View3DInventor::getClassTypeId()))) + if (!(mdi && mdi->isDerivedFrom())) return 0; Gui::View3DInventorViewer* viewer = static_cast(mdi)->getViewer(); SoCamera* pCam = viewer->getSoRenderManager()->getCamera(); diff --git a/src/Mod/Spreadsheet/App/Cell.cpp b/src/Mod/Spreadsheet/App/Cell.cpp index fb45faca49..a5a1ee2c11 100644 --- a/src/Mod/Spreadsheet/App/Cell.cpp +++ b/src/Mod/Spreadsheet/App/Cell.cpp @@ -1093,11 +1093,11 @@ std::string Cell::getFormattedQuantity() App::CellAddress thisCell = getAddress(); Property* prop = owner->sheet()->getPropertyByName(thisCell.toString().c_str()); - if (prop->isDerivedFrom(App::PropertyString::getClassTypeId())) { + if (prop->isDerivedFrom()) { const App::PropertyString* stringProp = static_cast(prop); qFormatted = QString::fromUtf8(stringProp->getValue()); } - else if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) { + else if (prop->isDerivedFrom()) { double rawVal = static_cast(prop)->getValue(); const App::PropertyQuantity* floatProp = static_cast(prop); DisplayUnit du; @@ -1113,7 +1113,7 @@ std::string Cell::getFormattedQuantity() } } } - else if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId())) { + else if (prop->isDerivedFrom()) { double rawVal = static_cast(prop)->getValue(); DisplayUnit du; bool hasDisplayUnit = getDisplayUnit(du); @@ -1125,7 +1125,7 @@ std::string Cell::getFormattedQuantity() qFormatted = number + QString::fromStdString(" " + displayUnit.stringRep); } } - else if (prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) { + else if (prop->isDerivedFrom()) { double rawVal = static_cast(prop)->getValue(); DisplayUnit du; bool hasDisplayUnit = getDisplayUnit(du); diff --git a/src/Mod/Spreadsheet/App/PropertySheet.cpp b/src/Mod/Spreadsheet/App/PropertySheet.cpp index 73fb0a11fd..221a109788 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.cpp +++ b/src/Mod/Spreadsheet/App/PropertySheet.cpp @@ -1387,7 +1387,7 @@ void PropertySheet::addDependencies(CellAddress key) cellToPropertyNameMap[key].insert(propName); // Also an alias? - if (!name.empty() && docObj->isDerivedFrom(Sheet::getClassTypeId())) { + if (!name.empty() && docObj->isDerivedFrom()) { auto other = static_cast(docObj); auto j = other->cells.revAliasProp.find(name); @@ -2063,7 +2063,7 @@ PropertySheet::BindingType PropertySheet::getBinding(const Range& range, path << ObjectIdentifier::SimpleComponent(range.from().toString().c_str()); path << ObjectIdentifier::SimpleComponent(range.to().toString().c_str()); auto res = owner->getExpression(path); - if (res.expression && res.expression->isDerivedFrom(FunctionExpression::getClassTypeId())) { + if (res.expression && res.expression->isDerivedFrom()) { auto expr = static_cast(res.expression.get()); if (href) { if ((expr->getFunction() != FunctionExpression::HIDDENREF diff --git a/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp b/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp index 02013e2e65..a92b4a07d2 100644 --- a/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp +++ b/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp @@ -72,14 +72,14 @@ DlgBindSheet::DlgBindSheet(Sheet* sheet, const std::vector& ranges, QWidg ui->lineEditFromEnd->setReadOnly(true); ui->checkBoxHREF->setChecked(type == PropertySheet::BindingHiddenRef); assert(pStart && pEnd); - if (!pStart->hasComponent() && pStart->isDerivedFrom(StringExpression::getClassTypeId())) { + if (!pStart->hasComponent() && pStart->isDerivedFrom()) { toStart = static_cast(pStart.get())->getText(); } else { toStart = "="; toStart += pStart->toString(); } - if (!pEnd->hasComponent() && pEnd->isDerivedFrom(StringExpression::getClassTypeId())) { + if (!pEnd->hasComponent() && pEnd->isDerivedFrom()) { toEnd = static_cast(pEnd.get())->getText(); } else { diff --git a/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp b/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp index 3b18db875f..129b5eba0b 100644 --- a/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp +++ b/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp @@ -130,7 +130,7 @@ App::Property* DlgSheetConf::prepare(CellAddress& from, auto prop = path.getProperty(&pseudoType); if (pseudoType || (prop - && (!prop->isDerivedFrom(App::PropertyEnumeration::getClassTypeId()) + && (!prop->isDerivedFrom() || !prop->testStatus(App::Property::PropDynamic)))) { FC_THROWM(Base::RuntimeError, "Invalid property referenced in: " << expr->toString()); } @@ -140,7 +140,7 @@ App::Property* DlgSheetConf::prepare(CellAddress& from, Cell* cell = sheet->getCell(from); if (cell && cell->getExpression()) { auto expr = cell->getExpression(); - if (expr->isDerivedFrom(FunctionExpression::getClassTypeId())) { + if (expr->isDerivedFrom()) { auto fexpr = Base::freecad_dynamic_cast(cell->getExpression()); if (fexpr && (fexpr->getFunction() == FunctionExpression::HREF @@ -184,7 +184,7 @@ void DlgSheetConf::accept() auto cell = sheet->getCell(*r); if (cell && cell->getExpression()) { ExpressionPtr expr(cell->getExpression()->eval()); - if (expr->isDerivedFrom(StringExpression::getClassTypeId())) { + if (expr->isDerivedFrom()) { continue; } } diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.cpp b/src/Mod/Spreadsheet/Gui/SheetModel.cpp index 51e372fe81..9d5aab502e 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetModel.cpp @@ -286,7 +286,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const return {}; } } - else if (prop->isDerivedFrom(App::PropertyString::getClassTypeId())) { + else if (prop->isDerivedFrom()) { /* String */ const App::PropertyString* stringProp = static_cast(prop); @@ -321,7 +321,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const return {}; } } - else if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) { + else if (prop->isDerivedFrom()) { /* Number */ const App::PropertyQuantity* floatProp = static_cast(prop); @@ -386,13 +386,13 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const return {}; } } - else if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId()) - || prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) { + else if (prop->isDerivedFrom() + || prop->isDerivedFrom()) { /* Number */ double d {}; long l {}; bool isInteger = false; - if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId())) { + if (prop->isDerivedFrom()) { d = static_cast(prop)->getValue(); } else { @@ -454,7 +454,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const return {}; } } - else if (prop->isDerivedFrom(App::PropertyPythonObject::getClassTypeId())) { + else if (prop->isDerivedFrom()) { auto pyProp = static_cast(prop); switch (role) { diff --git a/src/Mod/Surface/Gui/TaskFilling.cpp b/src/Mod/Surface/Gui/TaskFilling.cpp index f4fdd254d6..84ec52c057 100644 --- a/src/Mod/Surface/Gui/TaskFilling.cpp +++ b/src/Mod/Surface/Gui/TaskFilling.cpp @@ -212,7 +212,7 @@ public: if (pObj == editedObject) { return false; } - if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (!pObj->isDerivedFrom()) { return false; } diff --git a/src/Mod/Surface/Gui/TaskFillingEdge.cpp b/src/Mod/Surface/Gui/TaskFillingEdge.cpp index fefa88cb3a..d6b0b2cdbe 100644 --- a/src/Mod/Surface/Gui/TaskFillingEdge.cpp +++ b/src/Mod/Surface/Gui/TaskFillingEdge.cpp @@ -73,7 +73,7 @@ public: if (pObj == editedObject) { return false; } - if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (!pObj->isDerivedFrom()) { return false; } diff --git a/src/Mod/Surface/Gui/TaskFillingVertex.cpp b/src/Mod/Surface/Gui/TaskFillingVertex.cpp index 18132ef526..d972a0da48 100644 --- a/src/Mod/Surface/Gui/TaskFillingVertex.cpp +++ b/src/Mod/Surface/Gui/TaskFillingVertex.cpp @@ -65,7 +65,7 @@ public: if (pObj == editedObject) { return false; } - if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (!pObj->isDerivedFrom()) { return false; } diff --git a/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp b/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp index ecbaf1995b..fe5054ce93 100644 --- a/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp +++ b/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp @@ -168,7 +168,7 @@ bool GeomFillSurface::EdgeSelection::allow(App::Document*, if (pObj == editedObject) { return false; } - if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (!pObj->isDerivedFrom()) { return false; } diff --git a/src/Mod/Surface/Gui/TaskSections.cpp b/src/Mod/Surface/Gui/TaskSections.cpp index a7975ad4a5..b2fbf5bfda 100644 --- a/src/Mod/Surface/Gui/TaskSections.cpp +++ b/src/Mod/Surface/Gui/TaskSections.cpp @@ -212,7 +212,7 @@ public: if (pObj == editedObject) { return false; } - if (!pObj->isDerivedFrom(Part::Feature::getClassTypeId())) { + if (!pObj->isDerivedFrom()) { return false; } diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp index 05c3a7f919..ec32ca2b61 100644 --- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp +++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp @@ -553,7 +553,7 @@ private: TopoDS_Shape shape = ShapeUtils::mirrorShape(gObj->getVisHard()); double offX = 0.0; double offY = 0.0; - if (dvp->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { + if (dvp->isDerivedFrom()) { TechDraw::DrawProjGroupItem* dpgi = static_cast(dvp); TechDraw::DrawProjGroup* dpg = dpgi->getPGroup(); if (dpg) { @@ -687,13 +687,13 @@ private: dPage = static_cast(obj); auto views = dPage->getAllViews(); for (auto& view : views) { - if (view->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (view->isDerivedFrom()) { TechDraw::DrawViewPart* dvp = static_cast(view); layerName = dvp->getNameInDocument(); writer.setLayerName(layerName); write1ViewDxf(writer, dvp, true); - } else if (view->isDerivedFrom(TechDraw::DrawViewAnnotation::getClassTypeId())) { + } else if (view->isDerivedFrom()) { TechDraw::DrawViewAnnotation* dva = static_cast(view); layerName = dva->getNameInDocument(); writer.setLayerName(layerName); @@ -703,7 +703,7 @@ private: auto lines = dva->Text.getValues(); writer.exportText(lines[0].c_str(), loc, loc, height, just); - } else if (view->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { + } else if (view->isDerivedFrom()) { DrawViewDimension* dvd = static_cast(view); TechDraw::DrawViewPart* dvp = dvd->getViewPart(); if (!dvp) { @@ -711,7 +711,7 @@ private: } double grandParentX = 0.0; double grandParentY = 0.0; - if (dvp->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { + if (dvp->isDerivedFrom()) { TechDraw::DrawProjGroupItem* dpgi = static_cast(dvp); TechDraw::DrawProjGroup* dpg = dpgi->getPGroup(); if (!dpg) { diff --git a/src/Mod/TechDraw/App/DimensionReferences.cpp b/src/Mod/TechDraw/App/DimensionReferences.cpp index dd350d1a70..a81f1bbc6b 100644 --- a/src/Mod/TechDraw/App/DimensionReferences.cpp +++ b/src/Mod/TechDraw/App/DimensionReferences.cpp @@ -108,7 +108,7 @@ TopoDS_Shape ReferenceEntry::getGeometry() const return {}; } - if ( getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) ) { + if ( getObject()->isDerivedFrom() ) { // 2d geometry from DrawViewPart will be rotated and scaled return getGeometry2d(); } @@ -277,14 +277,14 @@ bool ReferenceEntry::isWholeObject() const bool ReferenceEntry::is3d() const { if (getObject() && - getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) && + getObject()->isDerivedFrom() && !getSubName().empty()) { // this is a well formed 2d reference return false; } if (getObject() && - getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) && + getObject()->isDerivedFrom() && getSubName().empty()) { // this is a broken 3d reference, so it should be treated as 3d return true; @@ -302,7 +302,7 @@ bool ReferenceEntry::hasGeometry() const return false; } - if ( getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) ) { + if ( getObject()->isDerivedFrom() ) { // 2d reference return hasGeometry2d(); } diff --git a/src/Mod/TechDraw/App/DrawLeaderLine.cpp b/src/Mod/TechDraw/App/DrawLeaderLine.cpp index fad7be8e3e..124b5164b2 100644 --- a/src/Mod/TechDraw/App/DrawLeaderLine.cpp +++ b/src/Mod/TechDraw/App/DrawLeaderLine.cpp @@ -321,7 +321,7 @@ DrawLeaderLine* DrawLeaderLine::makeLeader(DrawViewPart* parent, std::vectorgetDocument()->getObject(leaderName.c_str()); - if (!obj || !obj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) { + if (!obj || !obj->isDerivedFrom()) { throw Base::RuntimeError("DrawLeaderLine::makeLeader - new object not found"); } diff --git a/src/Mod/TechDraw/App/DrawPage.cpp b/src/Mod/TechDraw/App/DrawPage.cpp index c6e112b455..2ad8f2c926 100644 --- a/src/Mod/TechDraw/App/DrawPage.cpp +++ b/src/Mod/TechDraw/App/DrawPage.cpp @@ -173,7 +173,7 @@ bool DrawPage::hasValidTemplate() const App::DocumentObject* obj = nullptr; obj = Template.getValue(); - if (obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) { + if (obj && obj->isDerivedFrom()) { TechDraw::DrawTemplate* templ = static_cast(obj); if (templ->getWidth() > 0. && templ->getHeight() > 0.) { return true; @@ -187,7 +187,7 @@ double DrawPage::getPageWidth() const { App::DocumentObject* obj = Template.getValue(); - if (obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) { + if (obj && obj->isDerivedFrom()) { TechDraw::DrawTemplate* templ = static_cast(obj); return templ->getWidth(); } @@ -199,7 +199,7 @@ double DrawPage::getPageHeight() const { App::DocumentObject* obj = Template.getValue(); - if (obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) { + if (obj && obj->isDerivedFrom()) { TechDraw::DrawTemplate* templ = static_cast(obj); return templ->getHeight(); } @@ -213,7 +213,7 @@ const char* DrawPage::getPageOrientation() const App::DocumentObject* obj; obj = Template.getValue(); - if (obj && obj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId())) { + if (obj && obj->isDerivedFrom()) { TechDraw::DrawTemplate* templ = static_cast(obj); return templ->Orientation.getValueAsString(); } @@ -225,7 +225,7 @@ int DrawPage::getOrientation() const { App::DocumentObject* obj = Template.getValue(); - if (obj && obj->isDerivedFrom(DrawTemplate::getClassTypeId())) { + if (obj && obj->isDerivedFrom()) { auto* templ = static_cast(obj); return templ->Orientation.getValue(); } diff --git a/src/Mod/TechDraw/App/DrawPagePyImp.cpp b/src/Mod/TechDraw/App/DrawPagePyImp.cpp index e1d203bc3f..15ef2b8e78 100644 --- a/src/Mod/TechDraw/App/DrawPagePyImp.cpp +++ b/src/Mod/TechDraw/App/DrawPagePyImp.cpp @@ -88,15 +88,15 @@ PyObject* DrawPagePy::getViews(PyObject* args) Py::List ret; for (auto v: allViews) { - if (v->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { + if (v->isDerivedFrom()) { TechDraw::DrawProjGroupItem* dpgi = static_cast(v); ret.append(Py::asObject(new TechDraw::DrawProjGroupItemPy(dpgi))); } - else if (v->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + else if (v->isDerivedFrom()) { TechDraw::DrawViewPart* dvp = static_cast(v); ret.append(Py::asObject(new TechDraw::DrawViewPartPy(dvp))); } - else if (v->isDerivedFrom(TechDraw::DrawViewAnnotation::getClassTypeId())) { + else if (v->isDerivedFrom()) { TechDraw::DrawViewAnnotation* dva = static_cast(v); ret.append(Py::asObject(new TechDraw::DrawViewAnnotationPy(dva))); } @@ -120,15 +120,15 @@ PyObject* DrawPagePy::getAllViews(PyObject* args) Py::List ret; for (auto v: allViews) { - if (v->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { + if (v->isDerivedFrom()) { TechDraw::DrawProjGroupItem* dpgi = static_cast(v); ret.append(Py::asObject(new TechDraw::DrawProjGroupItemPy(dpgi))); } - else if (v->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + else if (v->isDerivedFrom()) { TechDraw::DrawViewPart* dvp = static_cast(v); ret.append(Py::asObject(new TechDraw::DrawViewPartPy(dvp))); } - else if (v->isDerivedFrom(TechDraw::DrawViewAnnotation::getClassTypeId())) { + else if (v->isDerivedFrom()) { TechDraw::DrawViewAnnotation* dva = static_cast(v); ret.append(Py::asObject(new TechDraw::DrawViewAnnotationPy(dva))); } diff --git a/src/Mod/TechDraw/App/DrawProjGroup.cpp b/src/Mod/TechDraw/App/DrawProjGroup.cpp index 7144b17202..67994b22e4 100644 --- a/src/Mod/TechDraw/App/DrawProjGroup.cpp +++ b/src/Mod/TechDraw/App/DrawProjGroup.cpp @@ -441,7 +441,7 @@ bool DrawProjGroup::canDelete(const char* viewProjType) const if (item == this) { continue; } - if (item->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (item->isDerivedFrom()) { return false; } } diff --git a/src/Mod/TechDraw/App/DrawSVGTemplate.cpp b/src/Mod/TechDraw/App/DrawSVGTemplate.cpp index c313641143..898dc68146 100644 --- a/src/Mod/TechDraw/App/DrawSVGTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawSVGTemplate.cpp @@ -103,7 +103,7 @@ void DrawSVGTemplate::onSettingDocument() void DrawSVGTemplate::slotCreatedObject(const App::DocumentObject& obj) { // Base::Console().Message("DSVGT::slotCreatedObject()\n"); - if (!obj.isDerivedFrom(TechDraw::DrawPage::getClassTypeId())) { + if (!obj.isDerivedFrom()) { // we don't care return; } @@ -113,7 +113,7 @@ void DrawSVGTemplate::slotCreatedObject(const App::DocumentObject& obj) void DrawSVGTemplate::slotDeletedObject(const App::DocumentObject& obj) { // Base::Console().Message("DSVGT::slotDeletedObject()\n"); - if (!obj.isDerivedFrom(TechDraw::DrawPage::getClassTypeId())) { + if (!obj.isDerivedFrom()) { // we don't care return; } diff --git a/src/Mod/TechDraw/App/DrawView.cpp b/src/Mod/TechDraw/App/DrawView.cpp index f1fcda1ca6..dcb8140cf9 100644 --- a/src/Mod/TechDraw/App/DrawView.cpp +++ b/src/Mod/TechDraw/App/DrawView.cpp @@ -573,7 +573,7 @@ void DrawView::handleChangedPropertyType(Base::XMLReader &reader, const char * T } } } - else if (prop->isDerivedFrom(App::PropertyLinkList::getClassTypeId()) + else if (prop->isDerivedFrom() && strcmp(prop->getName(), "Source") == 0) { App::PropertyLinkGlobal glink; App::PropertyLink link; diff --git a/src/Mod/TechDraw/App/DrawViewClip.cpp b/src/Mod/TechDraw/App/DrawViewClip.cpp index 56282cb460..027dcc6104 100644 --- a/src/Mod/TechDraw/App/DrawViewClip.cpp +++ b/src/Mod/TechDraw/App/DrawViewClip.cpp @@ -129,11 +129,11 @@ std::vector DrawViewClip::getViews() const std::vector views = Views.getValues(); std::vector allViews; for (auto& v : views) { - if (v->isDerivedFrom(App::Link::getClassTypeId())) { + if (v->isDerivedFrom()) { v = static_cast(v)->getLinkedObject(); } - if (!v->isDerivedFrom(DrawView::getClassTypeId())) { + if (!v->isDerivedFrom()) { continue; } diff --git a/src/Mod/TechDraw/App/DrawViewCollection.cpp b/src/Mod/TechDraw/App/DrawViewCollection.cpp index b2b0cf95f2..c14f8b39ba 100644 --- a/src/Mod/TechDraw/App/DrawViewCollection.cpp +++ b/src/Mod/TechDraw/App/DrawViewCollection.cpp @@ -133,11 +133,11 @@ std::vector DrawViewCollection::getViews() const std::vector views = Views.getValues(); std::vector allViews; for (auto& v : views) { - if (v->isDerivedFrom(App::Link::getClassTypeId())) { + if (v->isDerivedFrom()) { v = static_cast(v)->getLinkedObject(); } - if (!v->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (!v->isDerivedFrom()) { continue; } diff --git a/src/Mod/TechDraw/App/DrawViewDetail.cpp b/src/Mod/TechDraw/App/DrawViewDetail.cpp index 241a01f0b1..6a31f6efd9 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.cpp +++ b/src/Mod/TechDraw/App/DrawViewDetail.cpp @@ -157,7 +157,7 @@ App::DocumentObjectExecReturn* DrawViewDetail::execute() DrawViewPart* dvp = static_cast(baseObj); TopoDS_Shape shape3d = dvp->getShapeForDetail(); DrawViewSection* dvs = nullptr; - if (dvp->isDerivedFrom(TechDraw::DrawViewSection::getClassTypeId())) { + if (dvp->isDerivedFrom()) { dvs = static_cast(dvp); } diff --git a/src/Mod/TechDraw/App/DrawViewDimExtent.cpp b/src/Mod/TechDraw/App/DrawViewDimExtent.cpp index a684054411..c915859bf6 100644 --- a/src/Mod/TechDraw/App/DrawViewDimExtent.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimExtent.cpp @@ -114,7 +114,7 @@ pointPair DrawViewDimExtent::getPointsExtent(ReferenceVector references) // Base::Console().Message("DVD::getPointsExtent() - %s\n", getNameInDocument()); App::DocumentObject* refObject = references.front().getObject(); int direction = DirExtent.getValue(); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (refObject->isDerivedFrom()) { auto dvp = static_cast(refObject); std::vector edgeNames; //empty list means we are using all the edges diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index ce421aab3b..dd98dba830 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -809,7 +809,7 @@ pointPair DrawViewDimension::getPointsOneEdge(ReferenceVector references) { App::DocumentObject* refObject = references.front().getObject(); int iSubelement = DrawUtil::getIndexFromName(references.front().getSubName()); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) + if (refObject->isDerivedFrom() && !references.at(0).getSubName().empty()) { // TODO: Notify if not straight line Edge? // this is a 2d object (a DVP + subelements) @@ -850,7 +850,7 @@ pointPair DrawViewDimension::getPointsTwoEdges(ReferenceVector references) App::DocumentObject* refObject = references.front().getObject(); int iSubelement0 = DrawUtil::getIndexFromName(references.at(0).getSubName()); int iSubelement1 = DrawUtil::getIndexFromName(references.at(1).getSubName()); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) + if (refObject->isDerivedFrom() && !references.at(0).getSubName().empty()) { // this is a 2d object (a DVP + subelements) TechDraw::BaseGeomPtr geom0 = getViewPart()->getGeomByIndex(iSubelement0); @@ -882,7 +882,7 @@ pointPair DrawViewDimension::getPointsTwoVerts(ReferenceVector references) App::DocumentObject* refObject = references.front().getObject(); int iSubelement0 = DrawUtil::getIndexFromName(references.at(0).getSubName()); int iSubelement1 = DrawUtil::getIndexFromName(references.at(1).getSubName()); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) + if (refObject->isDerivedFrom() && !references.at(0).getSubName().empty()) { // this is a 2d object (a DVP + subelements) TechDraw::VertexPtr v0 = getViewPart()->getProjVertexByIndex(iSubelement0); @@ -919,7 +919,7 @@ pointPair DrawViewDimension::getPointsEdgeVert(ReferenceVector references) App::DocumentObject* refObject = references.front().getObject(); int iSubelement0 = DrawUtil::getIndexFromName(references.at(0).getSubName()); int iSubelement1 = DrawUtil::getIndexFromName(references.at(1).getSubName()); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) + if (refObject->isDerivedFrom() && !references.at(0).getSubName().empty()) { // this is a 2d object (a DVP + subelements) TechDraw::BaseGeomPtr edge; @@ -975,7 +975,7 @@ arcPoints DrawViewDimension::getArcParameters(ReferenceVector references) { App::DocumentObject* refObject = references.front().getObject(); int iSubelement = DrawUtil::getIndexFromName(references.front().getSubName()); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) + if (refObject->isDerivedFrom() && !references.at(0).getSubName().empty()) { // this is a 2d object (a DVP + subelements) TechDraw::BaseGeomPtr geom = getViewPart()->getGeomByIndex(iSubelement); @@ -1207,7 +1207,7 @@ anglePoints DrawViewDimension::getAnglePointsTwoEdges(ReferenceVector references App::DocumentObject* refObject = references.front().getObject(); int iSubelement0 = DrawUtil::getIndexFromName(references.at(0).getSubName()); int iSubelement1 = DrawUtil::getIndexFromName(references.at(1).getSubName()); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) + if (refObject->isDerivedFrom() && !references.at(0).getSubName().empty()) { // this is a 2d object (a DVP + subelements) TechDraw::BaseGeomPtr geom0 = getViewPart()->getGeomByIndex(iSubelement0); @@ -1345,7 +1345,7 @@ anglePoints DrawViewDimension::getAnglePointsThreeVerts(ReferenceVector referenc int iSubelement0 = DrawUtil::getIndexFromName(references.at(0).getSubName()); int iSubelement1 = DrawUtil::getIndexFromName(references.at(1).getSubName()); int iSubelement2 = DrawUtil::getIndexFromName(references.at(2).getSubName()); - if (refObject->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) + if (refObject->isDerivedFrom() && !references.at(0).getSubName().empty()) { // this is a 2d object (a DVP + subelements) TechDraw::VertexPtr vert0 = getViewPart()->getProjVertexByIndex(iSubelement0); diff --git a/src/Mod/TechDraw/App/DrawViewSpreadsheet.cpp b/src/Mod/TechDraw/App/DrawViewSpreadsheet.cpp index 98566c2893..6225f95adc 100644 --- a/src/Mod/TechDraw/App/DrawViewSpreadsheet.cpp +++ b/src/Mod/TechDraw/App/DrawViewSpreadsheet.cpp @@ -273,15 +273,15 @@ std::string DrawViewSpreadsheet::getSheetImage() App::Property* prop = sheet->getPropertyByName(address.toString().c_str()); std::stringstream field; if (prop && cell) { - if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) { + if (prop->isDerivedFrom()) { auto contentAsQuantity = static_cast(prop)->getQuantityValue(); field << contentAsQuantity.getUserString(); - } else if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId()) || - prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) { + } else if (prop->isDerivedFrom() || + prop->isDerivedFrom()) { std::string temp = cell->getFormattedQuantity(); DrawUtil::encodeXmlSpecialChars(temp); field << temp; - } else if (prop->isDerivedFrom(App::PropertyString::getClassTypeId())) { + } else if (prop->isDerivedFrom()) { std::string temp = static_cast(prop)->getValue(); DrawUtil::encodeXmlSpecialChars(temp); field << temp; diff --git a/src/Mod/TechDraw/App/ShapeExtractor.cpp b/src/Mod/TechDraw/App/ShapeExtractor.cpp index 24ecc02a22..69ef1a862c 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.cpp +++ b/src/Mod/TechDraw/App/ShapeExtractor.cpp @@ -69,7 +69,7 @@ std::vector ShapeExtractor::getShapes2d(const std::vectorgetTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { + if (l->isDerivedFrom()) { TopoDS_Shape temp = getLocatedShape(l); // checkShape on 2d objs? if (!temp.IsNull()) { @@ -118,7 +118,7 @@ TopoDS_Shape ShapeExtractor::getShapes(const std::vector l } for (auto* inObj : l->getInList()) { - if (inObj->isDerivedFrom(App::Part::getClassTypeId())) { + if (inObj->isDerivedFrom()) { // we replace obj by the assembly obj = inObj; break; diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 3d4bd35ebf..f3e61d6ed5 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -377,9 +377,9 @@ void CmdTechDrawView::activated(int iMsg) continue; } - if (obj->isDerivedFrom(App::LinkElement::getClassTypeId()) - || obj->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || obj->isDerivedFrom(App::Link::getClassTypeId())) { + if (obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom()) { is_linked = true; } // If parent of the obj is a link to another document, we possibly need to treat non-link obj as linked, too @@ -392,9 +392,9 @@ void CmdTechDrawView::activated(int iMsg) continue; } // 2nd, do we really have a link to obj? - if (parent->isDerivedFrom(App::LinkElement::getClassTypeId()) - || parent->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || parent->isDerivedFrom(App::Link::getClassTypeId())) { + if (parent->isDerivedFrom() + || parent->isDerivedFrom() + || parent->isDerivedFrom()) { // We have a link chain from this document to obj, and obj is in another document -> it is an XLink target is_linked = true; } @@ -920,10 +920,10 @@ void execComplexSection(Gui::Command* cmd) for (auto& sel : selection) { bool is_linked = false; auto obj = sel.getObject(); - if (obj->isDerivedFrom(TechDraw::DrawPage::getClassTypeId())) { + if (obj->isDerivedFrom()) { continue; } - if (obj->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (obj->isDerivedFrom()) { //use the dvp's Sources as sources for this ComplexSection & //check the subelement(s) to see if they can be used as a profile baseView = static_cast(obj); @@ -934,9 +934,9 @@ void execComplexSection(Gui::Command* cmd) } continue; } - if (obj->isDerivedFrom(App::LinkElement::getClassTypeId()) - || obj->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || obj->isDerivedFrom(App::Link::getClassTypeId())) { + if (obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom()) { is_linked = true; } // If parent of the obj is a link to another document, we possibly need to treat non-link obj as linked, too @@ -949,9 +949,9 @@ void execComplexSection(Gui::Command* cmd) continue; } // 2nd, do we really have a link to obj? - if (parent->isDerivedFrom(App::LinkElement::getClassTypeId()) - || parent->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || parent->isDerivedFrom(App::Link::getClassTypeId())) { + if (parent->isDerivedFrom() + || parent->isDerivedFrom() + || parent->isDerivedFrom()) { // We have a link chain from this document to obj, and obj is in another document -> it is an XLink target is_linked = true; } @@ -1076,12 +1076,12 @@ void CmdTechDrawProjectionGroup::activated(int iMsg) for (auto& sel : selection) { bool is_linked = false; auto obj = sel.getObject(); - if (obj->isDerivedFrom(TechDraw::DrawPage::getClassTypeId())) { + if (obj->isDerivedFrom()) { continue; } - if (obj->isDerivedFrom(App::LinkElement::getClassTypeId()) - || obj->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || obj->isDerivedFrom(App::Link::getClassTypeId())) { + if (obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom()) { is_linked = true; } // If parent of the obj is a link to another document, we possibly need to treat non-link obj as linked, too @@ -1094,9 +1094,9 @@ void CmdTechDrawProjectionGroup::activated(int iMsg) continue; } // 2nd, do we really have a link to obj? - if (parent->isDerivedFrom(App::LinkElement::getClassTypeId()) - || parent->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || parent->isDerivedFrom(App::Link::getClassTypeId())) { + if (parent->isDerivedFrom() + || parent->isDerivedFrom() + || parent->isDerivedFrom()) { // We have a link chain from this document to obj, and obj is in another document -> it is an XLink target is_linked = true; } @@ -1396,10 +1396,10 @@ void CmdTechDrawClipGroupAdd::activated(int iMsg) TechDraw::DrawView* view = nullptr; std::vector::iterator itSel = selection.begin(); for (; itSel != selection.end(); itSel++) { - if ((*itSel).getObject()->isDerivedFrom(TechDraw::DrawViewClip::getClassTypeId())) { + if ((*itSel).getObject()->isDerivedFrom()) { clip = static_cast((*itSel).getObject()); } - else if ((*itSel).getObject()->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + else if ((*itSel).getObject()->isDerivedFrom()) { view = static_cast((*itSel).getObject()); } } @@ -1625,8 +1625,8 @@ void CmdTechDrawDraftView::activated(int iMsg) std::pair dirs = DrawGuiUtil::get3DDirAndRot(); for (auto* obj : objects) { - if (obj->isDerivedFrom(TechDraw::DrawPage::getClassTypeId()) || - obj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (obj->isDerivedFrom() || + obj->isDerivedFrom()) { // skip over TechDraw objects as they are not valid subjects for a DraftView continue; } @@ -1676,8 +1676,8 @@ void CmdTechDrawArchView::activated(int iMsg) App::DocumentObject* archObject = nullptr; int archCount = 0; for (auto& obj : objects) { - if (obj->isDerivedFrom(TechDraw::DrawPage::getClassTypeId()) || - obj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (obj->isDerivedFrom() || + obj->isDerivedFrom()) { // skip over TechDraw objects as they are not valid subjects for a ArchView continue; } @@ -1864,7 +1864,7 @@ void CmdTechDrawExportPageDXF::activated(int iMsg) std::vector views = page->getViews(); for (auto& v : views) { - if (v->isDerivedFrom(TechDraw::DrawViewArch::getClassTypeId())) { + if (v->isDerivedFrom()) { QMessageBox::StandardButton rc = QMessageBox::question( Gui::getMainWindow(), QObject::tr("Can not export selection"), QObject::tr("Page contains DrawViewArch which will not be exported. Continue?"), @@ -1977,12 +1977,12 @@ void getSelectedShapes(Gui::Command* cmd, for (auto& sel : selection) { bool is_linked = false; auto obj = sel.getObject(); - if (obj->isDerivedFrom(TechDraw::DrawPage::getClassTypeId())) { + if (obj->isDerivedFrom()) { continue; } - if (obj->isDerivedFrom(App::LinkElement::getClassTypeId()) - || obj->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || obj->isDerivedFrom(App::Link::getClassTypeId())) { + if (obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom()) { is_linked = true; } // If parent of the obj is a link to another document, we possibly need to treat non-link obj as linked, too @@ -1995,9 +1995,9 @@ void getSelectedShapes(Gui::Command* cmd, continue; } // 2nd, do we really have a link to obj? - if (parent->isDerivedFrom(App::LinkElement::getClassTypeId()) - || parent->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || parent->isDerivedFrom(App::Link::getClassTypeId())) { + if (parent->isDerivedFrom() + || parent->isDerivedFrom() + || parent->isDerivedFrom()) { // We have a link chain from this document to obj, and obj is in another document -> it is an XLink target is_linked = true; } diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index 52d5f29461..5b0979a37b 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -737,7 +737,7 @@ void execCenterLine(Gui::Command* cmd) std::vector::iterator itSel = selection.begin(); for (; itSel != selection.end(); itSel++) { - if ((*itSel).getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if ((*itSel).getObject()->isDerivedFrom()) { baseFeat = static_cast ((*itSel).getObject()); subNames = (*itSel).getSubNames(); } @@ -924,7 +924,7 @@ void exec2PointCenterLine(Gui::Command* cmd) std::vector::iterator itSel = selection.begin(); for (; itSel != selection.end(); itSel++) { - if ((*itSel).getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if ((*itSel).getObject()->isDerivedFrom()) { baseFeat = static_cast ((*itSel).getObject()); subNames = (*itSel).getSubNames(); } @@ -1030,10 +1030,10 @@ void execLine2Points(Gui::Command* cmd) } for (auto& so: selection) { - if (so.getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (so.getObject()->isDerivedFrom()) { baseFeat = static_cast (so.getObject()); subNames2D = so.getSubNames(); - } else if (so.getObject()->isDerivedFrom(Part::Feature::getClassTypeId())) { + } else if (so.getObject()->isDerivedFrom()) { std::vector subNames3D = so.getSubNames(); for (auto& sub3D: subNames3D) { std::pair temp; @@ -1181,10 +1181,10 @@ void execCosmeticCircle(Gui::Command* cmd) } for (auto& so: selection) { - if (so.getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (so.getObject()->isDerivedFrom()) { baseFeat = static_cast (so.getObject()); subNames2D = so.getSubNames(); - } else if (so.getObject()->isDerivedFrom(Part::Feature::getClassTypeId())) { + } else if (so.getObject()->isDerivedFrom()) { std::vector subNames3D = so.getSubNames(); for (auto& sub3D: subNames3D) { std::pair temp; @@ -1318,7 +1318,7 @@ void CmdTechDrawCosmeticEraser::activated(int iMsg) for (auto& s: selection) { TechDraw::DrawViewPart * objFeat = static_cast (s.getObject()); - if (!objFeat->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (!objFeat->isDerivedFrom()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), QObject::tr("At least 1 object in selection is not a part view")); return; @@ -1329,7 +1329,7 @@ void CmdTechDrawCosmeticEraser::activated(int iMsg) std::vector subNames; std::vector::iterator itSel = selection.begin(); for (; itSel != selection.end(); itSel++) { - if ((*itSel).getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if ((*itSel).getObject()->isDerivedFrom()) { objFeat = static_cast ((*itSel).getObject()); subNames = (*itSel).getSubNames(); } @@ -1446,7 +1446,7 @@ void CmdTechDrawDecorateLine::activated(int iMsg) std::vector::iterator itSel = selection.begin(); for (; itSel != selection.end(); itSel++) { - if ((*itSel).getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if ((*itSel).getObject()->isDerivedFrom()) { baseFeat = static_cast ((*itSel).getObject()); subNames = (*itSel).getSubNames(); } @@ -1639,8 +1639,8 @@ void CmdTechDrawSurfaceFinishSymbols::activated(int iMsg) else { auto objFeat = dynamic_cast(selection.front().getObject()); if ( !objFeat || - !(objFeat->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId()) || - objFeat->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) ) { + !(objFeat->isDerivedFrom() || + objFeat->isDerivedFrom()) ) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("SurfaceFinishSymbols"), QObject::tr("Selected object is not a part view, nor a leader line")); return; diff --git a/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp b/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp index b0f26d5a39..c7202baf28 100644 --- a/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp @@ -136,7 +136,7 @@ void execInsertPrefixChar(Gui::Command* cmd, std::string prefixFormat, const QAc Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Insert Prefix")); for (auto selected : selection) { auto object = selected.getObject(); - if (object->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { + if (object->isDerivedFrom()) { auto dim = static_cast(selected.getObject()); std::string formatSpec = dim->FormatSpec.getStrValue(); formatSpec = prefixText + formatSpec; @@ -257,7 +257,7 @@ void execRemovePrefixChar(Gui::Command* cmd) { for (auto selected : selection) { auto object = selected.getObject(); - if (object->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { + if (object->isDerivedFrom()) { auto dim = static_cast(selected.getObject()); std::string formatSpec = dim->FormatSpec.getStrValue(); int pos = formatSpec.find("%."); @@ -443,7 +443,7 @@ void execIncreaseDecreaseDecimal(Gui::Command* cmd, int delta) { std::string numStr; for (auto selected : selection) { auto object = selected.getObject(); - if (object->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { + if (object->isDerivedFrom()) { auto dim = static_cast(selected.getObject()); std::string formatSpec = dim->FormatSpec.getStrValue(); std::string searchStr("%."); @@ -2349,8 +2349,8 @@ void CmdTechDrawExtensionCustomizeFormat::activated(int iMsg) if (!_checkSelection(this, selected, QT_TRANSLATE_NOOP("QObject","TechDraw Customize Format"))) return; auto object = selected[0].getObject(); - if (object->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId()) || - object->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) + if (object->isDerivedFrom() || + object->isDerivedFrom()) Gui::Control().showDialog(new TaskDlgCustomizeFormat(object)); } @@ -2521,7 +2521,7 @@ namespace TechDrawGui { std::vector validDimension; for (auto selected : selection) { auto object = selected.getObject(); - if (object->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { + if (object->isDerivedFrom()) { auto dim = static_cast(selected.getObject()); std::string dimType = dim->Type.getValueAsString(); if (dimType == needDimType) diff --git a/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp b/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp index 8a85781947..8448ed2054 100644 --- a/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp +++ b/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp @@ -1480,7 +1480,7 @@ void CmdTechDrawExtensionLockUnlockView::activated(int iMsg) return; } Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Lock/Unlock View")); - if (objFeat->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (objFeat->isDerivedFrom()) { bool lockPosition = objFeat->LockPosition.getValue(); lockPosition = !lockPosition; objFeat->LockPosition.setValue(lockPosition); diff --git a/src/Mod/TechDraw/Gui/CommandHelpers.cpp b/src/Mod/TechDraw/Gui/CommandHelpers.cpp index b7a78c9dbc..e054bebf74 100644 --- a/src/Mod/TechDraw/Gui/CommandHelpers.cpp +++ b/src/Mod/TechDraw/Gui/CommandHelpers.cpp @@ -100,7 +100,7 @@ std::vector CommandHelpers::getSelectedSubElements(Gui::Command* cm std::vector selection = cmd->getSelection().getSelectionEx(); std::vector::iterator itSel = selection.begin(); for (; itSel != selection.end(); itSel++) { - if ((*itSel).getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if ((*itSel).getObject()->isDerivedFrom()) { dvp = static_cast ((*itSel).getObject()); subNames = (*itSel).getSubNames(); break; @@ -144,12 +144,12 @@ void CommandHelpers::getSelectedShapes(Gui::Command* cmd, for (auto& sel : selection) { bool is_linked = false; auto obj = sel.getObject(); - if (obj->isDerivedFrom(TechDraw::DrawPage::getClassTypeId())) { + if (obj->isDerivedFrom()) { continue; } - if (obj->isDerivedFrom(App::LinkElement::getClassTypeId()) - || obj->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || obj->isDerivedFrom(App::Link::getClassTypeId())) { + if (obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom()) { is_linked = true; } // If parent of the obj is a link to another document, we possibly need to treat non-link obj as linked, too @@ -162,9 +162,9 @@ void CommandHelpers::getSelectedShapes(Gui::Command* cmd, continue; } // 2nd, do we really have a link to obj? - if (parent->isDerivedFrom(App::LinkElement::getClassTypeId()) - || parent->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || parent->isDerivedFrom(App::Link::getClassTypeId())) { + if (parent->isDerivedFrom() + || parent->isDerivedFrom() + || parent->isDerivedFrom()) { // We have a link chain from this document to obj, and obj is in another document -> it is an XLink target is_linked = true; } diff --git a/src/Mod/TechDraw/Gui/DimensionValidators.cpp b/src/Mod/TechDraw/Gui/DimensionValidators.cpp index f477c2f6c9..8484c7b5ed 100644 --- a/src/Mod/TechDraw/Gui/DimensionValidators.cpp +++ b/src/Mod/TechDraw/Gui/DimensionValidators.cpp @@ -54,10 +54,10 @@ TechDraw::DrawViewPart* TechDraw::getReferencesFromSelection(ReferenceVector& re allowOnlySingle); for (auto& selItem : selectionAll) { - if (selItem.getObject()->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { + if (selItem.getObject()->isDerivedFrom()) { //we are probably repairing a dimension, but we will check later dim = static_cast(selItem.getObject()); //NOLINT cppcoreguidelines-pro-type-static-cast-downcast - } else if (selItem.getObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + } else if (selItem.getObject()->isDerivedFrom()) { //this could be a 2d geometry selection or just a DrawViewPart for context in //a 3d selection dvp = static_cast(selItem.getObject()); //NOLINT cppcoreguidelines-pro-type-static-cast-downcast @@ -75,7 +75,7 @@ TechDraw::DrawViewPart* TechDraw::getReferencesFromSelection(ReferenceVector& re ReferenceEntry ref(dvp, ShapeFinder::getLastTerm(sub)); references2d.push_back(ref); } - } else if (!selItem.getObject()->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + } else if (!selItem.getObject()->isDerivedFrom()) { App::DocumentObject* obj3d = selItem.getObject(); // this is a regular 3d reference in form obj + long subelement for (auto& sub3d : selItem.getSubNames()) { diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 70ede6f53a..4944e89635 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -168,7 +168,7 @@ void MDIViewPage::onDeleteObject(const App::DocumentObject& obj) { //if this page has a QView for this obj, delete it. blockSceneSelection(true); - if (obj.isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (obj.isDerivedFrom()) { (void)m_scene->removeQViewByName(obj.getNameInDocument()); } blockSceneSelection(false); @@ -657,7 +657,7 @@ void MDIViewPage::onSelectionChanged(const Gui::SelectionChanges& msg) std::vector selObjs = Gui::Selection().getSelectionEx(msg.pDocName); for (auto &so : selObjs) { App::DocumentObject *docObj = so.getObject(); - if (docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (docObj->isDerivedFrom()) { selectQGIView(docObj, true, so.getSubNames()); } } @@ -665,7 +665,7 @@ void MDIViewPage::onSelectionChanged(const Gui::SelectionChanges& msg) } else if (msg.Type == Gui::SelectionChanges::AddSelection || msg.Type == Gui::SelectionChanges::RmvSelection) { App::DocumentObject *docObj = msg.Object.getSubObject(); - if (docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (docObj->isDerivedFrom()) { bool isSelected = msg.Type != Gui::SelectionChanges::RmvSelection; selectQGIView(docObj, isSelected, std::vector(1, std::string(msg.pSubName ? msg.pSubName : ""))); } @@ -991,7 +991,7 @@ bool MDIViewPage::compareSelections(std::vector treeSel, std::vector sceneNames; for (auto tn : treeSel) { - if (tn.getObject()->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (tn.getObject()->isDerivedFrom()) { std::string s = tn.getObject()->getNameInDocument(); treeNames.push_back(s); subCount += tn.getSubNames().size(); diff --git a/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp b/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp index 0669fa0120..d374af06c5 100644 --- a/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp +++ b/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp @@ -59,7 +59,7 @@ void QGIDrawingTemplate::clearContents() TechDraw::DrawParametricTemplate * QGIDrawingTemplate::getParametricTemplate() { - if(pageTemplate && pageTemplate->isDerivedFrom(TechDraw::DrawParametricTemplate::getClassTypeId())) + if(pageTemplate && pageTemplate->isDerivedFrom()) return static_cast(pageTemplate); else return nullptr; diff --git a/src/Mod/TechDraw/Gui/QGIEdge.cpp b/src/Mod/TechDraw/Gui/QGIEdge.cpp index 306e3294cc..1e134ed77d 100644 --- a/src/Mod/TechDraw/Gui/QGIEdge.cpp +++ b/src/Mod/TechDraw/Gui/QGIEdge.cpp @@ -125,7 +125,7 @@ void QGIEdge::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) QGIView *parent = dynamic_cast(parentItem()); - if (parent && parent->getViewObject() && parent->getViewObject()->isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { + if (parent && parent->getViewObject() && parent->getViewObject()->isDerivedFrom()) { TechDraw::DrawViewPart *baseFeat = static_cast(parent->getViewObject()); std::vector edgeName(1, DrawUtil::makeGeomName("Edge", getProjIndex())); diff --git a/src/Mod/TechDraw/Gui/QGISVGTemplate.cpp b/src/Mod/TechDraw/Gui/QGISVGTemplate.cpp index 1d801d3242..4a76d1ca2d 100644 --- a/src/Mod/TechDraw/Gui/QGISVGTemplate.cpp +++ b/src/Mod/TechDraw/Gui/QGISVGTemplate.cpp @@ -112,7 +112,7 @@ void QGISVGTemplate::load(const QByteArray& svgCode) TechDraw::DrawSVGTemplate* QGISVGTemplate::getSVGTemplate() { - if (pageTemplate && pageTemplate->isDerivedFrom(TechDraw::DrawSVGTemplate::getClassTypeId())) { + if (pageTemplate && pageTemplate->isDerivedFrom()) { return static_cast(pageTemplate); } else { diff --git a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp index 1502c02151..c8a5fb54f0 100644 --- a/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewBalloon.cpp @@ -617,7 +617,7 @@ void QGIViewBalloon::drawBalloon(bool originDrag) TechDraw::DrawViewBalloon* balloon = dynamic_cast(getViewObject()); if ((!balloon) || - (!balloon->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId()))) { + (!balloon->isDerivedFrom())) { //nothing to draw, don't try return; } diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 15ea440ceb..d11f7a7acd 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -685,7 +685,7 @@ void QGIViewPart::drawAllSectionLines() if (vp->ShowSectionLine.getValue()) { auto refs = viewPart->getSectionRefs(); for (auto& r : refs) { - if (r->isDerivedFrom(DrawComplexSection::getClassTypeId())) { + if (r->isDerivedFrom()) { drawComplexSectionLine(r, true); } else { @@ -1010,7 +1010,7 @@ void QGIViewPart::drawMatting() { auto viewPart(dynamic_cast(getViewObject())); TechDraw::DrawViewDetail* dvd = nullptr; - if (viewPart && viewPart->isDerivedFrom(TechDraw::DrawViewDetail::getClassTypeId())) { + if (viewPart && viewPart->isDerivedFrom()) { dvd = static_cast(viewPart); } else { diff --git a/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp b/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp index aa5c9fccbf..8bfe2c5483 100644 --- a/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewSymbol.cpp @@ -170,8 +170,8 @@ double QGIViewSymbol::legacyScaler(TechDraw::DrawViewSymbol* feature) const // double pxMm = 3.54; //90px/25.4mm ( inkscape value version <= 0.91) //some software uses different px/in, so symbol will need Scale adjusted. //Arch/Draft views are in px and need to be scaled @ rezfactor px/mm to ensure proper representation - if (feature->isDerivedFrom(TechDraw::DrawViewArch::getClassTypeId()) - || feature->isDerivedFrom(TechDraw::DrawViewDraft::getClassTypeId())) { + if (feature->isDerivedFrom() + || feature->isDerivedFrom()) { scaling = scaling * rezfactor; } else { diff --git a/src/Mod/TechDraw/Gui/QGSPage.cpp b/src/Mod/TechDraw/Gui/QGSPage.cpp index c8cc68ea8e..f6f59a0d94 100644 --- a/src/Mod/TechDraw/Gui/QGSPage.cpp +++ b/src/Mod/TechDraw/Gui/QGSPage.cpp @@ -225,7 +225,7 @@ void QGSPage::updateTemplate(bool forceUpdate) if (forceUpdate || (templObj && templObj->isTouched() - && templObj->isDerivedFrom(TechDraw::DrawTemplate::getClassTypeId()))) { + && templObj->isDerivedFrom())) { QGITemplate* qItemTemplate = getTemplate(); @@ -269,10 +269,10 @@ void QGSPage::setPageTemplate(TechDraw::DrawTemplate* templateFeat) // Base::Console().Message("QGSP::setPageTemplate()\n"); removeTemplate(); - if (templateFeat->isDerivedFrom(TechDraw::DrawParametricTemplate::getClassTypeId())) { + if (templateFeat->isDerivedFrom()) { pageTemplate = new QGIDrawingTemplate(this); } - else if (templateFeat->isDerivedFrom(TechDraw::DrawSVGTemplate::getClassTypeId())) { + else if (templateFeat->isDerivedFrom()) { pageTemplate = new QGISVGTemplate(this); } pageTemplate->setTemplate(templateFeat); diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index fb2d85a176..ebad0c7080 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -561,7 +561,7 @@ QColor QGVPage::getBackgroundColor() double QGVPage::getDevicePixelRatio() const { for (Gui::MDIView* view : m_vpPage->getDocument()->getMDIViews()) { - if (view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { + if (view->isDerivedFrom()) { return static_cast(view)->getViewer()->devicePixelRatio(); } } diff --git a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp index 13af2e6a11..1e801cc395 100644 --- a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp +++ b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp @@ -282,9 +282,9 @@ void TaskComplexSection::onSectionObjectsUseSelectionClicked() std::vector newSelection; std::vector newXSelection; for (auto& sel : selection) { - if (sel.getObject()->isDerivedFrom(App::LinkElement::getClassTypeId()) - || sel.getObject()->isDerivedFrom(App::LinkGroup::getClassTypeId()) - || sel.getObject()->isDerivedFrom(App::Link::getClassTypeId())) { + if (sel.getObject()->isDerivedFrom() + || sel.getObject()->isDerivedFrom() + || sel.getObject()->isDerivedFrom()) { newXSelection.push_back(sel.getObject()); } else { diff --git a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp index d864feb4d2..9e3433a3f7 100644 --- a/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp @@ -92,7 +92,7 @@ TaskLeaderLine::TaskLeaderLine(TechDrawGui::ViewProviderLeader* leadVP) : } App::DocumentObject* obj = m_lineFeat->LeaderParent.getValue(); if (obj) { - if (obj->isDerivedFrom(TechDraw::DrawView::getClassTypeId()) ) { + if (obj->isDerivedFrom() ) { m_baseFeat = static_cast(m_lineFeat->LeaderParent.getValue()); } } @@ -364,7 +364,7 @@ void TaskLeaderLine::createLeaderFeature(std::vector sceneDeltas throw Base::RuntimeError("TaskLeaderLine - new markup object not found"); } - if (obj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) { + if (obj->isDerivedFrom()) { m_lineFeat = static_cast(obj); auto forMath{m_attachPoint}; if (baseRotation != 0) { diff --git a/src/Mod/TechDraw/Gui/TaskRichAnno.cpp b/src/Mod/TechDraw/Gui/TaskRichAnno.cpp index c423e9e78b..c580adc939 100644 --- a/src/Mod/TechDraw/Gui/TaskRichAnno.cpp +++ b/src/Mod/TechDraw/Gui/TaskRichAnno.cpp @@ -82,7 +82,7 @@ TaskRichAnno::TaskRichAnno(TechDrawGui::ViewProviderRichAnno* annoVP) : //m_baseFeat can be null App::DocumentObject* obj = m_annoFeat->AnnoParent.getValue(); if (obj) { - if ( obj->isDerivedFrom(TechDraw::DrawView::getClassTypeId()) ) { + if ( obj->isDerivedFrom() ) { m_baseFeat = static_cast(m_annoFeat->AnnoParent.getValue()); } } @@ -300,7 +300,7 @@ void TaskRichAnno::createAnnoFeature() if (!obj) { throw Base::RuntimeError("TaskRichAnno - new RichAnno object not found"); } - if (obj->isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId())) { + if (obj->isDerivedFrom()) { m_annoFeat = static_cast(obj); commonFeatureUpdate(); if (m_baseFeat) { @@ -415,7 +415,7 @@ QPointF TaskRichAnno::calcTextStartPos(double scale) std::vector points; if (m_baseFeat) { - if (m_baseFeat->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) { + if (m_baseFeat->isDerivedFrom()) { TechDraw::DrawLeaderLine* dll = static_cast(m_baseFeat); points = dll->WayPoints.getValues(); } else { diff --git a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp index 4cf17056aa..a554abba31 100644 --- a/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp +++ b/src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp @@ -95,7 +95,7 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) : App::DocumentObject* obj = m_weldFeat->Leader.getValue(); if (!obj || - !obj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId()) ) { + !obj->isDerivedFrom() ) { Base::Console().Error("TaskWeldingSymbol - no leader for welding symbol. Can not proceed.\n"); return; } diff --git a/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp b/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp index eb6b0f2a52..f28da16315 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderDimension.cpp @@ -110,7 +110,7 @@ void ViewProviderDimension::attach(App::DocumentObject *pcFeat) // sPixmap = "TechDraw_Dimension"; setPixmapForType(); - if (getViewObject()->isDerivedFrom(TechDraw::LandmarkDimension::getClassTypeId())) { + if (getViewObject()->isDerivedFrom()) { sPixmap = "TechDraw_LandmarkDimension"; } } diff --git a/src/Mod/TechDraw/Gui/ViewProviderPageExtension.cpp b/src/Mod/TechDraw/Gui/ViewProviderPageExtension.cpp index bc5c7e6ee9..a7110d20e5 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderPageExtension.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderPageExtension.cpp @@ -61,7 +61,7 @@ bool ViewProviderPageExtension::extensionCanDropObjects() const { return true; } bool ViewProviderPageExtension::extensionCanDropObject(App::DocumentObject* obj) const { // Accept links to views as well. - if (obj->isDerivedFrom(App::Link::getClassTypeId())) { + if (obj->isDerivedFrom()) { auto* link = static_cast(obj); obj = link->getLinkedObject(); } @@ -107,14 +107,14 @@ bool ViewProviderPageExtension::extensionCanDropObjectEx(App::DocumentObject* ob void ViewProviderPageExtension::extensionDropObject(App::DocumentObject* obj) { bool linkToView = false; - if (obj->isDerivedFrom(App::Link::getClassTypeId())) { + if (obj->isDerivedFrom()) { auto* link = static_cast(obj); - if (link->getLinkedObject()->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (link->getLinkedObject()->isDerivedFrom()) { linkToView = true; } } - if (obj->isDerivedFrom(TechDraw::DrawView::getClassTypeId()) || linkToView) { + if (obj->isDerivedFrom() || linkToView) { dropObject(obj); return; } diff --git a/src/Mod/TechDraw/Gui/ViewProviderTemplate.cpp b/src/Mod/TechDraw/Gui/ViewProviderTemplate.cpp index 6a1993af60..06cc8e5672 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderTemplate.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderTemplate.cpp @@ -81,7 +81,7 @@ void ViewProviderTemplate::attach(App::DocumentObject* pcFeat) void ViewProviderTemplate::updateData(const App::Property* prop) { //This doesn't belong here. Should be in a ViewProviderSvgTemplate? - if (getTemplate()->isDerivedFrom(TechDraw::DrawSVGTemplate::getClassTypeId())) { + if (getTemplate()->isDerivedFrom()) { auto t = static_cast(getTemplate()); if (prop == &(t->Template)) { auto page = t->getParentPage(); diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewClip.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewClip.cpp index 7147d67c6e..4664410531 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewClip.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewClip.cpp @@ -111,7 +111,7 @@ TechDraw::DrawViewClip* ViewProviderViewClip::getObject() const void ViewProviderViewClip::dragObject(App::DocumentObject* docObj) { - if (!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (!docObj->isDerivedFrom()) { return; } @@ -122,14 +122,14 @@ void ViewProviderViewClip::dragObject(App::DocumentObject* docObj) void ViewProviderViewClip::dropObject(App::DocumentObject* docObj) { - if (docObj->isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) { + if (docObj->isDerivedFrom()) { //DPGI can not be dropped onto the Page if it belongs to DPG auto* dpgi = static_cast(docObj); if (dpgi->getPGroup()) { return; } } - if (!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId())) { + if (!docObj->isDerivedFrom()) { return; } diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp index 715fe006cc..a33c81fb69 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp @@ -169,7 +169,7 @@ ViewProviderViewPart::~ViewProviderViewPart() void ViewProviderViewPart::onChanged(const App::Property* prop) { - if (auto part = getViewPart(); part && part->isDerivedFrom(TechDraw::DrawViewDetail::getClassTypeId()) && + if (auto part = getViewPart(); part && part->isDerivedFrom() && prop == &(HighlightAdjust)) { auto detail = static_cast(getViewPart()); auto baseDvp = dynamic_cast(detail->BaseView.getValue()); From 02c8bfff69e06bfe47af92f650a744d05e6be7b9 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Fri, 17 Jan 2025 00:05:22 +0100 Subject: [PATCH 031/224] Add constraints to templates in BaseClass using static_asserts --- src/Base/BaseClass.h | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/Base/BaseClass.h b/src/Base/BaseClass.h index df658b6513..33d7ced2f2 100644 --- a/src/Base/BaseClass.h +++ b/src/Base/BaseClass.h @@ -156,16 +156,10 @@ public: } template - bool is() const - { - return getTypeId() == T::getClassTypeId(); - } + bool is() const; template - bool isDerivedFrom() const - { - return getTypeId().isDerivedFrom(T::getClassTypeId()); - } + bool isDerivedFrom() const; private: static Type classTypeId; // NOLINT @@ -187,6 +181,20 @@ public: virtual ~BaseClass(); }; +template +bool BaseClass::is() const +{ + static_assert(std::is_base_of::value, "T must be derived from Base::BaseClass"); + return getTypeId() == T::getClassTypeId(); +} + +template +bool BaseClass::isDerivedFrom() const +{ + static_assert(std::is_base_of::value, "T must be derived from Base::BaseClass"); + return getTypeId().isDerivedFrom(T::getClassTypeId()); +} + /** * Template that works just like dynamic_cast, but expects the argument to * inherit from Base::BaseClass. @@ -195,6 +203,8 @@ public: template T* freecad_dynamic_cast(Base::BaseClass* type) { + static_assert(std::is_base_of::value, "T must be derived from Base::BaseClass"); + if (type && type->isDerivedFrom(T::getClassTypeId())) { return static_cast(type); } @@ -210,6 +220,8 @@ T* freecad_dynamic_cast(Base::BaseClass* type) template const T* freecad_dynamic_cast(const Base::BaseClass* type) { + static_assert(std::is_base_of::value, "T must be derived from Base::BaseClass"); + if (type && type->isDerivedFrom(T::getClassTypeId())) { return static_cast(type); } From 97bf3c5e33b2a0bdf93e381288334504095c314a Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Thu, 16 Jan 2025 23:37:04 +0100 Subject: [PATCH 032/224] Manual changes to improve isDerivedFrom usage --- src/Gui/DocumentModel.cpp | 13 ++---- src/Gui/ViewProviderDocumentObject.cpp | 10 ++--- src/Mod/Fem/App/FemPostFilter.cpp | 3 +- src/Mod/Fem/Gui/ViewProviderAnalysis.cpp | 37 ++++++---------- src/Mod/Import/App/SketchExportHelper.cpp | 10 +---- src/Mod/Measure/Gui/TaskMeasure.cpp | 3 +- src/Mod/Part/App/MeasureClient.cpp | 6 +-- src/Mod/Robot/Gui/ViewProviderRobotObject.cpp | 4 +- .../Sketcher/Gui/DrawSketchHandlerSplitting.h | 4 +- src/Mod/Spreadsheet/App/Sheet.cpp | 2 +- src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp | 6 +-- src/Mod/TechDraw/App/ShapeExtractor.cpp | 42 +++++-------------- 12 files changed, 43 insertions(+), 97 deletions(-) diff --git a/src/Gui/DocumentModel.cpp b/src/Gui/DocumentModel.cpp index c8d58d0006..fc04ef65aa 100644 --- a/src/Gui/DocumentModel.cpp +++ b/src/Gui/DocumentModel.cpp @@ -575,15 +575,10 @@ const Document* DocumentModel::getDocument(const QModelIndex& index) const bool DocumentModel::isPropertyLink(const App::Property& prop) const { - if (prop.isDerivedFrom(App::PropertyLink::getClassTypeId())) - return true; - if (prop.isDerivedFrom(App::PropertyLinkSub::getClassTypeId())) - return true; - if (prop.isDerivedFrom(App::PropertyLinkList::getClassTypeId())) - return true; - if (prop.isDerivedFrom(App::PropertyLinkSubList::getClassTypeId())) - return true; - return false; + return prop.isDerivedFrom() + || prop.isDerivedFrom() + || prop.isDerivedFrom() + || prop.isDerivedFrom(); } std::vector diff --git a/src/Gui/ViewProviderDocumentObject.cpp b/src/Gui/ViewProviderDocumentObject.cpp index 3aed6cf9b1..7de7919277 100644 --- a/src/Gui/ViewProviderDocumentObject.cpp +++ b/src/Gui/ViewProviderDocumentObject.cpp @@ -499,12 +499,10 @@ void ViewProviderDocumentObject::setActiveMode() bool ViewProviderDocumentObject::canDelete(App::DocumentObject* obj) const { - Q_UNUSED(obj) - if (getObject()->hasExtension(App::GroupExtension::getExtensionClassTypeId())) - return true; - if (getObject()->isDerivedFrom(App::Origin::getClassTypeId())) - return true; - return false; + Q_UNUSED(obj); + auto* o = getObject(); + return o->hasExtension(App::GroupExtension::getExtensionClassTypeId()) + || o->isDerivedFrom(); } PyObject* ViewProviderDocumentObject::getPyObject() diff --git a/src/Mod/Fem/App/FemPostFilter.cpp b/src/Mod/Fem/App/FemPostFilter.cpp index 6522fcb423..7d0fd60c3b 100644 --- a/src/Mod/Fem/App/FemPostFilter.cpp +++ b/src/Mod/Fem/App/FemPostFilter.cpp @@ -91,8 +91,7 @@ DocumentObjectExecReturn* FemPostFilter::execute() vtkDataObject* FemPostFilter::getInputData() { if (Input.getValue()) { - if (Input.getValue()->getTypeId().isDerivedFrom( - Base::Type::fromName("Fem::FemPostObject"))) { + if (Input.getValue()->isDerivedFrom()) { return Input.getValue()->Data.getValue(); } else { diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp index 0eb707801a..62b1f59d3d 100644 --- a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp +++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp @@ -230,38 +230,25 @@ bool ViewProviderFemAnalysis::canDragObject(App::DocumentObject* obj) const if (!obj) { return false; } - if (obj->isDerivedFrom()) { - return true; - } - else if (obj->isDerivedFrom()) { - return true; - } - else if (obj->isDerivedFrom()) { - return true; - } - else if (obj->isDerivedFrom()) { - return true; - } - else if (obj->isDerivedFrom()) { - return true; - } - else if (obj->getTypeId().isDerivedFrom(Base::Type::fromName("Fem::FeaturePython"))) { - return true; - } - else if (obj->isDerivedFrom()) { - return true; - } - else if (obj->isDerivedFrom()) { + + // clang-format off: keep line breaks for readability + if (obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom() + || obj->isDerivedFrom(Base::Type::fromName("Fem::FeaturePython")) + || obj->isDerivedFrom() + || obj->isDerivedFrom()) { return true; } + // clang-format on #ifdef FC_USE_VTK else if (obj->isDerivedFrom()) { return true; } #endif - else { - return false; - } + return false; } void ViewProviderFemAnalysis::dragObject(App::DocumentObject* obj) diff --git a/src/Mod/Import/App/SketchExportHelper.cpp b/src/Mod/Import/App/SketchExportHelper.cpp index 0a1072a8dc..08f2305b20 100644 --- a/src/Mod/Import/App/SketchExportHelper.cpp +++ b/src/Mod/Import/App/SketchExportHelper.cpp @@ -73,14 +73,8 @@ TopoDS_Shape SketchExportHelper::projectShape(const TopoDS_Shape& inShape, //! true if obj is a sketch bool SketchExportHelper::isSketch(App::DocumentObject* obj) { - // TODO:: the check for an object being a sketch should be done as in the commented - // if statement below. To do this, we need to include Mod/Sketcher/SketchObject.h, - // but that makes Import dependent on Eigen libraries which we don't use. As a - // workaround we will inspect the object's class name. - // if (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) { - std::string objTypeName = obj->getTypeId().getName(); - std::string sketcherToken("Sketcher"); - return objTypeName.find(sketcherToken) != std::string::npos; + // Use name to lookup to avoid dependency on Sketcher module + return obj->isDerivedFrom(Base::Type::fromName("Sketcher::SketchObject")); } diff --git a/src/Mod/Measure/Gui/TaskMeasure.cpp b/src/Mod/Measure/Gui/TaskMeasure.cpp index 56d538367a..9ed4d88ec0 100644 --- a/src/Mod/Measure/Gui/TaskMeasure.cpp +++ b/src/Mod/Measure/Gui/TaskMeasure.cpp @@ -369,8 +369,7 @@ void TaskMeasure::ensureGroup(Measure::MeasureBase* measurement) App::DocumentObject* obj = doc->getObject(measurementGroupName); - if (!obj || !obj->isValid() - || !obj->isDerivedFrom(App::DocumentObjectGroup::getClassTypeId())) { + if (!obj || !obj->isValid() || !obj->isDerivedFrom()) { obj = doc->addObject("App::DocumentObjectGroup", measurementGroupName, true, diff --git a/src/Mod/Part/App/MeasureClient.cpp b/src/Mod/Part/App/MeasureClient.cpp index e6f0479420..9b0a0e8290 100644 --- a/src/Mod/Part/App/MeasureClient.cpp +++ b/src/Mod/Part/App/MeasureClient.cpp @@ -139,10 +139,8 @@ App::MeasureElementType PartMeasureTypeCb(App::DocumentObject* ob, const char* s switch (curve.GetType()) { case GeomAbs_Line: { - if (ob->getTypeId().isDerivedFrom(Base::Type::fromName("Part::Datum"))) { - return App::MeasureElementType::LINE; - } - return App::MeasureElementType::LINESEGMENT; + return ob->isDerivedFrom() ? App::MeasureElementType::LINE + : App::MeasureElementType::LINESEGMENT; } case GeomAbs_Circle: { return App::MeasureElementType::CIRCLE; } case GeomAbs_BezierCurve: diff --git a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp index 1690738ba2..83e914a503 100644 --- a/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp +++ b/src/Mod/Robot/Gui/ViewProviderRobotObject.cpp @@ -376,9 +376,7 @@ void ViewProviderRobotObject::updateData(const App::Property* prop) else if (prop == &robObj->ToolShape) { App::DocumentObject* o = robObj->ToolShape.getValue(); - if (o - && (o->isDerivedFrom(Part::Feature::getClassTypeId()) - || o->isDerivedFrom(App::VRMLObject::getClassTypeId()))) { + if (o && (o->isDerivedFrom() || o->isDerivedFrom())) { // Part::Feature *p = dynamic_cast(o); toolShape = Gui::Application::Instance->getViewProvider(o); toolShape->setTransformation( diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h index 5ad102ec25..604a08ce15 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h @@ -70,7 +70,7 @@ public: if (geom->is() || geom->is() || geom->is() - || geom->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId()) + || geom->isDerivedFrom() || geom->is()) { return true; } @@ -122,7 +122,7 @@ public: if (geom->is() || geom->is() || geom->is() - || geom->isDerivedFrom(Part::GeomArcOfConic::getClassTypeId()) + || geom->isDerivedFrom() || geom->is()) { GeoId = curveGeoId; } diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index cfd800dd36..a9e4edd96a 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -924,7 +924,7 @@ void Sheet::recomputeCell(CellAddress p) cellErrors.insert(p); cellUpdated(p); - if (e.isDerivedFrom(Base::AbortException::getClassTypeId())) { + if (e.isDerivedFrom()) { throw; } } diff --git a/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp b/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp index 129b5eba0b..41f73305c6 100644 --- a/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp +++ b/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp @@ -115,8 +115,7 @@ App::Property* DlgSheetConf::prepare(CellAddress& from, e.ReportException(); FC_THROWM(Base::RuntimeError, "Failed to parse expression for property"); } - if (expr->hasComponent() - || !expr->isDerivedFrom(App::VariableExpression::getClassTypeId())) { + if (expr->hasComponent() || !expr->isDerivedFrom()) { FC_THROWM(Base::RuntimeError, "Invalid property expression: " << expr->toString()); } @@ -196,8 +195,7 @@ void DlgSheetConf::accept() std::string exprTxt(ui->lineEditProp->text().trimmed().toUtf8().constData()); App::ExpressionPtr expr(App::Expression::parse(sheet, exprTxt)); - if (expr->hasComponent() - || !expr->isDerivedFrom(App::VariableExpression::getClassTypeId())) { + if (expr->hasComponent() || !expr->isDerivedFrom()) { FC_THROWM(Base::RuntimeError, "Invalid property expression: " << expr->toString()); } diff --git a/src/Mod/TechDraw/App/ShapeExtractor.cpp b/src/Mod/TechDraw/App/ShapeExtractor.cpp index 69ef1a862c..46247e125d 100644 --- a/src/Mod/TechDraw/App/ShapeExtractor.cpp +++ b/src/Mod/TechDraw/App/ShapeExtractor.cpp @@ -398,31 +398,20 @@ bool ShapeExtractor::is2dObject(const App::DocumentObject* obj) bool ShapeExtractor::isEdgeType(const App::DocumentObject* obj) { Base::Type t = obj->getTypeId(); - if (t.isDerivedFrom(Part::Line::getClassTypeId()) ) { - return true; - } else if (t.isDerivedFrom(Part::Circle::getClassTypeId())) { - return true; - } else if (t.isDerivedFrom(Part::Ellipse::getClassTypeId())) { - return true; - } else if (t.isDerivedFrom(Part::RegularPolygon::getClassTypeId())) { - return true; - } - return false; + return t.isDerivedFrom(Part::Line::getClassTypeId()) + || t.isDerivedFrom(Part::Circle::getClassTypeId()) + || t.isDerivedFrom(Part::Ellipse::getClassTypeId()) + || t.isDerivedFrom(Part::RegularPolygon::getClassTypeId()); } bool ShapeExtractor::isPointType(const App::DocumentObject* obj) { - if (obj) { - Base::Type t = obj->getTypeId(); - if (t.isDerivedFrom(Part::Vertex::getClassTypeId())) { - return true; - } else if (isDraftPoint(obj)) { - return true; - } else if (isDatumPoint(obj)) { - return true; - } + if (!obj) { + return false; } - return false; + return obj->isDerivedFrom() + || isDraftPoint(obj) + || isDatumPoint(obj); } bool ShapeExtractor::isDraftPoint(const App::DocumentObject* obj) @@ -486,17 +475,8 @@ TopoDS_Shape ShapeExtractor::getLocatedShape(const App::DocumentObject* docObj) bool ShapeExtractor::isSketchObject(const App::DocumentObject* obj) { -// TODO:: the check for an object being a sketch should be done as in the commented -// if statement below. To do this, we need to include Mod/Sketcher/SketchObject.h, -// but that makes TechDraw dependent on Eigen libraries which we don't use. As a -// workaround we will inspect the object's class name. -// if (obj->isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) { - std::string objTypeName = obj->getTypeId().getName(); - std::string sketcherToken("Sketcher"); - if (objTypeName.find(sketcherToken) != std::string::npos) { - return true; - } - return false; + // Use name to lookup to avoid dependency on Sketcher module + return obj->isDerivedFrom(Base::Type::fromName("Sketcher::SketchObject")); } From 5410123f0d0bca1d9a13bc9fd6492f70b701c899 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Fri, 17 Jan 2025 18:45:34 +0100 Subject: [PATCH 033/224] Simplify logic using freecad_dynamic_cast --- src/Gui/DemoMode.cpp | 8 +-- .../Drawing/App/FeatureViewSpreadsheet.cpp | 12 ++-- src/Mod/Fem/App/FemPostFilter.cpp | 15 ++--- src/Mod/Spreadsheet/App/Sheet.cpp | 18 ++--- src/Mod/TechDraw/Gui/QGSPage.cpp | 66 +++++++++---------- 5 files changed, 56 insertions(+), 63 deletions(-) diff --git a/src/Gui/DemoMode.cpp b/src/Gui/DemoMode.cpp index 861e1bf86f..e253246b3d 100644 --- a/src/Gui/DemoMode.cpp +++ b/src/Gui/DemoMode.cpp @@ -143,12 +143,8 @@ void DemoMode::hideEvent(QHideEvent*) Gui::View3DInventor* DemoMode::activeView() const { - Document* doc = Application::Instance->activeDocument(); - if (doc) { - MDIView* view = doc->getActiveView(); - if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) { - return static_cast(view); - } + if (Document* doc = Application::Instance->activeDocument()) { + return Base::freecad_dynamic_cast(doc->getActiveView()); } return nullptr; diff --git a/src/Mod/Drawing/App/FeatureViewSpreadsheet.cpp b/src/Mod/Drawing/App/FeatureViewSpreadsheet.cpp index 024bc0889b..bf5b300e76 100644 --- a/src/Mod/Drawing/App/FeatureViewSpreadsheet.cpp +++ b/src/Mod/Drawing/App/FeatureViewSpreadsheet.cpp @@ -186,14 +186,14 @@ App::DocumentObjectExecReturn* FeatureViewSpreadsheet::execute(void) App::Property* prop = sheet->getPropertyByName(address.toString().c_str()); std::stringstream field; if (prop) { - if (prop->isDerivedFrom((App::PropertyQuantity::getClassTypeId()))) { - field << static_cast(prop)->getValue(); + if (auto* p = Base::freecad_dynamic_cast(prop)) { + field << p->getValue(); } - else if (prop->isDerivedFrom((App::PropertyFloat::getClassTypeId()))) { - field << static_cast(prop)->getValue(); + else if (auto p = Base::freecad_dynamic_cast(prop)) { + field << p->getValue(); } - else if (prop->isDerivedFrom((App::PropertyString::getClassTypeId()))) { - field << static_cast(prop)->getValue(); + else if (auto p = Base::freecad_dynamic_cast(prop)) { + field << p->getValue(); } else { assert(0); diff --git a/src/Mod/Fem/App/FemPostFilter.cpp b/src/Mod/Fem/App/FemPostFilter.cpp index 7d0fd60c3b..1bb70fe426 100644 --- a/src/Mod/Fem/App/FemPostFilter.cpp +++ b/src/Mod/Fem/App/FemPostFilter.cpp @@ -468,12 +468,9 @@ void FemPostClipFilter::onChanged(const Property* prop) { if (prop == &Function) { - if (Function.getValue() - && Function.getValue()->isDerivedFrom(FemPostFunction::getClassTypeId())) { - m_clipper->SetClipFunction( - static_cast(Function.getValue())->getImplicitFunction()); - m_extractor->SetImplicitFunction( - static_cast(Function.getValue())->getImplicitFunction()); + if (auto* value = Base::freecad_dynamic_cast(Function.getValue())) { + m_clipper->SetClipFunction(value->getImplicitFunction()); + m_extractor->SetImplicitFunction(value->getImplicitFunction()); } } else if (prop == &InsideOut) { @@ -922,10 +919,8 @@ FemPostCutFilter::~FemPostCutFilter() = default; void FemPostCutFilter::onChanged(const Property* prop) { if (prop == &Function) { - if (Function.getValue() - && Function.getValue()->isDerivedFrom(FemPostFunction::getClassTypeId())) { - m_cutter->SetCutFunction( - static_cast(Function.getValue())->getImplicitFunction()); + if (auto* value = Base::freecad_dynamic_cast(Function.getValue())) { + m_cutter->SetCutFunction(value->getImplicitFunction()); } } diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index a9e4edd96a..2c82a184d8 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -329,17 +329,19 @@ bool Sheet::exportToFile(const std::string& filename, std::stringstream field; - if (prop->isDerivedFrom((PropertyQuantity::getClassTypeId()))) { - field << static_cast(prop)->getValue(); + using Base::freecad_dynamic_cast; + + if (auto p = freecad_dynamic_cast(prop)) { + field << p->getValue(); } - else if (prop->isDerivedFrom((PropertyFloat::getClassTypeId()))) { - field << static_cast(prop)->getValue(); + else if (auto p = freecad_dynamic_cast(prop)) { + field << p->getValue(); } - else if (prop->isDerivedFrom((PropertyInteger::getClassTypeId()))) { - field << static_cast(prop)->getValue(); + else if (auto p = freecad_dynamic_cast(prop)) { + field << p->getValue(); } - else if (prop->isDerivedFrom((PropertyString::getClassTypeId()))) { - field << static_cast(prop)->getValue(); + else if (auto p = freecad_dynamic_cast(prop)) { + field << p->getValue(); } else { assert(0); diff --git a/src/Mod/TechDraw/Gui/QGSPage.cpp b/src/Mod/TechDraw/Gui/QGSPage.cpp index f6f59a0d94..fae504888d 100644 --- a/src/Mod/TechDraw/Gui/QGSPage.cpp +++ b/src/Mod/TechDraw/Gui/QGSPage.cpp @@ -390,57 +390,57 @@ bool QGSPage::addView(const App::DocumentObject* obj) bool QGSPage::attachView(App::DocumentObject* obj) { // Base::Console().Message("QGSP::attachView(%s)\n", obj->getNameInDocument()); - QGIView* existing = findQViewForDocObj(obj); - if (existing) + if (findQViewForDocObj(obj)) { return true; - - auto typeId(obj->getTypeId()); + } QGIView* qview(nullptr); - if (typeId.isDerivedFrom(TechDraw::DrawViewSection::getClassTypeId())) { - qview = addViewSection(static_cast(obj)); + using Base::freecad_dynamic_cast; + + if (auto o = freecad_dynamic_cast(obj)) { + qview = addViewSection(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewPart::getClassTypeId())) { - qview = addViewPart(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addViewPart(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawProjGroup::getClassTypeId())) { - qview = addProjectionGroup(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addProjectionGroup(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) { - qview = addDrawView(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addDrawView(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) { - qview = addViewDimension(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addViewDimension(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId())) { - qview = addViewBalloon(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addViewBalloon(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewAnnotation::getClassTypeId())) { - qview = addAnnotation(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addAnnotation(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewSymbol::getClassTypeId())) { - qview = addDrawViewSymbol(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addDrawViewSymbol(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewClip::getClassTypeId())) { - qview = addDrawViewClip(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addDrawViewClip(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewSpreadsheet::getClassTypeId())) { - qview = addDrawViewSpreadsheet(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addDrawViewSpreadsheet(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawViewImage::getClassTypeId())) { - qview = addDrawViewImage(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addDrawViewImage(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) { - qview = addViewLeader(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addViewLeader(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId())) { - qview = addRichAnno(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addRichAnno(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawWeldSymbol::getClassTypeId())) { - qview = addWeldSymbol(static_cast(obj)); + else if (auto o = freecad_dynamic_cast(obj)) { + qview = addWeldSymbol(o); } - else if (typeId.isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())) { + else if (auto o = freecad_dynamic_cast(obj)) { //Hatch is not attached like other Views (since it isn't really a View) return true; } From 44a1e8de4d9b19bab8cf447e0df34d4e2102ac27 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 17 Jan 2025 19:49:30 -0500 Subject: [PATCH 034/224] [TD]fix front view position in projection group (fix #19085) --- src/Mod/TechDraw/Gui/TaskProjGroup.cpp | 18 ++++++++----- .../TechDraw/Gui/ViewProviderProjGroup.cpp | 25 +++++++++++++++++++ src/Mod/TechDraw/Gui/ViewProviderProjGroup.h | 2 ++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp index e5b8a973be..bdc1c9c06e 100644 --- a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp @@ -59,6 +59,7 @@ #include "ViewProviderPage.h" #include "ViewProviderDrawingView.h" #include "ViewProviderProjGroupItem.h" +#include "ViewProviderProjGroup.h" using namespace Gui; @@ -276,6 +277,7 @@ void TaskProjGroup::viewToggled(bool toggle) else { // If toggle then we remove the view object and create a proj group instead. turnViewToProjGroup(); + changed = true; } } @@ -293,6 +295,10 @@ void TaskProjGroup::viewToggled(bool toggle) } if (changed) { + // necessary to prevent position problems + Gui::Document* activeGui = Gui::Application::Instance->getDocument(m_page->getDocument()); + auto* vppg = static_cast(activeGui->getViewProvider(multiView)); + vppg->regroupSubViews(); if (view->ScaleType.isValue("Automatic")) { double scale = view->getScale(); setFractionalScale(scale); @@ -312,7 +318,6 @@ void TaskProjGroup::turnViewToProjGroup() Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.addView(App.activeDocument().%s)", view->findParentPage()->getNameInDocument(), multiViewName.c_str()); auto* viewPart = static_cast(view); - m_page->removeView(viewPart); multiView = static_cast(doc->getObject(multiViewName.c_str())); multiView->Source.setValues(viewPart->Source.getValues()); @@ -322,23 +327,24 @@ void TaskProjGroup::turnViewToProjGroup() multiView->Scale.setValue(viewPart->Scale.getValue()); multiView->ScaleType.setValue(viewPart->ScaleType.getValue()); multiView->ProjectionType.setValue(Preferences::projectionAngle()); + + multiView->addView(viewPart); + multiView->Anchor.setValue(viewPart); + multiView->Anchor.purgeTouched(); + viewPart->X.setValue(0.0); viewPart->Y.setValue(0.0); viewPart->ScaleType.setValue("Custom"); viewPart->ScaleType.setStatus(App::Property::Hidden, true); viewPart->Scale.setStatus(App::Property::Hidden, true); viewPart->Label.setValue("Front"); - - multiView->addView(viewPart); - multiView->Anchor.setValue(view); - multiView->Anchor.purgeTouched(); - viewPart->LockPosition.setValue(true); viewPart->LockPosition.setStatus(App::Property::ReadOnly, true); //Front should stay locked. viewPart->LockPosition.purgeTouched(); m_page->requestPaint(); view = multiView; + m_page->removeView(viewPart); // prevent multiple entries in tree updateUi(); } diff --git a/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp b/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp index bf94945816..4cba9d6aff 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp @@ -43,6 +43,9 @@ #include #include "TaskProjGroup.h" +#include "QGIViewPart.h" +#include "QGSPage.h" +#include "ViewProviderPage.h" #include "ViewProviderProjGroup.h" using namespace TechDrawGui; @@ -216,3 +219,25 @@ TechDraw::DrawProjGroup* ViewProviderProjGroup::getObject() const { return getViewObject(); } + + +//! gather the (existing) graphics for our sub views into our scene group. +void ViewProviderProjGroup::regroupSubViews() +{ + auto vpPage = getViewProviderPage(); + if (!vpPage) { + return; + } + + auto scene = vpPage->getQGSPage(); + auto dpgQView = getQView(); + + auto viewsAll = getObject()->getViewsAsDPGI(); + for (auto& view : viewsAll) { + auto viewQView = dynamic_cast(scene->findQViewForDocObj(view)); + if (viewQView) { + scene->addItemToParent(viewQView, dpgQView); + } + } +} + diff --git a/src/Mod/TechDraw/Gui/ViewProviderProjGroup.h b/src/Mod/TechDraw/Gui/ViewProviderProjGroup.h index 2495cb1e83..49e837d1be 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderProjGroup.h +++ b/src/Mod/TechDraw/Gui/ViewProviderProjGroup.h @@ -54,6 +54,8 @@ public: bool onDelete(const std::vector &parms) override; bool canDelete(App::DocumentObject* obj) const override; + void regroupSubViews(); + protected: bool setEdit(int ModNum) override; From 65daa70c6b6d72e13554da0dc7689fca03e631e3 Mon Sep 17 00:00:00 2001 From: CandL Date: Mon, 27 Jan 2025 11:41:18 -0500 Subject: [PATCH 035/224] Addition of CAM postprocessor for the Masso controller (#18845) * Mods to accommodate tool order in Gcode. Some controllers want T# M6 others want M6 T#. Masso wants T# M6. Added file refactored_masso_g3_post.py (based on refactored_linuxcnc_post.py) and modified UtilsParse.py * Added tests and additional comments * Working on the testing framework * Tried to make refactored linux and masso as compatable line by line to support fil diffing * A space in the file name caused all sorts of grief ... Thanks Larry * added files to , swapped tool order in testrefactored_masso * Added note regarding how files are "clones" of one another * Added space in comment line for consistent formatting. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Updated formatting and comments --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .../CAMTests/TestRefactoredLinuxCNCPost.py | 8 + .../CAM/CAMTests/TestRefactoredMassoG3Post.py | 294 ++++++++++++++++++ src/Mod/CAM/CMakeLists.txt | 2 + src/Mod/CAM/Path/Post/UtilsParse.py | 22 +- .../Post/scripts/refactored_linuxcnc_post.py | 6 + .../Post/scripts/refactored_masso_g3_post.py | 227 ++++++++++++++ src/Mod/CAM/TestCAMApp.py | 2 + 7 files changed, 559 insertions(+), 2 deletions(-) create mode 100644 src/Mod/CAM/CAMTests/TestRefactoredMassoG3Post.py create mode 100644 src/Mod/CAM/Path/Post/scripts/refactored_masso_g3_post.py diff --git a/src/Mod/CAM/CAMTests/TestRefactoredLinuxCNCPost.py b/src/Mod/CAM/CAMTests/TestRefactoredLinuxCNCPost.py index 15f4e1d22f..93de6879e8 100644 --- a/src/Mod/CAM/CAMTests/TestRefactoredLinuxCNCPost.py +++ b/src/Mod/CAM/CAMTests/TestRefactoredLinuxCNCPost.py @@ -21,6 +21,14 @@ # * * # *************************************************************************** +# *************************************************************************** +# * Note: TestRefactoredMassoG3Post.py is a modified clone of this file * +# * any changes to this file should be applied to the other * +# * * +# * * +# *************************************************************************** + + from importlib import reload import FreeCAD diff --git a/src/Mod/CAM/CAMTests/TestRefactoredMassoG3Post.py b/src/Mod/CAM/CAMTests/TestRefactoredMassoG3Post.py new file mode 100644 index 0000000000..479d781407 --- /dev/null +++ b/src/Mod/CAM/CAMTests/TestRefactoredMassoG3Post.py @@ -0,0 +1,294 @@ +# -*- coding: utf-8 -*- +# *************************************************************************** +# * Copyright (c) 2022 sliptonic * +# * Copyright (c) 2022 Larry Woestman * +# * Copyright (c) 2024 Carl Slater * +# * * +# * 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 * +# * * +# *************************************************************************** + +# *************************************************************************** +# * Note: This file is a modified clone of TestRefactoredLinuxCNCPost.py * +# * any changes to this file should be applied to the other * +# * * +# * * +# *************************************************************************** + +from importlib import reload + +import FreeCAD + +import Path +import CAMTests.PathTestUtils as PathTestUtils +from Path.Post.scripts import refactored_masso_g3_post as postprocessor + + +Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule()) +Path.Log.trackModule(Path.Log.thisModule()) + + +class TestRefactoredMassoG3Post(PathTestUtils.PathTestBase): + @classmethod + def setUpClass(cls): + """setUpClass()... + This method is called upon instantiation of this test class. Add code + and objects here that are needed for the duration of the test() methods + in this class. In other words, set up the 'global' test environment + here; use the `setUp()` method to set up a 'local' test environment. + This method does not have access to the class `self` reference, but it + is able to call static methods within this same class. + """ + + # Open existing FreeCAD document with test geometry + FreeCAD.newDocument("Unnamed") + + @classmethod + def tearDownClass(cls): + """tearDownClass()... + This method is called prior to destruction of this test class. Add + code and objects here that cleanup the test environment after the + test() methods in this class have been executed. This method does not + have access to the class `self` reference. This method + is able to call static methods within this same class. + """ + # Close geometry document without saving + FreeCAD.closeDocument(FreeCAD.ActiveDocument.Name) + + # Setup and tear down methods called before and after each unit test + def setUp(self): + """setUp()... + This method is called prior to each `test()` method. Add code and + objects here that are needed for multiple `test()` methods. + """ + self.doc = FreeCAD.ActiveDocument + self.con = FreeCAD.Console + self.docobj = FreeCAD.ActiveDocument.addObject("Path::Feature", "testpath") + reload( + postprocessor + ) # technical debt. This shouldn't be necessary but here to bypass a bug + + def tearDown(self): + """tearDown()... + This method is called after each test() method. Add cleanup instructions here. + Such cleanup instructions will likely undo those in the setUp() method. + """ + FreeCAD.ActiveDocument.removeObject("testpath") + + def test000(self): + """Test Output Generation. + Empty path. Produces only the preamble and postable. + """ + + self.docobj.Path = Path.Path([]) + postables = [self.docobj] + + # Test generating with header + # Header contains a time stamp that messes up unit testing. + # Only test length of result. + args = "--no-show-editor" + gcode = postprocessor.export(postables, "-", args) + self.assertTrue(len(gcode.splitlines()) == 14) + + # Test without header + expected = """(Begin preamble) +G17 G54 G40 G49 G80 G90 +G21 +(Begin operation: testpath) +(Machine units: mm/min) +(Finish operation: testpath) +(Begin postamble) +M05 +G17 G54 G90 G80 G40 +M2 +""" + + self.docobj.Path = Path.Path([]) + postables = [self.docobj] + + args = "--no-header --no-show-editor" + # args = ("--no-header --no-comments --no-show-editor --precision=2") + gcode = postprocessor.export(postables, "-", args) + self.assertEqual(gcode, expected) + + # test without comments + expected = """G17 G54 G40 G49 G80 G90 +G21 +M05 +G17 G54 G90 G80 G40 +M2 +""" + + args = "--no-header --no-comments --no-show-editor" + # args = ("--no-header --no-comments --no-show-editor --precision=2") + gcode = postprocessor.export(postables, "-", args) + self.assertEqual(gcode, expected) + + def test010(self): + """Test command Generation. + Test Precision + """ + c = Path.Command("G0 X10 Y20 Z30") + + self.docobj.Path = Path.Path([c]) + postables = [self.docobj] + + args = "--no-header --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[5] + expected = "G0 X10.000 Y20.000 Z30.000" + self.assertEqual(result, expected) + + args = "--no-header --precision=2 --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[5] + expected = "G0 X10.00 Y20.00 Z30.00" + self.assertEqual(result, expected) + + def test020(self): + """ + Test Line Numbers + """ + c = Path.Command("G0 X10 Y20 Z30") + + self.docobj.Path = Path.Path([c]) + postables = [self.docobj] + + args = "--no-header --line-numbers --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[5] + expected = "N150 G0 X10.000 Y20.000 Z30.000" + self.assertEqual(result, expected) + + def test030(self): + """ + Test Pre-amble + """ + + self.docobj.Path = Path.Path([]) + postables = [self.docobj] + + args = "--no-header --no-comments --preamble='G18 G55' --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[0] + self.assertEqual(result, "G18 G55") + + def test040(self): + """ + Test Post-amble + """ + self.docobj.Path = Path.Path([]) + postables = [self.docobj] + args = "--no-header --no-comments --postamble='G0 Z50\nM2' --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[-2] + self.assertEqual(result, "G0 Z50") + self.assertEqual(gcode.splitlines()[-1], "M2") + + def test050(self): + """ + Test inches + """ + + c = Path.Command("G0 X10 Y20 Z30") + self.docobj.Path = Path.Path([c]) + postables = [self.docobj] + + args = "--no-header --inches --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + self.assertEqual(gcode.splitlines()[2], "G20") + + result = gcode.splitlines()[5] + expected = "G0 X0.3937 Y0.7874 Z1.1811" + self.assertEqual(result, expected) + + args = "--no-header --inches --precision=2 --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[5] + expected = "G0 X0.39 Y0.79 Z1.18" + self.assertEqual(result, expected) + + def test060(self): + """ + Test test modal + Suppress the command name if the same as previous + """ + c = Path.Command("G0 X10 Y20 Z30") + c1 = Path.Command("G0 X10 Y30 Z30") + + self.docobj.Path = Path.Path([c, c1]) + postables = [self.docobj] + + args = "--no-header --modal --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[6] + expected = "X10.000 Y30.000 Z30.000" + self.assertEqual(result, expected) + + def test070(self): + """ + Test axis modal + Suppress the axis coordinate if the same as previous + """ + c = Path.Command("G0 X10 Y20 Z30") + c1 = Path.Command("G0 X10 Y30 Z30") + + self.docobj.Path = Path.Path([c, c1]) + postables = [self.docobj] + + args = "--no-header --axis-modal --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[6] + expected = "G0 Y30.000" + self.assertEqual(result, expected) + + def test080(self): + """ + Test tool change + """ + c = Path.Command("M6 T2") + c2 = Path.Command("M3 S3000") + self.docobj.Path = Path.Path([c, c2]) + postables = [self.docobj] + + args = "--no-header --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + self.assertEqual(gcode.splitlines()[6], "M5") + self.assertEqual(gcode.splitlines()[7], "T2 M6") + self.assertEqual(gcode.splitlines()[8], "G43 H2") + self.assertEqual(gcode.splitlines()[9], "M3 S3000") + + # suppress TLO + args = "--no-header --no-tlo --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + self.assertEqual(gcode.splitlines()[8], "M3 S3000") + + def test090(self): + """ + Test comment + """ + + c = Path.Command("(comment)") + + self.docobj.Path = Path.Path([c]) + postables = [self.docobj] + + args = "--no-header --no-show-editor" + gcode = postprocessor.export(postables, "-", args) + result = gcode.splitlines()[5] + expected = "(comment)" + self.assertEqual(result, expected) diff --git a/src/Mod/CAM/CMakeLists.txt b/src/Mod/CAM/CMakeLists.txt index 578ca2e551..de03de7190 100644 --- a/src/Mod/CAM/CMakeLists.txt +++ b/src/Mod/CAM/CMakeLists.txt @@ -165,6 +165,7 @@ SET(PathPythonPostScripts_SRCS Path/Post/scripts/refactored_grbl_post.py Path/Post/scripts/refactored_linuxcnc_post.py Path/Post/scripts/refactored_mach3_mach4_post.py + Path/Post/scripts/refactored_masso_g3_post.py Path/Post/scripts/refactored_test_post.py Path/Post/scripts/rml_post.py Path/Post/scripts/rrf_post.py @@ -348,6 +349,7 @@ SET(Tests_SRCS CAMTests/TestRefactoredGrblPost.py CAMTests/TestRefactoredLinuxCNCPost.py CAMTests/TestRefactoredMach3Mach4Post.py + CAMTests/TestRefactoredMassoG3Post.py CAMTests/TestRefactoredTestPost.py CAMTests/TestRefactoredTestPostGCodes.py CAMTests/TestRefactoredTestPostMCodes.py diff --git a/src/Mod/CAM/Path/Post/UtilsParse.py b/src/Mod/CAM/Path/Post/UtilsParse.py index bcd3963e16..404c6e751b 100644 --- a/src/Mod/CAM/Path/Post/UtilsParse.py +++ b/src/Mod/CAM/Path/Post/UtilsParse.py @@ -6,6 +6,7 @@ # * Copyright (c) 2018, 2019 Gauthier Briere * # * Copyright (c) 2019, 2020 Schildkroet * # * Copyright (c) 2022 Larry Woestman * +# * Copyright (c) 2024 Carl Slater * # * * # * This file is part of the FreeCAD CAx development system. * # * * @@ -656,6 +657,11 @@ def parse_a_path(values: Values, gcode: Gcode, pathobj) -> None: parameter: str parameter_value: str + # Check to see if values["TOOL_BEFORE_CHANGE"] is set and value is true + # doing it here to reduce the number of times it is checked + swap_tool_change_order = False + if "TOOL_BEFORE_CHANGE" in values and values["TOOL_BEFORE_CHANGE"]: + swap_tool_change_order = True current_location.update(Path.Command("G0", {"X": -1, "Y": -1, "Z": -1, "F": 0.0}).Parameters) adaptive_op_variables = determine_adaptive_op(values, pathobj) @@ -720,9 +726,21 @@ def parse_a_path(values: Values, gcode: Gcode, pathobj) -> None: command_line = [] if check_for_suppressed_commands(values, gcode, command, command_line): command_line = [] - # Add a line number to the front and a newline to the end of the command line + if command_line: - gcode += f"{linenumber(values)}{format_command_line(values, command_line)}{nl}" + if command in ("M6", "M06") and swap_tool_change_order: + swapped_command_line = [ + command_line[1], + command_line[0], + ] # swap the order of the commands + # Add a line number to the front and a newline to the end of the command line + gcode += ( + f"{linenumber(values)}{format_command_line(values, swapped_command_line)}{nl}" + ) + else: + # Add a line number to the front and a newline to the end of the command line + gcode += f"{linenumber(values)}{format_command_line(values, command_line)}{nl}" + check_for_tlo(values, gcode, command, c.Parameters) check_for_machine_specific_commands(values, gcode, command) diff --git a/src/Mod/CAM/Path/Post/scripts/refactored_linuxcnc_post.py b/src/Mod/CAM/Path/Post/scripts/refactored_linuxcnc_post.py index eb3db475ef..f7d8bb8434 100644 --- a/src/Mod/CAM/Path/Post/scripts/refactored_linuxcnc_post.py +++ b/src/Mod/CAM/Path/Post/scripts/refactored_linuxcnc_post.py @@ -1,6 +1,7 @@ # *************************************************************************** # * Copyright (c) 2014 sliptonic * # * Copyright (c) 2022 Larry Woestman * +# * Copyright (c) 2024 Carl Slater * # * * # * This file is part of the FreeCAD CAx development system. * # * * @@ -22,6 +23,11 @@ # * * # *************************************************************************** +# *************************************************************************** +# * Note: refactored_masso_g3_Post.py is a modified clone of this file * +# * any changes to this file should be applied to the other * +# * * +# *************************************************************************** import argparse diff --git a/src/Mod/CAM/Path/Post/scripts/refactored_masso_g3_post.py b/src/Mod/CAM/Path/Post/scripts/refactored_masso_g3_post.py new file mode 100644 index 0000000000..3ff1bd8e35 --- /dev/null +++ b/src/Mod/CAM/Path/Post/scripts/refactored_masso_g3_post.py @@ -0,0 +1,227 @@ +# *************************************************************************** +# * Copyright (c) 2014 sliptonic * +# * Copyright (c) 2022 Larry Woestman * +# * Copyright (c) 2024 Carl Slater * +# * * +# * 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 * +# * * +# *************************************************************************** + +# *************************************************************************** +# * Note: this is copy & mod of refactored_linuxcnc_post.py * +# * * +# * * +# *************************************************************************** + +import argparse + +from typing import Any, Dict, Union + +import Path.Post.UtilsArguments as PostUtilsArguments +import Path.Post.UtilsExport as PostUtilsExport + +# Define some types that are used throughout this file +Parser = argparse.ArgumentParser +Values = Dict[str, Any] + +# +# The following variables need to be global variables +# to keep the PathPostProcessor.load method happy: +# +# TOOLTIP +# TOOLTIP_ARGS +# UNITS +# +# The "argument_defaults", "arguments_visible", and the "values" hashes +# need to be defined before the "init_shared_arguments" routine can be +# called to create TOOLTIP_ARGS, so they also end up having to be globals. +# +TOOLTIP: str = """This is a postprocessor file for the Path workbench. It is used to +take a pseudo-gcode fragment outputted by a Path object, and output +real GCode suitable for a Masso G3 3 axis mill. This postprocessor, once placed +in the appropriate PathScripts folder, can be used directly from inside +FreeCAD, via the GUI importer or via python scripts with: + +import refactored_masso_g3_post +refactored_masso_g3_post.export(object,"/path/to/file.ncc","") +""" +# +# Default to metric mode +# +UNITS: str = "G21" + + +def init_values(values: Values) -> None: + """Initialize values that are used throughout the postprocessor.""" + # + PostUtilsArguments.init_shared_values(values) + # + # Set any values here that need to override the default values set + # in the init_shared_values routine. + # + values["ENABLE_COOLANT"] = True + # the order of parameters + # Masso G3 doesn't want K properties on XY plane; Arcs need work. + values["PARAMETER_ORDER"] = [ + "X", + "Y", + "Z", + "A", + "B", + "C", + "I", + "J", + "F", + "S", + "T", + "Q", + "R", + "L", + "H", + "D", + "P", + ] + # + # Used in the argparser code as the "name" of the postprocessor program. + # This would normally show up in the usage message in the TOOLTIP_ARGS, + # but we are suppressing the usage message, so it doesn't show up after all. + # + values["MACHINE_NAME"] = "Masso G3" + # + # Any commands in this value will be output as the last commands + # in the G-code file. + # + values[ + "POSTAMBLE" + ] = """M05 +G17 G54 G90 G80 G40 +M2""" + values["POSTPROCESSOR_FILE_NAME"] = __name__ + # + # Any commands in this value will be output after the header and + # safety block at the beginning of the G-code file. + # + values["PREAMBLE"] = """G17 G54 G40 G49 G80 G90""" + + # + # setting TOOL_BEFORE_CHANGE to True will output T# M6 before each tool change + # rather than M6 T#. + # + values["TOOL_BEFORE_CHANGE"] = type(True) + values["UNITS"] = UNITS + + +def init_argument_defaults(argument_defaults: Dict[str, bool]) -> None: + """Initialize which arguments (in a pair) are shown as the default argument.""" + PostUtilsArguments.init_argument_defaults(argument_defaults) + # + # Modify which argument to show as the default in flag-type arguments here. + # If the value is True, the first argument will be shown as the default. + # If the value is False, the second argument will be shown as the default. + # + # For example, if you want to show Metric mode as the default, use: + # argument_defaults["metric_inch"] = True + # + # If you want to show that "Don't pop up editor for writing output" is + # the default, use: + # argument_defaults["show-editor"] = False. + # + # Note: You also need to modify the corresponding entries in the "values" hash + # to actually make the default value(s) change to match. + # + + +def init_arguments_visible(arguments_visible: Dict[str, bool]) -> None: + """Initialize which argument pairs are visible in TOOLTIP_ARGS.""" + PostUtilsArguments.init_arguments_visible(arguments_visible) + # + # Modify the visibility of any arguments from the defaults here. + # + + +def init_arguments( + values: Values, + argument_defaults: Dict[str, bool], + arguments_visible: Dict[str, bool], +) -> Parser: + """Initialize the shared argument definitions.""" + parser: Parser = PostUtilsArguments.init_shared_arguments( + values, argument_defaults, arguments_visible + ) + # + # Add any argument definitions that are not shared with all other + # postprocessors here. + # + return parser + + +# +# Creating global variables and using functions to modify them +# is useful for being able to test things later. +# +global_values: Values = {} +init_values(global_values) +global_argument_defaults: Dict[str, bool] = {} +init_argument_defaults(global_argument_defaults) +global_arguments_visible: Dict[str, bool] = {} +init_arguments_visible(global_arguments_visible) +global_parser: Parser = init_arguments( + global_values, global_argument_defaults, global_arguments_visible +) +# +# The TOOLTIP_ARGS value is created from the help information about the arguments. +# +TOOLTIP_ARGS: str = global_parser.format_help() +# +# Create another parser just to get a list of all possible arguments +# that may be output using --output_all_arguments. +# +global_all_arguments_visible: Dict[str, bool] = {} +for k in iter(global_arguments_visible): + global_all_arguments_visible[k] = True +global_all_visible: Parser = init_arguments( + global_values, global_argument_defaults, global_all_arguments_visible +) + + +def export(objectslist, filename: str, argstring: str) -> str: + """Postprocess the objects in objectslist to filename.""" + args: Union[str, argparse.Namespace] + flag: bool + + global UNITS # pylint: disable=global-statement + + # print(parser.format_help()) + + (flag, args) = PostUtilsArguments.process_shared_arguments( + global_values, global_parser, argstring, global_all_visible, filename + ) + if not flag: + return args # type: ignore + # + # Process any additional arguments here + # + + # + # Update the global variables that might have been modified + # while processing the arguments. + # + UNITS = global_values["UNITS"] + + return PostUtilsExport.export_common(global_values, objectslist, filename) diff --git a/src/Mod/CAM/TestCAMApp.py b/src/Mod/CAM/TestCAMApp.py index 7b7ed471e7..80554918d9 100644 --- a/src/Mod/CAM/TestCAMApp.py +++ b/src/Mod/CAM/TestCAMApp.py @@ -75,6 +75,7 @@ from CAMTests.TestMach3Mach4Post import TestMach3Mach4Post from CAMTests.TestRefactoredCentroidPost import TestRefactoredCentroidPost from CAMTests.TestRefactoredGrblPost import TestRefactoredGrblPost from CAMTests.TestRefactoredLinuxCNCPost import TestRefactoredLinuxCNCPost +from CAMTests.TestRefactoredMassoG3Post import TestRefactoredMassoG3Post from CAMTests.TestRefactoredMach3Mach4Post import TestRefactoredMach3Mach4Post from CAMTests.TestRefactoredTestPost import TestRefactoredTestPost from CAMTests.TestRefactoredTestPostGCodes import TestRefactoredTestPostGCodes @@ -130,6 +131,7 @@ False if TestMach3Mach4Post.__name__ else True False if TestRefactoredCentroidPost.__name__ else True False if TestRefactoredGrblPost.__name__ else True False if TestRefactoredLinuxCNCPost.__name__ else True +False if TestRefactoredMassoG3Post.__name__ else True False if TestRefactoredMach3Mach4Post.__name__ else True False if TestRefactoredTestPost.__name__ else True False if TestRefactoredTestPostGCodes.__name__ else True From 4d3fc9a700b8ea1942ae6988a372c82467b4b141 Mon Sep 17 00:00:00 2001 From: Shai Seger Date: Mon, 27 Jan 2025 18:41:49 +0200 Subject: [PATCH 036/224] [CAM Simulator] Add ifdef to fix OpenGL compatibility on linux. issue #18707 (#18746) * Add ifdef to fix compilation on linux. issue #18707 * remove multisample line altogether --- src/Mod/CAM/PathSimulator/AppGL/DlgCAMSimulator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Mod/CAM/PathSimulator/AppGL/DlgCAMSimulator.cpp b/src/Mod/CAM/PathSimulator/AppGL/DlgCAMSimulator.cpp index 74a5af01e0..0ffa463d67 100644 --- a/src/Mod/CAM/PathSimulator/AppGL/DlgCAMSimulator.cpp +++ b/src/Mod/CAM/PathSimulator/AppGL/DlgCAMSimulator.cpp @@ -231,7 +231,6 @@ void DlgCAMSimulator::initialize() const qreal retinaScale = devicePixelRatio(); glViewport(0, 0, width() * retinaScale, height() * retinaScale); - glEnable(GL_MULTISAMPLE); } void DlgCAMSimulator::checkInitialization() From 187635aa430331ea2360b98dceb9fa2428673c06 Mon Sep 17 00:00:00 2001 From: Dan Taylor Date: Sat, 14 Dec 2024 16:50:44 -0600 Subject: [PATCH 037/224] Make adaptive toolpaths use actual stock outline instead of bounding box --- src/Mod/CAM/Path/Op/Adaptive.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Mod/CAM/Path/Op/Adaptive.py b/src/Mod/CAM/Path/Op/Adaptive.py index ade9b250ba..dc40299eda 100644 --- a/src/Mod/CAM/Path/Op/Adaptive.py +++ b/src/Mod/CAM/Path/Op/Adaptive.py @@ -42,7 +42,7 @@ __doc__ = "Class and implementation of the Adaptive CAM operation." from lazy_loader.lazy_loader import LazyLoader Part = LazyLoader("Part", globals(), "Part") -# TechDraw = LazyLoader('TechDraw', globals(), 'TechDraw') +TechDraw = LazyLoader("TechDraw", globals(), "TechDraw") FeatureExtensions = LazyLoader("Path.Op.FeatureExtension", globals(), "Path.Op.FeatureExtension") DraftGeomUtils = LazyLoader("DraftGeomUtils", globals(), "DraftGeomUtils") @@ -649,19 +649,10 @@ def Execute(op, obj): path2d = convertTo2d(pathArray) - stockPaths = [] - if hasattr(op.stock, "StockType") and op.stock.StockType == "CreateCylinder": - stockPaths.append([discretize(op.stock.Shape.Edges[0])]) - - else: - stockBB = op.stock.Shape.BoundBox - v = [] - v.append(FreeCAD.Vector(stockBB.XMin, stockBB.YMin, 0)) - v.append(FreeCAD.Vector(stockBB.XMax, stockBB.YMin, 0)) - v.append(FreeCAD.Vector(stockBB.XMax, stockBB.YMax, 0)) - v.append(FreeCAD.Vector(stockBB.XMin, stockBB.YMax, 0)) - v.append(FreeCAD.Vector(stockBB.XMin, stockBB.YMin, 0)) - stockPaths.append([v]) + # Use the 2D outline of the stock as the stock + # FIXME: This does not account for holes in the middle of stock! + outer_wire = TechDraw.findShapeOutline(op.stock.Shape, 1, FreeCAD.Vector(0, 0, 1)) + stockPaths = [[discretize(outer_wire)]] stockPath2d = convertTo2d(stockPaths) From 3a24e87492ab05554c7bf520ad85cb06ffafc9aa Mon Sep 17 00:00:00 2001 From: dzid26 Date: Mon, 20 Jan 2025 11:36:50 +0000 Subject: [PATCH 038/224] Gui: show tooltips when window is not focused --- src/Gui/MainWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 18ae3e4455..2376fb69d7 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1766,6 +1766,8 @@ void MainWindow::loadWindowSettings() statusBar()->setVisible(showStatusBar); + setAttribute(Qt::WA_AlwaysShowToolTips); + ToolBarManager::getInstance()->restoreState(); std::clog << "Toolbars restored" << std::endl; From 90ed7ea7939510e210a6ff284be9d2b855862cd5 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Sun, 5 Jan 2025 17:46:23 -0300 Subject: [PATCH 039/224] App: Set PropertyMap using Python objects with mapping protocol --- src/App/PropertyStandard.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index 96e3984005..148c846708 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -1970,17 +1970,14 @@ PyObject* PropertyMap::getPyObject() void PropertyMap::setPyObject(PyObject* value) { - if (PyDict_Check(value)) { - + if (PyMapping_Check(value)) { std::map values; // get key and item list - PyObject* keyList = PyDict_Keys(value); - - PyObject* itemList = PyDict_Values(value); + PyObject* keyList = PyMapping_Keys(value); + PyObject* itemList = PyMapping_Values(value); Py_ssize_t nSize = PyList_Size(keyList); for (Py_ssize_t i = 0; i < nSize; ++i) { - // check on the key: std::string keyStr; PyObject* key = PyList_GetItem(keyList, i); @@ -1988,7 +1985,7 @@ void PropertyMap::setPyObject(PyObject* value) keyStr = PyUnicode_AsUTF8(key); } else { - std::string error("type of the key need to be unicode or string, not"); + std::string error("type of the key need to be string, not "); error += key->ob_type->tp_name; throw Base::TypeError(error); } @@ -1999,16 +1996,19 @@ void PropertyMap::setPyObject(PyObject* value) values[keyStr] = PyUnicode_AsUTF8(item); } else { - std::string error("type in list must be string or unicode, not "); + std::string error("type in values must be string, not "); error += item->ob_type->tp_name; throw Base::TypeError(error); } } + Py_XDECREF(itemList); + Py_XDECREF(keyList); + setValues(values); } else { - std::string error("type must be a dict object"); + std::string error("type must be a dict or object with mapping protocol, not "); error += value->ob_type->tp_name; throw Base::TypeError(error); } From 864fcf996ad137c34df96bf632ab74248d220492 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Sun, 5 Jan 2025 17:51:12 -0300 Subject: [PATCH 040/224] Material: Add mapping and sequence protocols to MaterialPy object --- src/Mod/Material/App/MaterialPy.xml | 16 +++++++++++++ src/Mod/Material/App/MaterialPyImp.cpp | 32 ++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/Mod/Material/App/MaterialPy.xml b/src/Mod/Material/App/MaterialPy.xml index edd21c5890..e6998690f1 100644 --- a/src/Mod/Material/App/MaterialPy.xml +++ b/src/Mod/Material/App/MaterialPy.xml @@ -210,5 +210,21 @@ Set the value associated with the property + + + Property keys + + + + + Property values + + + + diff --git a/src/Mod/Material/App/MaterialPyImp.cpp b/src/Mod/Material/App/MaterialPyImp.cpp index 3e4c72c079..f650df64a5 100644 --- a/src/Mod/Material/App/MaterialPyImp.cpp +++ b/src/Mod/Material/App/MaterialPyImp.cpp @@ -553,3 +553,35 @@ PyObject* MaterialPy::setAppearanceValue(PyObject* args) Py_INCREF(Py_None); return Py_None; } + +PyObject* MaterialPy::keys() +{ + return Py::new_reference_to(this->getProperties().keys()); +} + +PyObject* MaterialPy::values() +{ + return Py::new_reference_to(this->getProperties().values()); +} + +Py_ssize_t MaterialPy::sequence_length(PyObject *self) +{ + return static_cast(self)->getProperties().size(); +} + +PyObject* MaterialPy::sequence_item(PyObject* self, Py_ssize_t item) +{ + Py::List keys = static_cast(self)->getProperties().keys(); + return Py::new_reference_to(keys.getItem(item)); +} + +int MaterialPy::sequence_contains(PyObject* self, PyObject* key) +{ + return PyDict_Contains(static_cast(self)->getProperties().ptr(), key); +} + +PyObject* MaterialPy::mapping_subscript(PyObject* self, PyObject* key) +{ + Py::Dict dict = static_cast(self)->getProperties(); + return Py::new_reference_to(dict.getItem(Py::Object(key))); +} From 91a95369f21786568e9b71a989e181386c882888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20B=C3=A4hr?= Date: Sun, 5 Jan 2025 13:53:37 +0100 Subject: [PATCH 041/224] Main: Avoid Popups in Console Mode When in console mode, some messages from CLI interaction still resulted in popup dialogs, e.g. the response from `--help` or `--version`. This is becasue those information are communicated via exceptions and those exceptions prevented the console mode from being properly set. By using a scope guard the console mode flag is now evaluated in all cases. The code to display those messages got refactored into dedicated methods which now also take care of console mode. --- src/App/Application.cpp | 18 ++++++++++----- src/App/PreCompiled.h | 1 + src/Main/MainGui.cpp | 51 ++++++++++++++++++++++++++--------------- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 967bf5bcb2..1120475074 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -35,6 +35,7 @@ # endif # include # include +# include # include # include #endif @@ -2420,11 +2421,6 @@ void processProgramOptions(const variables_map& vm, std::map Mods = vm["module-path"].as< vector >(); string temp; @@ -2599,7 +2595,17 @@ void Application::initConfig(int argc, char ** argv) } variables_map vm; - parseProgramOptions(argc, argv, mConfig["ExeName"], vm); + { + BOOST_SCOPE_EXIT_ALL(&) { + // console-mode needs to be set (if possible) also in case parseProgramOptions + // throws, as it's needed when reporting such exceptions + if (vm.count("console")) { + mConfig["Console"] = "1"; + mConfig["RunMode"] = "Cmd"; + } + }; + parseProgramOptions(argc, argv, mConfig["ExeName"], vm); + } if (vm.count("keep-deprecated-paths")) { mConfig["KeepDeprecatedPaths"] = "1"; diff --git a/src/App/PreCompiled.h b/src/App/PreCompiled.h index 57cafc2a35..66ec6e5a34 100644 --- a/src/App/PreCompiled.h +++ b/src/App/PreCompiled.h @@ -100,6 +100,7 @@ #include #include #include +#include #endif //_PreComp_ diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index be25becbef..80e0c5e8a2 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -95,6 +95,35 @@ private: FILE* file; }; +static void DisplayInfo(const QString& msg, bool preformatted = true) +{ + if (App::Application::Config()["Console"] == "1") { + std::cout << msg.toStdString(); + return; + } + + QString appName = QString::fromStdString(App::Application::Config()["ExeName"]); + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Information); + msgBox.setWindowTitle(appName); + msgBox.setDetailedText(msg); + msgBox.setText(preformatted ? QStringLiteral("
%1
").arg(msg) : msg); + msgBox.exec(); +} + +static void DisplayCritical(const QString& msg, bool preformatted = true) +{ + if (App::Application::Config()["Console"] == "1") { + std::cerr << msg.toStdString(); + return; + } + + QString appName = QString::fromStdString(App::Application::Config()["ExeName"]); + QString title = QObject::tr("Initialization of %1 failed").arg(appName); + QString text = preformatted ? QStringLiteral("
%1
").arg(msg) : msg; + QMessageBox::critical(nullptr, title, text); +} + int main(int argc, char** argv) { #if defined(FC_OS_LINUX) || defined(FC_OS_BSD) @@ -217,24 +246,14 @@ int main(int argc, char** argv) } catch (const Base::UnknownProgramOption& e) { QApplication app(argc, argv); - QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); QString msg = QString::fromLatin1(e.what()); - QString s = QLatin1String("
") + msg + QLatin1String("
"); - QMessageBox::critical(nullptr, appName, s); + DisplayCritical(msg); exit(1); } catch (const Base::ProgramInformation& e) { QApplication app(argc, argv); - QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); QString msg = QString::fromUtf8(e.what()); - QString s = QLatin1String("
") + msg + QLatin1String("
"); - - QMessageBox msgBox; - msgBox.setIcon(QMessageBox::Information); - msgBox.setWindowTitle(appName); - msgBox.setDetailedText(msg); - msgBox.setText(s); - msgBox.exec(); + DisplayInfo(msg); exit(0); } catch (const Base::Exception& e) { @@ -261,9 +280,7 @@ int main(int argc, char** argv) "\nPlease contact the application's support team for more information.\n\n"); } - QMessageBox::critical(nullptr, - QObject::tr("Initialization of %1 failed").arg(appName), - msg); + DisplayCritical(msg, false); exit(100); } catch (...) { @@ -274,9 +291,7 @@ int main(int argc, char** argv) QObject::tr("Unknown runtime error occurred while initializing %1.\n\n" "Please contact the application's support team for more information.\n\n") .arg(appName); - QMessageBox::critical(nullptr, - QObject::tr("Initialization of %1 failed").arg(appName), - msg); + DisplayCritical(msg, false); exit(101); } From f9616e93e7dea107d03425b5b885819e79040df3 Mon Sep 17 00:00:00 2001 From: MisterMaker Date: Mon, 27 Jan 2025 17:49:20 +0100 Subject: [PATCH 042/224] [stylesheets] Gathering of stylesheet fixes (#18929) * this is a workaround to remove caps pelase ignore this hackery * And now the caps are gone * a bunch of small tweaks and fixes. * Update FreeCAD Light.qss updated menubar color light theme * updated the buttons a tiny bit * Fix for to short buttons. Couldn't test it since my macro window is broken. Co-Authored-By: Syres916 <46537884+Syres916@users.noreply.github.com> * qspinbox disabled tweaks. * Update FreeCAD Dark.qss Tweaked the buttons a bit so they are more in line with the light theme. * Update FreeCAD Dark.qss small tweaks * reversed the spreadsheet headers gradient for dark * Update light with undo arrows position Co-Authored-By: Syres916 <46537884+Syres916@users.noreply.github.com> * Update undo buttons arrow position dark Co-Authored-By: Syres916 <46537884+Syres916@users.noreply.github.com> * added an offset to qcombobox * removed the fix since it ruined every Qcombobox. * Tabs update more clean less gradients. * Update DlgMacroExecuteImp.cpp fixing conflicts * Update DlgMacroExecuteImp.cpp * Delete DlgMacroExecuteImp.cpp * Create DlgMacroExecuteImp.cpp * Revert "Create DlgMacroExecuteImp.cpp" This reverts commit 8de8f7506177d773bb356fd0e22a66466c25b668. * Revert "Delete DlgMacroExecuteImp.cpp" This reverts commit 41315f31abdad79afd4b696ee15c603de3e4a6a1. * Revert "Update DlgMacroExecuteImp.cpp" This reverts commit aa792291684e2d674f6961c641c8e2f8b9af12c8. * Revert "Update DlgMacroExecuteImp.cpp" This reverts commit e8376a8fdf11d7fd014f2c46f189afdca42833ce. * Delete src/Gui/DlgMacroExecuteImp.cpp * Update DlgMacroExecuteImp.cpp finally realized what was going on lol --------- Co-authored-by: Syres916 <46537884+Syres916@users.noreply.github.com> --- src/Gui/Dialogs/DlgMacroExecuteImp.cpp | 1 + .../FreeCAD Light/FreeCAD Light.cfg | 2 +- src/Gui/Stylesheets/FreeCAD Dark.qss | 344 +++++++++++------- src/Gui/Stylesheets/FreeCAD Light.qss | 339 ++++++++++------- ...k.png => arrow-double-leftright-black.png} | Bin ...ue.png => arrow-double-leftright-blue.png} | Bin ...ng => arrow-double-leftright-darkgray.png} | Bin ...g => arrow-double-leftright-lightgray.png} | Bin ...e.png => arrow-double-leftright-white.png} | Bin ...lack.png => arrow-double-updown-black.png} | Bin ...-blue.png => arrow-double-updown-blue.png} | Bin ...y.png => arrow-double-updown-darkgray.png} | Bin ....png => arrow-double-updown-lightgray.png} | Bin ...hite.png => arrow-double-updown-white.png} | Bin ...ow-down-black.png => arrow-down-black.png} | Bin ...rrow-down-blue.png => arrow-down-blue.png} | Bin ...n-darkgray.png => arrow-down-darkgray.png} | Bin ...lightgray.png => arrow-down-lightgray.png} | Bin ...ow-down-white.png => arrow-down-white.png} | Bin ...ow-left-black.png => arrow-left-black.png} | Bin ...rrow-left-blue.png => arrow-left-blue.png} | Bin ...t-darkgray.png => arrow-left-darkgray.png} | Bin ...lightgray.png => arrow-left-lightgray.png} | Bin ...ow-left-white.png => arrow-left-white.png} | Bin ...own-black.png => arrow-leftdown-black.png} | Bin ...tDown-blue.png => arrow-leftdown-blue.png} | Bin ...rkgray.png => arrow-leftdown-darkgray.png} | Bin ...tgray.png => arrow-leftdown-lightgray.png} | Bin ...own-white.png => arrow-leftdown-white.png} | Bin ...-right-black.png => arrow-right-black.png} | Bin ...ow-right-blue.png => arrow-right-blue.png} | Bin ...-darkgray.png => arrow-right-darkgray.png} | Bin ...ightgray.png => arrow-right-lightgray.png} | Bin ...-right-white.png => arrow-right-white.png} | Bin ...wn-black.png => arrow-rightdown-black.png} | Bin ...Down-blue.png => arrow-rightdown-blue.png} | Bin ...kgray.png => arrow-rightdown-darkgray.png} | Bin ...gray.png => arrow-rightdown-lightgray.png} | Bin ...wn-white.png => arrow-rightdown-white.png} | Bin ...{Arrow-up-black.png => arrow-up-black.png} | Bin .../{Arrow-up-blue.png => arrow-up-blue.png} | Bin ...-up-darkgray.png => arrow-up-darkgray.png} | Bin ...p-lightgray.png => arrow-up-lightgray.png} | Bin ...{Arrow-up-white.png => arrow-up-white.png} | Bin ...pty-black.png => checkbox-empty-black.png} | Bin ...Empty-blue.png => checkbox-empty-blue.png} | Bin ...rkgray.png => checkbox-empty-darkgray.png} | Bin ...tgray.png => checkbox-empty-lightgray.png} | Bin ...pty-white.png => checkbox-empty-white.png} | Bin .../{Close-DarkRed.png => close-darkred.png} | Bin ...lose-lightgray.png => close-lightgray.png} | Bin ...olbar-black.png => hmovetoolbar-black.png} | Bin ...toolbar-blue.png => hmovetoolbar-blue.png} | Bin ...darkgray.png => hmovetoolbar-darkgray.png} | Bin ...ghtgray.png => hmovetoolbar-lightgray.png} | Bin ...olbar-white.png => hmovetoolbar-white.png} | Bin ...lbar-black.png => hsepartoolbar-black.png} | Bin ...oolbar-blue.png => hsepartoolbar-blue.png} | Bin ...arkgray.png => hsepartoolbar-darkgray.png} | Bin ...htgray.png => hsepartoolbar-lightgray.png} | Bin ...lbar-white.png => hsepartoolbar-white.png} | Bin ..._black.png => qsint_header_fold_black.png} | Bin ...ue.png => qsint_header_fold_blue-blue.png} | Bin ...rk.png => qsint_header_fold_blue-dark.png} | Bin ...t.png => qsint_header_fold_blue-light.png} | Bin ...ray.png => qsint_header_fold_darkgray.png} | Bin ...ay.png => qsint_header_fold_lightgray.png} | Bin ..._white.png => qsint_header_fold_white.png} | Bin ...ng => qsint_header_foldover_blue-blue.png} | Bin ...ng => qsint_header_foldover_blue-dark.png} | Bin ...g => qsint_header_foldover_blue-light.png} | Bin ...lack.png => qsint_header_unfold_black.png} | Bin ....png => qsint_header_unfold_blue-blue.png} | Bin ....png => qsint_header_unfold_blue-dark.png} | Bin ...png => qsint_header_unfold_blue-light.png} | Bin ...y.png => qsint_header_unfold_darkgray.png} | Bin ....png => qsint_header_unfold_lightgray.png} | Bin ...hite.png => qsint_header_unfold_white.png} | Bin ... => qsint_header_unfoldover_blue-blue.png} | Bin ... => qsint_header_unfoldover_blue-dark.png} | Bin ...=> qsint_header_unfoldover_blue-light.png} | Bin ...cked-black.png => radio-checked-black.png} | Bin ...hecked-blue.png => radio-checked-blue.png} | Bin ...arkgray.png => radio-checked-darkgray.png} | Bin ...htgray.png => radio-checked-lightgray.png} | Bin ...cked-white.png => radio-checked-white.png} | Bin ...ed-black.png => radio-unchecked-black.png} | Bin ...cked-blue.png => radio-unchecked-blue.png} | Bin ...kgray.png => radio-unchecked-darkgray.png} | Bin ...gray.png => radio-unchecked-lightgray.png} | Bin ...ed-white.png => radio-unchecked-white.png} | Bin ...olbar-black.png => vmovetoolbar-black.png} | Bin ...toolbar-blue.png => vmovetoolbar-blue.png} | Bin ...darkgray.png => vmovetoolbar-darkgray.png} | Bin ...ghtgray.png => vmovetoolbar-lightgray.png} | Bin ...olbar-white.png => vmovetoolbar-white.png} | Bin ...lbar-black.png => vsepartoolbar-black.png} | Bin ...oolbar-blue.png => vsepartoolbar-blue.png} | Bin ...arkgray.png => vsepartoolbar-darkgray.png} | Bin ...htgray.png => vsepartoolbar-lightgray.png} | Bin ...lbar-white.png => vsepartoolbar-white.png} | Bin 101 files changed, 429 insertions(+), 257 deletions(-) rename src/Gui/Stylesheets/images_classic/{Arrow-double-LeftRight-black.png => arrow-double-leftright-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-LeftRight-blue.png => arrow-double-leftright-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-LeftRight-darkgray.png => arrow-double-leftright-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-LeftRight-lightgray.png => arrow-double-leftright-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-LeftRight-white.png => arrow-double-leftright-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-UpDown-black.png => arrow-double-updown-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-UpDown-blue.png => arrow-double-updown-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-UpDown-darkgray.png => arrow-double-updown-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-UpDown-lightgray.png => arrow-double-updown-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-double-UpDown-white.png => arrow-double-updown-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-down-black.png => arrow-down-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-down-blue.png => arrow-down-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-down-darkgray.png => arrow-down-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-down-lightgray.png => arrow-down-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-down-white.png => arrow-down-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-left-black.png => arrow-left-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-left-blue.png => arrow-left-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-left-darkgray.png => arrow-left-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-left-lightgray.png => arrow-left-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-left-white.png => arrow-left-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-leftDown-black.png => arrow-leftdown-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-leftDown-blue.png => arrow-leftdown-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-leftDown-darkgray.png => arrow-leftdown-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-leftDown-lightgray.png => arrow-leftdown-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-leftDown-white.png => arrow-leftdown-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-right-black.png => arrow-right-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-right-blue.png => arrow-right-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-right-darkgray.png => arrow-right-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-right-lightgray.png => arrow-right-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-right-white.png => arrow-right-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-rightDown-black.png => arrow-rightdown-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-rightDown-blue.png => arrow-rightdown-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-rightDown-darkgray.png => arrow-rightdown-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-rightDown-lightgray.png => arrow-rightdown-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-rightDown-white.png => arrow-rightdown-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-up-black.png => arrow-up-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-up-blue.png => arrow-up-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-up-darkgray.png => arrow-up-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-up-lightgray.png => arrow-up-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Arrow-up-white.png => arrow-up-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{checkbox-Empty-black.png => checkbox-empty-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{checkbox-Empty-blue.png => checkbox-empty-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{checkbox-Empty-darkgray.png => checkbox-empty-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{checkbox-Empty-lightgray.png => checkbox-empty-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{checkbox-Empty-white.png => checkbox-empty-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Close-DarkRed.png => close-darkred.png} (100%) rename src/Gui/Stylesheets/images_classic/{Close-lightgray.png => close-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hmovetoolbar-black.png => hmovetoolbar-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hmovetoolbar-blue.png => hmovetoolbar-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hmovetoolbar-darkgray.png => hmovetoolbar-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hmovetoolbar-lightgray.png => hmovetoolbar-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hmovetoolbar-white.png => hmovetoolbar-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hsepartoolbar-black.png => hsepartoolbar-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hsepartoolbar-blue.png => hsepartoolbar-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hsepartoolbar-darkgray.png => hsepartoolbar-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hsepartoolbar-lightgray.png => hsepartoolbar-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Hsepartoolbar-white.png => hsepartoolbar-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_fold_black.png => qsint_header_fold_black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_Fold_Blue-Blue.png => qsint_header_fold_blue-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_Fold_Blue-dark.png => qsint_header_fold_blue-dark.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_Fold_Blue-light.png => qsint_header_fold_blue-light.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_fold_darkgray.png => qsint_header_fold_darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_fold_lightgray.png => qsint_header_fold_lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_fold_white.png => qsint_header_fold_white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_FoldOver_Blue-Blue.png => qsint_header_foldover_blue-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_FoldOver_Blue-dark.png => qsint_header_foldover_blue-dark.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_FoldOver_Blue-light.png => qsint_header_foldover_blue-light.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_unfold_black.png => qsint_header_unfold_black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_Unfold_Blue-Blue.png => qsint_header_unfold_blue-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_Unfold_Blue-dark.png => qsint_header_unfold_blue-dark.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_Unfold_Blue-light.png => qsint_header_unfold_blue-light.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_unfold_darkgray.png => qsint_header_unfold_darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_unfold_lightgray.png => qsint_header_unfold_lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_unfold_white.png => qsint_header_unfold_white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_UnFoldOver_Blue-Blue.png => qsint_header_unfoldover_blue-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_UnfoldOver_Blue-dark.png => qsint_header_unfoldover_blue-dark.png} (100%) rename src/Gui/Stylesheets/images_classic/{Qsint_header_UnfoldOver_Blue-light.png => qsint_header_unfoldover_blue-light.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-checked-black.png => radio-checked-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-checked-blue.png => radio-checked-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-checked-darkgray.png => radio-checked-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-checked-lightgray.png => radio-checked-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-checked-white.png => radio-checked-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-unchecked-black.png => radio-unchecked-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-unchecked-blue.png => radio-unchecked-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-unchecked-darkgray.png => radio-unchecked-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-unchecked-lightgray.png => radio-unchecked-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Radio-unchecked-white.png => radio-unchecked-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vmovetoolbar-black.png => vmovetoolbar-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vmovetoolbar-blue.png => vmovetoolbar-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vmovetoolbar-darkgray.png => vmovetoolbar-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vmovetoolbar-lightgray.png => vmovetoolbar-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vmovetoolbar-white.png => vmovetoolbar-white.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vsepartoolbar-black.png => vsepartoolbar-black.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vsepartoolbar-blue.png => vsepartoolbar-blue.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vsepartoolbar-darkgray.png => vsepartoolbar-darkgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vsepartoolbar-lightgray.png => vsepartoolbar-lightgray.png} (100%) rename src/Gui/Stylesheets/images_classic/{Vsepartoolbar-white.png => vsepartoolbar-white.png} (100%) diff --git a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp index 2b8401b61a..98b4622986 100644 --- a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp +++ b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp @@ -569,6 +569,7 @@ void DlgMacroExecuteImp::onToolbarButtonClicked() QAbstractButton* doNotShowAgainButton = msgBox.addButton(tr("Do not show again"), QMessageBox::YesRole); msgBox.setText(tr("Guided Walkthrough")); + msgBox.setObjectName(QString::fromLatin1("macroGuideWalkthrough")); msgBox.setInformativeText(tr("This will guide you in setting up this macro in a custom \ global toolbar. Instructions will be in red text inside the dialog.\n\ \n\ diff --git a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg index 0f3e06a6ea..8f46f8a66b 100644 --- a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg @@ -130,7 +130,7 @@ - + diff --git a/src/Gui/Stylesheets/FreeCAD Dark.qss b/src/Gui/Stylesheets/FreeCAD Dark.qss index 282bd523e3..2e17bbb2ea 100644 --- a/src/Gui/Stylesheets/FreeCAD Dark.qss +++ b/src/Gui/Stylesheets/FreeCAD Dark.qss @@ -416,7 +416,7 @@ QRadioButton::indicator { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-unchecked-white.png); + image:url(qss:images_classic/radio-unchecked-white.png); } QRadioButton::indicator:unchecked { @@ -430,14 +430,14 @@ QRadioButton::indicator:unchecked:disabled { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-unchecked-lightgray.png); + image:url(qss:images_classic/radio-unchecked-lightgray.png); } QRadioButton::indicator:checked { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-checked-white.png); + image:url(qss:images_classic/radio-checked-white.png); } QRadioButton::indicator:checked:hover, QRadioButton::indicator:checked:pressed { @@ -448,7 +448,7 @@ QRadioButton::indicator:checked:disabled { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-checked-lightgray.png); + image:url(qss:images_classic/radio-checked-lightgray.png); } /* QMenuBar --------------------------------------------------------------- @@ -462,6 +462,11 @@ QMenuBar { selection-background-color: @ThemeAccentColor1; } +QMenuBar:disabled, +QMenuBar::item:disabled{ + color: #adadad; +} + QMenuBar:focus { border: 1px solid @ThemeAccentColor2; } @@ -512,6 +517,10 @@ QMenu::item { border: 0px transparent #020202; } +QMenu::item:disabled { + color: #adadad; +} + QMenu::item:selected { color: white; background-color: @ThemeAccentColor1; @@ -545,7 +554,7 @@ QMenu::icon:checked { /* appearance of a 'checked' icon */ border-radius: 0px; } QMenu::indicator:non-exclusive:unchecked { - image: url(qss:images_classic/checkbox-Empty-white.png); + image: url(qss:images_classic/checkbox-empty-white.png); } QMenu::indicator:non-exclusive:unchecked:hover, QMenu::indicator:non-exclusive:unchecked:focus, QMenu::indicator:non-exclusive:unchecked:pressed { @@ -554,7 +563,7 @@ QMenu::indicator:non-exclusive:unchecked:hover, QMenu::indicator:non-exclusive:u } QMenu::indicator:non-exclusive:unchecked:disabled { - image: url(qss:images_classic/checkbox-Empty-lightgray.png); + image: url(qss:images_classic/checkbox-empty-lightgray.png); } QMenu::indicator:non-exclusive:checked { @@ -590,35 +599,35 @@ QMenu::indicator:exclusive:unchecked:hover, QMenu::indicator:exclusive:unchecked border: none; outline: none; background-color: @ThemeAccentColor1; - image: url(qss:images_classic/checkbox-Empty-white.png); + image: url(qss:images_classic/checkbox-empty-white.png); } QMenu::indicator:exclusive:unchecked:disabled { - image: url(qss:images_classic/checkbox-Empty-white.png); + image: url(qss:images_classic/checkbox-empty-white.png); } QMenu::indicator:exclusive:checked { border: none; outline: none; - image: url(qss:images_classic/Radio-checked-white.png); + image: url(qss:images_classic/radio-checked-white.png); } QMenu::indicator:exclusive:checked:hover, QMenu::indicator:exclusive:checked:focus, QMenu::indicator:exclusive:checked:pressed { border: none; outline: none; background-color: @ThemeAccentColor1; - image: url(qss:images_classic/checkbox-Empty-white.png); + image: url(qss:images_classic/checkbox-empty-white.png); } QMenu::indicator:exclusive:checked:disabled { outline: none; - image: url(qss:images_classic/Radio-checked-white.png); + image: url(qss:images_classic/radio-checked-white.png); } QMenu::right-arrow { margin: 5px; padding-left: 12px; - image:url(qss:images_classic/Arrow-right-white.png); + image:url(qss:images_classic/arrow-right-white.png); height: 8px; width: 8px; background-color: transparent; @@ -730,7 +739,7 @@ QScrollBar::handle:vertical:focus { QScrollBar::add-line:horizontal { margin: 6px 6px; - image: url(qss:images_classic/Arrow-right-lightgray.png); + image: url(qss:images_classic/arrow-right-lightgray.png); height: 8px; width: 4px; subcontrol-position: right; @@ -738,7 +747,7 @@ QScrollBar::add-line:horizontal { } QScrollBar::add-line:horizontal:hover, QScrollBar::add-line:horizontal:on { - image: url(qss:images_classic/Arrow-right-white.png); + image: url(qss:images_classic/arrow-right-white.png); height: 8px; width: 4px; subcontrol-position: right; @@ -747,7 +756,7 @@ QScrollBar::add-line:horizontal:hover, QScrollBar::add-line:horizontal:on { QScrollBar::add-line:vertical { margin: 6px 6px; - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); height: 4px; width: 8px; subcontrol-position: bottom; @@ -755,7 +764,7 @@ QScrollBar::add-line:vertical { } QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on { - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); height: 4px; width: 8px; subcontrol-position: bottom; @@ -764,7 +773,7 @@ QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on { QScrollBar::sub-line:horizontal { margin: 6px 6px; - image: url(qss:images_classic/Arrow-left-lightgray.png); + image: url(qss:images_classic/arrow-left-lightgray.png); height: 8px; width: 4px; subcontrol-position: left; @@ -772,7 +781,7 @@ QScrollBar::sub-line:horizontal { } QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:on { - image: url(qss:images_classic/Arrow-left-white.png); + image: url(qss:images_classic/arrow-left-white.png); height: 8px; width: 4px; subcontrol-position: left; @@ -781,7 +790,7 @@ QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:on { QScrollBar::sub-line:vertical { margin: 6px 6px; - image: url(qss:images_classic/Arrow-up-lightgray.png); + image: url(qss:images_classic/arrow-up-lightgray.png); height: 4px; width: 8px; subcontrol-position: top; @@ -789,7 +798,7 @@ QScrollBar::sub-line:vertical { } QScrollBar::sub-line:vertical:hover, QScrollBar::sub-line:vertical:on { - image: url(qss:images_classic/Arrow-up-white.png); + image: url(qss:images_classic/arrow-up-white.png); height: 4px; width: 8px; subcontrol-position: top; @@ -880,7 +889,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbar --------------------------------------------------------------------------- */ QToolBar { - background-color: #333333; + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #151515, stop:0.03 #333333,stop:0.97 #303030, stop:1 #151515); /* border: 1px solid #020202; */ /* font-weight: bold; */ } @@ -892,16 +901,22 @@ QToolBar:only-one { } QToolBar:horizontal { - border-bottom: 1px solid #020202; padding-top: 3px; - padding-left: 4px; + padding-left: 3px; + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #151515, stop:0.03 #333333,stop:0.97 #303030, stop:1 #151515); +} + +/* fix background color for toolbars that are the on menubar. */ +QToolBar:only-one { + background-color: transparent; + border:0px; + /* margin-top: -3px; */ } QToolBar:vertical { - border-left: 1px solid #020202; - border-right: 1px solid #020202; - padding-top: 4px; + padding-top: 3px; padding-left: 3px; + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #151515, stop:0.02 #333333,stop:0.98 #303030, stop:1 #151515); } QToolBar:disabled { @@ -909,34 +924,63 @@ QToolBar:disabled { QToolBar::handle:horizontal { width: 8px; - image: url(qss:images_classic/Hmovetoolbar-lightgray.png); + image: url(qss:images_classic/hmovetoolbar-lightgray.png); } QToolBar::handle:vertical { height: 8px; - image: url(qss:images_classic/Vmovetoolbar-lightgray.png); + image: url(qss:images_classic/vmovetoolbar-lightgray.png); } QToolBar::handle:horizontal:hover { width: 8px; - image: url(qss:images_classic/Hmovetoolbar-white.png); + image: url(qss:images_classic/hmovetoolbar-white.png); } QToolBar::handle:vertical:hover { height: 8px; - image: url(qss:images_classic/Vmovetoolbar-white.png); + image: url(qss:images_classic/vmovetoolbar-white.png); } QToolBar::separator:horizontal { width: 2px; padding: 0px 3px; - image: url(qss:images_classic/Hsepartoolbar-Darkgray.png); + image: url(qss:images_classic/hsepartoolbar-darkgray.png); } QToolBar::separator:vertical { height: 2px; padding: 3px 0px; - image: url(qss:images_classic/Vsepartoolbar-Darkgray.png); + image: url(qss:images_classic/vsepartoolbar-darkgray.png); +} + +/* undo button */ + +QToolBar[objectName="Edit"] > QToolButton::menu-arrow { + background-image: url(qss:images_classic/arrow-down-lightgray.png); + background-position: center center; + background-repeat: none; + subcontrol-origin: padding; + subcontrol-position: bottom right; + height: 6px; +} + +QToolBar[objectName="Edit"] > QToolButton::menu-arrow:hover { + background-image: url(qss:images_classic/arrow-down-white.png); + background-position: center center; + background-repeat: none; + subcontrol-origin: padding; + subcontrol-position: bottom right; + height: 6px; +} + +QToolBar[objectName="Edit"] > QToolButton::menu-arrow:open { + background-image: url(qss:images_classic/arrow-down-white.png); + background-position: center center; + background-repeat: none; + subcontrol-origin: padding; + subcontrol-position: bottom right; + height: 6px; } /*The "show more" button (it can also be stylable with "QToolBarExtension" icon is not working Qproperty works but breaks when you move the toolbar see also */ @@ -971,7 +1015,7 @@ QSpinBox { } QAbstractSpinBox:up-button { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #252525); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #333333); subcontrol-origin: border; subcontrol-position: top right; border-top: 1px solid transparent; @@ -983,20 +1027,24 @@ QAbstractSpinBox:up-button { margin-bottom:-1px; } +QAbstractSpinBox:up-button:disabled { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #444444); +} + QAbstractSpinBox::up-arrow, QAbstractSpinBox::up-arrow:disabled, QAbstractSpinBox::up-arrow:off { - image: url(qss:images_classic/Arrow-up-lightgray.png); + image: url(qss:images_classic/arrow-up-lightgray.png); height: 8px; width: 8px; } QAbstractSpinBox::up-arrow:hover { - image: url(qss:images_classic/Arrow-up-white.png); + image: url(qss:images_classic/arrow-up-white.png); height: 8px; width: 8px; } QAbstractSpinBox:down-button { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #252525, stop:1 #333333); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #333333); subcontrol-origin: border; subcontrol-position: bottom right; border-bottom: 1px solid transparent; @@ -1008,18 +1056,26 @@ QAbstractSpinBox:down-button { margin-top:-1px; } +QAbstractSpinBox:down-button:disabled { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #444444); +} + QAbstractSpinBox::down-arrow, QAbstractSpinBox::down-arrow:disabled, QAbstractSpinBox::down-arrow:off { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); height: 8px; width: 8px; } QAbstractSpinBox::down-arrow:hover { - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); height: 8px; width: 8px; } +QAbstractSpinBox:disabled { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #444444); +} + QAbstractSpinBox:hover { } @@ -1171,7 +1227,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qpushbutton --------------------------------------------------------------------------- */ QPushButton { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #252525); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #333333); color: white; border: 1px solid #020202; /* border-bottom-color: #1e1e1e; simulates shadow under the button */ @@ -1186,7 +1242,7 @@ QPushButton { } QPushButton:disabled { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #444444); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #333333); color: #adadad; border: 1px solid #020202; } @@ -1212,7 +1268,7 @@ QPushButton:checked:selected { } QPushButton:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #333333); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #404040); color: white; } @@ -1236,6 +1292,9 @@ QDialogButtonBox QPushButton { min-width: 80px; } +QMessageBox[objectName="macroGuideWalkthrough"] QDialogButtonBox QPushButton { + min-width: 20px; +} /* QToolButton ------------------------------------------------------------ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbutton @@ -1272,7 +1331,7 @@ QToolButton:checked:disabled { } QToolButton:checked:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:0.7 #444444, stop:1 #444444); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:0.7 #444444, stop:1 #404040); border: 1px solid #020202; } @@ -1281,13 +1340,14 @@ QToolButton:checked:pressed { } QToolButton:checked:selected { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:0.7 #444444, stop:1 #444444); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:0.7 #444444, stop:1 #404040); border: 1px solid @ThemeAccentColor1; } QToolButton:hover { color: white; border: 1px solid #020202; + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #404040); } QToolButton:pressed { @@ -1331,18 +1391,18 @@ QToolButton::menu-indicator { } QToolButton::menu-arrow { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); width: 18px; height: 18px; /* background-color: transparent; */ } QToolButton::menu-arrow:open { - image: url(qss:images_classic/Arrow-Down-white.png); + image: url(qss:images_classic/arrow-down-white.png); width: 18px; height: 18px; } QToolButton::menu-arrow:hover { - image: url(qss:images_classic/Arrow-Down-white.png); + image: url(qss:images_classic/arrow-down-white.png); width: 18px; height: 18px; } @@ -1375,7 +1435,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcombobox QComboBox { border: 1px solid #020202; border-radius: 2px; - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #333333, stop:1 #252525); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #333333); selection-background-color: @ThemeAccentColor1; padding-left: 4px; padding-right: 2px; @@ -1392,9 +1452,10 @@ QComboBox { QComboBox:editable { background-color: #252525; } + QComboBox QAbstractItemView { - border: 1px solid #020202; - border-radius: 2px; + border: 2px solid #020202; + /* padding-left: 4px; this fixes the icon padding but adds a 4px padding to all Qcomboboxes.*/ background-color: #252525; selection-background-color: @ThemeAccentColor1; } @@ -1423,7 +1484,7 @@ QComboBox:disabled { } QComboBox:hover { - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #444444, stop:1 #333333); + background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #444444, stop:1 #404040); /* border: 1px solid @ThemeAccentColor1; */ } @@ -1473,7 +1534,7 @@ QComboBox::item:selected { QComboBox::drop-down { subcontrol-origin: padding; - /* background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #333333, stop:1 #020202); */ + /* background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #333333, stop:1 #020202); */ subcontrol-position: top right; width: 20px; border-right: 1px solid transparent; @@ -1485,16 +1546,15 @@ QComboBox::drop-down:hover { } QComboBox::down-arrow { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); /* height: 10px; */ width: 8px; } QComboBox::down-arrow:on, QComboBox::down-arrow:hover, QComboBox::down-arrow:focus { - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); } - /*================================================================================================== Tasks panel (custom FreeCAD class) ==================================================================================================*/ @@ -1568,25 +1628,25 @@ padding: 0px; QSint--ActionGroup QFrame[class="header"] QLabel[fold="false"] { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_unfold_lightgray.png); + image: url(qss:images_classic/qsint_header_unfold_lightgray.png); } QSint--ActionGroup QFrame[class="header"] QLabel:hover[fold="false"] { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_unfold_white.png); + image: url(qss:images_classic/qsint_header_unfold_white.png); } QSint--ActionGroup QFrame[class="header"] QLabel[fold="true"] { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_fold_lightgray.png); + image: url(qss:images_classic/qsint_header_fold_lightgray.png); } QSint--ActionGroup QFrame[class="header"] QLabel[fold="true"]:hover { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_fold_white.png); + image: url(qss:images_classic/qsint_header_fold_white.png); } QSint--ActionGroup QFrame[class="content"] { @@ -1640,7 +1700,7 @@ background-color: #252525; QSint--ActionGroup QFrame[class="content"] QToolButton { color: white; text-align: center; - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #333333, stop:1 #252525); + background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #333333, stop:1 #252525); border: 1px solid #000000; padding: 1px 1px; /* different than regular QPushButton */ margin: 0px; /* different than regular QPushButton */ @@ -1649,7 +1709,7 @@ QSint--ActionGroup QFrame[class="content"] QToolButton { } QSint--ActionGroup QFrame[class="content"] QToolButton:checked { - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #333333, stop:1 #444444); + background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #333333, stop:1 #444444); border: 1px solid @ThemeAccentColor2; } @@ -1935,9 +1995,9 @@ QTabBar[style="text-only"]::tab:left { QTabBar::close-button, QDockWidget QTabBar::close-button { border: 0; - margin: 3px; + margin: 4px; padding: 0px; - image: url(qss:images_classic/Close-lightgray.png); + image: url(qss:images_classic/close-lightgray.png); } QTabBar::close-button:hover, QDockWidget QTabBar::close-button:hover { @@ -1946,7 +2006,7 @@ QTabBar::close-button:hover, QDockWidget QTabBar::close-button:hover { } QTabBar::close-button:pressed, QDockWidget QTabBar::close-button:pressed { - image: url(qss:images_classic/close-DarkRed.png); + image: url(qss:images_classic/close-darkRed.png); } QTabBar::tab, QDockWidget QTabBar::tab { @@ -1961,121 +2021,137 @@ QTabBar::tab:top, QDockWidget QTabBar::tab:top { margin-left: 0px; margin-right: 0px; min-width: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:0.6 #252525, stop:1 #252525); + background-color: #252525; margin-top: 3px; - border-top: 1px solid #202020; /* selection color */ + border-top: 1px solid #202020; border-bottom: 1px solid #202020; border-left: 1px solid #202020; border-right: 1px solid #202020; - border-top-left-radius: 2px; - border-top-right-radius: 2px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; } QTabBar::tab:top:selected, QDockWidget QTabBar::tab:top:selected { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:0.6 #444444, stop:1 #333333); + background-color: #3b3b3b; color: white; - border-top: 1px solid #202020; /* selection color */ - border-bottom: 1px solid #333333; + border-top: 1px solid #202020; + border-bottom: 1px solid #3b3b3b; border-left: 1px solid #202020; border-right: 1px solid #202020; margin-top: 0px; - border-top-left-radius: 2px; - border-top-right-radius: 2px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; } QTabBar::tab:top:!selected:hover, QDockWidget QTabBar::tab:top:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #444444); - margin-top: 0px; + background-color:#333333; + color: white; + border-bottom: 1px solid #202020; + border-top: 1px solid #202020; + border-left: 1px solid #202020; + border-right: 1px solid #202020; } QTabBar::tab:bottom, QDockWidget QTabBar::tab:bottom { color: #adadad; min-width: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:0.6 #252525, stop:1 #252525); + background-color: #252525; margin-bottom: 3px; - border-bottom: 1px solid #202020; /* selection color */ + border-bottom: 1px solid #202020; border-top: 1px solid #202020; border-left: 1px solid #202020; border-right: 1px solid #202020; - border-bottom-left-radius: 2px; - border-bottom-right-radius: 2px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:bottom:selected, QDockWidget QTabBar::tab:bottom:selected { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:0.6 #444444, stop:1 #333333); + background-color: #3b3b3b; color: white; - border-bottom: 1px solid #202020; /* selection color */ - border-top: 1px solid #333333; + border-bottom: 1px solid #202020; + border-top: 1px solid #3b3b3b; border-left: 1px solid #202020; border-right: 1px solid #202020; margin-bottom: 0px; - border-bottom-left-radius: 2px; - border-bottom-right-radius: 2px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:bottom:!selected:hover, QDockWidget QTabBar::tab:bottom:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #333333, stop:1 #444444); - margin-bottom: 0px; + background-color:#333333; + color: white; + border-bottom: 1px solid #202020; + border-top: 1px solid #202020; + border-left: 1px solid #202020; + border-right: 1px solid #202020; } QTabBar::tab:left, QDockWidget QTabBar::tab:left { color: #adadad; min-height: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #333333, stop:0.6 #252525, stop:1 #252525); + background-color: #252525; margin-right: 3px; - border-bottom: 1px solid #202020; /* selection color */ + border-bottom: 1px solid #202020; border-right: 1px solid #202020; border-left: 1px solid #202020; border-top: 1px solid #202020; - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; } QTabBar::tab:left:selected, QDockWidget QTabBar::tab:left:selected { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #444444, stop:0.6 #444444, stop:1 #333333); + background-color: #3b3b3b; color: white; - border-bottom: 1px solid #202020; /* selection color */ - border-right: 1px solid #333333; + border-bottom: 1px solid #202020; + border-right: 1px solid #3b3b3b; border-left: 1px solid #202020; border-top: 1px solid #202020; margin-left: 0px; - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; } QTabBar::tab:left:!selected:hover, QDockWidget QTabBar::tab:left:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #444444, stop:1 #333333); - margin-left: 0px; + background-color:#333333; + color: white; + border-bottom: 1px solid #202020; + border-top: 1px solid #202020; + border-left: 1px solid #202020; + border-right: 1px solid #202020; } QTabBar::tab:right, QDockWidget QTabBar::tab:right { color: white; min-height: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #333333, stop:0.6 #252525, stop:1 #252525); + background-color: #252525; margin-right: 3px; - border-bottom: 1px solid #202020; /* selection color */ + border-bottom: 1px solid #202020; border-left: 1px solid #202020; border-right: 1px solid #202020; border-top: 1px solid #202020; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:right:selected, QDockWidget QTabBar::tab:right:selected { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #444444, stop:0.6 #444444, stop:1 #333333); + background-color: #3b3b3b; color: white; - border-bottom: 1px solid #202020; /* selection color */ - border-left: 1px solid #333333; + border-bottom: 1px solid #202020; + border-left: 1px solid #3b3b3b; border-left: 1px solid #202020; border-top: 1px solid #202020; margin-right: 0px; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:right:!selected:hover, QDockWidget QTabBar::tab:right:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #333333, stop:1 #444444); - margin-right: 0px; + background-color:#333333; + color: white; + border-bottom: 1px solid #202020; + border-top: 1px solid #202020; + border-left: 1px solid #202020; + border-right: 1px solid #202020; } QTabBar QToolButton, QDockWidget QTabBar QToolButton { @@ -2096,19 +2172,19 @@ QTabBar QToolButton:pressed:hover, QDockWidget QTabBar QToolButton:pressed:hover } QTabBar QToolButton::left-arrow:enabled, QDockWidget QTabBar QToolButton::left-arrow:enabled { - image: url(qss:images_classic/Arrow-left-lightgray.png); + image: url(qss:images_classic/arrow-left-lightgray.png); } QTabBar QToolButton::left-arrow:disabled, QDockWidget QTabBar QToolButton::left-arrow:disabled { - image: url(qss:images_classic/Arrow-left-darkgray.png); + image: url(qss:images_classic/arrow-left-darkgray.png); } QTabBar QToolButton::right-arrow:enabled, QDockWidget QTabBar QToolButton::right-arrow:enabled { - image: url(qss:images_classic/Arrow-right-lightgray.png); + image: url(qss:images_classic/arrow-right-lightgray.png); } QTabBar QToolButton::right-arrow:disabled, QDockWidget QTabBar QToolButton::right-arrow:disabled { - image: url(qss:images_classic/Arrow-right-darkgray.png); + image: url(qss:images_classic/arrow-right-darkgray.png); } /* QDockWiget ------------------------------------------------------------- @@ -2127,7 +2203,7 @@ QDockWidget::title { padding: 3px; spacing: 4px; border: none; - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #333333, stop:1 #252525); + background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #333333, stop:1 #252525); text-align: center; font-weight: bold; } @@ -2196,22 +2272,22 @@ QTreeView::branch:!has-children:!has-siblings:adjoins-item { QTreeView::branch:closed:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-right-white.png); + image: url(qss:images_classic/arrow-right-white.png); } QTreeView::branch:has-children:!has-siblings:closed { border-image: none; - image: url(qss:images_classic/Arrow-right-white.png); + image: url(qss:images_classic/arrow-right-white.png); } QTreeView::branch:open:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); } QTreeView::branch:open:has-children:!has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); } QTreeView::indicator, @@ -2262,7 +2338,7 @@ QColumnView::indicator:checked:pressed { QListView::indicator:unchecked, QTableView::indicator:unchecked, QColumnView::indicator:unchecked { - image: url(qss:images_classic/checkbox-Empty-white.png); + image: url(qss:images_classic/checkbox-empty-white.png); } */ QTreeView::indicator:unchecked:hover, QTreeView::indicator:unchecked:focus, QTreeView::indicator:unchecked:pressed, @@ -2275,7 +2351,7 @@ QTableView::indicator:unchecked:pressed, QColumnView::indicator:unchecked:hover, QColumnView::indicator:unchecked:focus, QColumnView::indicator:unchecked:pressed { - /* image: url(qss:images_classic/checkbox-Empty-blue.png); */ + /* image: url(qss:images_classic/checkbox-empty-blue.png); */ /* background-color: @ThemeAccentColor1; border: 1px solid #ffffff; */ } @@ -2284,7 +2360,7 @@ QTreeView::indicator:indeterminate, QListView::indicator:indeterminate, QTableView::indicator:indeterminate, QColumnView::indicator:indeterminate { - image: url(qss:images_classic/Indeterminate-mark-white.png); + image: url(qss:images_classic/indeterminate-mark-white.png); } QTreeView::indicator:indeterminate:hover, QTreeView::indicator:indeterminate:focus, QTreeView::indicator:indeterminate:pressed, @@ -2297,7 +2373,7 @@ QTableView::indicator:indeterminate:pressed, QColumnView::indicator:indeterminate:hover, QColumnView::indicator:indeterminate:focus, QColumnView::indicator:indeterminate:pressed { - /* image: url(qss:images_classic/Indeterminate-mark-lightgray.png); + /* image: url(qss:images_classic/indeterminate-mark-lightgray.png); background-color: @ThemeAccentColor1; border: 1px solid #ffffff; */ } @@ -2375,6 +2451,7 @@ QTableView::item { color: white; } + /* QHeaderView ------------------------------------------------------------ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qheaderview @@ -2400,11 +2477,15 @@ QHeaderView:disabled { } QHeaderView::section { - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #333333, stop:1 #252525); + background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #252525, stop:1 #333333); color: #ffffff; padding: 4px; } +QHeaderView::section:hover { + background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #444444, stop:1 #404040); +} + QHeaderView::section::horizontal { border-bottom: 2px solid #020202; border-right: 0px solid transparent; @@ -2446,7 +2527,7 @@ QHeaderView::down-arrow { width: 12px; padding-left: 2px; padding-right: 2px; - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); } QHeaderView::up-arrow { @@ -2456,7 +2537,7 @@ QHeaderView::up-arrow { width: 12px; padding-left: 2px; padding-right: 2px; - image: url(qss:images_classic/Arrow-up-lightgray.png); + image: url(qss:images_classic/arrow-up-lightgray.png); } /* QToolBox -------------------------------------------------------------- @@ -2511,7 +2592,7 @@ QToolBox::tab:!selected:disabled { } QToolBox::tab:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #444444, stop:1 #333333); + background-color: qlineargradient(x1:0, y0:0, x2:0, y1:1, stop:0 #444444, stop:1 #404040); } QToolBox > QScrollArea > QWidget > QWidget { @@ -2561,7 +2642,7 @@ https://stackoverflow.com/questions/14581498/qt-stylesheet-for-hline-vline-color https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qsplitter ---------------------------------------------------------------------------*/ -QSplitterHandle:hover { /* to fix bug about hovering on splitters https://bugreports.qt.io/browse/QTBUG-13768 */ +QSplitterHandle:hover { /* to fix bug about hovering on splitters https://bugreports.qt.io/browse/qTBUG-13768 */ } @@ -2622,13 +2703,13 @@ QDateEdit::drop-down, QDateTimeEdit::drop-down { } QDateEdit::down-arrow, QDateTimeEdit::down-arrow { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); height: 8px; width: 8px; } QDateEdit::down-arrow:on, QDateEdit::down-arrow:hover, QDateEdit::down-arrow:focus, QDateTimeEdit::down-arrow:on, QDateTimeEdit::down-arrow:hover, QDateTimeEdit::down-arrow:focus { - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); } QDateEdit QAbstractItemView, QDateTimeEdit QAbstractItemView { @@ -2752,23 +2833,23 @@ Settings menu #groupsTreeView: QTreeView::branch#groupsTreeView:closed:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-right-white.png); + image: url(qss:images_classic/arrow-right-white.png); } QTreeView::branch#groupsTreeView:open:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); } QTreeView::branch#groupsTreeView:open:has-children:!has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-white.png); + image: url(qss:images_classic/arrow-down-white.png); } QTreeView::branch#groupsTreeView:has-children:!has-siblings:closed { border-image: none; - image: url(qss:images_classic/Arrow-right-white.png); + image: url(qss:images_classic/arrow-right-white.png); } QTreeView::branch#groupsTreeView:has-siblings:!adjoins-item { @@ -2816,3 +2897,4 @@ QTreeView::item:!selected:hover#groupsTreeView { background-color: @ThemeAccentColor1; margin-left:-8px; } */ + diff --git a/src/Gui/Stylesheets/FreeCAD Light.qss b/src/Gui/Stylesheets/FreeCAD Light.qss index 943222caf0..db107bfe66 100644 --- a/src/Gui/Stylesheets/FreeCAD Light.qss +++ b/src/Gui/Stylesheets/FreeCAD Light.qss @@ -104,6 +104,7 @@ Main window ==================================================================================================*/ QMainWindow, QDialog, + QDockWidget { background-color: #f0f0f0; /* main background color */ } @@ -416,7 +417,7 @@ QRadioButton::indicator { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-unchecked-black.png); + image:url(qss:images_classic/radio-unchecked-black.png); } QRadioButton::indicator:unchecked { @@ -430,14 +431,14 @@ QRadioButton::indicator:unchecked:disabled { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-unchecked-lightgray.png); + image:url(qss:images_classic/radio-unchecked-lightgray.png); } QRadioButton::indicator:checked { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-checked-black.png); + image:url(qss:images_classic/radio-checked-black.png); } QRadioButton::indicator:checked:hover, QRadioButton::indicator:checked:pressed { @@ -448,7 +449,7 @@ QRadioButton::indicator:checked:disabled { border-image: none; width: 14px; height: 14px; - image:url(qss:images_classic/Radio-checked-lightgray.png); + image:url(qss:images_classic/radio-checked-lightgray.png); } /* QMenuBar --------------------------------------------------------------- @@ -457,11 +458,16 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qmenubar --------------------------------------------------------------------------- */ QMenuBar { - background-color: #f0f0f0; + background-color: #ffffff; color: black; selection-background-color: @ThemeAccentColor1; } +QMenuBar:disabled, +QMenuBar::item:disabled{ + color: #646464; +} + QMenuBar:focus { border: 1px solid @ThemeAccentColor2; } @@ -495,6 +501,10 @@ QMenu { selection-background-color: @ThemeAccentColor1; } +QMenu::item:disabled { + color: #646464; +} + QMenu::separator { height: 2px; background-color: #ededed; @@ -545,7 +555,7 @@ QMenu::icon:checked { /* appearance of a 'checked' icon */ border-radius: 0px; } QMenu::indicator:non-exclusive:unchecked { - image: url(qss:images_classic/checkbox-Empty-black.png); + image: url(qss:images_classic/checkbox-empty-black.png); } QMenu::indicator:non-exclusive:unchecked:hover, QMenu::indicator:non-exclusive:unchecked:focus, QMenu::indicator:non-exclusive:unchecked:pressed { @@ -554,7 +564,7 @@ QMenu::indicator:non-exclusive:unchecked:hover, QMenu::indicator:non-exclusive:u } QMenu::indicator:non-exclusive:unchecked:disabled { - image: url(qss:images_classic/checkbox-Empty-lightgray.png); + image: url(qss:images_classic/checkbox-empty-lightgray.png); } QMenu::indicator:non-exclusive:checked { @@ -590,35 +600,35 @@ QMenu::indicator:exclusive:unchecked:hover, QMenu::indicator:exclusive:unchecked border: none; outline: none; background-color: @ThemeAccentColor1; - image: url(qss:images_classic/checkbox-Empty-black.png); + image: url(qss:images_classic/checkbox-empty-black.png); } QMenu::indicator:exclusive:unchecked:disabled { - image: url(qss:images_classic/checkbox-Empty-black.png); + image: url(qss:images_classic/checkbox-empty-black.png); } QMenu::indicator:exclusive:checked { border: none; outline: none; - image: url(qss:images_classic/Radio-checked-black.png); + image: url(qss:images_classic/radio-checked-black.png); } QMenu::indicator:exclusive:checked:hover, QMenu::indicator:exclusive:checked:focus, QMenu::indicator:exclusive:checked:pressed { border: none; outline: none; background-color: @ThemeAccentColor1; - image: url(qss:images_classic/checkbox-Empty-black.png); + image: url(qss:images_classic/checkbox-empty-black.png); } QMenu::indicator:exclusive:checked:disabled { outline: none; - image: url(qss:images_classic/Radio-checked-black.png); + image: url(qss:images_classic/radio-checked-black.png); } QMenu::right-arrow { margin: 5px; padding-left: 12px; - image:url(qss:images_classic/Arrow-right-black.png); + image:url(qss:images_classic/arrow-right-black.png); height: 8px; width: 8px; background-color: transparent; @@ -730,7 +740,7 @@ QScrollBar::handle:vertical:focus { QScrollBar::add-line:horizontal { margin: 6px 6px; - image: url(qss:images_classic/Arrow-right-lightgray.png); + image: url(qss:images_classic/arrow-right-lightgray.png); height: 8px; width: 4px; subcontrol-position: right; @@ -738,7 +748,7 @@ QScrollBar::add-line:horizontal { } QScrollBar::add-line:horizontal:hover, QScrollBar::add-line:horizontal:on { - image: url(qss:images_classic/Arrow-right-black.png); + image: url(qss:images_classic/arrow-right-black.png); height: 8px; width: 4px; subcontrol-position: right; @@ -747,7 +757,7 @@ QScrollBar::add-line:horizontal:hover, QScrollBar::add-line:horizontal:on { QScrollBar::add-line:vertical { margin: 6px 6px; - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); height: 4px; width: 8px; subcontrol-position: bottom; @@ -755,7 +765,7 @@ QScrollBar::add-line:vertical { } QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on { - image: url(qss:images_classic/Arrow-down-black.png); + image: url(qss:images_classic/arrow-down-black.png); height: 4px; width: 8px; subcontrol-position: bottom; @@ -764,7 +774,7 @@ QScrollBar::add-line:vertical:hover, QScrollBar::add-line:vertical:on { QScrollBar::sub-line:horizontal { margin: 6px 6px; - image: url(qss:images_classic/Arrow-left-lightgray.png); + image: url(qss:images_classic/arrow-left-lightgray.png); height: 8px; width: 4px; subcontrol-position: left; @@ -772,7 +782,7 @@ QScrollBar::sub-line:horizontal { } QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:on { - image: url(qss:images_classic/Arrow-left-black.png); + image: url(qss:images_classic/arrow-left-black.png); height: 8px; width: 4px; subcontrol-position: left; @@ -781,7 +791,7 @@ QScrollBar::sub-line:horizontal:hover, QScrollBar::sub-line:horizontal:on { QScrollBar::sub-line:vertical { margin: 6px 6px; - image: url(qss:images_classic/Arrow-up-lightgray.png); + image: url(qss:images_classic/arrow-up-lightgray.png); height: 4px; width: 8px; subcontrol-position: top; @@ -789,7 +799,7 @@ QScrollBar::sub-line:vertical { } QScrollBar::sub-line:vertical:hover, QScrollBar::sub-line:vertical:on { - image: url(qss:images_classic/Arrow-up-black.png); + image: url(qss:images_classic/arrow-up-black.png); height: 4px; width: 8px; subcontrol-position: top; @@ -880,8 +890,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbar --------------------------------------------------------------------------- */ QToolBar { - background-color: #f0f0f0; - /* border: 1px solid #ababab; */ + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #cecece, stop:0.03 #f4f4f4,stop:0.97 #f0f0f0, stop:1 #cecece); /* font-weight: bold; */ } @@ -892,16 +901,22 @@ QToolBar:only-one { } QToolBar:horizontal { - border-bottom: 1px solid #ababab; padding-top: 3px; - padding-left: 4px; + padding-left: 3px; + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #cecece, stop:0.03 #f4f4f4,stop:0.97 #f0f0f0, stop:1 #cecece); +} + +/* fix background color for toolbars that are the on menubar. */ +QToolBar:only-one { + background-color: transparent; + border:0px; + /* margin-top: -3px; */ } QToolBar:vertical { - border-left: 1px solid #ababab; - border-right: 1px solid #ababab; - padding-top: 4px; + padding-top: 3px; padding-left: 3px; + background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #cecece, stop:0.03 #f4f4f4,stop:0.97 #f0f0f0, stop:1 #cecece); } QToolBar:disabled { @@ -909,34 +924,63 @@ QToolBar:disabled { QToolBar::handle:horizontal { width: 8px; - image: url(qss:images_classic/Hmovetoolbar-lightgray.png); + image: url(qss:images_classic/hmovetoolbar-lightgray.png); } QToolBar::handle:vertical { height: 8px; - image: url(qss:images_classic/Vmovetoolbar-lightgray.png); + image: url(qss:images_classic/vmovetoolbar-lightgray.png); } QToolBar::handle:horizontal:hover { width: 8px; - image: url(qss:images_classic/Hmovetoolbar-darkgray.png); + image: url(qss:images_classic/hmovetoolbar-darkgray.png); } QToolBar::handle:vertical:hover { height: 8px; - image: url(qss:images_classic/Vmovetoolbar-darkgray.png); + image: url(qss:images_classic/vmovetoolbar-darkgray.png); } QToolBar::separator:horizontal { width: 2px; padding: 0px 3px; - image: url(qss:images_classic/Hsepartoolbar-lightgray.png); + image: url(qss:images_classic/hsepartoolbar-lightgray.png); } QToolBar::separator:vertical { height: 2px; padding: 3px 0px; - image: url(qss:images_classic/Vsepartoolbar-lightgray.png); + image: url(qss:images_classic/vsepartoolbar-lightgray.png); +} + +/* undo button */ + +QToolBar[objectName="Edit"] > QToolButton::menu-arrow { + background-image: url(qss:images_classic/arrow-down-lightgray.png); + background-position: center center; + background-repeat: none; + subcontrol-origin: padding; + subcontrol-position: bottom right; + height: 6px; +} + +QToolBar[objectName="Edit"] > QToolButton::menu-arrow:hover { + background-image: url(qss:images_classic/arrow-down-black.png); + background-position: center center; + background-repeat: none; + subcontrol-origin: padding; + subcontrol-position: bottom right; + height: 6px; +} + +QToolBar[objectName="Edit"] > QToolButton::menu-arrow:open { + background-image: url(qss:images_classic/arrow-down-black.png); + background-position: center center; + background-repeat: none; + subcontrol-origin: padding; + subcontrol-position: bottom right; + height: 6px; } /*The "show more" button (it can also be stylable with "QToolBarExtension" icon is not working Qproperty works but breaks when you move the toolbar see also */ @@ -969,7 +1013,7 @@ QSpinBox { } QAbstractSpinBox:up-button { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f0f0f0, stop:1 #fdfdfd); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fdfdfd, stop:1 #f0f0f0); subcontrol-origin: border; subcontrol-position: top right; border-top: 1px solid transparent; @@ -981,14 +1025,18 @@ QAbstractSpinBox:up-button { margin-bottom:-1px; } +QAbstractSpinBox:up-button:disabled { +background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #e2e2e2, stop:1 #ededed); +} + QAbstractSpinBox::up-arrow, QAbstractSpinBox::up-arrow:disabled, QAbstractSpinBox::up-arrow:off { - image: url(qss:images_classic/Arrow-up-lightgray.png); + image: url(qss:images_classic/arrow-up-lightgray.png); height: 8px; width: 8px; } QAbstractSpinBox::up-arrow:hover { - image: url(qss:images_classic/Arrow-up-black.png); + image: url(qss:images_classic/arrow-up-black.png); height: 8px; width: 8px; } @@ -1006,18 +1054,26 @@ QAbstractSpinBox:down-button { margin-top:-1px; } +QAbstractSpinBox:down-button:disabled { +background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #e2e2e2, stop:1 #ededed); +} + QAbstractSpinBox::down-arrow, QAbstractSpinBox::down-arrow:disabled, QAbstractSpinBox::down-arrow:off { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); height: 8px; width: 8px; } QAbstractSpinBox::down-arrow:hover { - image: url(qss:images_classic/Arrow-down-black.png); + image: url(qss:images_classic/arrow-down-black.png); height: 8px; width: 8px; } +QAbstractSpinBox:disabled { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #e2e2e2, stop:1 #ededed); +} + QAbstractSpinBox:hover { } @@ -1168,7 +1224,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qpushbutton --------------------------------------------------------------------------- */ QPushButton { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f0f0f0, stop:1 #fdfdfd); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fdfdfd, stop:1 #f0f0f0); color: black; border: 1px solid #ababab; /* border-bottom-color: #1e1e1e; simulates shadow under the button */ @@ -1183,7 +1239,7 @@ QPushButton { } QPushButton:disabled { -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #e2e2e2, stop:1 #fdfdfd); +background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #e2e2e2, stop:1 #ededed); color: #646464; border: 1px solid #ababab; } @@ -1209,7 +1265,7 @@ QPushButton:checked:selected { } QPushButton:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fefefe, stop:1 #f8f8f8); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1 #fefefe); color: black; } @@ -1233,6 +1289,10 @@ QDialogButtonBox QPushButton { min-width: 80px; } +QMessageBox[objectName="macroGuideWalkthrough"] QDialogButtonBox QPushButton { + min-width: 20px; +} + /* QToolButton ------------------------------------------------------------ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbutton @@ -1284,6 +1344,7 @@ QToolButton:checked:selected { QToolButton:hover { color: black; + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1 #fefefe); border: 1px solid #ababab; } @@ -1328,18 +1389,18 @@ QToolButton::menu-indicator { } QToolButton::menu-arrow { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); width: 18px; height: 18px; /* background-color: transparent; */ } QToolButton::menu-arrow:open { - image: url(qss:images_classic/Arrow-Down-black.png); + image: url(qss:images_classic/arrow-Down-black.png); width: 18px; height: 18px; } QToolButton::menu-arrow:hover { - image: url(qss:images_classic/Arrow-Down-black.png); + image: url(qss:images_classic/arrow-Down-black.png); width: 18px; height: 18px; } @@ -1372,7 +1433,7 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcombobox QComboBox { border: 1px solid #ababab; border-radius: 2px; - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #f0f0f0, stop:1 #fdfdfd); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fdfdfd, stop:1 #f0f0f0); selection-background-color: @ThemeAccentColor1; padding-left: 4px; padding-right: 2px; @@ -1389,9 +1450,10 @@ QComboBox { QComboBox:editable { background-color: #fdfdfd; } + QComboBox QAbstractItemView { - border: 1px solid #ababab; - border-radius: 2px; + border: 2px solid #ababab; + /* padding-left: 4px; this fixes the icon padding but adds a 4px padding to all Qcomboboxes.*/ background-color: #fdfdfd; selection-background-color: @ThemeAccentColor1; } @@ -1482,13 +1544,13 @@ QComboBox::drop-down:hover { } QComboBox::down-arrow { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); /* height: 10px; */ width: 8px; } QComboBox::down-arrow:on, QComboBox::down-arrow:hover, QComboBox::down-arrow:focus { - image: url(qss:images_classic/Arrow-down-black.png); + image: url(qss:images_classic/arrow-down-black.png); } @@ -1565,25 +1627,25 @@ padding: 0px; QSint--ActionGroup QFrame[class="header"] QLabel[fold="false"] { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_unfold_lightgray.png); + image: url(qss:images_classic/qsint_header_unfold_lightgray.png); } QSint--ActionGroup QFrame[class="header"] QLabel:hover[fold="false"] { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_unfold_black.png); + image: url(qss:images_classic/qsint_header_unfold_black.png); } QSint--ActionGroup QFrame[class="header"] QLabel[fold="true"] { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_fold_lightgray.png); + image: url(qss:images_classic/qsint_header_fold_lightgray.png); } QSint--ActionGroup QFrame[class="header"] QLabel[fold="true"]:hover { width: 30px; height: 30px; - image: url(qss:images_classic/Qsint_header_fold_black.png); + image: url(qss:images_classic/qsint_header_fold_black.png); } QSint--ActionGroup QFrame[class="content"] { @@ -1637,7 +1699,7 @@ background-color: #f0f0f0; QSint--ActionGroup QFrame[class="content"] QToolButton { color: black; text-align: center; - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #f0f0f0, stop:1 #fdfdfd); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fdfdfd, stop:1 #f0f0f0); border: 1px solid #adadad; padding: 1px 1px; /* different than regular QPushButton */ margin: 0px; /* different than regular QPushButton */ @@ -1646,7 +1708,7 @@ QSint--ActionGroup QFrame[class="content"] QToolButton { } QSint--ActionGroup QFrame[class="content"] QToolButton:checked { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fefefe, stop:1 #f8f8f8); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1 #fefefe); border: 1px solid @ThemeAccentColor2; } @@ -1677,7 +1739,7 @@ QSint--ActionGroup QToolButton#filterButton QListWidget { QSint--ActionGroup QFrame[class="content"] QToolButton:hover{ - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fefefe, stop:1 #f8f8f8); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1 #fefefe); } QSint--ActionGroup QFrame[class="content"] QToolButton:focus { border: 1px solid @ThemeAccentColor2; @@ -1932,9 +1994,9 @@ QTabBar[style="text-only"]::tab:left { QTabBar::close-button, QDockWidget QTabBar::close-button { border: 0; - margin: 3px; + margin: 4px; padding: 0px; - image: url(qss:images_classic/Close-lightgray.png); + image: url(qss:images_classic/close-lightgray.png); } QTabBar::close-button:hover, QDockWidget QTabBar::close-button:hover { @@ -1958,122 +2020,133 @@ QTabBar::tab:top, QDockWidget QTabBar::tab:top { margin-left: 0px; margin-right: 0px; min-width: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #dddddd, stop:0.6 #e2e2e2, stop:1 #cccccc); + background-color: #e2e2e2; margin-top: 3px; - border-top: 1px solid #ababab; /* selection color */ + border-top: 1px solid #ababab; border-bottom: 1px solid #ababab; border-left: 1px solid #ababab; border-right: 1px solid #ababab; - border-top-left-radius: 2px; - border-top-right-radius: 2px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; } QTabBar::tab:top:selected, QDockWidget QTabBar::tab:top:selected { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f0f0f0, stop:0.6 #fdfdfd stop:1 #f0f0f0); + background-color: #f8f8f8; color: black; - border-top: 1px solid #ababab; /* selection color */ - border-bottom: 1px solid #f0f0f0; + border-top: 1px solid #ababab; + border-bottom: 1px solid #f8f8f8; border-left: 1px solid #ababab; border-right: 1px solid #ababab; margin-top: 0px; - border-top-left-radius: 2px; - border-top-right-radius: 2px; + border-top-left-radius: 3px; + border-top-right-radius: 3px; } QTabBar::tab:top:!selected:hover, QDockWidget QTabBar::tab:top:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f0f0f0, stop:1 #d8d8d8); - margin-top: 0px; + background-color: #f8f8f8; } QTabBar::tab:bottom, QDockWidget QTabBar::tab:bottom { color: #646464; min-width: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #dddddd, stop:0.6 #e2e2e2, stop:1 #cccccc); + background-color: #e2e2e2; margin-bottom: 3px; - border-bottom: 1px solid #ababab; /* selection color */ + border-bottom: 1px solid #ababab; border-top: 1px solid #ababab; border-left: 1px solid #ababab; border-right: 1px solid #ababab; - border-bottom-left-radius: 2px; - border-bottom-right-radius: 2px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:bottom:selected, QDockWidget QTabBar::tab:bottom:selected { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #f0f0f0, stop:0.6 #fdfdfd stop:1 #f0f0f0); + background-color: #f8f8f8; color: black; - border-bottom: 1px solid #ababab; /* selection color */ - border-top: 1px solid #f0f0f0; + border-bottom: 1px solid #ababab; + border-top: 1px solid #f8f8f8; border-left: 1px solid #ababab; border-right: 1px solid #ababab; margin-bottom: 0px; - border-bottom-left-radius: 2px; - border-bottom-right-radius: 2px; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:bottom:!selected:hover, QDockWidget QTabBar::tab:bottom:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #d8d8d8, stop:1 #f0f0f0); - margin-bottom: 0px; + background-color: #f8f8f8; + color: black; + border-bottom: 1px solid #ababab; + border-top: 1px solid #ababab; + border-left: 1px solid #ababab; + border-right: 1px solid #ababab; } QTabBar::tab:left, QDockWidget QTabBar::tab:left { color: #646464; min-height: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #dddddd, stop:0.6 #e2e2e2, stop:1 #cccccc); + background-color: #e2e2e2; margin-left: 3px; - border-bottom: 1px solid #ababab; /* selection color */ + border-bottom: 1px solid #ababab; border-right: 1px solid #ababab; border-left: 1px solid #ababab; border-top: 1px solid #ababab; - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; } QTabBar::tab:left:selected, QDockWidget QTabBar::tab:left:selected { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #f0f0f0, stop:0.6 #fdfdfd stop:1 #f0f0f0); + background-color: #f8f8f8; color: black; - border-bottom: 1px solid #ababab; /* selection color */ + border-bottom: 1px solid #ababab; border-right: 1px solid #f0f0f0; border-left: 1px solid #ababab; border-top: 1px solid #ababab; margin-left: 0px; - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; } QTabBar::tab:left:!selected:hover, QDockWidget QTabBar::tab:left:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #d8d8d8, stop:1 #f0f0f0); - margin-left: 0px; + background-color: #f8f8f8; + color: black; + border-bottom: 1px solid #ababab; + border-top: 1px solid #ababab; + border-left: 1px solid #ababab; + border-right: 1px solid #ababab; } QTabBar::tab:right, QDockWidget QTabBar::tab:right { color: black; min-height: 5px; - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #dddddd, stop:0.6 #e2e2e2, stop:1 #cccccc); + background-color: #e2e2e2; margin-right: 3px; - border-bottom: 1px solid #ababab; /* selection color */ + border-bottom: 1px solid #ababab; border-left: 1px solid #ababab; border-right: 1px solid #ababab; border-top: 1px solid #ababab; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:right:selected, QDockWidget QTabBar::tab:right:selected { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #f0f0f0, stop:0.6 #fdfdfd stop:1 #f0f0f0); + background-color: #f8f8f8; color: black; - border-bottom: 1px solid #ababab; /* selection color */ + border-bottom: 1px solid #ababab; border-left: 1px solid #f0f0f0; border-left: 1px solid #ababab; border-top: 1px solid #ababab; margin-right: 0px; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; } QTabBar::tab:right:!selected:hover, QDockWidget QTabBar::tab:right:!selected:hover { - background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #f0f0f0, stop:1 #d8d8d8); - margin-right: 0px; -} + background-color: #f8f8f8; + color: black; + border-bottom: 1px solid #ababab; + border-top: 1px solid #ababab; + border-left: 1px solid #ababab; + border-right: 1px solid #ababab; + } QTabBar QToolButton, QDockWidget QTabBar QToolButton { /* Fixes #136 */ @@ -2093,19 +2166,19 @@ QTabBar QToolButton:pressed:hover, QDockWidget QTabBar QToolButton:pressed:hover } QTabBar QToolButton::left-arrow:enabled, QDockWidget QTabBar QToolButton::left-arrow:enabled { - image: url(qss:images_classic/Arrow-left-darkgray.png); + image: url(qss:images_classic/arrow-left-darkgray.png); } QTabBar QToolButton::left-arrow:disabled, QDockWidget QTabBar QToolButton::left-arrow:disabled { - image: url(qss:images_classic/Arrow-left-lightgray.png); + image: url(qss:images_classic/arrow-left-lightgray.png); } QTabBar QToolButton::right-arrow:enabled, QDockWidget QTabBar QToolButton::right-arrow:enabled { - image: url(qss:images_classic/Arrow-right-darkgray.png); + image: url(qss:images_classic/arrow-right-darkgray.png); } QTabBar QToolButton::right-arrow:disabled, QDockWidget QTabBar QToolButton::right-arrow:disabled { - image: url(qss:images_classic/Arrow-right-lightgray.png); + image: url(qss:images_classic/arrow-right-lightgray.png); } /* QDockWiget ------------------------------------------------------------- @@ -2193,22 +2266,22 @@ QTreeView::branch:!has-children:!has-siblings:adjoins-item { QTreeView::branch:closed:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-right-black.png); + image: url(qss:images_classic/arrow-right-black.png); } QTreeView::branch:has-children:!has-siblings:closed { border-image: none; - image: url(qss:images_classic/Arrow-right-black.png); + image: url(qss:images_classic/arrow-right-black.png); } QTreeView::branch:open:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-black.png); + image: url(qss:images_classic/arrow-down-black.png); } QTreeView::branch:open:has-children:!has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-black.png) ; + image: url(qss:images_classic/arrow-down-black.png) ; } QTreeView::indicator, @@ -2259,7 +2332,7 @@ QColumnView::indicator:checked:pressed { QListView::indicator:unchecked, QTableView::indicator:unchecked, QColumnView::indicator:unchecked { - image: url(qss:images_classic/checkbox-Empty-black.png); + image: url(qss:images_classic/checkbox-empty-black.png); } */ QTreeView::indicator:unchecked:hover, QTreeView::indicator:unchecked:focus, QTreeView::indicator:unchecked:pressed, @@ -2272,7 +2345,7 @@ QTableView::indicator:unchecked:pressed, QColumnView::indicator:unchecked:hover, QColumnView::indicator:unchecked:focus, QColumnView::indicator:unchecked:pressed { - /* image: url(qss:images_classic/checkbox-Empty-blue.png); */ + /* image: url(qss:images_classic/checkbox-empty-blue.png); */ /* background-color: @ThemeAccentColor1; border: 1px solid #1c1c1c; */ } @@ -2390,6 +2463,7 @@ QHeaderView { background-color: transparent; /* text-align: bottom; */ margin: -1px; /* fix for misalignement*/ + selection-background-color: @ThemeAccentColor1; } QHeaderView:disabled { @@ -2398,18 +2472,33 @@ QHeaderView:disabled { } QHeaderView::section { - background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #f0f0f0, stop:1 #fdfdfd); + background-color: qlineargradient(x1:0, y1:0.3, x2:0, y2:1, stop:0 #fdfdfd, stop:1 #f0f0f0); color: black; - padding: 4px; + /* padding: 1px; */ +} + +QHeaderView::section:hover { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1 #fefefe); +} + +QHeaderView::section:checked, QHeaderView::section:selected { + background-color: @ThemeAccentColor1; /*Does not work currently. */ } QHeaderView::section::horizontal { + selection-background-color: @ThemeAccentColor1; border-bottom: 2px solid #ababab; border-right: 0px solid transparent; border-top: 2px solid #ababab; border-left: 1px solid #ababab; } +QHeaderView::section::horizontal:selected { + background-color: @ThemeAccentColor1; + selection-background-color: @ThemeAccentColor1; +} + + QHeaderView::section::horizontal::first, QHeaderView::section::horizontal::only-one { /* border-left: 0px solid #ababab; */ } @@ -2444,7 +2533,7 @@ QHeaderView::down-arrow { width: 12px; padding-left: 2px; padding-right: 2px; - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); } QHeaderView::up-arrow { @@ -2454,7 +2543,7 @@ QHeaderView::up-arrow { width: 12px; padding-left: 2px; padding-right: 2px; - image: url(qss:images_classic/Arrow-up-lightgray.png); + image: url(qss:images_classic/arrow-up-lightgray.png); } /* QToolBox -------------------------------------------------------------- @@ -2491,7 +2580,7 @@ QToolBox::tab:disabled { } QToolBox::tab:selected { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fefefe, stop:1 #f8f8f8); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1 #fefefe); } QToolBox::tab:selected:disabled { @@ -2509,7 +2598,7 @@ QToolBox::tab:!selected:disabled { } QToolBox::tab:hover { - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #fefefe, stop:1 #f8f8f8); + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffffff, stop:1 #fefefe); } QToolBox > QScrollArea > QWidget > QWidget { @@ -2559,7 +2648,7 @@ https://stackoverflow.com/questions/14581498/qt-stylesheet-for-hline-vline-color https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qsplitter ---------------------------------------------------------------------------*/ -QSplitterHandle:hover { /* to fix bug about hovering on splitters https://bugreports.qt.io/browse/QTBUG-13768 */ +QSplitterHandle:hover { /* to fix bug about hovering on splitters https://bugreports.qt.io/browse/qTBUG-13768 */ } @@ -2620,13 +2709,13 @@ QDateEdit::drop-down, QDateTimeEdit::drop-down { } QDateEdit::down-arrow, QDateTimeEdit::down-arrow { - image: url(qss:images_classic/Arrow-down-lightgray.png); + image: url(qss:images_classic/arrow-down-lightgray.png); height: 8px; width: 8px; } QDateEdit::down-arrow:on, QDateEdit::down-arrow:hover, QDateEdit::down-arrow:focus, QDateTimeEdit::down-arrow:on, QDateTimeEdit::down-arrow:hover, QDateTimeEdit::down-arrow:focus { - image: url(qss:images_classic/Arrow-down-black.png); + image: url(qss:images_classic/arrow-down-black.png); } QDateEdit QAbstractItemView, QDateTimeEdit QAbstractItemView { @@ -2750,22 +2839,22 @@ Settings menu #groupsTreeView: QTreeView::branch#groupsTreeView:closed:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-right-black.png); + image: url(qss:images_classic/arrow-right-black.png); } QTreeView::branch#groupsTreeView:open:has-children:has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-black.png); + image: url(qss:images_classic/arrow-down-black.png); } QTreeView::branch#groupsTreeView:open:has-children:!has-siblings { border-image: none; - image: url(qss:images_classic/Arrow-down-black.png); + image: url(qss:images_classic/arrow-down-black.png); } QTreeView::branch#groupsTreeView:has-children:!has-siblings:closed { border-image: none; - image: url(qss:images_classic/Arrow-right-black.png); + image: url(qss:images_classic/arrow-right-black.png); } QTreeView::branch#groupsTreeView:has-siblings:!adjoins-item { diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-black.png b/src/Gui/Stylesheets/images_classic/arrow-double-leftright-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-black.png rename to src/Gui/Stylesheets/images_classic/arrow-double-leftright-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-blue.png b/src/Gui/Stylesheets/images_classic/arrow-double-leftright-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-double-leftright-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-double-leftright-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-double-leftright-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-double-leftright-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-double-leftright-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-white.png b/src/Gui/Stylesheets/images_classic/arrow-double-leftright-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-LeftRight-white.png rename to src/Gui/Stylesheets/images_classic/arrow-double-leftright-white.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-black.png b/src/Gui/Stylesheets/images_classic/arrow-double-updown-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-black.png rename to src/Gui/Stylesheets/images_classic/arrow-double-updown-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-blue.png b/src/Gui/Stylesheets/images_classic/arrow-double-updown-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-double-updown-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-double-updown-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-double-updown-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-double-updown-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-double-updown-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-white.png b/src/Gui/Stylesheets/images_classic/arrow-double-updown-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-double-UpDown-white.png rename to src/Gui/Stylesheets/images_classic/arrow-double-updown-white.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-down-black.png b/src/Gui/Stylesheets/images_classic/arrow-down-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-down-black.png rename to src/Gui/Stylesheets/images_classic/arrow-down-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-down-blue.png b/src/Gui/Stylesheets/images_classic/arrow-down-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-down-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-down-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-down-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-down-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-down-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-down-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-down-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-down-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-down-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-down-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-down-white.png b/src/Gui/Stylesheets/images_classic/arrow-down-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-down-white.png rename to src/Gui/Stylesheets/images_classic/arrow-down-white.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-left-black.png b/src/Gui/Stylesheets/images_classic/arrow-left-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-left-black.png rename to src/Gui/Stylesheets/images_classic/arrow-left-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-left-blue.png b/src/Gui/Stylesheets/images_classic/arrow-left-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-left-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-left-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-left-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-left-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-left-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-left-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-left-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-left-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-left-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-left-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-left-white.png b/src/Gui/Stylesheets/images_classic/arrow-left-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-left-white.png rename to src/Gui/Stylesheets/images_classic/arrow-left-white.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-leftDown-black.png b/src/Gui/Stylesheets/images_classic/arrow-leftdown-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-leftDown-black.png rename to src/Gui/Stylesheets/images_classic/arrow-leftdown-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-leftDown-blue.png b/src/Gui/Stylesheets/images_classic/arrow-leftdown-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-leftDown-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-leftdown-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-leftDown-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-leftdown-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-leftDown-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-leftdown-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-leftDown-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-leftdown-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-leftDown-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-leftdown-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-leftDown-white.png b/src/Gui/Stylesheets/images_classic/arrow-leftdown-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-leftDown-white.png rename to src/Gui/Stylesheets/images_classic/arrow-leftdown-white.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-right-black.png b/src/Gui/Stylesheets/images_classic/arrow-right-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-right-black.png rename to src/Gui/Stylesheets/images_classic/arrow-right-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-right-blue.png b/src/Gui/Stylesheets/images_classic/arrow-right-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-right-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-right-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-right-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-right-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-right-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-right-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-right-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-right-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-right-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-right-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-right-white.png b/src/Gui/Stylesheets/images_classic/arrow-right-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-right-white.png rename to src/Gui/Stylesheets/images_classic/arrow-right-white.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-rightDown-black.png b/src/Gui/Stylesheets/images_classic/arrow-rightdown-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-rightDown-black.png rename to src/Gui/Stylesheets/images_classic/arrow-rightdown-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-rightDown-blue.png b/src/Gui/Stylesheets/images_classic/arrow-rightdown-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-rightDown-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-rightdown-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-rightDown-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-rightdown-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-rightDown-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-rightdown-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-rightDown-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-rightdown-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-rightDown-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-rightdown-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-rightDown-white.png b/src/Gui/Stylesheets/images_classic/arrow-rightdown-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-rightDown-white.png rename to src/Gui/Stylesheets/images_classic/arrow-rightdown-white.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-up-black.png b/src/Gui/Stylesheets/images_classic/arrow-up-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-up-black.png rename to src/Gui/Stylesheets/images_classic/arrow-up-black.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-up-blue.png b/src/Gui/Stylesheets/images_classic/arrow-up-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-up-blue.png rename to src/Gui/Stylesheets/images_classic/arrow-up-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-up-darkgray.png b/src/Gui/Stylesheets/images_classic/arrow-up-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-up-darkgray.png rename to src/Gui/Stylesheets/images_classic/arrow-up-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-up-lightgray.png b/src/Gui/Stylesheets/images_classic/arrow-up-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-up-lightgray.png rename to src/Gui/Stylesheets/images_classic/arrow-up-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Arrow-up-white.png b/src/Gui/Stylesheets/images_classic/arrow-up-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Arrow-up-white.png rename to src/Gui/Stylesheets/images_classic/arrow-up-white.png diff --git a/src/Gui/Stylesheets/images_classic/checkbox-Empty-black.png b/src/Gui/Stylesheets/images_classic/checkbox-empty-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/checkbox-Empty-black.png rename to src/Gui/Stylesheets/images_classic/checkbox-empty-black.png diff --git a/src/Gui/Stylesheets/images_classic/checkbox-Empty-blue.png b/src/Gui/Stylesheets/images_classic/checkbox-empty-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/checkbox-Empty-blue.png rename to src/Gui/Stylesheets/images_classic/checkbox-empty-blue.png diff --git a/src/Gui/Stylesheets/images_classic/checkbox-Empty-darkgray.png b/src/Gui/Stylesheets/images_classic/checkbox-empty-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/checkbox-Empty-darkgray.png rename to src/Gui/Stylesheets/images_classic/checkbox-empty-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/checkbox-Empty-lightgray.png b/src/Gui/Stylesheets/images_classic/checkbox-empty-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/checkbox-Empty-lightgray.png rename to src/Gui/Stylesheets/images_classic/checkbox-empty-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/checkbox-Empty-white.png b/src/Gui/Stylesheets/images_classic/checkbox-empty-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/checkbox-Empty-white.png rename to src/Gui/Stylesheets/images_classic/checkbox-empty-white.png diff --git a/src/Gui/Stylesheets/images_classic/Close-DarkRed.png b/src/Gui/Stylesheets/images_classic/close-darkred.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Close-DarkRed.png rename to src/Gui/Stylesheets/images_classic/close-darkred.png diff --git a/src/Gui/Stylesheets/images_classic/Close-lightgray.png b/src/Gui/Stylesheets/images_classic/close-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Close-lightgray.png rename to src/Gui/Stylesheets/images_classic/close-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Hmovetoolbar-black.png b/src/Gui/Stylesheets/images_classic/hmovetoolbar-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hmovetoolbar-black.png rename to src/Gui/Stylesheets/images_classic/hmovetoolbar-black.png diff --git a/src/Gui/Stylesheets/images_classic/Hmovetoolbar-blue.png b/src/Gui/Stylesheets/images_classic/hmovetoolbar-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hmovetoolbar-blue.png rename to src/Gui/Stylesheets/images_classic/hmovetoolbar-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Hmovetoolbar-darkgray.png b/src/Gui/Stylesheets/images_classic/hmovetoolbar-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hmovetoolbar-darkgray.png rename to src/Gui/Stylesheets/images_classic/hmovetoolbar-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Hmovetoolbar-lightgray.png b/src/Gui/Stylesheets/images_classic/hmovetoolbar-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hmovetoolbar-lightgray.png rename to src/Gui/Stylesheets/images_classic/hmovetoolbar-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Hmovetoolbar-white.png b/src/Gui/Stylesheets/images_classic/hmovetoolbar-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hmovetoolbar-white.png rename to src/Gui/Stylesheets/images_classic/hmovetoolbar-white.png diff --git a/src/Gui/Stylesheets/images_classic/Hsepartoolbar-black.png b/src/Gui/Stylesheets/images_classic/hsepartoolbar-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hsepartoolbar-black.png rename to src/Gui/Stylesheets/images_classic/hsepartoolbar-black.png diff --git a/src/Gui/Stylesheets/images_classic/Hsepartoolbar-blue.png b/src/Gui/Stylesheets/images_classic/hsepartoolbar-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hsepartoolbar-blue.png rename to src/Gui/Stylesheets/images_classic/hsepartoolbar-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Hsepartoolbar-darkgray.png b/src/Gui/Stylesheets/images_classic/hsepartoolbar-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hsepartoolbar-darkgray.png rename to src/Gui/Stylesheets/images_classic/hsepartoolbar-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Hsepartoolbar-lightgray.png b/src/Gui/Stylesheets/images_classic/hsepartoolbar-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hsepartoolbar-lightgray.png rename to src/Gui/Stylesheets/images_classic/hsepartoolbar-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Hsepartoolbar-white.png b/src/Gui/Stylesheets/images_classic/hsepartoolbar-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Hsepartoolbar-white.png rename to src/Gui/Stylesheets/images_classic/hsepartoolbar-white.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_fold_black.png b/src/Gui/Stylesheets/images_classic/qsint_header_fold_black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_fold_black.png rename to src/Gui/Stylesheets/images_classic/qsint_header_fold_black.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_Fold_Blue-Blue.png b/src/Gui/Stylesheets/images_classic/qsint_header_fold_blue-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_Fold_Blue-Blue.png rename to src/Gui/Stylesheets/images_classic/qsint_header_fold_blue-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_Fold_Blue-dark.png b/src/Gui/Stylesheets/images_classic/qsint_header_fold_blue-dark.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_Fold_Blue-dark.png rename to src/Gui/Stylesheets/images_classic/qsint_header_fold_blue-dark.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_Fold_Blue-light.png b/src/Gui/Stylesheets/images_classic/qsint_header_fold_blue-light.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_Fold_Blue-light.png rename to src/Gui/Stylesheets/images_classic/qsint_header_fold_blue-light.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_fold_darkgray.png b/src/Gui/Stylesheets/images_classic/qsint_header_fold_darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_fold_darkgray.png rename to src/Gui/Stylesheets/images_classic/qsint_header_fold_darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_fold_lightgray.png b/src/Gui/Stylesheets/images_classic/qsint_header_fold_lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_fold_lightgray.png rename to src/Gui/Stylesheets/images_classic/qsint_header_fold_lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_fold_white.png b/src/Gui/Stylesheets/images_classic/qsint_header_fold_white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_fold_white.png rename to src/Gui/Stylesheets/images_classic/qsint_header_fold_white.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_FoldOver_Blue-Blue.png b/src/Gui/Stylesheets/images_classic/qsint_header_foldover_blue-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_FoldOver_Blue-Blue.png rename to src/Gui/Stylesheets/images_classic/qsint_header_foldover_blue-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_FoldOver_Blue-dark.png b/src/Gui/Stylesheets/images_classic/qsint_header_foldover_blue-dark.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_FoldOver_Blue-dark.png rename to src/Gui/Stylesheets/images_classic/qsint_header_foldover_blue-dark.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_FoldOver_Blue-light.png b/src/Gui/Stylesheets/images_classic/qsint_header_foldover_blue-light.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_FoldOver_Blue-light.png rename to src/Gui/Stylesheets/images_classic/qsint_header_foldover_blue-light.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_unfold_black.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfold_black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_unfold_black.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfold_black.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_Unfold_Blue-Blue.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfold_blue-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_Unfold_Blue-Blue.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfold_blue-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_Unfold_Blue-dark.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfold_blue-dark.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_Unfold_Blue-dark.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfold_blue-dark.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_Unfold_Blue-light.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfold_blue-light.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_Unfold_Blue-light.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfold_blue-light.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_unfold_darkgray.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfold_darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_unfold_darkgray.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfold_darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_unfold_lightgray.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfold_lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_unfold_lightgray.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfold_lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_unfold_white.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfold_white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_unfold_white.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfold_white.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_UnFoldOver_Blue-Blue.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfoldover_blue-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_UnFoldOver_Blue-Blue.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfoldover_blue-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_UnfoldOver_Blue-dark.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfoldover_blue-dark.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_UnfoldOver_Blue-dark.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfoldover_blue-dark.png diff --git a/src/Gui/Stylesheets/images_classic/Qsint_header_UnfoldOver_Blue-light.png b/src/Gui/Stylesheets/images_classic/qsint_header_unfoldover_blue-light.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Qsint_header_UnfoldOver_Blue-light.png rename to src/Gui/Stylesheets/images_classic/qsint_header_unfoldover_blue-light.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-checked-black.png b/src/Gui/Stylesheets/images_classic/radio-checked-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-checked-black.png rename to src/Gui/Stylesheets/images_classic/radio-checked-black.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-checked-blue.png b/src/Gui/Stylesheets/images_classic/radio-checked-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-checked-blue.png rename to src/Gui/Stylesheets/images_classic/radio-checked-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-checked-darkgray.png b/src/Gui/Stylesheets/images_classic/radio-checked-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-checked-darkgray.png rename to src/Gui/Stylesheets/images_classic/radio-checked-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-checked-lightgray.png b/src/Gui/Stylesheets/images_classic/radio-checked-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-checked-lightgray.png rename to src/Gui/Stylesheets/images_classic/radio-checked-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-checked-white.png b/src/Gui/Stylesheets/images_classic/radio-checked-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-checked-white.png rename to src/Gui/Stylesheets/images_classic/radio-checked-white.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-unchecked-black.png b/src/Gui/Stylesheets/images_classic/radio-unchecked-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-unchecked-black.png rename to src/Gui/Stylesheets/images_classic/radio-unchecked-black.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-unchecked-blue.png b/src/Gui/Stylesheets/images_classic/radio-unchecked-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-unchecked-blue.png rename to src/Gui/Stylesheets/images_classic/radio-unchecked-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-unchecked-darkgray.png b/src/Gui/Stylesheets/images_classic/radio-unchecked-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-unchecked-darkgray.png rename to src/Gui/Stylesheets/images_classic/radio-unchecked-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-unchecked-lightgray.png b/src/Gui/Stylesheets/images_classic/radio-unchecked-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-unchecked-lightgray.png rename to src/Gui/Stylesheets/images_classic/radio-unchecked-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Radio-unchecked-white.png b/src/Gui/Stylesheets/images_classic/radio-unchecked-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Radio-unchecked-white.png rename to src/Gui/Stylesheets/images_classic/radio-unchecked-white.png diff --git a/src/Gui/Stylesheets/images_classic/Vmovetoolbar-black.png b/src/Gui/Stylesheets/images_classic/vmovetoolbar-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vmovetoolbar-black.png rename to src/Gui/Stylesheets/images_classic/vmovetoolbar-black.png diff --git a/src/Gui/Stylesheets/images_classic/Vmovetoolbar-blue.png b/src/Gui/Stylesheets/images_classic/vmovetoolbar-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vmovetoolbar-blue.png rename to src/Gui/Stylesheets/images_classic/vmovetoolbar-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Vmovetoolbar-darkgray.png b/src/Gui/Stylesheets/images_classic/vmovetoolbar-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vmovetoolbar-darkgray.png rename to src/Gui/Stylesheets/images_classic/vmovetoolbar-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Vmovetoolbar-lightgray.png b/src/Gui/Stylesheets/images_classic/vmovetoolbar-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vmovetoolbar-lightgray.png rename to src/Gui/Stylesheets/images_classic/vmovetoolbar-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Vmovetoolbar-white.png b/src/Gui/Stylesheets/images_classic/vmovetoolbar-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vmovetoolbar-white.png rename to src/Gui/Stylesheets/images_classic/vmovetoolbar-white.png diff --git a/src/Gui/Stylesheets/images_classic/Vsepartoolbar-black.png b/src/Gui/Stylesheets/images_classic/vsepartoolbar-black.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vsepartoolbar-black.png rename to src/Gui/Stylesheets/images_classic/vsepartoolbar-black.png diff --git a/src/Gui/Stylesheets/images_classic/Vsepartoolbar-blue.png b/src/Gui/Stylesheets/images_classic/vsepartoolbar-blue.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vsepartoolbar-blue.png rename to src/Gui/Stylesheets/images_classic/vsepartoolbar-blue.png diff --git a/src/Gui/Stylesheets/images_classic/Vsepartoolbar-darkgray.png b/src/Gui/Stylesheets/images_classic/vsepartoolbar-darkgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vsepartoolbar-darkgray.png rename to src/Gui/Stylesheets/images_classic/vsepartoolbar-darkgray.png diff --git a/src/Gui/Stylesheets/images_classic/Vsepartoolbar-lightgray.png b/src/Gui/Stylesheets/images_classic/vsepartoolbar-lightgray.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vsepartoolbar-lightgray.png rename to src/Gui/Stylesheets/images_classic/vsepartoolbar-lightgray.png diff --git a/src/Gui/Stylesheets/images_classic/Vsepartoolbar-white.png b/src/Gui/Stylesheets/images_classic/vsepartoolbar-white.png similarity index 100% rename from src/Gui/Stylesheets/images_classic/Vsepartoolbar-white.png rename to src/Gui/Stylesheets/images_classic/vsepartoolbar-white.png From f29cc727a7da9d4089f82aacd6481eb47f5229d4 Mon Sep 17 00:00:00 2001 From: Pascal de Bruijn Date: Mon, 13 Jan 2025 18:50:11 +0100 Subject: [PATCH 043/224] TechDraw: fix editable/autofill scale in Templates --- src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_advanced.svg | 2 +- src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg | 2 +- src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_advanced.svg | 2 +- src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg | 2 +- src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_advanced.svg | 2 +- src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg | 2 +- src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_advanced.svg | 2 +- src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg | 2 +- src/Mod/TechDraw/Templates/A3_Landscape_TD.svg | 2 +- src/Mod/TechDraw/Templates/A3_Landscape_m52.svg | 2 +- src/Mod/TechDraw/Templates/A4_Landscape_ISO5457_advanced.svg | 2 +- src/Mod/TechDraw/Templates/A4_Landscape_ISO5457_minimal.svg | 2 +- src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_advanced.svg | 2 +- src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg | 2 +- src/Mod/TechDraw/Templates/ANSIA_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/ANSIA_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/ANSIB.svg | 2 +- src/Mod/TechDraw/Templates/ANSIB_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/ANSIB_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/ANSIC_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/ANSIC_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/ANSID_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/ANSID_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/ANSIE_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/ANSIE_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_A_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_A_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_B_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_B_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_C_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_C_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_D_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_D_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E1_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E1_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E2_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E2_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E3_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E3_Portrait.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E_Landscape.svg | 2 +- src/Mod/TechDraw/Templates/Arch_E_Portrait.svg | 2 +- .../Templates/ISO 5457/ISO7200_titleblock_1_minimal.svg | 2 +- .../Templates/ISO 5457/ISO7200_titleblock_3_advanced.svg | 2 +- .../Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg | 2 +- src/Mod/TechDraw/Templates/USLetter_Landscape.svg | 2 +- .../Templates/locale/ca/A0_Landscape_ISO5457_advanced.svg | 2 +- .../Templates/locale/ca/A0_Landscape_ISO5457_minimal.svg | 2 +- .../Templates/locale/ca/A1_Landscape_ISO5457_advanced.svg | 2 +- .../Templates/locale/ca/A1_Landscape_ISO5457_minimal.svg | 2 +- .../Templates/locale/ca/A2_Landscape_ISO5457_advanced.svg | 2 +- .../Templates/locale/ca/A2_Landscape_ISO5457_minimal.svg | 2 +- .../Templates/locale/ca/A3_Landscape_ISO5457_advanced.svg | 2 +- .../Templates/locale/ca/A3_Landscape_ISO5457_minimal.svg | 2 +- .../Templates/locale/ca/A4_Landscape_ISO5457_advanced.svg | 2 +- .../Templates/locale/ca/A4_Landscape_ISO5457_minimal.svg | 2 +- .../Templates/locale/ca/A4_Portrait_ISO5457_advanced.svg | 2 +- .../Templates/locale/ca/A4_Portrait_ISO5457_minimal.svg | 2 +- .../Templates/locale/zh-CN/landscape/A0_Landscape_CN_CLIP.svg | 2 +- .../locale/zh-CN/landscape/A0_Landscape_CN_NO_CLIP.svg | 2 +- .../Templates/locale/zh-CN/landscape/A1_Landscape_CN_CLIP.svg | 2 +- .../locale/zh-CN/landscape/A1_Landscape_CN_NO_CLIP.svg | 2 +- .../Templates/locale/zh-CN/landscape/A2_Landscape_CN_CLIP.svg | 2 +- .../locale/zh-CN/landscape/A2_Landscape_CN_NO_CLIP.svg | 2 +- .../Templates/locale/zh-CN/landscape/A3_Landscape_CN_CLIP.svg | 2 +- .../locale/zh-CN/landscape/A3_Landscape_CN_NO_CLIP.svg | 2 +- .../Templates/locale/zh-CN/landscape/A4_Landscape_CN_CLIP.svg | 2 +- .../locale/zh-CN/landscape/A4_Landscape_CN_NO_CLIP.svg | 2 +- .../Templates/locale/zh-CN/portrait/A3_Portrait_CN_CLIP.svg | 2 +- .../Templates/locale/zh-CN/portrait/A4_Portrait_CN_CLIP.svg | 2 +- 69 files changed, 69 insertions(+), 69 deletions(-) diff --git a/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_advanced.svg b/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_advanced.svg index 15a4a83112..c634c33aa7 100644 --- a/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_advanced.svg +++ b/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_advanced.svg @@ -254,7 +254,7 @@ A. Nemesis Component Drawing In preparation - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg index a9dcbe35f6..7a82383fd7 100644 --- a/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg @@ -246,7 +246,7 @@ B. Hecate A. Nemesis Component Drawing - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_advanced.svg b/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_advanced.svg index a6c72cebc2..53b25186f0 100644 --- a/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_advanced.svg +++ b/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_advanced.svg @@ -206,7 +206,7 @@ A. Nemesis Component Drawing In preparation - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg index 7f9ff8d529..66f0ca4c3e 100644 --- a/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg @@ -199,7 +199,7 @@ B. Hecate A. Nemesis Component Drawing - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_advanced.svg b/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_advanced.svg index 07dc9eeb44..550734668f 100644 --- a/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_advanced.svg +++ b/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_advanced.svg @@ -174,7 +174,7 @@ A. Nemesis Component Drawing In preparation - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg index 042afeb12f..04bc82b06e 100644 --- a/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg @@ -166,7 +166,7 @@ B. Hecate A. Nemesis Component Drawing - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_advanced.svg b/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_advanced.svg index b68aa4e837..071ff3c0eb 100644 --- a/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_advanced.svg +++ b/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_advanced.svg @@ -150,7 +150,7 @@ A. Nemesis Component Drawing In preparation - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg index 3dcede74b4..f6b95768f5 100644 --- a/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg @@ -142,7 +142,7 @@ B. Hecate A. Nemesis Component Drawing - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg b/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg index fc308d9234..cf981c1026 100644 --- a/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg +++ b/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg @@ -886,7 +886,7 @@ x="220.65581" y="278.57715" style="line-height:0%" - freecad:editable="FC-Scale" + freecad:editable="scale" freecad:autofill="scale">SCALE A. Nemesis Component Drawing In preparation - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A4_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A4_Landscape_ISO5457_minimal.svg index 5ed374a717..5324d213be 100644 --- a/src/Mod/TechDraw/Templates/A4_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A4_Landscape_ISO5457_minimal.svg @@ -117,7 +117,7 @@ B. Hecate A. Nemesis Component Drawing - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_advanced.svg b/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_advanced.svg index 9cedb10d4a..034abea592 100644 --- a/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_advanced.svg +++ b/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_advanced.svg @@ -125,7 +125,7 @@ A. Nemesis Component Drawing In preparation - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg index bb47614039..617dc8a078 100644 --- a/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg @@ -117,7 +117,7 @@ B. Hecate A. Nemesis Component Drawing - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg b/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg index 386bc61f17..c9eba5a968 100644 --- a/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg +++ b/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg @@ -58,7 +58,7 @@ Checked By Approved 1 Approved 2 - Scale + Scale Code A Weight diff --git a/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg b/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg index 7be177ed56..6147891942 100644 --- a/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg +++ b/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg @@ -46,7 +46,7 @@ Checked By Approved 1 Approved 2 - Scale + Scale Code A Weight diff --git a/src/Mod/TechDraw/Templates/ANSIB.svg b/src/Mod/TechDraw/Templates/ANSIB.svg index 8e802f5745..82190e68e5 100644 --- a/src/Mod/TechDraw/Templates/ANSIB.svg +++ b/src/Mod/TechDraw/Templates/ANSIB.svg @@ -689,7 +689,7 @@ letter-spacing="0px" word-spacing="0px" style="line-height:0%" - freecad:editable="Scale">Scale diff --git a/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg b/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg index 68aff6d525..979fdfb462 100644 --- a/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg +++ b/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg @@ -638,7 +638,7 @@ letter-spacing="0px" word-spacing="0px" style="line-height:0%" - freecad:editable="Scale" + freecad:editable="scale" freecad:autofill="scale">SUPERVISOR NAME CHECK DATE ANSI C - SCALE + SCALE WEIGHT NUMBER SHEET diff --git a/src/Mod/TechDraw/Templates/ANSIC_Portrait.svg b/src/Mod/TechDraw/Templates/ANSIC_Portrait.svg index 3c4a7bcd2c..a1ed6eabce 100644 --- a/src/Mod/TechDraw/Templates/ANSIC_Portrait.svg +++ b/src/Mod/TechDraw/Templates/ANSIC_Portrait.svg @@ -917,7 +917,7 @@ stroke-width=".10827" word-spacing="0px" style="line-height:125%" - freecad:editable="SCALE" + freecad:editable="scale" freecad:autofill="scale">B. Hecate A. Nemesis Component Drawing - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_3_advanced.svg b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_3_advanced.svg index 896e450b72..4ecb54ea65 100644 --- a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_3_advanced.svg +++ b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_3_advanced.svg @@ -81,7 +81,7 @@ A. Nemesis Component Drawing In preparation - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg index f64f7184f9..681bea4ac2 100644 --- a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg +++ b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg @@ -95,7 +95,7 @@ In preparation X / Y A3 - 1 : 1 + 1 : 1 ISO 2768-m Stainless steel Mat.No. 1.4301 diff --git a/src/Mod/TechDraw/Templates/USLetter_Landscape.svg b/src/Mod/TechDraw/Templates/USLetter_Landscape.svg index 12f9370913..310f48cd99 100644 --- a/src/Mod/TechDraw/Templates/USLetter_Landscape.svg +++ b/src/Mod/TechDraw/Templates/USLetter_Landscape.svg @@ -685,7 +685,7 @@ letter-spacing="0px" word-spacing="0px" style="line-height:0%" - freecad:editable="Scale">1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 1 : 1 审核人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A0_Landscape_CN_NO_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A0_Landscape_CN_NO_CLIP.svg index da72c542b0..236137c112 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A0_Landscape_CN_NO_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A0_Landscape_CN_NO_CLIP.svg @@ -234,7 +234,7 @@ 审核人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_CLIP.svg index 06425ae3a5..a37ddbbb28 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_CLIP.svg @@ -214,7 +214,7 @@ 审核人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_NO_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_NO_CLIP.svg index 6badbb3524..fd3a22bd43 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_NO_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A1_Landscape_CN_NO_CLIP.svg @@ -213,7 +213,7 @@ 审核人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_CLIP.svg index e613f77362..9f697127bd 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_CLIP.svg @@ -196,7 +196,7 @@ 审核人 99 1 - M x:x + M x:x 重量 diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_NO_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_NO_CLIP.svg index 2b6efefc8c..982824adfc 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_NO_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A2_Landscape_CN_NO_CLIP.svg @@ -187,7 +187,7 @@ 审核人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_CLIP.svg index 7cd5a6fbf5..f3da9ec5f9 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_CLIP.svg @@ -253,7 +253,7 @@ 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_NO_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_NO_CLIP.svg index b5811e0b53..d2c2f6d2e0 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_NO_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A3_Landscape_CN_NO_CLIP.svg @@ -171,7 +171,7 @@ 批准人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_CLIP.svg index d843355fcf..c800d62846 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_CLIP.svg @@ -219,7 +219,7 @@ 评审人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_NO_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_NO_CLIP.svg index 1913b976b3..6b17c03dcd 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_NO_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/landscape/A4_Landscape_CN_NO_CLIP.svg @@ -152,7 +152,7 @@ 评审人 99 1 - M x:x + M x:x 重量 diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A3_Portrait_CN_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A3_Portrait_CN_CLIP.svg index 7d95618751..72f78457bc 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A3_Portrait_CN_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A3_Portrait_CN_CLIP.svg @@ -265,7 +265,7 @@ 评审人 99 1 - M x:x + M x:x diff --git a/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A4_Portrait_CN_CLIP.svg b/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A4_Portrait_CN_CLIP.svg index bf4503b362..b6b2e85d83 100644 --- a/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A4_Portrait_CN_CLIP.svg +++ b/src/Mod/TechDraw/Templates/locale/zh-CN/portrait/A4_Portrait_CN_CLIP.svg @@ -234,7 +234,7 @@ 1 - M x:x + M x:x From 28f18ded8596583ce10212addd6321c1b195e459 Mon Sep 17 00:00:00 2001 From: tritao Date: Sat, 18 Jan 2025 13:12:42 +0000 Subject: [PATCH 044/224] Gui: Fix invalid scene graph mutation in `EditableDatumLabel`. `EditableDatumLabel` uses `activate`/`deactivate` methods for showing or hiding its widgets in the scene. However, `activate`/`deactivate` methods can end up being called as part of a scene graph / Coin action (`SoAction`) handler, in the context of `SoFCUnifiedSelection`, and this ended up in a Coin warning and eventual crash due to the scene graph being manipulated (nodes being removed), which Coin has checks for in debug mode: ``` Coin error in SoGroup::removeChild(): tried to remove non-existent child 0x5555579c5290 (Annotation) ``` Fix this issue by using a `SoSwitch` node instead and by controling the child visibility using it instead. --- src/Gui/EditableDatumLabel.cpp | 22 ++++++++++++++-------- src/Gui/EditableDatumLabel.h | 5 ++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Gui/EditableDatumLabel.cpp b/src/Gui/EditableDatumLabel.cpp index bca2b209b2..5fa800935e 100644 --- a/src/Gui/EditableDatumLabel.cpp +++ b/src/Gui/EditableDatumLabel.cpp @@ -27,6 +27,7 @@ # include # include # include +# include #endif // _PreComp_ #include @@ -60,13 +61,17 @@ EditableDatumLabel::EditableDatumLabel(View3DInventorViewer* view, , function(Function::Positioning) { // NOLINTBEGIN - root = new SoAnnotation; + root = new SoSwitch; root->ref(); - root->renderCaching = SoSeparator::OFF; + + annotation = new SoAnnotation; + annotation->ref(); + annotation->renderCaching = SoSeparator::OFF; + root->addChild(annotation); transform = new SoTransform(); transform->ref(); - root->addChild(transform); + annotation->addChild(transform); label = new SoDatumLabel(); label->ref(); @@ -82,16 +87,19 @@ EditableDatumLabel::EditableDatumLabel(View3DInventorViewer* view, if (autoDistance) { setLabelRecommendedDistance(); } - root->addChild(label); + annotation->addChild(label); setPlacement(plc); // NOLINTEND + + static_cast(viewer->getSceneGraph())->addChild(root); // NOLINT } EditableDatumLabel::~EditableDatumLabel() { deactivate(); transform->unref(); + annotation->unref(); root->unref(); label->unref(); } @@ -102,7 +110,7 @@ void EditableDatumLabel::activate() return; } - static_cast(viewer->getSceneGraph())->addChild(root); // NOLINT + root->whichChild = 0; //track camera movements to update spinbox position. auto info = new NodeData{ this }; @@ -129,9 +137,7 @@ void EditableDatumLabel::deactivate() cameraSensor = nullptr; } - if (viewer) { - static_cast(viewer->getSceneGraph())->removeChild(root); // NOLINT - } + root->whichChild = SO_SWITCH_NONE; } void EditableDatumLabel::startEdit(double val, QObject* eventFilteringObj, bool visibleToMouse) diff --git a/src/Gui/EditableDatumLabel.h b/src/Gui/EditableDatumLabel.h index 80d6bffe06..ea224ff31a 100644 --- a/src/Gui/EditableDatumLabel.h +++ b/src/Gui/EditableDatumLabel.h @@ -34,6 +34,8 @@ class SoNodeSensor; class SoTransform; +class SoAnnotation; +class SoSwitch; namespace Gui { @@ -97,7 +99,8 @@ private: SbVec3f getTextCenterPoint() const; private: - SoSeparator* root; + SoSwitch* root; + SoAnnotation* annotation; SoTransform* transform; QPointer viewer; QuantitySpinBox* spinBox; From b7dc993ebe5f9f69b94937d75a50292d9cecdc27 Mon Sep 17 00:00:00 2001 From: Stan Tomlinson Date: Thu, 9 Jan 2025 19:02:25 -0500 Subject: [PATCH 045/224] improved checks in GUI/Jobs.py/claimChildren eliminate some error messages when a Job is not fully loaded (or when not properly constructed via scripting) TESTED ON V0.21 -- code hasn't changed since then --- src/Mod/CAM/Path/Main/Gui/Job.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/CAM/Path/Main/Gui/Job.py b/src/Mod/CAM/Path/Main/Gui/Job.py index 4499d992b6..e5f9e2f060 100644 --- a/src/Mod/CAM/Path/Main/Gui/Job.py +++ b/src/Mod/CAM/Path/Main/Gui/Job.py @@ -265,13 +265,14 @@ class ViewProvider: def claimChildren(self): children = [] - children.append(self.obj.Operations) + if hasattr(self.obj, "Operations"): + children.append(self.obj.Operations) if hasattr(self.obj, "Model"): # unfortunately this function is called before the object has been fully loaded # which means we could be dealing with an old job which doesn't have the new Model # yet. children.append(self.obj.Model) - if self.obj.Stock: + if hasattr(self.obj, "Stock"): children.append(self.obj.Stock) if hasattr(self.obj, "SetupSheet"): # when loading a job that didn't have a setup sheet they might not've been created yet From 3ac01778f7a5fdee9911a03e137e8c8ea768f76d Mon Sep 17 00:00:00 2001 From: Dan Taylor Date: Sat, 11 Jan 2025 18:09:55 -0600 Subject: [PATCH 046/224] TechDraw: Fix finding outlines consisting of a single closed edge --- src/Mod/TechDraw/App/AppTechDrawPy.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp index 05c3a7f919..6bae70d4b3 100644 --- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp +++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp @@ -270,6 +270,8 @@ private: std::vector closedEdges; edgeList = DrawProjectSplit::scrubEdges(edgeList, closedEdges); + // Need to also check closed edges- those are valid wires + edgeList.insert( edgeList.end(), closedEdges.begin(), closedEdges.end() ); std::vector sortedWires; try { @@ -326,6 +328,8 @@ private: std::vector closedEdges; edgeList = DrawProjectSplit::scrubEdges(edgeList, closedEdges); + // Need to also check closed edges, since that may be the outline + edgeList.insert( edgeList.end(), closedEdges.begin(), closedEdges.end() ); PyObject* outerWire = nullptr; std::vector sortedWires; @@ -389,6 +393,8 @@ private: std::vector closedEdges; edgeList = DrawProjectSplit::scrubEdges(edgeList, closedEdges); + // Need to also check closed edges, since that may be the outline + edgeList.insert( edgeList.end(), closedEdges.begin(), closedEdges.end() ); PyObject* outerWire = nullptr; std::vector sortedWires; From d72124f86a7865899e4d144492d6a909da1717d7 Mon Sep 17 00:00:00 2001 From: marcuspollio Date: Thu, 23 Jan 2025 18:28:54 +0100 Subject: [PATCH 047/224] TechDraw: rename user-facing strings Arch to BIM --- src/Mod/BIM/bimcommands/BimTDView.py | 2 +- src/Mod/TechDraw/App/DrawView.cpp | 2 +- src/Mod/TechDraw/App/DrawViewArch.cpp | 4 ++-- src/Mod/TechDraw/Gui/Command.cpp | 22 ++++++++++------------ 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Mod/BIM/bimcommands/BimTDView.py b/src/Mod/BIM/bimcommands/BimTDView.py index c3d1230d01..a80c0819d4 100644 --- a/src/Mod/BIM/bimcommands/BimTDView.py +++ b/src/Mod/BIM/bimcommands/BimTDView.py @@ -77,7 +77,7 @@ class BIM_TDView: FreeCAD.ActiveDocument.openTransaction("Create view") for section in sections: view = FreeCAD.ActiveDocument.addObject( - "TechDraw::DrawViewArch", "ArchView" + "TechDraw::DrawViewArch", "BIM view" ) view.Label = section.Label view.Source = section diff --git a/src/Mod/TechDraw/App/DrawView.cpp b/src/Mod/TechDraw/App/DrawView.cpp index f1fcda1ca6..07faf0bcfc 100644 --- a/src/Mod/TechDraw/App/DrawView.cpp +++ b/src/Mod/TechDraw/App/DrawView.cpp @@ -65,7 +65,7 @@ using DU = DrawUtil; QT_TRANSLATE_NOOP("DrawViewAnnotation", "Annotation"); QT_TRANSLATE_NOOP("DrawViewImage", "Image"); QT_TRANSLATE_NOOP("DrawViewSymbol", "Symbol"); - QT_TRANSLATE_NOOP("DrawViewArch", "Arch"); + QT_TRANSLATE_NOOP("DrawViewArch", "BIM"); QT_TRANSLATE_NOOP("DrawViewDraft", "Draft"); QT_TRANSLATE_NOOP("DrawLeaderLine", "LeaderLine"); QT_TRANSLATE_NOOP("DrawViewBalloon", "Balloon"); diff --git a/src/Mod/TechDraw/App/DrawViewArch.cpp b/src/Mod/TechDraw/App/DrawViewArch.cpp index 62726a3449..e5366bddfb 100644 --- a/src/Mod/TechDraw/App/DrawViewArch.cpp +++ b/src/Mod/TechDraw/App/DrawViewArch.cpp @@ -49,14 +49,14 @@ const char* DrawViewArch::RenderModeEnums[]= {"Wireframe", DrawViewArch::DrawViewArch() { - static const char *group = "Arch view"; + static const char *group = "BIM view"; ADD_PROPERTY_TYPE(Source ,(nullptr), group, App::Prop_None, "SectionPlane or BuildingPart object for this view"); Source.setScope(App::LinkScope::Global); ADD_PROPERTY_TYPE(AllOn ,(false), group, App::Prop_None, "If hidden objects must be shown or not"); RenderMode.setEnums(RenderModeEnums); ADD_PROPERTY_TYPE(RenderMode, ((long)0), group, App::Prop_None, "The render mode to use"); - ADD_PROPERTY_TYPE(FillSpaces ,(false), group, App::Prop_None, "If True, Arch Spaces are shown as a colored area"); + ADD_PROPERTY_TYPE(FillSpaces ,(false), group, App::Prop_None, "If True, BIM Spaces are shown as a colored area"); ADD_PROPERTY_TYPE(ShowHidden ,(false), group, App::Prop_None, "If the hidden geometry behind the section plane is shown or not"); ADD_PROPERTY_TYPE(ShowFill ,(false), group, App::Prop_None, "If cut areas must be filled with a hatch pattern or not"); ADD_PROPERTY_TYPE(LineWidth, (0.25), group, App::Prop_None, "Line width of this view"); diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 3d4bd35ebf..db5e246c48 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -303,7 +303,7 @@ CmdTechDrawView::CmdTechDrawView() : Command("TechDraw_View") sGroup = QT_TR_NOOP("TechDraw"); sMenuText = QT_TR_NOOP("Insert View"); sToolTipText = QT_TR_NOOP("Insert a View in current page.\n" - "Selected objects, spreadsheets or Arch WB section planes will be added.\n" + "Selected objects, spreadsheets or BIM section planes will be added.\n" "Without a selection, a file browser lets you select a SVG or image file."); sWhatsThis = "TechDraw_View"; sStatusTip = sToolTipText; @@ -360,12 +360,12 @@ void CmdTechDrawView::activated(int iMsg) continue; } else if (DrawGuiUtil::isArchSection(obj)) { - std::string FeatName = getUniqueObjectName("ArchView"); + std::string FeatName = getUniqueObjectName("BIM view"); std::string SourceName = obj->getNameInDocument(); - openCommand(QT_TRANSLATE_NOOP("Command", "Create BIM View")); + openCommand(QT_TRANSLATE_NOOP("Command", "Create BIM view")); doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewArch', '%s')", FeatName.c_str()); - doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewArch', 'ArchView', '%s')", + doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewArch', 'BIM view', '%s')", FeatName.c_str(), FeatName.c_str()); doCommand(Doc, "App.activeDocument().%s.Source = App.activeDocument().%s", FeatName.c_str(), SourceName.c_str()); @@ -1661,7 +1661,7 @@ CmdTechDrawArchView::CmdTechDrawArchView() : Command("TechDraw_ArchView") // setting the Gui eye-candy sGroup = QT_TR_NOOP("TechDraw"); sMenuText = QT_TR_NOOP("Insert BIM Workbench Object"); - sToolTipText = QT_TR_NOOP("Insert a View of a Section Plane from BIM Workbench"); + sToolTipText = QT_TR_NOOP("Insert a View of a BIM Workbench section plane"); sWhatsThis = "TechDraw_NewArch"; sStatusTip = sToolTipText; sPixmap = "actions/TechDraw_ArchView"; @@ -1688,13 +1688,13 @@ void CmdTechDrawArchView::activated(int iMsg) } if (archCount > 1) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("Please select only 1 BIM Section.")); + QObject::tr("Please select only 1 BIM section plane.")); return; } if (!archObject) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), - QObject::tr("No BIM Sections in selection.")); + QObject::tr("No BIM section plane in selection.")); return; } @@ -1704,12 +1704,12 @@ void CmdTechDrawArchView::activated(int iMsg) } std::string PageName = page->getNameInDocument(); - std::string FeatName = getUniqueObjectName("ArchView"); + std::string FeatName = getUniqueObjectName("BIM view"); std::string SourceName = archObject->getNameInDocument(); - openCommand(QT_TRANSLATE_NOOP("Command", "Create ArchView")); + openCommand(QT_TRANSLATE_NOOP("Command", "Create BIM view")); doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewArch', '%s')", FeatName.c_str()); - doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewArch', 'ArchView', '%s')", + doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewArch', 'BIM view', '%s')", FeatName.c_str(), FeatName.c_str()); doCommand(Doc, "App.activeDocument().%s.Source = App.activeDocument().%s", FeatName.c_str(), SourceName.c_str()); @@ -2058,5 +2058,3 @@ std::pair faceFromSelection() return { nullptr, "" }; } - - From 2694dc85cf599e6a265e61854d3d0d4b5a8b3d3a Mon Sep 17 00:00:00 2001 From: mwganson Date: Tue, 14 Jan 2025 20:39:03 -0600 Subject: [PATCH 048/224] [VectorListEditor] Set precision to 12 digits when copying table data --- src/Gui/VectorListEditor.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Gui/VectorListEditor.cpp b/src/Gui/VectorListEditor.cpp index cb181b6893..7b43f63167 100644 --- a/src/Gui/VectorListEditor.cpp +++ b/src/Gui/VectorListEditor.cpp @@ -26,6 +26,7 @@ #include "ui_VectorListEditor.h" #include "QuantitySpinBox.h" +#include #include #include @@ -142,11 +143,14 @@ void Gui::VectorTableModel::copyToClipboard() const { QString clipboardText; QTextStream stream(&clipboardText); + int precision = App::GetApplication() + .GetParameterGroupByPath("User parameter:BaseApp/Preferences/Units") + ->GetInt("PropertyVectorListCopyPrecision", 16); for (const auto& vector : vectors) { - stream << QString::number(vector.x, 'f', decimals) << '\t' - << QString::number(vector.y, 'f', decimals) << '\t' - << QString::number(vector.z, 'f', decimals) << '\n'; + stream << QString::number(vector.x, 'f', precision) << '\t' + << QString::number(vector.y, 'f', precision) << '\t' + << QString::number(vector.z, 'f', precision) << '\n'; } QApplication::clipboard()->setText(clipboardText); From c16f04fdc84bb4f3db176c035f69368392be25a0 Mon Sep 17 00:00:00 2001 From: Lawrence Woestman Date: Sun, 15 Dec 2024 15:05:42 -0800 Subject: [PATCH 049/224] CAM: Fixed script-style postprocessors getting the wrong __name__ Also added a test that the __name__ of the postprocessor is correct --- src/Mod/CAM/CAMTests/TestPathPost.py | 11 ++++++++--- src/Mod/CAM/Path/Post/Processor.py | 9 +++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Mod/CAM/CAMTests/TestPathPost.py b/src/Mod/CAM/CAMTests/TestPathPost.py index 02a53cb5e4..65ae363723 100644 --- a/src/Mod/CAM/CAMTests/TestPathPost.py +++ b/src/Mod/CAM/CAMTests/TestPathPost.py @@ -360,6 +360,11 @@ class TestPostProcessorFactory(unittest.TestCase): self.assertTrue(post is not None) self.assertTrue(hasattr(post, "_buildPostList")) + def test040(self): + """Test that the __name__ of the postprocessor is correct.""" + post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc") + self.assertEqual(post.script_module.__name__, "linuxcnc_post") + class TestPostProcessorClass(unittest.TestCase): """Test new post structure objects.""" @@ -383,21 +388,21 @@ class TestPostProcessorClass(unittest.TestCase): def test010(self): """Test the export function.""" - post = PostProcessorFactory.get_post_processor(job, "linuxcnc") + post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc") sections = post.export() for sec in sections: print(sec[0]) def test020(self): """Test the export function with splitting.""" - post = PostProcessorFactory.get_post_processor(job, "linuxcnc") + post = PostProcessorFactory.get_post_processor(self.job, "linuxcnc") sections = post.export() for sec in sections: print(sec[0]) def test030(self): """Test the export function with splitting.""" - post = PostProcessorFactory.get_post_processor(job, "generic") + post = PostProcessorFactory.get_post_processor(self.job, "generic") sections = post.export() for sec in sections: print(sec[0]) diff --git a/src/Mod/CAM/Path/Post/Processor.py b/src/Mod/CAM/Path/Post/Processor.py index a643acfd75..9d52b5a0ed 100644 --- a/src/Mod/CAM/Path/Post/Processor.py +++ b/src/Mod/CAM/Path/Post/Processor.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # *************************************************************************** # * Copyright (c) 2014 Yorik van Havre * +# * Copyright (c) 2024 Larry Woestman * # * * # * This program is free software; you can redistribute it and/or modify * # * it under the terms of the GNU Lesser General Public License (LGPL) * @@ -58,7 +59,6 @@ class PostProcessorFactory: Path.Log.debug("PostProcessorFactory.get_post_processor()") # Posts have to be in a place we can find them - syspath = sys.path paths = Path.Preferences.searchPathsPost() paths.extend(sys.path) @@ -85,7 +85,7 @@ class PostProcessorFactory: except AttributeError: # Return an instance of WrapperPost if no valid module is found Path.Log.debug(f"Post processor {postname} is a script") - return WrapperPost(job, module_path) + return WrapperPost(job, module_path, module_name) class PostProcessor: @@ -283,16 +283,17 @@ class PostProcessor: class WrapperPost(PostProcessor): """Wrapper class for old post processors that are scripts.""" - def __init__(self, job, script_path, *args, **kwargs): + def __init__(self, job, script_path, module_name, *args, **kwargs): super().__init__(job, tooltip=None, tooltipargs=None, units=None, *args, **kwargs) self.script_path = script_path + self.module_name = module_name Path.Log.debug(f"WrapperPost.__init__({script_path})") self.load_script() def load_script(self): """Dynamically load the script as a module.""" try: - spec = importlib.util.spec_from_file_location("script_module", self.script_path) + spec = importlib.util.spec_from_file_location(self.module_name, self.script_path) self.script_module = importlib.util.module_from_spec(spec) spec.loader.exec_module(self.script_module) except Exception as e: From 503e5dd091aabc1909c975905a5db3914180e483 Mon Sep 17 00:00:00 2001 From: phaseloop <90922095+phaseloop@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:03:43 +0100 Subject: [PATCH 050/224] CAM: Fix finishing pass (#17960) * CAM: Fix finishing pass * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add finishing pass unit (by @baehr) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Mod/CAM/CAMTests/TestPathVcarve.py | 30 ++++++++++++++++++++++++++ src/Mod/CAM/Path/Op/Vcarve.py | 11 ++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/Mod/CAM/CAMTests/TestPathVcarve.py b/src/Mod/CAM/CAMTests/TestPathVcarve.py index 42ddbf3509..f1beb771a9 100644 --- a/src/Mod/CAM/CAMTests/TestPathVcarve.py +++ b/src/Mod/CAM/CAMTests/TestPathVcarve.py @@ -21,6 +21,8 @@ # *************************************************************************** import FreeCAD +import Part +import Path.Main.Job as PathJob import Path.Op.Vcarve as PathVcarve import Path.Tool.Bit as PathToolBit import math @@ -44,6 +46,34 @@ Scale60 = math.sqrt(3) class TestPathVcarve(PathTestBase): """Test Vcarve milling basics.""" + def tearDown(self): + if hasattr(self, "doc"): + FreeCAD.closeDocument(self.doc.Name) + + def testFinishingPass(self): + self.doc = FreeCAD.newDocument() + part = FreeCAD.ActiveDocument.addObject("Part::Feature", "TestShape") + rect = Part.makePolygon([(0, 0, 0), (5, 0, 0), (5, 10, 0), (0, 10, 0), (0, 0, 0)]) + part.Shape = Part.makeFace(rect, "Part::FaceMakerSimple") + job = PathJob.Create("Job", [part]) + tool_file = PathToolBit.findToolBit("60degree_Vbit.fctb") + job.Tools.Group[0].Tool = PathToolBit.Factory.CreateFrom(tool_file) + + op = PathVcarve.Create("TestVCarve") + op.Base = job.Model.Group[0] + + op.FinishingPass = False + op.Proxy.execute(op) + min_z_no_finish = op.Path.BoundBox.ZMin + + finishing_offset = -0.1 + op.FinishingPass = True + op.FinishingPassZOffset = finishing_offset + op.Proxy.execute(op) + min_z_with_finish = op.Path.BoundBox.ZMin + + self.assertRoughly(min_z_with_finish - min_z_no_finish, finishing_offset) + def test00(self): """Verify 90 deg depth calculation""" tool = VbitTool(10, 90, 0) diff --git a/src/Mod/CAM/Path/Op/Vcarve.py b/src/Mod/CAM/Path/Op/Vcarve.py index 527efd0509..179c6799a7 100644 --- a/src/Mod/CAM/Path/Op/Vcarve.py +++ b/src/Mod/CAM/Path/Op/Vcarve.py @@ -505,15 +505,12 @@ class ObjectVcarve(PathEngraveBase.ObjectOp): while geom.incrementStepDownDepth(maximumUsableDepth): cutWires(wires, pathlist, obj.OptimizeMovements) - # add finishing pass if enabled + # add finishing pass if enabled - # if obj.FinishingPass: - # geom.offset = obj.FinishingPassZOffset.Value + if obj.FinishingPass: + geom.offset = obj.FinishingPassZOffset.Value - # for w in wires: - # pWire = self._getPartEdges(obj, w, geom) - # if pWire: - # pathlist.extend(cutWire(pWire)) + cutWires(wires, pathlist, obj.OptimizeMovements) self.commandlist = pathlist From 6ce57a58e09f730b9dc1d098a3ffad3b84a1a5e3 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Sun, 26 Jan 2025 10:06:49 -0300 Subject: [PATCH 051/224] refactor: taskpanel ui on linux --- src/Gui/QSint/actionpanel/actionpanel.cpp | 2 +- src/Gui/QSint/actionpanel/freecadscheme.cpp | 215 +++++++++----------- src/Gui/QSint/actionpanel/freecadscheme.h | 2 +- 3 files changed, 102 insertions(+), 117 deletions(-) diff --git a/src/Gui/QSint/actionpanel/actionpanel.cpp b/src/Gui/QSint/actionpanel/actionpanel.cpp index 2c01e08a72..3a7b706379 100644 --- a/src/Gui/QSint/actionpanel/actionpanel.cpp +++ b/src/Gui/QSint/actionpanel/actionpanel.cpp @@ -26,7 +26,7 @@ ActionPanel::ActionPanel(QWidget *parent) : setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); QVBoxLayout *vbl = new QVBoxLayout(); - vbl->setContentsMargins(8, 8, 8, 8); + vbl->setContentsMargins(4, 8, 4, 8); vbl->setSpacing(8); setLayout(vbl); } diff --git a/src/Gui/QSint/actionpanel/freecadscheme.cpp b/src/Gui/QSint/actionpanel/freecadscheme.cpp index 6340493a86..74a3db76c8 100644 --- a/src/Gui/QSint/actionpanel/freecadscheme.cpp +++ b/src/Gui/QSint/actionpanel/freecadscheme.cpp @@ -202,13 +202,11 @@ SystemPanelScheme::SystemPanelScheme() headerAnimation = true; QPalette p = QApplication::palette(); - QPalette p2 = p; - p2.setColor(QPalette::Highlight,p2.color(QPalette::Highlight).lighter()); - headerButtonFold = drawFoldIcon(p, true); - headerButtonFoldOver = drawFoldIcon(p2, true); - headerButtonUnfold = drawFoldIcon(p, false); - headerButtonUnfoldOver = drawFoldIcon(p2, false); + headerButtonFold = drawFoldIcon(p, true, false); + headerButtonFoldOver = drawFoldIcon(p, true, true); + headerButtonUnfold = drawFoldIcon(p, false, false); + headerButtonUnfoldOver = drawFoldIcon(p, false, true); headerButtonSize = QSize(17,17); groupFoldSteps = 20; @@ -219,134 +217,121 @@ SystemPanelScheme::SystemPanelScheme() actionStyle = systemStyle(QApplication::palette()); } -/*! - \code - QPalette p = QApplication::palette(); - QPalette p2 = p; - p2.setColor(QPalette::Highlight,p2.color(QPalette::Highlight).lighter()); - headerButtonFold = drawFoldIcon(p, true); - headerButtonFoldOver = drawFoldIcon(p2, true); - headerButtonUnfold = drawFoldIcon(p, false); - headerButtonUnfoldOver = drawFoldIcon(p2, false); - \endcode - */ -QPixmap SystemPanelScheme::drawFoldIcon(const QPalette& p, bool fold) const +QPixmap SystemPanelScheme::drawFoldIcon(const QPalette& palette, bool fold, bool hover) const { - QImage img(17,17,QImage::Format_ARGB32_Premultiplied); - img.fill(0x00000000); - QPainter painter; - painter.begin(&img); - painter.setBrush(p.window()); - painter.drawEllipse(2,2,13,13); - painter.setPen(p.color(QPalette::Base)); - painter.drawEllipse(2,2,13,13); - painter.setPen(p.color(QPalette::Highlight)); - painter.drawLine(QLine(5,7,8,4)); - painter.drawLine(QLine(6,7,8,5)); - painter.drawLine(QLine(8,4,11,7)); - painter.drawLine(QLine(8,5,10,7)); - painter.drawLine(QLine(5,11,8,8)); - painter.drawLine(QLine(6,11,8,9)); - painter.drawLine(QLine(8,8,11,11)); - painter.drawLine(QLine(9,8,10,11)); - painter.end(); + QSize bSize = headerButtonSize; + QImage img(bSize.width(), bSize.height(), QImage::Format_ARGB32_Premultiplied); + img.fill(Qt::transparent); - if (!fold) { - QTransform mat; - mat.rotate(180.0); - img = img.transformed(mat); + QPainter painter(&img); + + painter.setRenderHint(QPainter::Antialiasing); + + qreal penWidth = bSize.width() / 14.0; + qreal lef_X = 0.25 * bSize.width(); + qreal mid_X = 0.50 * bSize.width(); + qreal rig_X = 0.75 * bSize.width(); + qreal bot_Y = 0.40 * bSize.height(); + qreal top_Y = 0.64 * bSize.height(); + + if (hover) { + penWidth *= 1.8; } + + painter.setBrush(Qt::NoBrush); + painter.setPen(QPen(palette.color(QPalette::HighlightedText), penWidth)); + + QPolygon chevron; + if (fold) { + // Upward + chevron << QPoint(lef_X, top_Y) + << QPoint(mid_X, bot_Y) + << QPoint(rig_X, top_Y); + } else { + // Downward + chevron << QPoint(lef_X, bot_Y) + << QPoint(mid_X, top_Y) + << QPoint(rig_X, bot_Y); + } + + painter.drawPolyline(chevron); + painter.end(); return QPixmap::fromImage(img); } + QString SystemPanelScheme::systemStyle(const QPalette& p) const { - QColor panelBackground1 = p.color(QPalette::Dark); - QColor panelBackground2 = p.color(QPalette::Midlight); + QColor headerBackground = p.color(QPalette::Highlight); + QColor headerLabelText = p.color(QPalette::HighlightedText); + QColor headerLabelTextOver = p.color(QPalette::BrightText); + QColor groupBorder = p.color(QPalette::Mid); + QColor disabledActionText = p.color(QPalette::Disabled, QPalette::Text); + QColor actionSelectedBg = p.color(QPalette::Active, QPalette::Light); + QColor actionSelectedText = p.color(QPalette::Active, QPalette::ButtonText); + QColor actionSelectedBorder = p.color(QPalette::Active, QPalette::Highlight); - QColor headerBackground1 = p.color(QPalette::Highlight); - QColor headerBackground2 = p.color(QPalette::Highlight).lighter(); + QString style = QString::fromLatin1( + "QSint--ActionGroup QFrame[class='header'] {" + "border: 1px solid transparent;" + "background-color: %1;" + "}" - QColor headerLabelText = p.color(QPalette::HighlightedText); - QColor headerLabelTextOver = p.color(QPalette::BrightText); + "QSint--ActionGroup QToolButton[class='header'] {" + "text-align: left;" + "color: %2;" + "background-color: transparent;" + "border: 1px solid transparent;" + "font-weight: bold;" + "}" - QColor groupBackground = p.window().color(); - QColor groupBorder = p.color(QPalette::Window); + "QSint--ActionGroup QToolButton[class='header']:hover {" + "color: %3;" + "}" - QColor taskLabelText = p.color(QPalette::Text); - QColor taskLabelTextOver = p.color(QPalette::Highlight); + "QSint--ActionGroup QFrame[class='content'] {" + "border: 1px solid %4;" + "}" - QString style = QString::fromLatin1( - "QFrame[class='panel'] {" - "background-color:qlineargradient(x1:1, y1:0.3, x2:1, y2:0, stop:0 %1, stop:1 %2);" - "}" + "QSint--ActionGroup QFrame[class='content'][header='true'] {" + "border-top: none;" + "}" - "QSint--ActionGroup QFrame[class='header'] {" - "border: 1px solid #ffffff;" // todo - "border-top-left-radius: 4px;" - "border-top-right-radius: 4px;" - "background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 %3, stop: 1 %4);" - "}" + "QSint--ActionGroup QToolButton[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "text-align: left;" + "}" - "QSint--ActionGroup QToolButton[class='header'] {" - "text-align: left;" - "color: %5;" - "background-color: transparent;" - "border: 1px solid transparent;" - "font-weight: bold;" - "}" + "QSint--ActionGroup QToolButton[class='action']:!enabled {" + "color: %5;" + "}" - "QSint--ActionGroup QToolButton[class='header']:hover {" - "color: %6;" - "}" + "QSint--ActionGroup QToolButton[class='action']:hover {" + "text-decoration: underline;" + "}" - "QSint--ActionGroup QFrame[class='content'] {" - "background-color: %7;" - "border: 1px solid %8;" - "}" + "QSint--ActionGroup QToolButton[class='action']:focus {" + "color: %7;" + "border: 1px dotted %8;" + "}" - "QSint--ActionGroup QFrame[class='content'][header='true'] {" - "border-top: none;" - "}" + "QSint--ActionGroup QToolButton[class='action']:on {" + "background-color: %6;" + "color: %7;" + "}" + ).arg( + headerBackground.name(), + headerLabelText.name(), + headerLabelTextOver.name(), + groupBorder.name(), + disabledActionText.name(), + actionSelectedBg.name(), + actionSelectedText.name(), + actionSelectedBorder.name() + ); - "QSint--ActionGroup QToolButton[class='action'] {" - "background-color: transparent;" - "border: 1px solid transparent;" - "color: %9;" - "text-align: left;" - "}" - - "QSint--ActionGroup QToolButton[class='action']:!enabled {" - "color: #999999;" // todo - "}" - - "QSint--ActionGroup QToolButton[class='action']:hover {" - "color: %10;" - "text-decoration: underline;" - "}" - - "QSint--ActionGroup QToolButton[class='action']:focus {" - "border: 1px dotted black;" - "}" - - "QSint--ActionGroup QToolButton[class='action']:on {" - "background-color: #ddeeff;" // todo - "color: #006600;" // todo - "}" - ) - .arg(panelBackground1.name(), - panelBackground2.name(), - headerBackground1.name(), - headerBackground2.name(), - headerLabelText.name(), - headerLabelTextOver.name(), - groupBackground.name(), - groupBorder.name(), - taskLabelText.name()) - .arg(taskLabelTextOver.name()) - ; - - return style; + return style; } } diff --git a/src/Gui/QSint/actionpanel/freecadscheme.h b/src/Gui/QSint/actionpanel/freecadscheme.h index fedf5afe3a..4cbeca0ba6 100644 --- a/src/Gui/QSint/actionpanel/freecadscheme.h +++ b/src/Gui/QSint/actionpanel/freecadscheme.h @@ -66,7 +66,7 @@ public: } private: - QPixmap drawFoldIcon(const QPalette& p, bool fold) const; + QPixmap drawFoldIcon(const QPalette& p, bool fold, bool hover) const; QString systemStyle(const QPalette& p) const; }; From 4f5610297889a77c2ca128fa01450e508ac97ad1 Mon Sep 17 00:00:00 2001 From: Benjamin Guest Date: Mon, 20 Jan 2025 18:01:53 -0500 Subject: [PATCH 052/224] TechDraw: Fix dimension alignment issue. Fixes issue #19121 "dimension numbers placed lower than normal". Problem: QGCustomText has a new method `alignmentRect` which can optionally return a `tightBoundingRect` instead of the regular `boundingRect`. The `alignmentRect` is used for laying out the `QGIDatumLabel`, however QGraphicsItemGroup's `childrenBoundingRect` use the childrens' `boundingRect` and knows nothing of `alignmentRect`. The result is an improperly sized label and frame and miss alignment. Additionally `childrenBoundingRect` calculations includes hidden views, so even though the `m_tolTextOver` and `m_tolTextUnder` are hidden they still affect the bounding rect size. Solution: 1. Implement new method `QGIDatumLabel::tightBoundingRect` this calculates the bounding rect using the subview's `aligmentRect` if there is text in the custom text. 2. Use `tightBoundingRect` in place of `boundingRect` to for the drawing of arrows and the exact dim frames. 3. This PR acknowledges that there are some edge case fonts that while not clipped may not interface perfectly with arrows and the exact dimension frame. 4. Fix vertical alignment of `m_tolTextOver` / `m_tolTextUnder` 5. Incorporate PR Review comments --- src/Mod/TechDraw/Gui/QGCustomText.cpp | 2 +- src/Mod/TechDraw/Gui/QGIViewDimension.cpp | 52 +++++++++++++---------- src/Mod/TechDraw/Gui/QGIViewDimension.h | 1 + 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/Mod/TechDraw/Gui/QGCustomText.cpp b/src/Mod/TechDraw/Gui/QGCustomText.cpp index 07e13a881f..895ec1c509 100644 --- a/src/Mod/TechDraw/Gui/QGCustomText.cpp +++ b/src/Mod/TechDraw/Gui/QGCustomText.cpp @@ -178,7 +178,7 @@ void QGCustomText::paint ( QPainter * painter, const QStyleOptionGraphicsItem * myOption.state &= ~QStyle::State_Selected; // painter->setPen(Qt::green); -// painter->drawRect(boundingRect()); //good for debugging +// painter->drawRect(alignmentRect()); //good for debugging QGraphicsTextItem::paint (painter, &myOption, widget); } diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index f426d0969e..b390dbd62d 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -354,18 +354,29 @@ QRectF QGIDatumLabel::boundingRect() const return childrenBoundingRect(); } +QRectF QGIDatumLabel::tightBoundingRect() const +{ + QRectF totalRect; + for (QGraphicsItem* item : m_textItems->childItems()) { + auto* customText = dynamic_cast(item); + if (customText && !customText->toPlainText().isEmpty()) { + QRectF itemRect = customText->alignmentRect(); + QPointF pos = customText->pos(); + itemRect.translate(pos.x(), pos.y()); + totalRect = totalRect.isNull() ? itemRect : totalRect.united(itemRect); + } + } + int fontSize = m_dimText->font().pixelSize(); + int paddingLeft = fontSize * 0.2; + int paddingTop = fontSize * 0.1; + int paddingRight = fontSize * 0.2; + int paddingBottom = fontSize * 0.1; + return totalRect.adjusted(-paddingLeft, -paddingTop, paddingRight, paddingBottom); +} + void QGIDatumLabel::updateFrameRect() { prepareGeometryChange(); - int fontSize = m_dimText->font().pixelSize(); - int paddingLeft = fontSize * 0.3; - int paddingTop = fontSize * 0.1; - int paddingRight = fontSize * 0.3; - int paddingBottom = fontSize * 0.125; - // Why top and bottom padding different? - // Because the m_dimText bounding box isn't relative to X height :( - // And we want padding to be relative to X height - // TODO: make QGCustomLabel::boundingBoxXHeight - m_frame->setRect(m_textItems->childrenBoundingRect().adjusted(-paddingLeft, -paddingTop, paddingRight, paddingBottom)); // Update bounding rect + m_frame->setRect(tightBoundingRect()); } void QGIDatumLabel::setLineWidth(double lineWidth) @@ -420,9 +431,7 @@ void QGIDatumLabel::setPosFromCenter(const double& xCenter, const double& yCente QRectF labelBox = m_dimText->alignmentRect(); double right = labelBox.right(); - double top = labelBox.top(); - double bottom = labelBox.bottom(); - double middle = (top + bottom) / 2.0; + double middle = labelBox.center().y(); //set unit position QRectF unitBox = m_unitText->alignmentRect(); @@ -437,10 +446,9 @@ void QGIDatumLabel::setPosFromCenter(const double& xCenter, const double& yCente // Adjust for difference in tight and original bounding box sizes, note the y-coord down system QPointF tol_adj = m_tolTextOver->tightBoundingAdjust(); - m_tolTextOver->justifyLeftAt(tolLeft + tol_adj.x(), middle - tol_adj.y(), false); + m_tolTextOver->justifyLeftAt(tolLeft + tol_adj.x(), middle + tol_adj.y()/2.0, false); tol_adj = m_tolTextUnder->tightBoundingAdjust(); - m_tolTextUnder->justifyLeftAt(tolLeft + tol_adj.x(), middle + overBox.height() - tol_adj.y(), - false); + m_tolTextUnder->justifyLeftAt(tolLeft + tol_adj.x(), middle + overBox.height() + tol_adj.y()/2.0, false); } void QGIDatumLabel::setLabelCenter() @@ -453,7 +461,7 @@ void QGIDatumLabel::setLabelCenter() Base::Vector2d QGIDatumLabel::getPosToCenterVec() { - QPointF center = boundingRect().center(); + QPointF center = tightBoundingRect().center(); return Base::Vector2d(center.x(), center.y()); } @@ -2350,7 +2358,7 @@ void QGIViewDimension::drawDistance(TechDraw::DrawViewDimension* dimension, ViewProviderDimension* viewProvider) const { Base::BoundBox2d labelRectangle( - fromQtGui(mapRectFromItem(datumLabel, datumLabel->boundingRect()))); + fromQtGui(mapRectFromItem(datumLabel, datumLabel->tightBoundingRect()))); pointPair linePoints = dimension->getLinearPoints(); const char* dimensionType = dimension->Type.getValueAsString(); @@ -2387,7 +2395,7 @@ void QGIViewDimension::drawRadius(TechDraw::DrawViewDimension* dimension, ViewProviderDimension* viewProvider) const { Base::BoundBox2d labelRectangle( - fromQtGui(mapRectFromItem(datumLabel, datumLabel->boundingRect()))); + fromQtGui(mapRectFromItem(datumLabel, datumLabel->tightBoundingRect()))); arcPoints curvePoints = dimension->getArcPoints(); double endAngle; @@ -2418,7 +2426,7 @@ void QGIViewDimension::drawDiameter(TechDraw::DrawViewDimension* dimension, ViewProviderDimension* viewProvider) const { Base::BoundBox2d labelRectangle( - fromQtGui(mapRectFromItem(datumLabel, datumLabel->boundingRect()))); + fromQtGui(mapRectFromItem(datumLabel, datumLabel->tightBoundingRect()))); Base::Vector2d labelCenter(labelRectangle.GetCenter()); arcPoints curvePoints = dimension->getArcPoints(); @@ -2585,7 +2593,7 @@ void QGIViewDimension::drawAngle(TechDraw::DrawViewDimension* dimension, QPainterPath anglePath; Base::BoundBox2d labelRectangle( - fromQtGui(mapRectFromItem(datumLabel, datumLabel->boundingRect()))); + fromQtGui(mapRectFromItem(datumLabel, datumLabel->tightBoundingRect()))); Base::Vector2d labelCenter(labelRectangle.GetCenter()); double labelAngle = 0.0; @@ -2775,7 +2783,7 @@ void QGIViewDimension::drawArea(TechDraw::DrawViewDimension* dimension, ViewProviderDimension* viewProvider) const { Base::BoundBox2d labelRectangle( - fromQtGui(mapRectFromItem(datumLabel, datumLabel->boundingRect()))); + fromQtGui(mapRectFromItem(datumLabel, datumLabel->tightBoundingRect()))); areaPoint areaPoint = dimension->getAreaPoint(); drawAreaExecutive( diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.h b/src/Mod/TechDraw/Gui/QGIViewDimension.h index 7dcb13660a..70a8efca50 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.h +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.h @@ -69,6 +69,7 @@ public: int type() const override { return Type;} QRectF boundingRect() const override; + QRectF tightBoundingRect() const; void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, From 1422981b9328d7de3bb0fa95dfd24e248147e8f6 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Mon, 27 Jan 2025 21:01:50 +0100 Subject: [PATCH 053/224] Draft: remove faulty code from importDXF.py The Group property of the 'new' layer object is not an attribute of its Proxy. --- src/Mod/Draft/importDXF.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Mod/Draft/importDXF.py b/src/Mod/Draft/importDXF.py index c6622a6b20..3dae1e6d2c 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -1928,16 +1928,7 @@ def addObject(shape, name="Shape", layer=None): newob = shape if layer: lay = locateLayer(layer) - # For old style layers, which are just groups if hasattr(lay, "Group"): - pass - # For new Draft Layers - elif hasattr(lay, "Proxy") and hasattr(lay.Proxy, "Group"): - lay = lay.Proxy - else: - lay = None - - if lay != None: if lay not in layerObjects: l = [] layerObjects[lay] = l @@ -1945,8 +1936,6 @@ def addObject(shape, name="Shape", layer=None): l = layerObjects[lay] l.append(newob) - - formatObject(newob) return newob From 3a4d7bd45229d3d1ef93c1beed8415dd1f2043b6 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Fri, 24 Jan 2025 20:34:37 +0100 Subject: [PATCH 054/224] Draft: introduce new Draft_Layers icon The current Draft_Layer.svg icon shows multiple layers. It is used for the Draft_Layer command but also for the LayerContainer. This is confusing. There should be separate icons, one with a single layer and one with multiple layers. --- src/Mod/Draft/Resources/Draft.qrc | 1 + src/Mod/Draft/Resources/icons/Draft_Layer.svg | 17 -- .../Draft/Resources/icons/Draft_Layers.svg | 147 ++++++++++++++++++ .../Draft/draftviewproviders/view_layer.py | 4 +- 4 files changed, 150 insertions(+), 19 deletions(-) create mode 100644 src/Mod/Draft/Resources/icons/Draft_Layers.svg diff --git a/src/Mod/Draft/Resources/Draft.qrc b/src/Mod/Draft/Resources/Draft.qrc index ee4e8589d6..378d61a96b 100644 --- a/src/Mod/Draft/Resources/Draft.qrc +++ b/src/Mod/Draft/Resources/Draft.qrc @@ -47,6 +47,7 @@ icons/Draft_Join.svg icons/Draft_Label.svg icons/Draft_Layer.svg + icons/Draft_Layers.svg icons/Draft_LayerManager.svg icons/Draft_Line.svg icons/Draft_LinkArray.svg diff --git a/src/Mod/Draft/Resources/icons/Draft_Layer.svg b/src/Mod/Draft/Resources/icons/Draft_Layer.svg index b5d6d8ba79..98e156cc4b 100644 --- a/src/Mod/Draft/Resources/icons/Draft_Layer.svg +++ b/src/Mod/Draft/Resources/icons/Draft_Layer.svg @@ -118,15 +118,6 @@ id="layer2" style="display:inline;stroke-width:0.653981" transform="matrix(1.5298962,0,0,1.5282988,-16.690014,-13.850775)"> - - - - diff --git a/src/Mod/Draft/Resources/icons/Draft_Layers.svg b/src/Mod/Draft/Resources/icons/Draft_Layers.svg new file mode 100644 index 0000000000..25cf5befb4 --- /dev/null +++ b/src/Mod/Draft/Resources/icons/Draft_Layers.svg @@ -0,0 +1,147 @@ + + + Draft_Layers + + + + + + + + + + + + + image/svg+xml + + Draft_Layers + Tue Jun 10 10:21:01 2014 -0300 + + + [Yorik van Havre] + + + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + FreeCAD/src/Mod/Draft/Resources/icons/Draft_Layers.svg + https://www.freecad.org/wiki/index.php?title=Artwork + + + [agryson] Alexander Gryson + + + + + page + pages + rectangles + stack + + + Three pages or rectangles stacked on top of each other. Previously VisGroup. + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/Draft/draftviewproviders/view_layer.py b/src/Mod/Draft/draftviewproviders/view_layer.py index 1658dbc8cf..8ae7cb29a4 100644 --- a/src/Mod/Draft/draftviewproviders/view_layer.py +++ b/src/Mod/Draft/draftviewproviders/view_layer.py @@ -527,7 +527,7 @@ class ViewProviderLayerContainer: def getIcon(self): """Return the path to the icon used by the viewprovider.""" - return ":/icons/Draft_Layer.svg" + return ":/icons/Draft_Layers.svg" def attach(self, vobj): """Set up the scene sub-graph of the viewprovider.""" @@ -535,7 +535,7 @@ class ViewProviderLayerContainer: def setupContextMenu(self, vobj, menu): """Set up actions to perform in the context menu.""" - action_merge = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Layer.svg"), + action_merge = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Layers.svg"), translate("draft", "Merge layer duplicates"), menu) action_merge.triggered.connect(self.merge_by_name) From 53ba838ac252523797a22c60d80d30b4347d2e44 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 26 Jan 2025 10:40:30 -0500 Subject: [PATCH 055/224] [Units]fix bad length multiplier in MeterDecimal --- src/Base/UnitsSchemaMeterDecimal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Base/UnitsSchemaMeterDecimal.cpp b/src/Base/UnitsSchemaMeterDecimal.cpp index e80bd7af7f..8d7337bdac 100644 --- a/src/Base/UnitsSchemaMeterDecimal.cpp +++ b/src/Base/UnitsSchemaMeterDecimal.cpp @@ -44,7 +44,7 @@ std::string UnitsSchemaMeterDecimal::schemaTranslate(const Base::Quantity& quant std::string& unitString) { static std::array>, 7> unitSpecs {{ - {Unit::Length, {"m", 1e0}}, + {Unit::Length, {"m", 1e3}}, {Unit::Area, {"m^2", 1e6}}, {Unit::Volume, {"m^3", 1e9}}, {Unit::Power, {"W", 1000000}}, From da3b9b59602688b312057e05ef64755787112cde Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Tue, 28 Jan 2025 17:37:29 +0100 Subject: [PATCH 056/224] Draft: fix handling of annotation Links in TD DraftViews Fixes #19199. --- src/Mod/Draft/draftfunctions/svg.py | 103 +++++++++++++++++----------- 1 file changed, 62 insertions(+), 41 deletions(-) diff --git a/src/Mod/Draft/draftfunctions/svg.py b/src/Mod/Draft/draftfunctions/svg.py index 32f3c302ff..bb21394442 100644 --- a/src/Mod/Draft/draftfunctions/svg.py +++ b/src/Mod/Draft/draftfunctions/svg.py @@ -425,54 +425,75 @@ def get_svg(obj, It defaults to `True`. """ # If this is a group, recursively call this function to gather - # all the SVG strings from the contents of the group - if hasattr(obj, "isDerivedFrom"): - if (obj.isDerivedFrom("App::DocumentObjectGroup") - or utils.get_type(obj) in ["Layer", "BuildingPart", "IfcGroup"] - or obj.isDerivedFrom("App::LinkGroup") + # all the SVG strings from the contents of the group. + if (obj.isDerivedFrom("App::DocumentObjectGroup") + or utils.get_type(obj) in ["Layer", "BuildingPart", "IfcGroup"] + or obj.isDerivedFrom("App::LinkGroup") + or (obj.isDerivedFrom("App::Link") + and obj.LinkedObject.isDerivedFrom("App::DocumentObjectGroup"))): + + hidden_doc = None + + if (obj.isDerivedFrom("App::LinkGroup") or (obj.isDerivedFrom("App::Link") and obj.LinkedObject.isDerivedFrom("App::DocumentObjectGroup"))): - - hidden_doc = None - - if (obj.isDerivedFrom("App::LinkGroup") - or (obj.isDerivedFrom("App::Link") - and obj.LinkedObject.isDerivedFrom("App::DocumentObjectGroup"))): - if obj.Placement.isIdentity(): - if obj.isDerivedFrom("App::LinkGroup"): - group = obj.ElementList - else: - group = obj.Group + if obj.Placement.isIdentity(): + if obj.isDerivedFrom("App::LinkGroup"): + group = obj.ElementList else: - # Using a hidden doc hack to handle placements. - hidden_doc = App.newDocument(name="hidden", hidden=True, temp=True) - new = hidden_doc.copyObject(obj, True) - pla = new.Placement - new.Placement = App.Placement() - if new.isDerivedFrom("App::LinkGroup"): - group = new.ElementList - else: - group = new.Group - for child in group: - child.Placement = pla * child.Placement + group = obj.Group else: - group = obj.Group + # Hidden doc hack: + hidden_doc = App.newDocument(name="hidden", hidden=True, temp=True) + new = hidden_doc.copyObject(obj, True) + pla = new.Placement + new.Placement = App.Placement() + if new.isDerivedFrom("App::LinkGroup"): + group = new.ElementList + else: + group = new.Group + for child in group: + child.Placement = pla * child.Placement + else: + group = obj.Group - svg = "" - for child in group: - svg += get_svg(child, - scale, linewidth, fontsize, - fillstyle, direction, linestyle, - color, linespacing, techdraw, - rotation, fillspaces, override) + svg = "" + for child in group: + svg += get_svg(child, + scale, linewidth, fontsize, + fillstyle, direction, linestyle, + color, linespacing, techdraw, + rotation, fillspaces, override) - if hidden_doc is not None: - try: - App.closeDocument(hidden_doc.Name) - except: - pass + if hidden_doc is not None: + try: + App.closeDocument(hidden_doc.Name) + except: + pass - return svg + return svg + + # Handle Links to texts and dimensions. These Links do not have a Shape. + if obj.isDerivedFrom("App::Link") and obj.LinkedObject and not hasattr(obj, "Shape"): + # Hidden doc hack: + hidden_doc = App.newDocument(name="hidden", hidden=True, temp=True) + new = hidden_doc.copyObject(obj.LinkedObject, True) + if utils.get_type(new) in ("Dimension", "LinearDimension", "AngularDimension"): + new.Proxy.transform(new, obj.Placement) + elif utils.get_type(new) == "Text" or obj.LinkTransform: + new.Placement = obj.Placement * new.Placement + else: + new.Placement = obj.Placement + svg = get_svg(new, + scale, linewidth, fontsize, + fillstyle, direction, linestyle, + color, linespacing, techdraw, + rotation, fillspaces, override) + try: + App.closeDocument(hidden_doc.Name) + except: + pass + return svg vobj = _get_view_object(obj) From dccc8788d17d2d055b1d757cf005eb22f9d9e2f1 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Tue, 28 Jan 2025 18:12:00 +0100 Subject: [PATCH 057/224] Draft: Increase max value for gridEvery in ui. Fixes #19267. --- src/Mod/Draft/Resources/ui/preferences-draftsnap.ui | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui index ea6c9b533c..85218af592 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftsnap.ui @@ -148,6 +148,9 @@ Major grid lines are thicker than minor grid lines.
squares + + 1000 + 10 @@ -220,7 +223,7 @@ Major grid lines are thicker than minor grid lines.
squares
- 9999 + 10000 100 From 41d55abcd2ab7de72a4cf063c585c5e153744182 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Tue, 28 Jan 2025 20:42:45 +0100 Subject: [PATCH 058/224] Draft: allow objects in layers to have overrides (#19207) * Draft: allow objects in layers to have overrides Fixes #17844. 1. When an object is put in a layer it always adopts the properties of that layer. 2. Properties of the object that are subsequently changed are considered overrides. 3. When the properties of the layer, or the object in the layer, are then changed so that they match again, there is no longer an override, and properties are synced again. 4. The layer and the layer container object get an extra Tree view context menu option "Reassign properties of layer"/"Reassign properties of all layers". --- src/Mod/Draft/draftobjects/layer.py | 54 +++- .../Draft/draftviewproviders/view_layer.py | 272 ++++++++++-------- 2 files changed, 195 insertions(+), 131 deletions(-) diff --git a/src/Mod/Draft/draftobjects/layer.py b/src/Mod/Draft/draftobjects/layer.py index 720f6a86b6..197627659b 100644 --- a/src/Mod/Draft/draftobjects/layer.py +++ b/src/Mod/Draft/draftobjects/layer.py @@ -113,12 +113,49 @@ class Layer: """Execute when the object is created or recomputed. Do nothing.""" pass + def _get_other_layers(self, obj, child): + other_lyrs = [] + for find in child.Document.findObjects(Type="App::FeaturePython"): + if utils.get_type(find) == "Layer" and find != obj and child in find.Group: + other_lyrs.append(find) + return other_lyrs + + def onBeforeChange(self, obj, prop): + if prop == "Group": + self.oldGroup = obj.Group + + def onChanged(self, obj, prop): + if prop != "Group": + return + vobj = getattr(obj, "ViewObject", None) + old_grp = getattr(self, "oldGroup", []) + for child in obj.Group: + if child in old_grp: + continue + for other_lyr in self._get_other_layers(obj, child): + other_grp = other_lyr.Group + other_grp.remove(child) + other_lyr.Group = other_grp + if vobj is None: + continue + for prop in ("LineColor", "ShapeAppearance", "LineWidth", "DrawStyle", "Visibility"): + vobj.Proxy.change_view_properties(vobj, prop, old_prop=None, targets=[child]) + def addObject(self, obj, child): - """Add an object to this object if not in the Group property.""" - group = obj.Group - if child not in group: - group.append(child) - obj.Group = group + if utils.get_type(child) in ("Layer", "LayerContainer"): + return + grp = obj.Group + if child in grp: + return + grp.append(child) + obj.Group = grp + + def removeObject(self, obj, child): + grp = obj.Group + if not child in grp: + return + grp.remove(child) + obj.Group = grp # Alias for compatibility with v0.18 and earlier @@ -147,9 +184,9 @@ class LayerContainer: Update the value of `Group` by sorting the contained layers by `Label`. """ - group = obj.Group - group.sort(key=lambda layer: layer.Label) - obj.Group = group + grp = obj.Group + grp.sort(key=lambda layer: layer.Label) + obj.Group = grp def dumps(self): """Return a tuple of objects to save or None.""" @@ -162,7 +199,6 @@ class LayerContainer: self.Type = state -# Similar function as in view_layer.py def get_layer(obj): """Get the layer the object belongs to.""" finds = obj.Document.findObjects(Name="LayerContainer") diff --git a/src/Mod/Draft/draftviewproviders/view_layer.py b/src/Mod/Draft/draftviewproviders/view_layer.py index 8ae7cb29a4..4e23ee1e6e 100644 --- a/src/Mod/Draft/draftviewproviders/view_layer.py +++ b/src/Mod/Draft/draftviewproviders/view_layer.py @@ -29,14 +29,14 @@ ## \addtogroup draftviewproviders # @{ -import pivy.coin as coin -import PySide.QtCore as QtCore -import PySide.QtGui as QtGui +from pivy import coin +from PySide import QtCore +from PySide import QtGui from PySide.QtCore import QT_TRANSLATE_NOOP import FreeCAD as App import FreeCADGui as Gui -from draftobjects.layer import Layer +from draftobjects.layer import get_layer from draftutils import params from draftutils import utils from draftutils.translate import translate @@ -216,14 +216,43 @@ class ViewProviderLayer: def updateData(self, obj, prop): """Execute when a property from the Proxy class is changed.""" - if prop == "Group": - for _prop in ("LineColor", "ShapeAppearance", "LineWidth", - "DrawStyle", "Visibility"): - self.onChanged(obj.ViewObject, _prop) + if prop == "Label": + self._paint_tree_icon(obj.ViewObject) - def change_view_properties(self, vobj, prop): - """Iterate over the contents and change the properties.""" - obj = vobj.Object + def change_view_properties(self, vobj, prop, old_prop=None, targets=None): + """Change the properties of the targets, or of all objects in the layer group. + + A child's property is only changed if it is not overridden (if its value + matches old_prop). + """ + + def _color_is_same(col1, col2): + # Ignore alpha and round RGB values + return [round(c, 2) for c in col1[:3]] == [round(c, 2) for c in col2[:3]] + + def _app_material_is_same(mat1, mat2): + for prop in ( + "AmbientColor", + "DiffuseColor", + "EmissiveColor", + "Shininess", + "SpecularColor", + "Transparency", + ): + if "Color" in prop: + if not _color_is_same(getattr(mat1, prop), getattr(mat2, prop)): + return False + elif getattr(mat1, prop) != getattr(mat2, prop): + return False + return True + + def _prop_is_same(prop1, prop2): + if isinstance(prop1, tuple): + if isinstance(prop1[0], App.Material): + # We do not check the length of the ShapeAppearance + return _app_material_is_same(prop1[0], prop2[0]) + return _color_is_same(prop1, prop2) + return prop1 == prop2 # Return if the property does not exist if not hasattr(vobj, prop): @@ -231,27 +260,30 @@ class ViewProviderLayer: # If the override properties are not set return without change if prop == "LineColor" and not vobj.OverrideLineColorChildren: return - elif prop == "ShapeAppearance" and not vobj.OverrideShapeAppearanceChildren: + if prop == "ShapeAppearance" and not vobj.OverrideShapeAppearanceChildren: return - for target_obj in obj.Group: + for target_obj in (targets if targets is not None else vobj.Object.Group): target_vobj = target_obj.ViewObject - # This checks that the property exists in the target object, - # and then sets the target property accordingly if hasattr(target_vobj, prop): - setattr(target_vobj, prop, getattr(vobj, prop)) + if old_prop is None \ + or _prop_is_same(getattr(target_vobj, prop), old_prop): + setattr(target_vobj, prop, getattr(vobj, prop)) - # Use the line color for the point color and text color - if prop == "LineColor": - if hasattr(target_vobj, "PointColor"): - target_vobj.PointColor = vobj.LineColor - if hasattr(target_vobj, "TextColor"): - target_vobj.TextColor = vobj.LineColor - # Use the line width for the point size - elif prop == "LineWidth": - if hasattr(target_vobj, "PointSize"): - target_vobj.PointSize = vobj.LineWidth + # Use the line color for the point color and text color, + # and the line width for the point size + dic = {"LineColor": ("PointColor", "TextColor"), "LineWidth": ("PointSize", )} + if prop in dic: + for target_prop in dic[prop]: + if hasattr(target_vobj, target_prop): + if old_prop is None \ + or _prop_is_same(getattr(target_vobj, target_prop), old_prop): + setattr(target_vobj, target_prop, getattr(vobj, prop)) + + def onBeforeChange(self, vobj, prop): + if prop in ("LineColor", "ShapeAppearance", "LineWidth", "DrawStyle", "Visibility"): + setattr(self, "old" + prop, getattr(vobj, prop)) def onChanged(self, vobj, prop): """Execute when a view property is changed.""" @@ -290,58 +322,52 @@ class ViewProviderLayer: "DrawStyle", "Visibility") and hasattr(vobj, "OverrideLineColorChildren") and hasattr(vobj, "OverrideShapeAppearanceChildren")): - self.change_view_properties(vobj, prop) + old_prop = getattr(self, "old" + prop, None) + self.change_view_properties(vobj, prop, old_prop) + if hasattr(self, "old" + prop): + delattr(self, "old" + prop) - # Paint the layer icon in the tree view: - if (prop in ("LineColor", "ShapeAppearance") - and hasattr(vobj, "LineColor") - and hasattr(vobj, "ShapeAppearance")): - l_color = vobj.LineColor - s_color = vobj.ShapeAppearance[0].DiffuseColor + if prop in ("LineColor", "ShapeAppearance"): + self._paint_tree_icon(vobj) - l_color = QtGui.QColor(int(l_color[0] * 255), - int(l_color[1] * 255), - int(l_color[2] * 255)) - s_color = QtGui.QColor(int(s_color[0] * 255), - int(s_color[1] * 255), - int(s_color[2] * 255)) - p1 = QtCore.QPointF(2, 17) - p2 = QtCore.QPointF(13, 8) - p3 = QtCore.QPointF(30, 15) - p4 = QtCore.QPointF(20, 25) + def _paint_tree_icon(self, vobj): + """Paint the layer icon in the tree view.""" + if not hasattr(vobj, "LineColor"): + return + if not hasattr(vobj, "ShapeAppearance"): + return + l_color = vobj.LineColor + s_color = vobj.ShapeAppearance[0].DiffuseColor - image = QtGui.QImage(32, 32, QtGui.QImage.Format_ARGB32) - image.fill(QtCore.Qt.transparent) + l_color = QtGui.QColor(int(l_color[0] * 255), + int(l_color[1] * 255), + int(l_color[2] * 255)) + s_color = QtGui.QColor(int(s_color[0] * 255), + int(s_color[1] * 255), + int(s_color[2] * 255)) + p1 = QtCore.QPointF(2, 17) + p2 = QtCore.QPointF(13, 8) + p3 = QtCore.QPointF(30, 15) + p4 = QtCore.QPointF(20, 25) - pt = QtGui.QPainter(image) - pt.setBrush(QtGui.QBrush(s_color, QtCore.Qt.SolidPattern)) - pt.drawPolygon([p1, p2, p3, p4]) - pt.setPen(QtGui.QPen(l_color, 2, - QtCore.Qt.SolidLine, QtCore.Qt.FlatCap)) - pt.drawPolygon([p1, p2, p3, p4]) - pt.end() + image = QtGui.QImage(32, 32, QtGui.QImage.Format_ARGB32) + image.fill(QtCore.Qt.transparent) - byte_array = QtCore.QByteArray() - buffer = QtCore.QBuffer(byte_array) - buffer.open(QtCore.QIODevice.WriteOnly) - image.save(buffer, "XPM") + pt = QtGui.QPainter(image) + pt.setBrush(QtGui.QBrush(s_color, QtCore.Qt.SolidPattern)) + pt.drawPolygon([p1, p2, p3, p4]) + pt.setPen(QtGui.QPen(l_color, 2, + QtCore.Qt.SolidLine, QtCore.Qt.FlatCap)) + pt.drawPolygon([p1, p2, p3, p4]) + pt.end() - self.icondata = byte_array.data().decode("latin1") - vobj.signalChangeIcon() + byte_array = QtCore.QByteArray() + buffer = QtCore.QBuffer(byte_array) + buffer.open(QtCore.QIODevice.WriteOnly) + image.save(buffer, "XPM") - def _get_layer(self, obj): - """Get the layer the object belongs to. - """ - from draftmake.make_layer import get_layer_container - # First look in the LayerContainer: - for layer in get_layer_container().Group: - if utils.get_type(layer) == "Layer" and obj in layer.Group: - return layer - # If not found, look through all App::FeaturePython objects (not just layers): - for find in obj.Document.findObjects(Type="App::FeaturePython"): - if utils.get_type(find) == "Layer" and obj in find.Group: - return find - return None + self.icondata = byte_array.data().decode("latin1") + vobj.signalChangeIcon() def canDragObject(self, obj): """Return True to allow dragging one object from the Layer. @@ -356,7 +382,7 @@ class ViewProviderLayer: if hasattr(parent, "Group"): old_data.append([parent, parent.Group]) # Layers are not in the Inlist because a layer's Group is App::PropertyLinkListHidden: - layer = self._get_layer(obj) + layer = get_layer(obj) if layer is not None: old_data.append([layer, layer.Group]) if old_data: @@ -369,14 +395,11 @@ class ViewProviderLayer: """Return True to allow dragging many objects from the Layer.""" return True - def dragObject(self, vobj, otherobj): + def dragObject(self, vobj, child): """Remove the object that was dragged from the layer.""" - layer = vobj.Object - if otherobj in layer.Group: - group = layer.Group - group.remove(otherobj) - layer.Group = group - App.ActiveDocument.recompute() + obj = vobj.Object + obj.Proxy.removeObject(obj, child) + App.ActiveDocument.recompute() def canDropObject(self, obj): """Return true to allow dropping one object. @@ -395,30 +418,14 @@ class ViewProviderLayer: """Return true to allow dropping many objects.""" return True - def dropObject(self, vobj, otherobj): - """Add object that was dropped into the Layer to the group. + def dropObject(self, vobj, child): + """Add the object that was dropped on the Layer to the group. - If the object being dropped is itself a `'Layer'`, - return immediately to prevent dropping a layer inside a layer, - at least for now. + This also results in a call to `change_view_properties` to update the + view properties of the child. """ - if utils.get_type(otherobj) == "Layer": - return - - # We assume a single old layer... - - old_layer = self._get_layer(otherobj) - if old_layer is not None: - group = old_layer.Group - group.remove(otherobj) - old_layer.Group = group - - new_layer = vobj.Object - if otherobj not in new_layer.Group: - group = new_layer.Group - group.append(otherobj) - new_layer.Group = group - + obj = vobj.Object + obj.Proxy.addObject(obj, child) App.ActiveDocument.recompute() def update_groups_after_drag_drop(self): @@ -450,7 +457,7 @@ class ViewProviderLayer: old_layer = old_parent break - new_layer = self._get_layer(child) + new_layer = get_layer(child) if new_layer == old_layer: continue @@ -497,6 +504,12 @@ class ViewProviderLayer: action_activate.triggered.connect(self.activate) menu.addAction(action_activate) + action_reassign = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Apply.svg"), + translate("draft", "Reassign properties of layer"), + menu) + action_reassign.triggered.connect(self.reassign_props) + menu.addAction(action_reassign) + action_select = QtGui.QAction(QtGui.QIcon(":/icons/Draft_SelectGroup.svg"), translate("draft", "Select layer contents"), menu) @@ -511,11 +524,15 @@ class ViewProviderLayer: Gui.activateWorkbench("DraftWorkbench") Gui.runCommand("Draft_AutoGroup") + def reassign_props(self): + for prop in ("LineColor", "ShapeAppearance", "LineWidth", "DrawStyle", "Visibility"): + self.onChanged(self.Object.ViewObject, prop) + def select_contents(self): """Select the contents of the layer.""" Gui.Selection.clearSelection() - for layer_obj in self.Object.Group: - Gui.Selection.addSelection(layer_obj) + for obj in self.Object.Group: + Gui.Selection.addSelection(obj) class ViewProviderLayerContainer: @@ -535,17 +552,41 @@ class ViewProviderLayerContainer: def setupContextMenu(self, vobj, menu): """Set up actions to perform in the context menu.""" + action_add = QtGui.QAction(QtGui.QIcon(":/icons/Draft_NewLayer.svg"), + translate("draft", "Add new layer"), + menu) + action_add.triggered.connect(self.add_layer) + menu.addAction(action_add) + + action_reassign = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Apply.svg"), + translate("draft", "Reassign properties of all layers"), + menu) + action_reassign.triggered.connect(self.reassign_props) + menu.addAction(action_reassign) + action_merge = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Layers.svg"), translate("draft", "Merge layer duplicates"), menu) action_merge.triggered.connect(self.merge_by_name) menu.addAction(action_merge) - action_add = QtGui.QAction(QtGui.QIcon(":/icons/Draft_NewLayer.svg"), - translate("draft", "Add new layer"), - menu) - action_add.triggered.connect(self.add_layer) - menu.addAction(action_add) + def add_layer(self): + """Creates a new layer""" + import Draft + + doc = App.ActiveDocument + doc.openTransaction(translate("draft", "Add new layer")) + + Draft.make_layer(name=None, line_color=None, shape_color=None, + line_width=None, draw_style=None, transparency=None) + + doc.recompute() + doc.commitTransaction() + + def reassign_props(self): + for obj in self.Object.Group: + if utils.get_type(obj) == "Layer": + obj.ViewObject.Proxy.reassign_props() def merge_by_name(self): """Merge the layers that have the same base label.""" @@ -590,19 +631,6 @@ class ViewProviderLayerContainer: doc.recompute() doc.commitTransaction() - def add_layer(self): - """Creates a new layer""" - import Draft - - doc = App.ActiveDocument - doc.openTransaction(translate("draft", "Add new layer")) - - Draft.make_layer(name=None, line_color=None, shape_color=None, - line_width=None, draw_style=None, transparency=None) - - doc.recompute() - doc.commitTransaction() - def dumps(self): """Return a tuple of objects to save or None.""" return None From d982743b7006be4883d0b920c7e97fb2733e01d0 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Tue, 28 Jan 2025 18:28:15 -0500 Subject: [PATCH 059/224] Fix typos Found via codespell --- src/Gui/Stylesheets/FreeCAD Dark.qss | 2 +- src/Gui/Stylesheets/FreeCAD Light.qss | 2 +- src/Mod/BIM/bimcommands/BimIfcQuantities.py | 2 +- src/Mod/BIM/importers/importDAE.py | 2 +- src/Mod/BIM/importers/importSH3DHelper.py | 14 +++++++------- src/Mod/Measure/App/ShapeFinder.cpp | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Gui/Stylesheets/FreeCAD Dark.qss b/src/Gui/Stylesheets/FreeCAD Dark.qss index 2e17bbb2ea..6711d3021a 100644 --- a/src/Gui/Stylesheets/FreeCAD Dark.qss +++ b/src/Gui/Stylesheets/FreeCAD Dark.qss @@ -2469,7 +2469,7 @@ QTableCornerButton::section { QHeaderView { background-color: transparent; - margin: -1px; /* fix for misalignement*/ + margin: -1px; /* fix for misalignment*/ } QHeaderView:disabled { diff --git a/src/Gui/Stylesheets/FreeCAD Light.qss b/src/Gui/Stylesheets/FreeCAD Light.qss index db107bfe66..fa2579e8dd 100644 --- a/src/Gui/Stylesheets/FreeCAD Light.qss +++ b/src/Gui/Stylesheets/FreeCAD Light.qss @@ -2462,7 +2462,7 @@ QTableCornerButton::section { QHeaderView { background-color: transparent; /* text-align: bottom; */ - margin: -1px; /* fix for misalignement*/ + margin: -1px; /* fix for misalignment*/ selection-background-color: @ThemeAccentColor1; } diff --git a/src/Mod/BIM/bimcommands/BimIfcQuantities.py b/src/Mod/BIM/bimcommands/BimIfcQuantities.py index d36850be03..f1ea3d0b19 100644 --- a/src/Mod/BIM/bimcommands/BimIfcQuantities.py +++ b/src/Mod/BIM/bimcommands/BimIfcQuantities.py @@ -318,7 +318,7 @@ class BIM_IfcQuantities: return txt def get_row(self, name): - """Returns the row number correspinding to the given object name""" + """Returns the row number corresponding to the given object name""" for i in range(self.qmodel.rowCount()): if self.qmodel.item(i).toolTip().split(" ")[0] == name: diff --git a/src/Mod/BIM/importers/importDAE.py b/src/Mod/BIM/importers/importDAE.py index d3749559da..9a3797dae4 100644 --- a/src/Mod/BIM/importers/importDAE.py +++ b/src/Mod/BIM/importers/importDAE.py @@ -166,7 +166,7 @@ def read(filename): # Print the errors that occurred during reading. if col.errors: - FreeCAD.Console.PrintWarning(translate("BIM", "File was read but some errors occured:") + "\n") + FreeCAD.Console.PrintWarning(translate("BIM", "File was read but some errors occurred:") + "\n") for e in col.errors: FreeCAD.Console.PrintWarning(str(e) + "\n") diff --git a/src/Mod/BIM/importers/importSH3DHelper.py b/src/Mod/BIM/importers/importSH3DHelper.py index d4e16fe834..3674e2e4b0 100644 --- a/src/Mod/BIM/importers/importSH3DHelper.py +++ b/src/Mod/BIM/importers/importSH3DHelper.py @@ -1004,7 +1004,7 @@ class LevelHandler(BaseHandler): # not sorted and do not form a "chain". Therefore, sort them, # recreate the wire while also rounding the precision of the # Vertices in order to avoid not closing because the points - # are not close enougth + # are not close enough wire = Part.Wire(Part.__sortEdges__(self._round(sv.Shape.Edges))) if not wire.isClosed(): _wrn(f"Projected Face for {object.Label} does not produce a closed wire. Not adding to slab construction ...") @@ -1768,8 +1768,8 @@ class WallHandler(BaseHandler): The face names are suitable for selection later on when creating the Facebinders and baseboards. Note, that this must be executed - once the wall has been completly been constructued. If a window - or door is added afterward, this will have an impact on what is + once the wall has been completely constructed. If a window or + door is added afterward, this will have an impact on what is considered the left and right side of the wall Args: @@ -1781,7 +1781,7 @@ class WallHandler(BaseHandler): right side of the wall """ # In order to handle curved walls, take the oriented line (from - # start to end) that pass throuh the center of gravity of the wall + # start to end) that pass through the center of gravity of the wall # Hopefully the COG of the face will always be on the correct side # of the COG of the wall wall_start = wall.BaseObjects[2].Start @@ -1962,7 +1962,7 @@ class DoorOrWindowHandler(BaseFurnitureHandler): center = coord_sh2fc(App.Vector(x_center, y_center, z_center)) center.z += floor.Placement.Base.z - # First create a solid representing the window countour and find the + # First create a solid representing the window contour and find the # walls containing that window width = dim_sh2fc(elm.get('width')) depth = dim_sh2fc(elm.get('depth')) @@ -2379,8 +2379,8 @@ def _color_section(section): def set_shininess(obj, shininess): - # TODO: it seems a shininess of 0 means the wall loose its - # color. We leave it at the default setting untill a later time + # TODO: it seems a shininess of 0 means the wall looses its + # color. We'll leave it at the default setting until a later time return if not App.GuiUp or not shininess: return diff --git a/src/Mod/Measure/App/ShapeFinder.cpp b/src/Mod/Measure/App/ShapeFinder.cpp index 2d70e64342..3d3fd6232a 100644 --- a/src/Mod/Measure/App/ShapeFinder.cpp +++ b/src/Mod/Measure/App/ShapeFinder.cpp @@ -321,8 +321,8 @@ ShapeFinder::getGlobalTransform(const App::DocumentObject& rootObject, const std } -//! trys to get the global position and scale for a object with no information about the path -//! through the tree from a root to cursor object. +//! tries to get the global position and scale for a object with no information about the +//! path through the tree from a root to cursor object. std::pair ShapeFinder::getGlobalTransform(const App::DocumentObject* cursorObject) { From f7f81b812cb80f75c350cac504bcfd1cf8263a64 Mon Sep 17 00:00:00 2001 From: filson1 <73068051+filson1@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:11:39 +0100 Subject: [PATCH 060/224] Helix tooltip spelling update in FeatureHelix.cpp --- src/Mod/PartDesign/App/FeatureHelix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/App/FeatureHelix.cpp b/src/Mod/PartDesign/App/FeatureHelix.cpp index 62c70e5efa..303bfbc197 100644 --- a/src/Mod/PartDesign/App/FeatureHelix.cpp +++ b/src/Mod/PartDesign/App/FeatureHelix.cpp @@ -91,7 +91,7 @@ Helix::Helix() ADD_PROPERTY_TYPE(Angle, (0.0), group, App::Prop_None, QT_TRANSLATE_NOOP("App::Property", "The angle of the cone that forms a hull around the helix.\n" "Non-zero values turn the helix into a conical spiral.\n" - "Positive values make the radius grow, nevatige shrink.")); + "Positive values make the radius grow, negative shrinks.")); Angle.setConstraints(&floatAngle); ADD_PROPERTY_TYPE(Growth, (0.0), group, App::Prop_None, QT_TRANSLATE_NOOP("App::Property", "The growth of the helix' radius per turn.\n" From 9f0f194d7b4dfaae3ee657eda308339713c18e7f Mon Sep 17 00:00:00 2001 From: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com> Date: Wed, 29 Jan 2025 12:14:26 +0100 Subject: [PATCH 061/224] Adding DPI info to the copied information in the about dialog (#19251) * Adding DPI info to the copied information in the about dialog. * Update DlgAbout.cpp changed screen() to QApplication::primaryScreen() --- src/Gui/Dialogs/DlgAbout.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Gui/Dialogs/DlgAbout.cpp b/src/Gui/Dialogs/DlgAbout.cpp index d1d5e5316d..caebd385a1 100644 --- a/src/Gui/Dialogs/DlgAbout.cpp +++ b/src/Gui/Dialogs/DlgAbout.cpp @@ -709,6 +709,13 @@ void AboutDialog::copyToClipboard() str << "Stylesheet/Theme/QtStyle: " << QString::fromStdString(styleSheet) << "/" << QString::fromStdString(theme) << "/" << QString::fromStdString(style) << "\n"; + // Add DPI information + str << "Logical/physical DPI: " + << QApplication::primaryScreen()->logicalDotsPerInch() + << "/" + << QApplication::primaryScreen()->physicalDotsPerInch() + << "\n"; + // Add installed module information: auto modDir = fs::path(App::Application::getUserAppDataDir()) / "Mod"; bool firstMod = true; From 07b2c87f0a00cbc445522d5796bd7fd5fa63d0e0 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 19 Jan 2025 09:43:12 -0600 Subject: [PATCH 062/224] Ext: Correct user preference specified in comment --- src/Ext/freecad/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ext/freecad/utils.py b/src/Ext/freecad/utils.py index 01bb923e50..0230a2b0ad 100644 --- a/src/Ext/freecad/utils.py +++ b/src/Ext/freecad/utils.py @@ -31,7 +31,7 @@ import FreeCAD def get_python_exe() -> str: """Find Python. In preference order - A) The value of the PythonExecutableForPip user preference + A) The value of the BaseApp/Preferences/PythonConsole/ExternalPythonExecutable user preference B) The executable located in the same bin directory as FreeCAD and called "python3" C) The executable located in the same bin directory as FreeCAD and called "python" D) The result of a shutil search for your system's "python3" executable From 456106910ec37283f2185c856f99c1a7731ccabe Mon Sep 17 00:00:00 2001 From: FEA-eng <59876896+FEA-eng@users.noreply.github.com> Date: Wed, 29 Jan 2025 13:37:02 +0100 Subject: [PATCH 063/224] FEM: Thermal expansion reference temperature for CalculiX analyses (#19285) * FEM: Update task_material_common.py * FEM: Update write_femelement_material.py * FEM: Update Material.ui * Fem: Enable material expansion reference temperature * FEM: Update thermomech_bimetal.py * FEM: Update thermomech_bimetal.inp --------- Co-authored-by: marioalexis --- src/Mod/Fem/Gui/Resources/ui/Material.ui | 188 ++++-------------- src/Mod/Fem/femexamples/thermomech_bimetal.py | 2 + .../calculix/write_femelement_material.py | 6 +- .../Fem/femtaskpanels/task_material_common.py | 59 ++++-- .../data/calculix/thermomech_bimetal.inp | 4 +- 5 files changed, 88 insertions(+), 171 deletions(-) diff --git a/src/Mod/Fem/Gui/Resources/ui/Material.ui b/src/Mod/Fem/Gui/Resources/ui/Material.ui index 41bdf99b9a..60913293b5 100755 --- a/src/Mod/Fem/Gui/Resources/ui/Material.ui +++ b/src/Mod/Fem/Gui/Resources/ui/Material.ui @@ -338,13 +338,53 @@
+ + + Expansion Reference Temperature: + + + + + + + false + + + + 0 + 0 + + + + + 80 + + + + Qt::AlignLeft|Qt::AlignTrailing|Qt::AlignVCenter + + + 1.000000000000000 + + + 100000000000.00000000000000 + + + K + + + 0.000000000000000 + + + + Specific Heat Capacity: - + false @@ -413,150 +453,4 @@ - - - chbu_allow_edit - toggled(bool) - qsb_density - setEnabled(bool) - - - 272 - 162 - - - 250 - 364 - - - - - chbu_allow_edit - toggled(bool) - qsb_young_modulus - setEnabled(bool) - - - 272 - 162 - - - 242 - 425 - - - - - chbu_allow_edit - toggled(bool) - qsb_poisson_ratio - setEnabled(bool) - - - 272 - 162 - - - 242 - 451 - - - - - chbu_allow_edit - toggled(bool) - qsb_kinematic_viscosity - setEnabled(bool) - - - 272 - 162 - - - 247 - 512 - - - - - chbu_allow_edit - toggled(bool) - qsb_thermal_conductivity - setEnabled(bool) - - - 272 - 162 - - - 254 - 573 - - - - - chbu_allow_edit - toggled(bool) - qsb_expansion_coefficient - setEnabled(bool) - - - 272 - 162 - - - 254 - 599 - - - - - chbu_allow_edit - toggled(bool) - qsb_specific_heat - setEnabled(bool) - - - 272 - 162 - - - 254 - 625 - - - - - chbu_allow_edit - toggled(bool) - label_vol_expansion_coefficient - setEnabled(bool) - - - 272 - 162 - - - 67 - 651 - - - - - chbu_allow_edit - toggled(bool) - pushButton_editMat - setDisabled(bool) - - - 272 - 162 - - - 91 - 162 - - - - diff --git a/src/Mod/Fem/femexamples/thermomech_bimetal.py b/src/Mod/Fem/femexamples/thermomech_bimetal.py index 8b7a61d85c..a83b79d65f 100644 --- a/src/Mod/Fem/femexamples/thermomech_bimetal.py +++ b/src/Mod/Fem/femexamples/thermomech_bimetal.py @@ -159,6 +159,7 @@ def setup(doc=None, solvertype="ccxtools"): mat["SpecificHeat"] = "385 J/kg/K" mat["ThermalConductivity"] = "398 W/m/K" mat["ThermalExpansionCoefficient"] = "0.0000165 m/m/K" + mat["ThermalExpansionReferenceTemperature"] = "273 K" mat["Density"] = "8960.0 kg/m^3" material_obj_bottom.Material = mat material_obj_bottom.References = [(geom_obj, "Solid1")] @@ -173,6 +174,7 @@ def setup(doc=None, solvertype="ccxtools"): mat["SpecificHeat"] = "515 J/kg/K" mat["ThermalConductivity"] = "13.5 W/m/K" mat["ThermalExpansionCoefficient"] = "0.00000125 m/m/K" + mat["ThermalExpansionReferenceTemperature"] = "273 K" material_obj_top.Material = mat material_obj_top.References = [(geom_obj, "Solid2")] analysis.addObject(material_obj_top) diff --git a/src/Mod/Fem/femsolver/calculix/write_femelement_material.py b/src/Mod/Fem/femsolver/calculix/write_femelement_material.py index c289f8d62c..ac930b1a43 100644 --- a/src/Mod/Fem/femsolver/calculix/write_femelement_material.py +++ b/src/Mod/Fem/femsolver/calculix/write_femelement_material.py @@ -81,6 +81,10 @@ def write_femelement_material(f, ccxwriter): if mat_obj.Category == "Solid": TEC = FreeCAD.Units.Quantity(mat_obj.Material["ThermalExpansionCoefficient"]) TEC_in_mmK = TEC.getValueAs("mm/mm/K").Value + RT = FreeCAD.Units.Quantity( + mat_obj.Material["ThermalExpansionReferenceTemperature"] + ) + RT_in_K = RT.getValueAs("K").Value elif mat_obj.Category == "Fluid": KV = FreeCAD.Units.Quantity(mat_obj.Material["KinematicViscosity"]) KV_in_mm2s = KV.getValueAs("mm^2/s").Value @@ -100,7 +104,7 @@ def write_femelement_material(f, ccxwriter): if mat_obj.Category == "Solid": f.write("*CONDUCTIVITY\n") f.write(f"{TC_in_WmK:.13G}\n") - f.write("*EXPANSION\n") + f.write(f"*EXPANSION, ZERO={RT_in_K:.13G}\n") f.write(f"{TEC_in_mmK:.13G}\n") f.write("*SPECIFIC HEAT\n") f.write(f"{SH_in_JkgK:.13G}\n") diff --git a/src/Mod/Fem/femtaskpanels/task_material_common.py b/src/Mod/Fem/femtaskpanels/task_material_common.py index e1c9498632..fc3fac6386 100644 --- a/src/Mod/Fem/femtaskpanels/task_material_common.py +++ b/src/Mod/Fem/femtaskpanels/task_material_common.py @@ -98,6 +98,11 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): QtCore.SIGNAL("editingFinished()"), self.tec_changed, ) + QtCore.QObject.connect( + self.parameterWidget.qsb_expansion_reference_temperature, + QtCore.SIGNAL("editingFinished()"), + self.tec_changed, + ) QtCore.QObject.connect( self.parameterWidget.qsb_specific_heat, QtCore.SIGNAL("editingFinished()"), @@ -154,13 +159,6 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.selectionWidget.finish_selection() return super().reject() - def isfloat(self, num): - try: - float(num) - return True - except ValueError: - return False - # choose material **************************************************************************** def filter_models(self, category): material_filter = Materials.MaterialFilter() @@ -172,24 +170,26 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): def toggleInputFieldsReadOnly(self): if self.parameterWidget.chbu_allow_edit.isChecked(): - self.parameterWidget.qsb_density.setReadOnly(False) - self.parameterWidget.qsb_young_modulus.setReadOnly(False) - self.parameterWidget.qsb_poisson_ratio.setReadOnly(False) - self.parameterWidget.qsb_thermal_conductivity.setReadOnly(False) - self.parameterWidget.qsb_expansion_coefficient.setReadOnly(False) - self.parameterWidget.qsb_specific_heat.setReadOnly(False) - self.parameterWidget.qsb_kinematic_viscosity.setReadOnly(False) + self.parameterWidget.qsb_density.setDisabled(False) + self.parameterWidget.qsb_young_modulus.setDisabled(False) + self.parameterWidget.qsb_poisson_ratio.setDisabled(False) + self.parameterWidget.qsb_thermal_conductivity.setDisabled(False) + self.parameterWidget.qsb_expansion_coefficient.setDisabled(False) + self.parameterWidget.qsb_expansion_reference_temperature.setDisabled(False) + self.parameterWidget.qsb_specific_heat.setDisabled(False) + self.parameterWidget.qsb_kinematic_viscosity.setDisabled(False) self.parameterWidget.wgt_material_tree.setEnabled(False) self.uuid = "" self.mat_from_input_fields() else: - self.parameterWidget.qsb_density.setReadOnly(True) - self.parameterWidget.qsb_young_modulus.setReadOnly(True) - self.parameterWidget.qsb_poisson_ratio.setReadOnly(True) - self.parameterWidget.qsb_thermal_conductivity.setReadOnly(True) - self.parameterWidget.qsb_expansion_coefficient.setReadOnly(True) - self.parameterWidget.qsb_specific_heat.setReadOnly(True) - self.parameterWidget.qsb_kinematic_viscosity.setReadOnly(True) + self.parameterWidget.qsb_density.setDisabled(True) + self.parameterWidget.qsb_young_modulus.setDisabled(True) + self.parameterWidget.qsb_poisson_ratio.setDisabled(True) + self.parameterWidget.qsb_thermal_conductivity.setDisabled(True) + self.parameterWidget.qsb_expansion_coefficient.setDisabled(True) + self.parameterWidget.qsb_expansion_reference_temperature.setDisabled(True) + self.parameterWidget.qsb_specific_heat.setDisabled(True) + self.parameterWidget.qsb_kinematic_viscosity.setDisabled(True) self.parameterWidget.wgt_material_tree.setEnabled(True) self.set_from_editor(self.material_tree.UUID) @@ -224,6 +224,14 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.parameterWidget.qsb_expansion_coefficient.property("value").UserString ) + def tec_changed(self): + if self.parameterWidget.chbu_allow_edit.isChecked(): + self.material["ThermalExpansionReferenceTemperature"] = ( + self.parameterWidget.qsb_expansion_reference_temperature.property( + "value" + ).UserString + ) + def sh_changed(self): if self.parameterWidget.chbu_allow_edit.isChecked(): self.material["SpecificHeat"] = self.parameterWidget.qsb_specific_heat.property( @@ -277,6 +285,12 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): self.parameterWidget.qsb_expansion_coefficient.setProperty("value", v) else: self.parameterWidget.qsb_expansion_coefficient.setProperty("rawValue", 0.0) + if "ThermalExpansionReferenceTemperature" in matmap: + self.parameterWidget.qsb_expansion_reference_temperature.setProperty( + "value", Units.Quantity(matmap["ThermalExpansionReferenceTemperature"]) + ) + else: + self.parameterWidget.qsb_expansion_reference_temperature.setProperty("rawValue", 0.0) if "SpecificHeat" in matmap: self.parameterWidget.qsb_specific_heat.setProperty( "value", Units.Quantity(matmap["SpecificHeat"]) @@ -299,6 +313,9 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel): d["Density"] = p.qsb_density.property("value").UserString d["ThermalConductivity"] = p.qsb_thermal_conductivity.property("value").UserString d["ThermalExpansionCoefficient"] = p.qsb_expansion_coefficient.property("value").UserString + d["ThermalExpansionReferenceTemperature"] = p.qsb_expansion_reference_temperature.property( + "value" + ).UserString d["SpecificHeat"] = p.qsb_specific_heat.property("value").UserString if self.obj.Category == "Solid": d["YoungsModulus"] = p.qsb_young_modulus.property("value").UserString diff --git a/src/Mod/Fem/femtest/data/calculix/thermomech_bimetal.inp b/src/Mod/Fem/femtest/data/calculix/thermomech_bimetal.inp index a898812b47..1267d1aa0b 100644 --- a/src/Mod/Fem/femtest/data/calculix/thermomech_bimetal.inp +++ b/src/Mod/Fem/femtest/data/calculix/thermomech_bimetal.inp @@ -7053,7 +7053,7 @@ Evolumes 119000,0.343 *CONDUCTIVITY 398 -*EXPANSION +*EXPANSION, ZERO=273 1.65E-05 *SPECIFIC HEAT 385000000 @@ -7064,7 +7064,7 @@ Evolumes 140000,0.29 *CONDUCTIVITY 13.5 -*EXPANSION +*EXPANSION, ZERO=273 1.25E-06 *SPECIFIC HEAT 515000000 From 2c9c2c9dc7f72b1c6e4b552e30503a639b936660 Mon Sep 17 00:00:00 2001 From: tritao Date: Wed, 22 Jan 2025 22:09:06 +0000 Subject: [PATCH 064/224] Gui: Add bounding box data to scene inspector. --- src/Gui/SceneInspector.cpp | 70 +++++++++++++++++++++++++++++++++++--- src/Gui/SceneInspector.ui | 4 +-- 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/src/Gui/SceneInspector.cpp b/src/Gui/SceneInspector.cpp index bec6a63f55..b94dc3ed61 100644 --- a/src/Gui/SceneInspector.cpp +++ b/src/Gui/SceneInspector.cpp @@ -30,6 +30,8 @@ # include #endif +#include + #include "SceneInspector.h" #include "ui_SceneInspector.h" #include "Application.h" @@ -37,6 +39,9 @@ #include "View3DInventor.h" #include "View3DInventorViewer.h" #include "ViewProviderDocumentObject.h" +#include "MainWindow.h" + +#include using namespace Gui::Dialog; @@ -53,7 +58,10 @@ enum class Column: std::int8_t { NAME = 1, MEMORY_ADDRESS = 2, DATA = 3, - COUNT = 4, + RENDER_CACHING = 4, + BOUNDING_BOX_CACHING = 5, + BOUNDING_BOX = 6, + COUNT = 7, }; SceneModel::~SceneModel() = default; @@ -84,6 +92,12 @@ QVariant SceneModel::headerData (int section, Qt::Orientation orientation, int r return tr("Address"); case Column::DATA: return tr("Data"); + case Column::RENDER_CACHING: + return tr("Render Cache"); + case Column::BOUNDING_BOX_CACHING: + return tr("Bounds Cache"); + case Column::BOUNDING_BOX: + return tr("Bounds"); default: assert(0 && "Not handled yet"); } @@ -175,6 +189,37 @@ static std::string_view formatSoPickStyleElement(int32_t value) } } +static inline bool isAtFloatValueLimit(float v) +{ + return v == std::numeric_limits::lowest() || v == std::numeric_limits::max(); +} + +static bool isInfinite(const SbVec3f& vec) +{ + float x, y, z; //NOLINT + vec.getValue(x, y, z); + return isAtFloatValueLimit(x) && isAtFloatValueLimit(y) && isAtFloatValueLimit(z); +} + +static std::string formatSbXfBox3f(const SbXfBox3f& box) +{ + SbVec3f minpoint; + SbVec3f maxpoint; + box.getBounds(minpoint, maxpoint); + + if (isInfinite(minpoint) && isInfinite(maxpoint)) { + return {"Infinite"}; + } + + float minx, miny, minz; //NOLINT + minpoint.getValue(minx, miny, minz); + + float maxx, maxy, maxz; //NOLINT + maxpoint.getValue(maxx, maxy, maxz); + + return fmt::format("Min: ({:.3},{:.3},{:.3}), Max: ({:.3},{:.3},{:.3})", minx, miny, minz, maxx, maxy, maxz); +} + void SceneModel::setNode(QModelIndex index, SoNode* node) { this->setData(index.siblingAtColumn(static_cast(Column::INVENTOR_TREE)), @@ -190,6 +235,9 @@ void SceneModel::setNode(QModelIndex index, SoNode* node) this->setData(index.siblingAtColumn(static_cast(Column::MEMORY_ADDRESS)), QVariant(QString::fromStdString(fmt::format("{}", (void*)node)))); + auto view = qobject_cast(getMainWindow()->activeWindow()); + auto vp = view->getViewer()->getSoRenderManager()->getViewportRegion(); + QString data; QTextStream stream(&data); if(static_cast(node->isOfType(SoSwitch::getClassTypeId()))) { @@ -198,8 +246,19 @@ void SceneModel::setNode(QModelIndex index, SoNode* node) stream << fmt::format("Which: {} ({})", formatSoSwitchValue(value), value).c_str(); } else if (static_cast(node->isOfType(SoSeparator::getClassTypeId()))) { auto pcSeparator = static_cast(node); - auto value = pcSeparator->renderCaching.getValue(); - stream << fmt::format("RenderCaching: {} ({})", formatSoSeparatorCacheEnabled(value), value).c_str(); + + auto renderCaching = pcSeparator->renderCaching.getValue(); + this->setData(index.siblingAtColumn(static_cast(Column::RENDER_CACHING)), + QVariant(QString::fromStdString(std::string{formatSoSeparatorCacheEnabled(renderCaching)}))); + + auto boundingBoxCaching = pcSeparator->boundingBoxCaching.getValue(); + this->setData(index.siblingAtColumn(static_cast(Column::BOUNDING_BOX_CACHING)), + QVariant(QString::fromStdString(std::string{formatSoSeparatorCacheEnabled(boundingBoxCaching)}))); + + SoGetBoundingBoxAction getBBox(vp); + getBBox.apply(pcSeparator); + this->setData(index.siblingAtColumn(static_cast(Column::BOUNDING_BOX)), + QVariant(QString::fromStdString(formatSbXfBox3f(getBBox.getXfBoundingBox())))); } else if (static_cast(node->isOfType(SoDrawStyle::getClassTypeId()))) { auto pcDrawStyle = static_cast(node); auto value = pcDrawStyle->style.getValue(); @@ -287,7 +346,10 @@ void DlgInspector::setNode(SoNode* node) header->setSectionResizeMode(static_cast(Column::NAME), QHeaderView::Interactive); header->resizeSection(static_cast(Column::NAME), 200); header->setSectionResizeMode(static_cast(Column::MEMORY_ADDRESS), QHeaderView::Interactive); - header->setSectionResizeMode(static_cast(Column::DATA), QHeaderView::Stretch); + header->resizeSection(static_cast(Column::MEMORY_ADDRESS), 140); + header->setSectionResizeMode(static_cast(Column::DATA), QHeaderView::Interactive); + header->resizeSection(static_cast(Column::DATA), 200); + header->setSectionsMovable(false); } diff --git a/src/Gui/SceneInspector.ui b/src/Gui/SceneInspector.ui index 478137cd5c..6d4a398303 100644 --- a/src/Gui/SceneInspector.ui +++ b/src/Gui/SceneInspector.ui @@ -6,8 +6,8 @@ 0 0 - 805 - 583 + 1200 + 700 From 91570a74c63217f20ae7c08324657e8e546d8058 Mon Sep 17 00:00:00 2001 From: tritao Date: Sun, 19 Jan 2025 16:50:08 +0000 Subject: [PATCH 065/224] CMake: Provide build flag to enable libc++ standard library. --- cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake b/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake index feb517c756..c6eb431637 100644 --- a/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake +++ b/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake @@ -82,6 +82,10 @@ macro(CompilerChecksAndSetups) endif() endif() endif(BUILD_DYNAMIC_LINK_PYTHON) + + if(BUILD_USE_LIBCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + endif() endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) if(CMAKE_COMPILER_IS_CLANGXX) From 9d53b7190a260dc4135788f0028eee8ec5a0bf1f Mon Sep 17 00:00:00 2001 From: tritao Date: Sun, 19 Jan 2025 16:50:22 +0000 Subject: [PATCH 066/224] CMake: Provide build flag to enable compile time tracing. --- cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake b/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake index c6eb431637..9fa104f6df 100644 --- a/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake +++ b/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake @@ -86,6 +86,11 @@ macro(CompilerChecksAndSetups) if(BUILD_USE_LIBCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() + + if(BUILD_ENABLE_TIME_TRACE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftime-trace") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftime-trace") + endif() endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) if(CMAKE_COMPILER_IS_CLANGXX) From 2acc5ffbea53cc719324525b1d2b57c5ee19390f Mon Sep 17 00:00:00 2001 From: luzpaz Date: Wed, 29 Jan 2025 07:18:13 -0500 Subject: [PATCH 067/224] Remove superflous whitespace + trailing newlines --- cMake/FindKDL.cmake | 2 +- src/Mod/BIM/importers/importSH3DHelper.py | 10 +++++----- src/Mod/OpenSCAD/OpenSCAD2Dgeom.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cMake/FindKDL.cmake b/cMake/FindKDL.cmake index 0bc567329c..789d0ffab2 100644 --- a/cMake/FindKDL.cmake +++ b/cMake/FindKDL.cmake @@ -9,7 +9,7 @@ IF ( CMAKE_PKGCONFIG_EXECUTABLE ) MESSAGE( STATUS "Detecting KDL" ) - + SET(ENV{PKG_CONFIG_PATH} "${KDL_INSTALL}/lib/pkgconfig/") MESSAGE( "Looking for KDL in: ${KDL_INSTALL}") PKGCONFIG( "orocos-kdl >= 1.4.0" KDL_FOUND KDL_INCLUDE_DIRS KDL_DEFINES KDL_LINK_DIRS KDL_LIBS ) diff --git a/src/Mod/BIM/importers/importSH3DHelper.py b/src/Mod/BIM/importers/importSH3DHelper.py index 3674e2e4b0..c32084c01b 100644 --- a/src/Mod/BIM/importers/importSH3DHelper.py +++ b/src/Mod/BIM/importers/importSH3DHelper.py @@ -482,7 +482,7 @@ class SH3DImporter: if floor.id not in self.spaces: self.spaces[floor.id] = [] self.spaces[floor.id].append(space) - + def get_spaces(self, floor): return self.spaces.get(floor.id, []) @@ -1002,7 +1002,7 @@ class LevelHandler(BaseHandler): if not wire.isClosed(): # Sometimes the wire is not closed because the edges are # not sorted and do not form a "chain". Therefore, sort them, - # recreate the wire while also rounding the precision of the + # recreate the wire while also rounding the precision of the # Vertices in order to avoid not closing because the points # are not close enough wire = Part.Wire(Part.__sortEdges__(self._round(sv.Shape.Edges))) @@ -1083,7 +1083,7 @@ class RoomHandler(BaseHandler): reference_face.recompute() floor.getObject(floor.ReferenceFacesGroupName).addObject(reference_face) - # NOTE: for room to properly display and calculate the area, the + # NOTE: for room to properly display and calculate the area, the # Base object can not be a face but must have a height... footprint = App.ActiveDocument.addObject("Part::Feature", "Footprint") footprint.Shape = reference_face.Shape.extrude(Z_NORM) @@ -1448,7 +1448,7 @@ class WallHandler(BaseHandler): # The Length property is used in the Wall to calculate volume, etc... # Since make Circle does not calculate this Length I calculate it here... self.importer.set_property(spine, "App::PropertyFloat", "Length", "The length of the Arc", length, group="Draft") - # The Start and End property are used in the Wall to determine Facebinders + # The Start and End property are used in the Wall to determine Facebinders # characteristics... self.importer.set_property(spine, "App::PropertyVector", "Start", "The start point of the Arc", start, group="Draft") self.importer.set_property(spine, "App::PropertyVector", "End", "The end point of the Arc", end, group="Draft") @@ -1766,7 +1766,7 @@ class WallHandler(BaseHandler): def _get_faces(self, wall): """Returns the name of the left and right face for `wall` - The face names are suitable for selection later on when creating + The face names are suitable for selection later on when creating the Facebinders and baseboards. Note, that this must be executed once the wall has been completely constructed. If a window or door is added afterward, this will have an impact on what is diff --git a/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py b/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py index de7967e9d5..39b22c5b45 100644 --- a/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py +++ b/src/Mod/OpenSCAD/OpenSCAD2Dgeom.py @@ -34,7 +34,7 @@ class Overlappingfaces(): def __init__(self,facelist): self.sortedfaces = sorted(facelist,key=(lambda shape: shape.Area),reverse=True) self.builddepdict() - + @staticmethod def dofacesoverlapboundbox(bigface,smallface): return bigface.BoundBox.isIntersection(smallface.BoundBox) @@ -196,7 +196,7 @@ class Overlappingfaces(): toolface=fusefaces([faces[tfi] for tfi in directchildren]) faces[fi]=faces[fi].cut(toolface) removefaces(directchildren) - + faces =[face for index,face in enumerate(faces) if index not in finishedwith] return fusefaces(faces) From 10e34c83634283e83886ac7e49e884a143e9079f Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Tue, 31 Dec 2024 18:10:25 +0530 Subject: [PATCH 068/224] [Sketcher] Move internal functions out of `trim` Towards making it a function class or similar. --- src/Mod/Sketcher/App/SketchObject.cpp | 224 +++++++++++++------------- 1 file changed, 116 insertions(+), 108 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 9b3c703250..c985629230 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3551,6 +3551,111 @@ bool getIntersectionParameter(const Part::Geometry* geo, return true; } +bool arePointsWithinPrecision(const Base::Vector3d& point1, const Base::Vector3d& point2) { + // From testing: 500x (or 0.000050) is needed in order to not falsely distinguish points + // calculated with seekTrimPoints + return ((point1 - point2).Length() < 500 * Precision::Confusion()); +} + +bool areParamsWithinApproximation(double param1, double param2) { + // From testing: 500x (or 0.000050) is needed in order to not falsely distinguish points + // calculated with seekTrimPoints + return (std::abs(param1 - param2) < Precision::PApproximation()); +} + +// returns true if the point defined by (GeoId1, pos1) can be considered to be coincident with +// point. +bool isPointAtPosition(const SketchObject* obj, int GeoId1, PointPos pos1, const Base::Vector3d& point) +{ + Base::Vector3d pp = obj->getPoint(GeoId1, pos1); + + return arePointsWithinPrecision(point, pp); +} + +// Checks whether preexisting constraints must be converted to new constraints. +// Preexisting point on object constraints get converted to coincidents. +// Returns: +// - The constraint that should be used to constraint GeoId and cuttingGeoId +std::unique_ptr transformPreexistingConstraintForTrim(const SketchObject* obj, + const Constraint* constr, + int GeoId, + int cuttingGeoId, + const Base::Vector3d& cutPointVec, + int newGeoId, + PointPos newPosId) +{ + /* TODO: It is possible that the trimming entity has both a PointOnObject constraint to the + * trimmed entity, and a simple Tangent constraint to the trimmed entity. In this case we + * want to change to a single end-to-end tangency, i.e we want to ensure that constrType1 + * is set to Sketcher::Tangent, that the secondPos1 is captured from the PointOnObject, + * and also make sure that the PointOnObject constraint is deleted. + */ + std::unique_ptr newConstr; + if (!constr->involvesGeoId(cuttingGeoId) + || !constr->involvesGeoIdAndPosId(GeoId, PointPos::none)) { + return newConstr; + } + switch (constr->Type) { + case PointOnObject: { + // we might want to transform this (and the new point-on-object constraints) into a coincidence + // At this stage of the check the point has to be an end of `cuttingGeoId` on the edge of `GeoId`. + if (isPointAtPosition(obj, constr->First, constr->FirstPos, cutPointVec)) { + // This concerns the start portion of the trim + newConstr.reset(constr->copy()); + newConstr->Type = Sketcher::Coincident; + newConstr->Second = newGeoId; + newConstr->SecondPos = newPosId; + } + break; + } + case Tangent: + case Perpendicular: { + // These may have to be turned into endpoint-to-endpoint or endpoint-to-edge + // TODO: could there be tangent/perpendicular constraints not involving the trim that are modified below? + newConstr.reset(constr->copy()); + newConstr->substituteIndexAndPos(GeoId, PointPos::none, newGeoId, newPosId); + // make sure the first position is a point + if (newConstr->FirstPos == PointPos::none) { + std::swap(newConstr->First, newConstr->Second); + std::swap(newConstr->FirstPos, newConstr->SecondPos); + } + // there is no need for the third point if it exists + newConstr->Third = GeoEnum::GeoUndef; + newConstr->ThirdPos = PointPos::none; + break; + } + default: + break; + } + return newConstr; +} + +std::unique_ptr getNewConstraintAtTrimCut(const SketchObject* obj, + int cuttingGeoId, + int cutGeoId, + PointPos cutPosId, + const Base::Vector3d& cutPointVec) +{ + auto newConstr = std::make_unique(); + newConstr->First = cutGeoId; + newConstr->FirstPos = cutPosId; + newConstr->Second = cuttingGeoId; + if (isPointAtPosition(obj, cuttingGeoId, PointPos::start, cutPointVec)) { + newConstr->Type = Sketcher::Coincident; + newConstr->SecondPos = PointPos::start; + } + else if (isPointAtPosition(obj, cuttingGeoId, PointPos::end, cutPointVec)) { + newConstr->Type = Sketcher::Coincident; + newConstr->SecondPos = PointPos::end; + } + else { + // Points are sufficiently far apart: use point-on-object + newConstr->Type = Sketcher::PointOnObject; + newConstr->SecondPos = PointPos::none; + } + return newConstr; +}; + int SketchObject::trim(int GeoId, const Base::Vector3d& point) { // no need to check input data validity as this is an sketchobject managed operation. @@ -3571,83 +3676,6 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) //******************* Lambdas - common functions for different intersections //****************************************// - auto arePointsWithinPrecision = [](Base::Vector3d& point1, Base::Vector3d& point2) { - // From testing: 500x (or 0.000050) is needed in order to not falsely distinguish points - // calculated with seekTrimPoints - return ((point1 - point2).Length() < 500 * Precision::Confusion()); - }; - - auto areParamsWithinApproximation = [](double param1, double param2) { - // From testing: 500x (or 0.000050) is needed in order to not falsely distinguish points - // calculated with seekTrimPoints - return (std::abs(param1 - param2) < Precision::PApproximation()); - }; - - // returns true if the point defined by (GeoId1, pos1) can be considered to be coincident with - // point. - auto isPointAtPosition = - [this, &arePointsWithinPrecision](int GeoId1, PointPos pos1, Base::Vector3d& point) { - Base::Vector3d pp = getPoint(GeoId1, pos1); - - return arePointsWithinPrecision(point, pp); - }; - - // Checks whether preexisting constraints must be converted to new constraints. - // Preexisting point on object constraints get converted to coincidents. - // Returns: - // - The constraint that should be used to constraint GeoId and cuttingGeoId - auto transformPreexistingConstraint = [&isPointAtPosition](const Constraint* constr, - int GeoId, - int cuttingGeoId, - Base::Vector3d& cutPointVec, - int newGeoId, - PointPos newPosId) { - /* TODO: It is possible that the trimming entity has both a PointOnObject constraint to the - * trimmed entity, and a simple Tangent constraint to the trimmed entity. In this case we - * want to change to a single end-to-end tangency, i.e we want to ensure that constrType1 - * is set to Sketcher::Tangent, that the secondPos1 is captured from the PointOnObject, - * and also make sure that the PointOnObject constraint is deleted. - */ - std::unique_ptr newConstr; - if (!constr->involvesGeoId(cuttingGeoId) - || !constr->involvesGeoIdAndPosId(GeoId, PointPos::none)) { - return newConstr; - } - switch (constr->Type) { - case PointOnObject: { - // we might want to transform this (and the new point-on-object constraints) into a coincidence - // At this stage of the check the point has to be an end of `cuttingGeoId` on the edge of `GeoId`. - if (isPointAtPosition(constr->First, constr->FirstPos, cutPointVec)) { - // This concerns the start portion of the trim - newConstr.reset(constr->copy()); - newConstr->Type = Sketcher::Coincident; - newConstr->Second = newGeoId; - newConstr->SecondPos = newPosId; - } - break; - } - case Tangent: - case Perpendicular: { - // These may have to be turned into endpoint-to-endpoint or endpoint-to-edge - // TODO: could there be tangent/perpendicular constraints not involving the trim that are modified below? - newConstr.reset(constr->copy()); - newConstr->substituteIndexAndPos(GeoId, PointPos::none, newGeoId, newPosId); - // make sure the first position is a point - if (newConstr->FirstPos == PointPos::none) { - std::swap(newConstr->First, newConstr->Second); - std::swap(newConstr->FirstPos, newConstr->SecondPos); - } - // there is no need for the third point if it exists - newConstr->Third = GeoEnum::GeoUndef; - newConstr->ThirdPos = PointPos::none; - break; - } - default: - break; - } - return newConstr; - }; - // makes an equality constraint between GeoId1 and GeoId2 auto constrainAsEqual = [this](int GeoId1, int GeoId2) { auto newConstr = std::make_unique(); @@ -3792,7 +3820,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) transferConstraints(GeoId, PointPos::mid, newIds.front(), PointPos::mid, true); // Make centers coincident if (newIds.size() > 1) { - Constraint* joint = new Constraint(); + auto* joint = new Constraint(); joint->Type = Coincident; joint->First = newIds.front(); joint->FirstPos = PointPos::mid; @@ -3829,14 +3857,14 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) geoIdsToBeDeleted.insert(con->First); continue; } - if (auto newConstr = transformPreexistingConstraint( - con, GeoId, cuttingGeoIds[0], cutPoints[0], newIds.front(), PointPos::end)) { + if (auto newConstr = transformPreexistingConstraintForTrim( + this, con, GeoId, cuttingGeoIds[0], cutPoints[0], newIds.front(), PointPos::end)) { newConstraints.push_back(newConstr.release()); isPoint1ConstrainedOnGeoId1 = true; continue; } - if (auto newConstr = transformPreexistingConstraint( - con, GeoId, cuttingGeoIds[1], cutPoints[1], newIds.back(), PointPos::start)) { + if (auto newConstr = transformPreexistingConstraintForTrim( + this, con, GeoId, cuttingGeoIds[1], cutPoints[1], newIds.back(), PointPos::start)) { newConstraints.push_back(newConstr.release()); isPoint2ConstrainedOnGeoId2 = true; continue; @@ -3855,36 +3883,16 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) // to coincident or end-to-end tangency/perpendicularity. // TODO: Tangent/perpendicular not yet covered - auto addNewConstraintAtCut = [&isPointAtPosition, &newConstraints](int cuttingGeoId, - int cutGeoId, - PointPos cutPosId, - Base::Vector3d cutPointVec) { - Constraint* newConstr = new Constraint(); - newConstr->First = cutGeoId; - newConstr->FirstPos = cutPosId; - newConstr->Second = cuttingGeoId; - if (isPointAtPosition(cuttingGeoId, PointPos::start, cutPointVec)) { - newConstr->Type = Sketcher::Coincident; - newConstr->SecondPos = PointPos::start; - } - else if (isPointAtPosition(cuttingGeoId, PointPos::end, cutPointVec)) { - newConstr->Type = Sketcher::Coincident; - newConstr->SecondPos = PointPos::end; - } - else { - // Points are sufficiently far apart: use point-on-object - newConstr->Type = Sketcher::PointOnObject; - newConstr->SecondPos = PointPos::none; - } - newConstraints.push_back(newConstr); - }; - if (cuttingGeoIds[0] != GeoEnum::GeoUndef && !isPoint1ConstrainedOnGeoId1) { - addNewConstraintAtCut(cuttingGeoIds[0], newIds.front(), PointPos::end, cutPoints[0]); + newConstraints.emplace_back( + getNewConstraintAtTrimCut( + this, cuttingGeoIds[0], newIds.front(), PointPos::end, cutPoints[0]).release()); } if (cuttingGeoIds[1] != GeoEnum::GeoUndef && !isPoint2ConstrainedOnGeoId2) { - addNewConstraintAtCut(cuttingGeoIds[1], newIds.back(), PointPos::start, cutPoints[1]); + newConstraints.emplace_back( + getNewConstraintAtTrimCut( + this, cuttingGeoIds[1], newIds.back(), PointPos::start, cutPoints[1]).release()); } // Workaround to avoid https://github.com/FreeCAD/FreeCAD/issues/15484. From 916086ad9cd04784a91484083d3d2999978f05cf Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Wed, 1 Jan 2025 13:01:56 +0530 Subject: [PATCH 069/224] [Sketcher] Move `trim` sub-steps to different functions --- src/Mod/Sketcher/App/SketchObject.cpp | 443 +++++++++++++++----------- src/Mod/Sketcher/App/SketchObject.h | 4 +- 2 files changed, 258 insertions(+), 189 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index c985629230..38e43c747f 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3656,38 +3656,164 @@ std::unique_ptr getNewConstraintAtTrimCut(const SketchObject* obj, return newConstr; }; +bool isGeoIdAllowedForTrim(const SketchObject* obj, int GeoId) +{ + const auto* geo = obj->getGeometry(GeoId); + + return GeoId >= 0 && GeoId <= obj->getHighestCurveIndex() + && GeometryFacade::isInternalType(geo, InternalType::None); +} + +bool getParamLimitsOfNewGeosForTrim(const SketchObject* obj, + int GeoId, + std::array& cuttingGeoIds, + std::array& cutPoints, + std::vector>& paramsOfNewGeos) +{ + const auto* geoAsCurve = static_cast(obj->getGeometry(GeoId)); + double firstParam = geoAsCurve->getFirstParameter(); + double lastParam = geoAsCurve->getLastParameter(); + double cut0Param {firstParam}, cut1Param {lastParam}; + + bool allParamsFound = getIntersectionParameter(geoAsCurve, cutPoints[0], cut0Param) + && getIntersectionParameter(geoAsCurve, cutPoints[1], cut1Param); + if (!allParamsFound) { + return false; + } + + if (!obj->isClosedCurve(geoAsCurve) && areParamsWithinApproximation(firstParam, cut0Param)) { + cuttingGeoIds[0] = GeoEnum::GeoUndef; + } + + if (!obj->isClosedCurve(geoAsCurve) && areParamsWithinApproximation(lastParam, cut1Param)) { + cuttingGeoIds[1] = GeoEnum::GeoUndef; + } + + size_t numUndefs = std::count(cuttingGeoIds.begin(), cuttingGeoIds.end(), GeoEnum::GeoUndef); + + if (numUndefs == 0 && arePointsWithinPrecision(cutPoints[0], cutPoints[1])) { + // If both points are detected and are coincident, deletion is the only option. + paramsOfNewGeos.clear(); + return true; + } + + paramsOfNewGeos.assign(2 - numUndefs, {firstParam, lastParam}); + + if (paramsOfNewGeos.empty()) { + return true; + } + + if (obj->isClosedCurve(geoAsCurve)) { + paramsOfNewGeos.pop_back(); + } + + if (cuttingGeoIds[0] != GeoEnum::GeoUndef) { + paramsOfNewGeos.front().second = cut0Param; + } + if (cuttingGeoIds[1] != GeoEnum::GeoUndef) { + paramsOfNewGeos.back().first = cut1Param; + } + + return true; +} + +void createArcsFromGeoWithLimits(const Part::GeomCurve* geo, + const std::vector>& paramsOfNewGeos, + std::vector>& newGeos) +{ + for (auto& [u1, u2] : paramsOfNewGeos) { + auto newGeo = static_cast(geo)->createArc(u1, u2); + assert(newGeo); + newGeos.emplace_back(newGeo); + } +} + +void createNewConstraintsForTrim(const SketchObject* obj, + const int GeoId, + const std::array& cuttingGeoIds, + const std::array& cutPoints, + const std::vector& newIds, + std::vector& idsOfOldConstraints, + std::vector& newConstraints, + std::set>& geoIdsToBeDeleted) +{ + const auto& allConstraints = obj->Constraints.getValues(); + + bool isPoint1ConstrainedOnGeoId1 = false; + bool isPoint2ConstrainedOnGeoId2 = false; + + for (const auto& oldConstrId : idsOfOldConstraints) { + // trim-specific changes first + const Constraint* con = allConstraints[oldConstrId]; + if (con->Type == InternalAlignment) { + geoIdsToBeDeleted.insert(con->First); + continue; + } + if (auto newConstr = transformPreexistingConstraintForTrim(obj, + con, + GeoId, + cuttingGeoIds[0], + cutPoints[0], + newIds.front(), + PointPos::end)) { + newConstraints.push_back(newConstr.release()); + isPoint1ConstrainedOnGeoId1 = true; + continue; + } + if (auto newConstr = transformPreexistingConstraintForTrim(obj, + con, + GeoId, + cuttingGeoIds[1], + cutPoints[1], + newIds.back(), + PointPos::start)) { + newConstraints.push_back(newConstr.release()); + isPoint2ConstrainedOnGeoId2 = true; + continue; + } + // We have already transferred all constraints on endpoints to the new pieces. + // If there is still any left, this means one of the remaining pieces was degenerate. + if (!con->involvesGeoIdAndPosId(GeoId, PointPos::none)) { + continue; + } + // constraint has not yet been changed + obj->deriveConstraintsForPieces(GeoId, newIds, con, newConstraints); + } + + // Add point-on-object/coincidence constraints with the newly exposed points. + // This will need to account for the constraints that were already converted + // to coincident or end-to-end tangency/perpendicularity. + // TODO: Tangent/perpendicular not yet covered + + if (cuttingGeoIds[0] != GeoEnum::GeoUndef && !isPoint1ConstrainedOnGeoId1) { + newConstraints.emplace_back(getNewConstraintAtTrimCut(obj, + cuttingGeoIds[0], + newIds.front(), + PointPos::end, + cutPoints[0]) + .release()); + } + + if (cuttingGeoIds[1] != GeoEnum::GeoUndef && !isPoint2ConstrainedOnGeoId2) { + newConstraints.emplace_back(getNewConstraintAtTrimCut(obj, + cuttingGeoIds[1], + newIds.back(), + PointPos::start, + cutPoints[1]) + .release()); + } +} + int SketchObject::trim(int GeoId, const Base::Vector3d& point) { - // no need to check input data validity as this is an sketchobject managed operation. - Base::StateLocker lock(managedoperation, true); - - //******************* Basic checks rejecting the operation - //****************************************// - if (GeoId < 0 || GeoId > getHighestCurveIndex()) { + if (!isGeoIdAllowedForTrim(this, GeoId)) { return -1; } - - auto geo = getGeometry(GeoId); - - if (!GeometryFacade::isInternalType(geo, InternalType::None)) { - return -1; // internal alignment geometry is not trimmable - } - - //******************* Lambdas - common functions for different intersections - //****************************************// - - // makes an equality constraint between GeoId1 and GeoId2 - auto constrainAsEqual = [this](int GeoId1, int GeoId2) { - auto newConstr = std::make_unique(); - - // Build Constraints associated with new pair of arcs - newConstr->Type = Sketcher::Equal; - newConstr->First = GeoId1; - newConstr->FirstPos = Sketcher::PointPos::none; - newConstr->Second = GeoId2; - newConstr->SecondPos = Sketcher::PointPos::none; - addConstraint(std::move(newConstr)); - }; + // Remove internal geometry beforehand for now + // FIXME: we should be able to transfer these to new curves smoothly + deleteUnusedInternalGeometryAndUpdateGeoId(GeoId); + // auto geo = getGeometry(GeoId); + const auto* geoAsCurve = static_cast(getGeometry(GeoId)); //******************* Step A => Detection of intersection - Common to all Geometries //****************************************// @@ -3717,105 +3843,118 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) return 0; } - const auto* geoAsCurve = static_cast(geo); - double firstParam = geoAsCurve->getFirstParameter(); - double lastParam = geoAsCurve->getLastParameter(); - double pointParam, cut0Param{firstParam}, cut1Param{lastParam}; - bool allParamsFound = getIntersectionParameter(geo, point, pointParam) - && getIntersectionParameter(geo, cutPoints[0], cut0Param) - && getIntersectionParameter(geo, cutPoints[1], cut1Param); - if (!allParamsFound) { + // TODO: find trim parameters + std::vector> paramsOfNewGeos; + paramsOfNewGeos.reserve(2); + if (!getParamLimitsOfNewGeosForTrim(this, GeoId, cuttingGeoIds, cutPoints, paramsOfNewGeos)) { return -1; } - if (!isClosedCurve(geo) && areParamsWithinApproximation(firstParam, cut0Param)) { - cuttingGeoIds[0] = GeoEnum::GeoUndef; - } - - if (!isClosedCurve(geo) && areParamsWithinApproximation(lastParam, cut1Param)) { - cuttingGeoIds[1] = GeoEnum::GeoUndef; - } - - size_t numUndefs = std::count(cuttingGeoIds.begin(), cuttingGeoIds.end(), GeoEnum::GeoUndef); - - if (numUndefs == 0 && arePointsWithinPrecision(cutPoints[0], cutPoints[1])) { - // If both points are detected and are coincident, deletion is the only option. - delGeometry(GeoId); - return 0; - } - - bool startPointRemains = (cuttingGeoIds[0] != GeoEnum::GeoUndef); - bool endPointRemains = (cuttingGeoIds[1] != GeoEnum::GeoUndef); - std::vector> paramsOfNewGeos(2 - numUndefs, {firstParam, lastParam}); + //******************* Step B => Creation of new geometries + //****************************************// std::vector newIds; - std::vector newGeos; + std::vector> newGeos; std::vector newGeosAsConsts; - // TODO: This should be needed, but for some reason we already get both curves as construction - // when needed. - - // bool oldGeoIsConstruction = - // GeometryFacade::getConstruction(static_cast(geo)); - - if (isClosedCurve(geo) && !paramsOfNewGeos.empty()) { - startPointRemains = false; - endPointRemains = false; - paramsOfNewGeos.pop_back(); - } switch (paramsOfNewGeos.size()) { - case 0: { - delGeometry(GeoId); - return 0; - } - case 1: { - newIds.push_back(GeoId); - break; - } - case 2: { - newIds.push_back(GeoId); - newIds.push_back(getHighestCurveIndex() + 1); - break; - } - default: { - return -1; - } + case 0: { + delGeometry(GeoId); + return 0; + } + case 1: { + newIds.push_back(GeoId); + break; + } + case 2: { + newIds.push_back(GeoId); + newIds.push_back(getHighestCurveIndex() + 1); + break; + } + default: { + return -1; + } } - if (cuttingGeoIds[0] != GeoEnum::GeoUndef) { - paramsOfNewGeos.front().second = cut0Param; - } - if (cuttingGeoIds[1] != GeoEnum::GeoUndef) { - paramsOfNewGeos.back().first = cut1Param; - } - - for (auto& [u1, u2] : paramsOfNewGeos) { - auto newGeo = static_cast(geo)->createArc(u1, u2); - assert(newGeo); - newGeos.push_back(newGeo); - newGeosAsConsts.push_back(newGeo); + createArcsFromGeoWithLimits(geoAsCurve, paramsOfNewGeos, newGeos); + for (const auto& geo : newGeos) { + newGeosAsConsts.push_back(geo.get()); } + //******************* Step C => Creation of new constraints + //****************************************// // Now that we have the new curves, change constraints as needed // Some are covered with `deriveConstraintsForPieces`, others are specific to trim // FIXME: We are using non-smart pointers since that's what's needed in `addConstraints`. + const auto& allConstraints = this->Constraints.getValues(); std::vector newConstraints; + std::vector idsOfOldConstraints; + std::set> geoIdsToBeDeleted; + getConstraintIndices(GeoId, idsOfOldConstraints); + // remove the constraints that we want to manually transfer + // We could transfer beforehand but in case of exception that transfer is permanent + if (!isClosedCurve(geoAsCurve)) { + if (cuttingGeoIds[0] != GeoEnum::GeoUndef) { + idsOfOldConstraints.erase( + std::remove_if( + idsOfOldConstraints.begin(), + idsOfOldConstraints.end(), + [this, &GeoId, &allConstraints](const auto& i) { + return (allConstraints[i]->involvesGeoIdAndPosId(GeoId, PointPos::start)); + }), + idsOfOldConstraints.end()); + } + if (cuttingGeoIds[1] != GeoEnum::GeoUndef) { + idsOfOldConstraints.erase( + std::remove_if(idsOfOldConstraints.begin(), + idsOfOldConstraints.end(), + [this, &GeoId, &allConstraints](const auto& i) { + return (allConstraints[i]->involvesGeoIdAndPosId(GeoId, + PointPos::end)); + }), + idsOfOldConstraints.end()); + } + } + idsOfOldConstraints.erase( + std::remove_if(idsOfOldConstraints.begin(), + idsOfOldConstraints.end(), + [this, &GeoId, &allConstraints](const auto& i) { + return (allConstraints[i]->involvesGeoIdAndPosId(GeoId, PointPos::mid)); + }), + idsOfOldConstraints.end()); - // A geoId we expect to never exist during this operation (but still not `GeoEnum::GeoUndef`). - // We use it because newIds.front() is supposed to be `GeoId`, but we will delete constraints - // on it down the line, even if we may need it later. - // Note that this will cause some malformed constraints until they are transferred back. - int nonexistentGeoId = getHighestCurveIndex() + newIds.size(); - newIds.front() = nonexistentGeoId; + createNewConstraintsForTrim(this, + GeoId, + cuttingGeoIds, + cutPoints, + newIds, + idsOfOldConstraints, + newConstraints, + geoIdsToBeDeleted); + + //******************* Step D => Replacing geometries and constraints + //****************************************// // Constraints related to start/mid/end points of original - if (startPointRemains) { + auto constrainAsEqual = [this](int GeoId1, int GeoId2) { + auto newConstr = std::make_unique(); + + // Build Constraints associated with new pair of arcs + newConstr->Type = Sketcher::Equal; + newConstr->First = GeoId1; + newConstr->FirstPos = Sketcher::PointPos::none; + newConstr->Second = GeoId2; + newConstr->SecondPos = Sketcher::PointPos::none; + addConstraint(std::move(newConstr)); + }; + + delConstraints(idsOfOldConstraints); + + if (isClosedCurve(geoAsCurve)) { transferConstraints(GeoId, PointPos::start, newIds.front(), PointPos::start, true); - } - if (endPointRemains) { transferConstraints(GeoId, PointPos::end, newIds.back(), PointPos::end, true); } - bool geomHasMid = - geo->isDerivedFrom() || geo->isDerivedFrom(); + bool geomHasMid = geoAsCurve->isDerivedFrom() + || geoAsCurve->isDerivedFrom(); if (geomHasMid) { transferConstraints(GeoId, PointPos::mid, newIds.front(), PointPos::mid, true); // Make centers coincident @@ -3834,92 +3973,19 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) } } - newIds.front() = GeoId; - - std::vector idsOfOldConstraints; - getConstraintIndices(GeoId, idsOfOldConstraints); - - const auto& allConstraints = this->Constraints.getValues(); - - bool isPoint1ConstrainedOnGeoId1 = false; - bool isPoint2ConstrainedOnGeoId2 = false; - - // Workaround to avoid https://github.com/FreeCAD/FreeCAD/issues/15484. - // We will delete its internal geometry first and then replace GeoId with one of the curves. - // Of course, this will change `newIds`, and that's why we offset them. - std::set> geoIdsToBeDeleted; - // geoIdsToBeDeleted.push_back(GeoId); - - for (const auto& oldConstrId : idsOfOldConstraints) { - // trim-specific changes first - const Constraint* con = allConstraints[oldConstrId]; - if (con->Type == InternalAlignment) { - geoIdsToBeDeleted.insert(con->First); - continue; - } - if (auto newConstr = transformPreexistingConstraintForTrim( - this, con, GeoId, cuttingGeoIds[0], cutPoints[0], newIds.front(), PointPos::end)) { - newConstraints.push_back(newConstr.release()); - isPoint1ConstrainedOnGeoId1 = true; - continue; - } - if (auto newConstr = transformPreexistingConstraintForTrim( - this, con, GeoId, cuttingGeoIds[1], cutPoints[1], newIds.back(), PointPos::start)) { - newConstraints.push_back(newConstr.release()); - isPoint2ConstrainedOnGeoId2 = true; - continue; - } - // We have already transferred all constraints on endpoints to the new pieces. - // If there is still any left, this means one of the remaining pieces was degenerate. - if (!con->involvesGeoIdAndPosId(GeoId, PointPos::none)) { - continue; - } - // constraint has not yet been changed - deriveConstraintsForPieces(GeoId, newIds, newGeosAsConsts, con, newConstraints); - } - - // Add point-on-object/coincidence constraints with the newly exposed points. - // This will need to account for the constraints that were already converted - // to coincident or end-to-end tangency/perpendicularity. - // TODO: Tangent/perpendicular not yet covered - - if (cuttingGeoIds[0] != GeoEnum::GeoUndef && !isPoint1ConstrainedOnGeoId1) { - newConstraints.emplace_back( - getNewConstraintAtTrimCut( - this, cuttingGeoIds[0], newIds.front(), PointPos::end, cutPoints[0]).release()); - } - - if (cuttingGeoIds[1] != GeoEnum::GeoUndef && !isPoint2ConstrainedOnGeoId2) { - newConstraints.emplace_back( - getNewConstraintAtTrimCut( - this, cuttingGeoIds[1], newIds.back(), PointPos::start, cutPoints[1]).release()); - } - - // Workaround to avoid https://github.com/FreeCAD/FreeCAD/issues/15484. - // Delete the geometry first to avoid it happening. - // Of course, this will change `newIds`, and that's why we offset them. - delConstraints(idsOfOldConstraints); - - // Retransfer constraints we put away to `nonexistentGeoId` - transferConstraints(nonexistentGeoId, PointPos::start, GeoId, PointPos::start, true); - transferConstraints(nonexistentGeoId, PointPos::end, GeoId, PointPos::end, true); - transferConstraints(nonexistentGeoId, PointPos::mid, GeoId, PointPos::mid, true); - + // TODO: Implement this + // replaceGeometries({GeoId}, newGeos); auto vals = getInternalGeometry(); auto newVals(vals); - GeometryFacade::copyId(geo, newGeos.front()); - newVals[GeoId] = newGeos.front(); + GeometryFacade::copyId(geoAsCurve, newGeos.front().get()); + newVals[GeoId] = newGeos.front().release(); if (newGeos.size() > 1) { - newVals.push_back(newGeos.back()); - generateId(newGeos.back()); + newVals.push_back(newGeos.back().get()); + generateId(newGeos.back().release()); newIds.back() = newVals.size() - 1; } Geometry.setValues(std::move(newVals)); - // FIXME: Somewhere here we need to delete the internal geometry (even if in use) - // FIXME: Set the second geoid as construction or not depending on what the original was. - // This somehow is still not needed (why?) - if (noRecomputes) { solve(); } @@ -3942,6 +4008,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) solve(); } + //******************* Cleanup + //****************************************// + // Since we used regular "non-smart" pointers, we have to handle cleanup for (auto& cons : newConstraints) { delete cons; @@ -3953,7 +4022,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) bool SketchObject::deriveConstraintsForPieces(const int oldId, const std::vector& newIds, const Constraint* con, - std::vector& newConstraints) + std::vector& newConstraints) const { std::vector newGeos; for (auto& newId: newIds) { @@ -3967,7 +4036,7 @@ bool SketchObject::deriveConstraintsForPieces(const int oldId, const std::vector& newIds, const std::vector& newGeos, const Constraint* con, - std::vector& newConstraints) + std::vector& newConstraints) const { const Part::Geometry* geo = getGeometry(oldId); int conId = con->First; diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index e586837318..05a484c7be 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -422,13 +422,13 @@ public: bool deriveConstraintsForPieces(const int oldId, const std::vector& newIds, const Constraint* con, - std::vector& newConstraints); + std::vector& newConstraints) const; // Explicitly giving `newGeos` for cases where they are not yet added bool deriveConstraintsForPieces(const int oldId, const std::vector& newIds, const std::vector& newGeo, const Constraint* con, - std::vector& newConstraints); + std::vector& newConstraints) const; /// split a curve int split(int geoId, const Base::Vector3d& point); From 53f7fbd66e287a9222e58daa90098c5178f27cdf Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Thu, 2 Jan 2025 10:28:44 +0530 Subject: [PATCH 070/224] [Sketcher] Use `replaceGeometries()` in `trim` --- src/Mod/Sketcher/App/SketchObject.cpp | 119 ++++++++++++++------------ 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 38e43c747f..7f2c6757ee 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3506,24 +3506,35 @@ void SketchObject::changeConstraintAfterDeletingGeo(Constraint* constr, } } -bool SketchObject::seekTrimPoints(int GeoId, const Base::Vector3d& point, int& GeoId1, - Base::Vector3d& intersect1, int& GeoId2, +// clang-format on +bool SketchObject::seekTrimPoints(int GeoId, + const Base::Vector3d& point, + int& GeoId1, + Base::Vector3d& intersect1, + int& GeoId2, Base::Vector3d& intersect2) { - if (GeoId < 0 || GeoId > getHighestCurveIndex()) + if (GeoId < 0 || GeoId > getHighestCurveIndex()) { return false; + } - auto geos = getCompleteGeometry();// this includes the axes too + auto geos = getCompleteGeometry(); // this includes the axes too - geos.resize(geos.size() - 2);// remove the axes to avoid intersections with the axes + geos.resize(geos.size() - 2); // remove the axes to avoid intersections with the axes int localindex1, localindex2; // Not found in will be returned as -1, not as GeoUndef, Part WB is agnostic to the concept of // GeoUndef - if (!Part2DObject::seekTrimPoints( - geos, GeoId, point, localindex1, intersect1, localindex2, intersect2)) + if (!Part2DObject::seekTrimPoints(geos, + GeoId, + point, + localindex1, + intersect1, + localindex2, + intersect2)) { return false; + } // invalid complete geometry indices are mapped to GeoUndef GeoId1 = getGeoIdFromCompleteGeometryIndex(localindex1); @@ -3537,7 +3548,8 @@ bool SketchObject::seekTrimPoints(int GeoId, const Base::Vector3d& point, int& G // throwing an exception. bool getIntersectionParameter(const Part::Geometry* geo, const Base::Vector3d point, - double& pointParam) { + double& pointParam) +{ const auto* curve = static_cast(geo); try { @@ -3551,13 +3563,15 @@ bool getIntersectionParameter(const Part::Geometry* geo, return true; } -bool arePointsWithinPrecision(const Base::Vector3d& point1, const Base::Vector3d& point2) { +bool arePointsWithinPrecision(const Base::Vector3d& point1, const Base::Vector3d& point2) +{ // From testing: 500x (or 0.000050) is needed in order to not falsely distinguish points // calculated with seekTrimPoints return ((point1 - point2).Length() < 500 * Precision::Confusion()); } -bool areParamsWithinApproximation(double param1, double param2) { +bool areParamsWithinApproximation(double param1, double param2) +{ // From testing: 500x (or 0.000050) is needed in order to not falsely distinguish points // calculated with seekTrimPoints return (std::abs(param1 - param2) < Precision::PApproximation()); @@ -3565,7 +3579,10 @@ bool areParamsWithinApproximation(double param1, double param2) { // returns true if the point defined by (GeoId1, pos1) can be considered to be coincident with // point. -bool isPointAtPosition(const SketchObject* obj, int GeoId1, PointPos pos1, const Base::Vector3d& point) +bool isPointAtPosition(const SketchObject* obj, + int GeoId1, + PointPos pos1, + const Base::Vector3d& point) { Base::Vector3d pp = obj->getPoint(GeoId1, pos1); @@ -3596,36 +3613,38 @@ std::unique_ptr transformPreexistingConstraintForTrim(const SketchOb return newConstr; } switch (constr->Type) { - case PointOnObject: { - // we might want to transform this (and the new point-on-object constraints) into a coincidence - // At this stage of the check the point has to be an end of `cuttingGeoId` on the edge of `GeoId`. - if (isPointAtPosition(obj, constr->First, constr->FirstPos, cutPointVec)) { - // This concerns the start portion of the trim + case PointOnObject: { + // we might want to transform this (and the new point-on-object constraints) into a + // coincidence At this stage of the check the point has to be an end of `cuttingGeoId` + // on the edge of `GeoId`. + if (isPointAtPosition(obj, constr->First, constr->FirstPos, cutPointVec)) { + // This concerns the start portion of the trim + newConstr.reset(constr->copy()); + newConstr->Type = Sketcher::Coincident; + newConstr->Second = newGeoId; + newConstr->SecondPos = newPosId; + } + break; + } + case Tangent: + case Perpendicular: { + // These may have to be turned into endpoint-to-endpoint or endpoint-to-edge + // TODO: could there be tangent/perpendicular constraints not involving the trim that + // are modified below? newConstr.reset(constr->copy()); - newConstr->Type = Sketcher::Coincident; - newConstr->Second = newGeoId; - newConstr->SecondPos = newPosId; + newConstr->substituteIndexAndPos(GeoId, PointPos::none, newGeoId, newPosId); + // make sure the first position is a point + if (newConstr->FirstPos == PointPos::none) { + std::swap(newConstr->First, newConstr->Second); + std::swap(newConstr->FirstPos, newConstr->SecondPos); + } + // there is no need for the third point if it exists + newConstr->Third = GeoEnum::GeoUndef; + newConstr->ThirdPos = PointPos::none; + break; } - break; - } - case Tangent: - case Perpendicular: { - // These may have to be turned into endpoint-to-endpoint or endpoint-to-edge - // TODO: could there be tangent/perpendicular constraints not involving the trim that are modified below? - newConstr.reset(constr->copy()); - newConstr->substituteIndexAndPos(GeoId, PointPos::none, newGeoId, newPosId); - // make sure the first position is a point - if (newConstr->FirstPos == PointPos::none) { - std::swap(newConstr->First, newConstr->Second); - std::swap(newConstr->FirstPos, newConstr->SecondPos); - } - // there is no need for the third point if it exists - newConstr->Third = GeoEnum::GeoUndef; - newConstr->ThirdPos = PointPos::none; - break; - } - default: - break; + default: + break; } return newConstr; } @@ -3719,7 +3738,7 @@ bool getParamLimitsOfNewGeosForTrim(const SketchObject* obj, void createArcsFromGeoWithLimits(const Part::GeomCurve* geo, const std::vector>& paramsOfNewGeos, - std::vector>& newGeos) + std::vector& newGeos) { for (auto& [u1, u2] : paramsOfNewGeos) { auto newGeo = static_cast(geo)->createArc(u1, u2); @@ -3853,8 +3872,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) //******************* Step B => Creation of new geometries //****************************************// std::vector newIds; - std::vector> newGeos; - std::vector newGeosAsConsts; + std::vector newGeos; switch (paramsOfNewGeos.size()) { case 0: { @@ -3876,9 +3894,6 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) } createArcsFromGeoWithLimits(geoAsCurve, paramsOfNewGeos, newGeos); - for (const auto& geo : newGeos) { - newGeosAsConsts.push_back(geo.get()); - } //******************* Step C => Creation of new constraints //****************************************// @@ -3974,17 +3989,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) } // TODO: Implement this - // replaceGeometries({GeoId}, newGeos); - auto vals = getInternalGeometry(); - auto newVals(vals); - GeometryFacade::copyId(geoAsCurve, newGeos.front().get()); - newVals[GeoId] = newGeos.front().release(); - if (newGeos.size() > 1) { - newVals.push_back(newGeos.back().get()); - generateId(newGeos.back().release()); - newIds.back() = newVals.size() - 1; - } - Geometry.setValues(std::move(newVals)); + replaceGeometries({GeoId}, newGeos); if (noRecomputes) { solve(); @@ -4019,6 +4024,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) return 0; } +// clang-format off + bool SketchObject::deriveConstraintsForPieces(const int oldId, const std::vector& newIds, const Constraint* con, From a817bcd5ac34cb1be12ceef015f82e122600a6c8 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Thu, 2 Jan 2025 10:31:19 +0530 Subject: [PATCH 071/224] [Sketcher] Fix some issues in `trim` 1. Don't bother deleting internal geometry first. 2. Don't assume all new constraints are well formed. --- src/Mod/Sketcher/App/SketchObject.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 7f2c6757ee..3beda7f640 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3830,7 +3830,6 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) } // Remove internal geometry beforehand for now // FIXME: we should be able to transfer these to new curves smoothly - deleteUnusedInternalGeometryAndUpdateGeoId(GeoId); // auto geo = getGeometry(GeoId); const auto* geoAsCurve = static_cast(getGeometry(GeoId)); @@ -3964,7 +3963,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) delConstraints(idsOfOldConstraints); - if (isClosedCurve(geoAsCurve)) { + if (!isClosedCurve(geoAsCurve)) { transferConstraints(GeoId, PointPos::start, newIds.front(), PointPos::start, true); transferConstraints(GeoId, PointPos::end, newIds.back(), PointPos::end, true); } From bae501e4936b7aa4f5c48845972bef30e130b22e Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Wed, 8 Jan 2025 23:13:53 +0530 Subject: [PATCH 072/224] [Sketcher][test] Move helper functions away for reusability ...in other tests --- tests/src/Mod/Sketcher/App/SketchObject.cpp | 122 +--------------- .../Mod/Sketcher/App/SketcherTestHelpers.h | 136 ++++++++++++++++++ 2 files changed, 138 insertions(+), 120 deletions(-) create mode 100644 tests/src/Mod/Sketcher/App/SketcherTestHelpers.h diff --git a/tests/src/Mod/Sketcher/App/SketchObject.cpp b/tests/src/Mod/Sketcher/App/SketchObject.cpp index 068d0d4aa8..98b1a5c837 100644 --- a/tests/src/Mod/Sketcher/App/SketchObject.cpp +++ b/tests/src/Mod/Sketcher/App/SketchObject.cpp @@ -11,127 +11,9 @@ #include #include #include +#include "SketcherTestHelpers.h" -void setupLineSegment(Part::GeomLineSegment& lineSeg) -{ - Base::Vector3d coords1(1.0, 2.0, 0.0); - Base::Vector3d coords2(3.0, 4.0, 0.0); - lineSeg.setPoints(coords1, coords2); -} - -void setupCircle(Part::GeomCircle& circle) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - Base::Vector3d splitPoint(2.0, 3.1, 0.0); - double radius = 3.0; - circle.setCenter(coordsCenter); - circle.setRadius(radius); -} - -void setupArcOfCircle(Part::GeomArcOfCircle& arcOfCircle) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double radius = 3.0; - double startParam = M_PI / 3, endParam = M_PI * 1.5; - arcOfCircle.setCenter(coordsCenter); - arcOfCircle.setRadius(radius); - arcOfCircle.setRange(startParam, endParam, true); -} - -void setupEllipse(Part::GeomEllipse& ellipse) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double majorRadius = 4.0; - double minorRadius = 3.0; - ellipse.setCenter(coordsCenter); - ellipse.setMajorRadius(majorRadius); - ellipse.setMinorRadius(minorRadius); -} - -void setupArcOfHyperbola(Part::GeomArcOfHyperbola& arcOfHyperbola) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double majorRadius = 4.0; - double minorRadius = 3.0; - double startParam = M_PI / 3, endParam = M_PI * 1.5; - arcOfHyperbola.setCenter(coordsCenter); - arcOfHyperbola.setMajorRadius(majorRadius); - arcOfHyperbola.setMinorRadius(minorRadius); - arcOfHyperbola.setRange(startParam, endParam, true); -} - -void setupArcOfParabola(Part::GeomArcOfParabola& aop) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double focal = 3.0; - double startParam = -M_PI * 1.5, endParam = M_PI * 1.5; - aop.setCenter(coordsCenter); - aop.setFocal(focal); - aop.setRange(startParam, endParam, true); -} - -std::unique_ptr createTypicalNonPeriodicBSpline() -{ - int degree = 3; - std::vector poles; - poles.emplace_back(1, 0, 0); - poles.emplace_back(1, 1, 0); - poles.emplace_back(1, 0.5, 0); - poles.emplace_back(0, 1, 0); - poles.emplace_back(0, 0, 0); - std::vector weights(5, 1.0); - std::vector knotsNonPeriodic = {0.0, 1.0, 2.0}; - std::vector multiplicitiesNonPeriodic = {degree + 1, 1, degree + 1}; - return std::make_unique(poles, - weights, - knotsNonPeriodic, - multiplicitiesNonPeriodic, - degree, - false); -} - -std::unique_ptr createTypicalPeriodicBSpline() -{ - int degree = 3; - std::vector poles; - poles.emplace_back(1, 0, 0); - poles.emplace_back(1, 1, 0); - poles.emplace_back(1, 0.5, 0); - poles.emplace_back(0, 1, 0); - poles.emplace_back(0, 0, 0); - std::vector weights(5, 1.0); - std::vector knotsPeriodic = {0.0, 0.3, 1.0, 1.5, 1.8, 2.0}; - std::vector multiplicitiesPeriodic(6, 1); - return std::make_unique(poles, - weights, - knotsPeriodic, - multiplicitiesPeriodic, - degree, - true); -} - -int countConstraintsOfType(const Sketcher::SketchObject* obj, const Sketcher::ConstraintType cType) -{ - const std::vector& constraints = obj->Constraints.getValues(); - - int result = std::count_if(constraints.begin(), - constraints.end(), - [&cType](const Sketcher::Constraint* constr) { - return constr->Type == cType; - }); - - return result; -} - -// Get point at the parameter after scaling the range to [0, 1]. -Base::Vector3d getPointAtNormalizedParameter(const Part::GeomCurve& curve, double param) -{ - return curve.pointAtParameter(curve.getFirstParameter() - + (curve.getLastParameter() - curve.getFirstParameter()) * param); -} - -// TODO: How to set up B-splines here? -// It's not straightforward to change everything from a "default" one. +using namespace SketcherTestHelpers; class SketchObjectTest: public ::testing::Test { diff --git a/tests/src/Mod/Sketcher/App/SketcherTestHelpers.h b/tests/src/Mod/Sketcher/App/SketcherTestHelpers.h new file mode 100644 index 0000000000..e03655e628 --- /dev/null +++ b/tests/src/Mod/Sketcher/App/SketcherTestHelpers.h @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include +#include +#include +#include +#include +#include +#include + +namespace SketcherTestHelpers +{ + +using namespace Sketcher; + +void setupLineSegment(Part::GeomLineSegment& lineSeg) +{ + Base::Vector3d coords1(1.0, 2.0, 0.0); + Base::Vector3d coords2(3.0, 4.0, 0.0); + lineSeg.setPoints(coords1, coords2); +} + +void setupCircle(Part::GeomCircle& circle) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + Base::Vector3d splitPoint(2.0, 3.1, 0.0); + double radius = 3.0; + circle.setCenter(coordsCenter); + circle.setRadius(radius); +} + +void setupArcOfCircle(Part::GeomArcOfCircle& arcOfCircle) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double radius = 3.0; + double startParam = M_PI / 3, endParam = M_PI * 1.5; + arcOfCircle.setCenter(coordsCenter); + arcOfCircle.setRadius(radius); + arcOfCircle.setRange(startParam, endParam, true); +} + +void setupEllipse(Part::GeomEllipse& ellipse) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double majorRadius = 4.0; + double minorRadius = 3.0; + ellipse.setCenter(coordsCenter); + ellipse.setMajorRadius(majorRadius); + ellipse.setMinorRadius(minorRadius); +} + +void setupArcOfHyperbola(Part::GeomArcOfHyperbola& arcOfHyperbola) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double majorRadius = 4.0; + double minorRadius = 3.0; + double startParam = M_PI / 3, endParam = M_PI * 1.5; + arcOfHyperbola.setCenter(coordsCenter); + arcOfHyperbola.setMajorRadius(majorRadius); + arcOfHyperbola.setMinorRadius(minorRadius); + arcOfHyperbola.setRange(startParam, endParam, true); +} + +void setupArcOfParabola(Part::GeomArcOfParabola& aop) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double focal = 3.0; + double startParam = -M_PI * 1.5, endParam = M_PI * 1.5; + aop.setCenter(coordsCenter); + aop.setFocal(focal); + aop.setRange(startParam, endParam, true); +} + +std::unique_ptr createTypicalNonPeriodicBSpline() +{ + int degree = 3; + std::vector poles; + poles.emplace_back(1, 0, 0); + poles.emplace_back(1, 1, 0); + poles.emplace_back(1, 0.5, 0); + poles.emplace_back(0, 1, 0); + poles.emplace_back(0, 0, 0); + std::vector weights(5, 1.0); + std::vector knotsNonPeriodic = {0.0, 1.0, 2.0}; + std::vector multiplicitiesNonPeriodic = {degree + 1, 1, degree + 1}; + return std::make_unique(poles, + weights, + knotsNonPeriodic, + multiplicitiesNonPeriodic, + degree, + false); +} + +std::unique_ptr createTypicalPeriodicBSpline() +{ + int degree = 3; + std::vector poles; + poles.emplace_back(1, 0, 0); + poles.emplace_back(1, 1, 0); + poles.emplace_back(1, 0.5, 0); + poles.emplace_back(0, 1, 0); + poles.emplace_back(0, 0, 0); + std::vector weights(5, 1.0); + std::vector knotsPeriodic = {0.0, 0.3, 1.0, 1.5, 1.8, 2.0}; + std::vector multiplicitiesPeriodic(6, 1); + return std::make_unique(poles, + weights, + knotsPeriodic, + multiplicitiesPeriodic, + degree, + true); +} + +int countConstraintsOfType(const Sketcher::SketchObject* obj, const Sketcher::ConstraintType cType) +{ + const std::vector& constraints = obj->Constraints.getValues(); + + int result = std::count_if(constraints.begin(), + constraints.end(), + [&cType](const Sketcher::Constraint* constr) { + return constr->Type == cType; + }); + + return result; +} + +// Get point at the parameter after scaling the range to [0, 1]. +Base::Vector3d getPointAtNormalizedParameter(const Part::GeomCurve& curve, double param) +{ + return curve.pointAtParameter(curve.getFirstParameter() + + (curve.getLastParameter() - curve.getFirstParameter()) * param); +} + +// TODO: How to set up B-splines here? +// It's not straightforward to change everything from a "default" one. +} // namespace SketcherTestHelpers From fd67538dec97fc1b8bfc4cdfabd0550cbfab9a40 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Sun, 12 Jan 2025 17:57:03 +0530 Subject: [PATCH 073/224] [Sketcher][test] Divide `SketchObject` tests into multiple files ...for managability. --- tests/src/Mod/Sketcher/App/CMakeLists.txt | 2 + tests/src/Mod/Sketcher/App/SketchObject.cpp | 946 ------------------ .../Mod/Sketcher/App/SketchObjectChanges.cpp | 920 +++++++++++++++++ .../Mod/Sketcher/App/SketcherTestHelpers.cpp | 155 +++ .../Mod/Sketcher/App/SketcherTestHelpers.h | 142 +-- 5 files changed, 1112 insertions(+), 1053 deletions(-) create mode 100644 tests/src/Mod/Sketcher/App/SketchObjectChanges.cpp create mode 100644 tests/src/Mod/Sketcher/App/SketcherTestHelpers.cpp diff --git a/tests/src/Mod/Sketcher/App/CMakeLists.txt b/tests/src/Mod/Sketcher/App/CMakeLists.txt index 7bcb006997..75dc0501a2 100644 --- a/tests/src/Mod/Sketcher/App/CMakeLists.txt +++ b/tests/src/Mod/Sketcher/App/CMakeLists.txt @@ -1,7 +1,9 @@ target_sources( Sketcher_tests_run PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/SketcherTestHelpers.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SketchObject.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/SketchObjectChanges.cpp ) add_subdirectory(planegcs) diff --git a/tests/src/Mod/Sketcher/App/SketchObject.cpp b/tests/src/Mod/Sketcher/App/SketchObject.cpp index 98b1a5c837..30e4432387 100644 --- a/tests/src/Mod/Sketcher/App/SketchObject.cpp +++ b/tests/src/Mod/Sketcher/App/SketchObject.cpp @@ -1,7 +1,5 @@ // SPDX-License-Identifier: LGPL-2.1-or-later -#include - #include #include @@ -10,50 +8,10 @@ #include #include #include -#include #include "SketcherTestHelpers.h" using namespace SketcherTestHelpers; -class SketchObjectTest: public ::testing::Test -{ -protected: - static void SetUpTestSuite() - { - tests::initApplication(); - } - - void SetUp() override - { - _docName = App::GetApplication().getUniqueDocumentName("test"); - auto _doc = App::GetApplication().newDocument(_docName.c_str(), "testUser"); - // TODO: Do we add a body newName, or is just adding sketch sufficient for this test? - _sketchobj = - static_cast(_doc->addObject("Sketcher::SketchObject")); - } - - void TearDown() override - { - App::GetApplication().closeDocument(_docName.c_str()); - } - - Sketcher::SketchObject* getObject() - { - return _sketchobj; - } - -private: - // TODO: use shared_ptr or something else here? - Sketcher::SketchObject* _sketchobj; - std::string _docName; - std::vector allowedTypes {"Vertex", - "Edge", - "ExternalEdge", - "H_Axis", - "V_Axis", - "RootPoint"}; -}; - TEST_F(SketchObjectTest, createSketchObject) // NOLINT { // Arrange @@ -752,910 +710,6 @@ TEST_F(SketchObjectTest, testDeleteOnlyUnusedInternalGeometryOfBSpline) EXPECT_EQ(getObject()->getHighestCurveIndex(), 2); } -TEST_F(SketchObjectTest, testSplitLineSegment) -{ - // Arrange - Base::Vector3d splitPoint(2.0, 3.1, 0.0); - Part::GeomLineSegment lineSeg; - setupLineSegment(lineSeg); - int geoId = getObject()->addGeometry(&lineSeg); - - // Act - int result = getObject()->split(geoId, splitPoint); - - // Assert - EXPECT_EQ(result, 0); - // One additional curve should be added - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); - // TODO: Expect the resultant curves are line segments and shape is conserved - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); -} - -TEST_F(SketchObjectTest, testSplitCircle) -{ - // Arrange - Base::Vector3d splitPoint(2.0, 3.1, 0.0); - Part::GeomCircle circle; - setupCircle(circle); - int geoId = getObject()->addGeometry(&circle); - - // Act - int result = getObject()->split(geoId, splitPoint); - - // Assert - EXPECT_EQ(result, 0); - // The circle should be split into an arc now - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); -} - -TEST_F(SketchObjectTest, testSplitEllipse) -{ - // Arrange - Base::Vector3d splitPoint(2.0, 3.1, 0.0); - Part::GeomEllipse ellipse; - setupEllipse(ellipse); - int geoId = getObject()->addGeometry(&ellipse); - - // Act - int result = getObject()->split(geoId, splitPoint); - - // Assert - EXPECT_EQ(result, 0); - // TODO: The ellipse should be split into an arc of ellipse now - // FIXME: Internal geometries may be added or removed which may cause some issues - // EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); -} - -TEST_F(SketchObjectTest, testSplitArcOfCircle) -{ - // Arrange - Base::Vector3d splitPoint(-2.0, 3.1, 0.0); - Part::GeomArcOfCircle arcOfCircle; - setupArcOfCircle(arcOfCircle); - int geoId = getObject()->addGeometry(&arcOfCircle); - - // Act - int result = getObject()->split(geoId, splitPoint); - - // Assert - EXPECT_EQ(result, 0); - // The arcOfCircle should be split into an arc now - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); - // Expect the end points and centers of the resultant curve are coincident. - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 2); -} - -TEST_F(SketchObjectTest, testSplitArcOfConic) -{ - // Arrange - // TODO: Define a parabola/hyperbola as reference - Base::Vector3d splitPoint(1.0, -1.1, 0.0); - Part::GeomArcOfParabola arcOfConic; - setupArcOfParabola(arcOfConic); - int geoId = getObject()->addGeometry(&arcOfConic); - - // Act - // TODO: Sample random points from both sides of the split - int result = getObject()->split(geoId, splitPoint); - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - - // Assert - EXPECT_EQ(result, 0); - // The arcOfConic should be split into two arcs of the same conic now - EXPECT_EQ(getObject()->getHighestCurveIndex(), 1); - // TODO: Expect the end points of the resultant curve are coincident. - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); -} - -TEST_F(SketchObjectTest, testSplitNonPeriodicBSpline) -{ - // Arrange - auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); - Base::Vector3d splitPoint(-0.5, 1.1, 0.0); - int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); - // TODO: Put a point on this - - // Act - // TODO: sample before point(s) at a random parameter - int result = getObject()->split(geoId, splitPoint); - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - - // Assert - EXPECT_EQ(result, 0); - EXPECT_EQ(getObject()->getHighestCurveIndex(), 1); - // TODO: confirm sampled point(s) is/are at the same place - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); -} - -TEST_F(SketchObjectTest, testSplitPeriodicBSpline) -{ - // Arrange - auto PeriodicBSpline = createTypicalPeriodicBSpline(); - Base::Vector3d splitPoint(-0.5, 1.1, 0.0); - int geoId = getObject()->addGeometry(PeriodicBSpline.get()); - // TODO: Put a point on this - - // Act - // TODO: sample before point(s) at a random parameter - int result = getObject()->split(geoId, splitPoint); - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - - // Assert - EXPECT_EQ(result, 0); - EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); - // TODO: confirm sampled point(s) is/are at the same place -} - -TEST_F(SketchObjectTest, testTrimWithoutIntersection) -{ - // Arrange - Part::GeomLineSegment lineSeg; - setupLineSegment(lineSeg); - int geoId = getObject()->addGeometry(&lineSeg); - Base::Vector3d trimPoint(2.0, 3.1, 0.0); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - // Once this line segment is trimmed, nothing should remain - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId - 1); -} - -// TODO: There are other combinations of constraints we may want to test with trim. - -TEST_F(SketchObjectTest, testTrimLineSegmentEnd) -{ - // Arrange - Part::GeomLineSegment lineSeg; - setupLineSegment(lineSeg); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(lineSeg, 0.2)); - Base::Vector3d p1(getPointAtNormalizedParameter(lineSeg, 0.5)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - int geoId = getObject()->addGeometry(&lineSeg); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - // TODO: Once this line segment is trimmed, the curve should be "smaller" - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); - // TODO: There should be a "point-on-object" constraint on the intersecting curves - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); -} - -TEST_F(SketchObjectTest, testTrimLineSegmentMid) -{ - // Arrange - Part::GeomLineSegment lineSeg; - setupLineSegment(lineSeg); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(lineSeg, 0.5)); - Base::Vector3d p1(getPointAtNormalizedParameter(lineSeg, 0.3)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - Base::Vector3d p3(getPointAtNormalizedParameter(lineSeg, 0.7)); - Base::Vector3d p4(p3.x + 0.1, p3.y - 0.1, p3.z); - // to ensure that this line clearly intersects the curve, not just have a point on object - // without explicit constraint - p3.x -= 0.1; - p3.y += 0.1; - Part::GeomLineSegment lineSegCut2; - lineSegCut2.setPoints(p3, p4); - getObject()->addGeometry(&lineSegCut2); - int geoId = getObject()->addGeometry(&lineSeg); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - // TODO: Once this line segment is trimmed, there should be two "smaller" curves in its place - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); - // TODO: There should be a "point-on-object" constraint on the intersecting curves - int numberOfPointOnObjectConstraints = - countConstraintsOfType(getObject(), Sketcher::PointOnObject); - EXPECT_EQ(numberOfPointOnObjectConstraints, 1); - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); - // TODO: Ensure shape is preserved -} - -TEST_F(SketchObjectTest, testTrimCircleEnd) -{ - // Arrange - Part::GeomCircle circle; - setupCircle(circle); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(circle, 0.2)); - Base::Vector3d p1(getPointAtNormalizedParameter(circle, 0.5)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - int geoId = getObject()->addGeometry(&circle); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - // TODO: Once this circle is trimmed, the circle should be deleted. - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId - 1); -} - -TEST_F(SketchObjectTest, testTrimCircleMid) -{ - // Arrange - Part::GeomCircle circle; - setupCircle(circle); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(circle, 0.5)); - Base::Vector3d p1(getPointAtNormalizedParameter(circle, 0.3)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - Base::Vector3d p3(getPointAtNormalizedParameter(circle, 0.7)); - Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); - // to ensure that this line clearly intersects the curve, not just have a point on object - // without explicit constraint - p3.x -= 0.1; - p3.y -= 0.1; - Part::GeomLineSegment lineSegCut2; - lineSegCut2.setPoints(p3, p4); - getObject()->addGeometry(&lineSegCut2); - int geoId = getObject()->addGeometry(&circle); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - // TODO: Once this circle is trimmed, there should be one arc. - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); - // There should be one "coincident" and one "point-on-object" constraint on the intersecting - // curves - int numberOfPointOnObjectConstraints = - countConstraintsOfType(getObject(), Sketcher::PointOnObject); - EXPECT_EQ(numberOfPointOnObjectConstraints, 1); - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); - // TODO: Ensure shape is preserved -} - -TEST_F(SketchObjectTest, testTrimArcOfCircleEnd) -{ - // This should also cover as a representative of arc of conic - - // Arrange - Part::GeomArcOfCircle arcOfCircle; - setupArcOfCircle(arcOfCircle); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(arcOfCircle, 0.2)); - Base::Vector3d p1(getPointAtNormalizedParameter(arcOfCircle, 0.5)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - int geoId = getObject()->addGeometry(&arcOfCircle); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); - // There should be a "point-on-object" constraint on the intersecting curves - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); -} - -TEST_F(SketchObjectTest, testTrimArcOfCircleMid) -{ - // Arrange - Part::GeomArcOfCircle arcOfCircle; - setupArcOfCircle(arcOfCircle); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(arcOfCircle, 0.5)); - Base::Vector3d p1(getPointAtNormalizedParameter(arcOfCircle, 0.3)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - Base::Vector3d p3(getPointAtNormalizedParameter(arcOfCircle, 0.7)); - Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); - // to ensure that this line clearly intersects the curve, not just have a point on object - // without explicit constraint - p3.x -= 0.1; - p3.y -= 0.1; - Part::GeomLineSegment lineSegCut2; - lineSegCut2.setPoints(p3, p4); - getObject()->addGeometry(&lineSegCut2); - int geoId = getObject()->addGeometry(&arcOfCircle); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); - // There should be a "point-on-object" constraint on the intersecting curves - int numberOfPointOnObjectConstraints = - countConstraintsOfType(getObject(), Sketcher::PointOnObject); - EXPECT_EQ(numberOfPointOnObjectConstraints, 1); - // There should be 2 coincident constraints: one with lineSegCut1 and one between centers of the - // new arcs - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 2); - // TODO: Ensure shape is preserved -} - -TEST_F(SketchObjectTest, testTrimEllipseEnd) -{ - // Arrange - Part::GeomEllipse ellipse; - setupEllipse(ellipse); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(ellipse, 0.2)); - Base::Vector3d p1(getPointAtNormalizedParameter(ellipse, 0.5)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - int geoId = getObject()->addGeometry(&ellipse); - - // Act - int result = getObject()->trim(geoId, trimPoint); - // remove all internal geometry - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - - // Assert - EXPECT_EQ(result, 0); - // Once this ellipse is trimmed, the ellipse should be deleted. - // Only remaining: line segment - EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); -} - -TEST_F(SketchObjectTest, testTrimEllipseMid) -{ - // Arrange - Part::GeomEllipse ellipse; - setupEllipse(ellipse); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(ellipse, 0.5)); - Base::Vector3d p1(getPointAtNormalizedParameter(ellipse, 0.3)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - Base::Vector3d p3(getPointAtNormalizedParameter(ellipse, 0.7)); - Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); - // to ensure that this line clearly intersects the curve, not just have a point on object - // without explicit constraint - p3.x -= 0.1; - p3.y -= 0.1; - Part::GeomLineSegment lineSegCut2; - lineSegCut2.setPoints(p3, p4); - getObject()->addGeometry(&lineSegCut2); - int geoId = getObject()->addGeometry(&ellipse); - // FIXME: Doing this to avoid trimming only until minor/major axes. Should not be needed. - getObject()->deleteUnusedInternalGeometry(geoId); - - // Act - int result = getObject()->trim(geoId, trimPoint); - // remove all internal geometry - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - - // Assert - EXPECT_EQ(result, 0); - // Once this ellipse is trimmed, there should be one arc and line segments. - EXPECT_EQ(getObject()->getHighestCurveIndex(), 2); - // There should be one "coincident" and one "point-on-object" constraint on the intersecting - // curves - int numberOfPointOnObjectConstraints = - countConstraintsOfType(getObject(), Sketcher::PointOnObject); - EXPECT_EQ(numberOfPointOnObjectConstraints, 1); - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); - // TODO: Ensure shape is preserved -} - -// TODO: Tests for other arcs of conics? - -TEST_F(SketchObjectTest, testTrimPeriodicBSplineEnd) -{ - // Arrange - auto periodicBSpline = createTypicalPeriodicBSpline(); - assert(periodicBSpline); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(*periodicBSpline, 0.2)); - Base::Vector3d p1(getPointAtNormalizedParameter(*periodicBSpline, 0.5)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - int geoId = getObject()->addGeometry(periodicBSpline.get()); - - // Act - int result = getObject()->trim(geoId, trimPoint); - - // Assert - EXPECT_EQ(result, 0); - // FIXME: This will fail because of deleted internal geometry - // Once this periodicBSpline is trimmed, the periodicBSpline should be deleted, leaving only the - // line segment. - EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); - // TODO: There should be a "point-on-object" constraint on the intersecting curves -} - -TEST_F(SketchObjectTest, testTrimPeriodicBSplineMid) -{ - // Arrange - auto periodicBSpline = createTypicalPeriodicBSpline(); - assert(periodicBSpline); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(*periodicBSpline, 0.5)); - Base::Vector3d p1(getPointAtNormalizedParameter(*periodicBSpline, 0.3)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - Base::Vector3d p3(getPointAtNormalizedParameter(*periodicBSpline, 0.7)); - Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); - // to ensure that this line clearly intersects the curve, not just have a point on object - // without explicit constraint - p3.x -= 0.1; - p3.y -= 0.1; - Part::GeomLineSegment lineSegCut2; - lineSegCut2.setPoints(p3, p4); - getObject()->addGeometry(&lineSegCut2); - int geoId = getObject()->addGeometry(periodicBSpline.get()); - - // Act - int result = getObject()->trim(geoId, trimPoint); - // remove all internal geometry - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - - // Assert - EXPECT_EQ(result, 0); - // Only remaining: Two line segments and the B-spline - EXPECT_EQ(getObject()->getHighestCurveIndex(), 2); - // There should be one "coincident" and one "point-on-object" constraint on the intersecting - // curves - int numberOfPointOnObjectConstraints = - countConstraintsOfType(getObject(), Sketcher::PointOnObject); - EXPECT_EQ(numberOfPointOnObjectConstraints, 1); - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); - // TODO: Ensure shape is preserved -} - -TEST_F(SketchObjectTest, testTrimNonPeriodicBSplineEnd) -{ - // This should also cover as a representative of arc of conic - - // Arrange - auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); - assert(nonPeriodicBSpline); - // create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.2)); - Base::Vector3d p1(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.5)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); - - // Act - int result = getObject()->trim(geoId, trimPoint); - // remove all internal geometry - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - - // Assert - EXPECT_EQ(result, 0); - // Only remaining: one line segment and the trimmed B-spline - EXPECT_EQ(getObject()->getHighestCurveIndex(), 1); - // FIXME: There should be a "point-on-object" constraint on the intersecting curves - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); -} - -TEST_F(SketchObjectTest, testTrimNonPeriodicBSplineMid) -{ - // Arrange - auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); - assert(nonPeriodicBSpline); - // TODO: create curves intersecting at the right spots - Base::Vector3d trimPoint(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.5)); - Base::Vector3d p1(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.3)); - Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); - Part::GeomLineSegment lineSegCut1; - lineSegCut1.setPoints(p1, p2); - getObject()->addGeometry(&lineSegCut1); - Base::Vector3d p3(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.7)); - Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); - // to ensure that this line clearly intersects the curve, not just have a point on object - // without explicit constraint - p3.x -= 0.1; - p3.y -= 0.1; - Part::GeomLineSegment lineSegCut2; - lineSegCut2.setPoints(p3, p4); - getObject()->addGeometry(&lineSegCut2); - int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); - - // Act - int result = getObject()->trim(geoId, trimPoint); - // remove all internal geometry - for (int i = 0; i < getObject()->getHighestCurveIndex(); ++i) { - if (getObject()->getGeometry(i)->is()) { - getObject()->deleteUnusedInternalGeometry(i); - } - } - - // Assert - EXPECT_EQ(result, 0); - // Only remaining: one line segment and the trimmed B-spline - EXPECT_EQ(getObject()->getHighestCurveIndex(), 3); - // There should be a "point-on-object" constraint on the intersecting curves - int numberOfPointOnObjectConstraints = - countConstraintsOfType(getObject(), Sketcher::PointOnObject); - EXPECT_EQ(numberOfPointOnObjectConstraints, 1); - int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); - EXPECT_EQ(numberOfCoincidentConstraints, 1); - // TODO: Ensure shape is preserved -} - -TEST_F(SketchObjectTest, testModifyKnotMultInNonPeriodicBSplineToZero) -{ - // Arrange - auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); - assert(nonPeriodicBSpline); - int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); - auto bsp1 = static_cast(getObject()->getGeometry(geoId)); - int oldKnotCount = bsp1->countKnots(); - - // Act - // Try decreasing mult to zero. - // NOTE: we still use OCCT notation of knot index starting with 1 (not 0). - getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); - // Assert - // Knot should disappear. We start with 3 (unique) knots, so expect 2. - auto bsp2 = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp2->countKnots(), oldKnotCount - 1); -} - -TEST_F(SketchObjectTest, testModifyKnotMultInNonPeriodicBSplineToDisallowed) -{ - // Arrange - auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); - assert(nonPeriodicBSpline); - int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); - - // Act and Assert - // TODO: Try modifying such that resultant multiplicity > degree - // TODO: This should immediately throw exception - EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 3), Base::ValueError); - // TODO: Try modifying such that resultant multiplicity < 0 - // TODO: This should immediately throw exception - EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -2), Base::ValueError); -} - -TEST_F(SketchObjectTest, testModifyKnotMultInNonPeriodicBSpline) -{ - // Arrange - auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); - assert(nonPeriodicBSpline); - int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); - - auto bsp = static_cast(getObject()->getGeometry(geoId)); - int oldKnotsNum = bsp->countKnots(); - int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[1]; - - // Act - // TODO: Increase/decrease knot multiplicity normally - getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 1); - // Assert - // This should not alter the sizes of knot and multiplicity vectors. - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum); - // This should increment the multiplicity. - EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot + 1); - // This should still be a non-periodic spline - EXPECT_FALSE(bsp->isPeriodic()); - // TODO: Expect shape is preserved - - // Act - // TODO: Increase/decrease knot multiplicity normally - getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); - // Assert - // This should not alter the sizes of knot and multiplicity vectors. - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum); - // This should increment the multiplicity. - EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot); - // This should still be a non-periodic spline - EXPECT_FALSE(bsp->isPeriodic()); -} - -TEST_F(SketchObjectTest, testModifyKnotMultInPeriodicBSplineToZero) -{ - // Arrange - auto PeriodicBSpline = createTypicalPeriodicBSpline(); - assert(PeriodicBSpline); - int geoId = getObject()->addGeometry(PeriodicBSpline.get()); - auto bsp1 = static_cast(getObject()->getGeometry(geoId)); - int oldKnotCount = bsp1->countKnots(); - - // Act - // Try decreasing mult to zero. - // NOTE: we still use OCCT notation of knot index starting with 1 (not 0). - getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); - // Assert - // Knot should disappear. - auto bsp2 = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp2->countKnots(), oldKnotCount - 1); -} - -TEST_F(SketchObjectTest, testModifyKnotMultInPeriodicBSplineToDisallowed) -{ - // Arrange - auto PeriodicBSpline = createTypicalPeriodicBSpline(); - assert(PeriodicBSpline); - int geoId = getObject()->addGeometry(PeriodicBSpline.get()); - - // Act and Assert - // TODO: Try modifying such that resultant multiplicity > degree - // TODO: This should immediately throw exception - EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 3), Base::ValueError); - // TODO: Try modifying such that resultant multiplicity < 0 - // TODO: This should immediately throw exception - EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -2), Base::ValueError); -} - -TEST_F(SketchObjectTest, testModifyKnotMultInPeriodicBSpline) -{ - // Arrange - auto PeriodicBSpline = createTypicalPeriodicBSpline(); - assert(PeriodicBSpline); - int geoId = getObject()->addGeometry(PeriodicBSpline.get()); - - auto bsp = static_cast(getObject()->getGeometry(geoId)); - int oldKnotsNum = bsp->countKnots(); - int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[1]; - - // Act - // TODO: Increase/decrease knot multiplicity normally - getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 1); - // Assert - // This should not alter the sizes of knot and multiplicity vectors. - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum); - // This should increment the multiplicity. - EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot + 1); - // This should still be a periodic spline - EXPECT_TRUE(bsp->isPeriodic()); - // TODO: Expect shape is preserved - - // Act - // TODO: Increase/decrease knot multiplicity normally - getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); - // Assert - // This should not alter the sizes of knot and multiplicity vectors. - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum); - // This should decrement the multiplicity. - EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot); - // This should still be a non-periodic spline - EXPECT_TRUE(bsp->isPeriodic()); -} - -TEST_F(SketchObjectTest, testInsertKnotInNonPeriodicBSpline) -{ - // Arrange - auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); - assert(nonPeriodicBSpline); - int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); - - // Act and Assert - // Try inserting knot with zero multiplicity - // zero multiplicity knot should immediately throw exception - EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 0), Base::ValueError); - - // Act and Assert - // Try inserting knot with multiplicity > degree - // This should immediately throw exception - EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 4), Base::ValueError); - - // Act and Assert - // TODO: Try inserting at an existing knot with resultant multiplicity > degree - // TODO: This should immediately throw exception - // FIXME: Not happening. May be ignoring existing values. - // EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 1.0, 3), Base::ValueError); - - auto bsp = static_cast(getObject()->getGeometry(geoId)); - int oldKnotsNum = bsp->countKnots(); - int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[1]; - - // Act - // Add at a general position (where no knot exists) - getObject()->insertBSplineKnot(geoId, 0.5, 1); - // Assert - // This should add to both the knot and multiplicity "vectors" - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); - // This should still be a non-periodic spline - EXPECT_FALSE(bsp->isPeriodic()); - - // Act - // Add a knot at an existing knot - getObject()->insertBSplineKnot(geoId, 1.0, 1); - // Assert - // This should not alter the sizes of knot and multiplicity vectors. - // (Since we previously added a knot, this means the total is still one more than original) - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); - // This should increment the multiplicity. - EXPECT_EQ(bsp->getMultiplicities()[2], oldMultiplicityOfTargetKnot + 1); - // This should still be a non-periodic spline - EXPECT_FALSE(bsp->isPeriodic()); -} - -TEST_F(SketchObjectTest, testInsertKnotInPeriodicBSpline) -{ - // This should also cover as a representative of arc of conic - - // Arrange - auto PeriodicBSpline = createTypicalPeriodicBSpline(); - assert(PeriodicBSpline); - int geoId = getObject()->addGeometry(PeriodicBSpline.get()); - - // Act and Assert - // Try inserting knot with zero multiplicity - // zero multiplicity knot should immediately throw exception - EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 0), Base::ValueError); - - // Act and Assert - // Try inserting knot with multiplicity > degree - // This should immediately throw exception - EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 4), Base::ValueError); - - // Act and Assert - // TODO: Try inserting at an existing knot with resultant multiplicity > degree - // TODO: This should immediately throw exception - - auto bsp = static_cast(getObject()->getGeometry(geoId)); - int oldKnotsNum = bsp->countKnots(); - int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[2]; - - // Act - // Add at a general position (where no knot exists) - getObject()->insertBSplineKnot(geoId, 0.5, 1); - // Assert - // This should add to both the knot and multiplicity "vectors" - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); - // This should still be a periodic spline - EXPECT_TRUE(bsp->isPeriodic()); - - // Act - // Add a knot at an existing knot - getObject()->insertBSplineKnot(geoId, 1.0, 1); - // Assert - // This should not alter the sizes of knot and multiplicity vectors. - bsp = static_cast(getObject()->getGeometry(geoId)); - EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); - // This should increment the multiplicity. - EXPECT_EQ(bsp->getMultiplicities()[3], oldMultiplicityOfTargetKnot + 1); - // This should still be a periodic spline - EXPECT_TRUE(bsp->isPeriodic()); -} - -TEST_F(SketchObjectTest, testJoinCurves) -{ - // Arrange - // Make two curves - Base::Vector3d coordsCenter(0.0, 0.0, 0.0); - double radius = 3.0, startParam = M_PI / 2, endParam = M_PI; - Part::GeomArcOfCircle arcOfCircle; - arcOfCircle.setCenter(coordsCenter); - arcOfCircle.setRadius(radius); - arcOfCircle.setRange(startParam, endParam, true); - int geoId1 = getObject()->addGeometry(&arcOfCircle); - - Base::Vector3d coords1(0.1, 0.0, 0.0); - Base::Vector3d coords2(3.0, 4.0, 0.0); - Part::GeomLineSegment lineSeg; - lineSeg.setPoints(coords1, coords2); - int geoId2 = getObject()->addGeometry(&lineSeg); - - // Act - // Join these curves - getObject()->join(geoId1, Sketcher::PointPos::start, geoId2, Sketcher::PointPos::start); - - // Assert - // Check they are replaced (here it means there is only one curve left after internal - // geometries are removed) - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); -} - -TEST_F(SketchObjectTest, testJoinCurvesWhenTangent) -{ - // Arrange - // Make two curves - Base::Vector3d coordsCenter(0.0, 0.0, 0.0); - double radius = 3.0, startParam = M_PI / 2, endParam = M_PI; - Part::GeomArcOfCircle arcOfCircle; - arcOfCircle.setCenter(coordsCenter); - arcOfCircle.setRadius(radius); - arcOfCircle.setRange(startParam, endParam, true); - int geoId1 = getObject()->addGeometry(&arcOfCircle); - - Base::Vector3d coords1(0.0, 0.0, 0.0); - Base::Vector3d coords2(3.0, 0.0, 0.0); - Part::GeomLineSegment lineSeg; - lineSeg.setPoints(coords1, coords2); - int geoId2 = getObject()->addGeometry(&lineSeg); - - // Add end-to-end tangent between these - auto constraint = new Sketcher::Constraint(); // Ownership will be transferred to the sketch - constraint->Type = Sketcher::ConstraintType::Tangent; - constraint->First = geoId1; - constraint->FirstPos = Sketcher::PointPos::start; - constraint->Second = geoId2; - constraint->SecondPos = Sketcher::PointPos::start; - getObject()->addConstraint(constraint); - - // Act - // Join these curves - getObject()->join(geoId1, Sketcher::PointPos::start, geoId2, Sketcher::PointPos::start, 1); - - // Assert - // Check they are replaced (here it means there is only one curve left after internal - // geometries are removed) - for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { - getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); - } - EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); - // TODO: Check the shape is conserved (how?) - // Check there is no C-0 knot (should be possible for the chosen example) - auto mults = static_cast(getObject()->getGeometry(0)) - ->getMultiplicities(); - EXPECT_TRUE(std::all_of(mults.begin(), mults.end(), [](auto mult) { - return mult >= 1; - })); -} - TEST_F(SketchObjectTest, testReverseAngleConstraintToSupplementaryExpressionNoUnits1) { std::string expr = Sketcher::SketchObject::reverseAngleConstraintExpression("180 - 60"); diff --git a/tests/src/Mod/Sketcher/App/SketchObjectChanges.cpp b/tests/src/Mod/Sketcher/App/SketchObjectChanges.cpp new file mode 100644 index 0000000000..2b0f69aa76 --- /dev/null +++ b/tests/src/Mod/Sketcher/App/SketchObjectChanges.cpp @@ -0,0 +1,920 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "SketcherTestHelpers.h" + +using namespace SketcherTestHelpers; + +TEST_F(SketchObjectTest, testSplitLineSegment) +{ + // Arrange + Base::Vector3d splitPoint(2.0, 3.1, 0.0); + Part::GeomLineSegment lineSeg; + setupLineSegment(lineSeg); + int geoId = getObject()->addGeometry(&lineSeg); + + // Act + int result = getObject()->split(geoId, splitPoint); + + // Assert + EXPECT_EQ(result, 0); + // One additional curve should be added + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); + // TODO: Expect the resultant curves are line segments and shape is conserved + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); +} + +TEST_F(SketchObjectTest, testSplitCircle) +{ + // Arrange + Base::Vector3d splitPoint(2.0, 3.1, 0.0); + Part::GeomCircle circle; + setupCircle(circle); + int geoId = getObject()->addGeometry(&circle); + + // Act + int result = getObject()->split(geoId, splitPoint); + + // Assert + EXPECT_EQ(result, 0); + // The circle should be split into an arc now + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); +} + +TEST_F(SketchObjectTest, testSplitEllipse) +{ + // Arrange + Base::Vector3d splitPoint(2.0, 3.1, 0.0); + Part::GeomEllipse ellipse; + setupEllipse(ellipse); + int geoId = getObject()->addGeometry(&ellipse); + + // Act + int result = getObject()->split(geoId, splitPoint); + + // Assert + EXPECT_EQ(result, 0); + // TODO: The ellipse should be split into an arc of ellipse now + // FIXME: Internal geometries may be added or removed which may cause some issues + // EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); +} + +TEST_F(SketchObjectTest, testSplitArcOfCircle) +{ + // Arrange + Base::Vector3d splitPoint(-2.0, 3.1, 0.0); + Part::GeomArcOfCircle arcOfCircle; + setupArcOfCircle(arcOfCircle); + int geoId = getObject()->addGeometry(&arcOfCircle); + + // Act + int result = getObject()->split(geoId, splitPoint); + + // Assert + EXPECT_EQ(result, 0); + // The arcOfCircle should be split into an arc now + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); + // Expect the end points and centers of the resultant curve are coincident. + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 2); +} + +TEST_F(SketchObjectTest, testSplitArcOfConic) +{ + // Arrange + // TODO: Define a parabola/hyperbola as reference + Base::Vector3d splitPoint(1.0, -1.1, 0.0); + Part::GeomArcOfParabola arcOfConic; + setupArcOfParabola(arcOfConic); + int geoId = getObject()->addGeometry(&arcOfConic); + + // Act + // TODO: Sample random points from both sides of the split + int result = getObject()->split(geoId, splitPoint); + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + + // Assert + EXPECT_EQ(result, 0); + // The arcOfConic should be split into two arcs of the same conic now + EXPECT_EQ(getObject()->getHighestCurveIndex(), 1); + // TODO: Expect the end points of the resultant curve are coincident. + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); +} + +TEST_F(SketchObjectTest, testSplitNonPeriodicBSpline) +{ + // Arrange + auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); + Base::Vector3d splitPoint(-0.5, 1.1, 0.0); + int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); + // TODO: Put a point on this + + // Act + // TODO: sample before point(s) at a random parameter + int result = getObject()->split(geoId, splitPoint); + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + + // Assert + EXPECT_EQ(result, 0); + EXPECT_EQ(getObject()->getHighestCurveIndex(), 1); + // TODO: confirm sampled point(s) is/are at the same place + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); +} + +TEST_F(SketchObjectTest, testSplitPeriodicBSpline) +{ + // Arrange + auto PeriodicBSpline = createTypicalPeriodicBSpline(); + Base::Vector3d splitPoint(-0.5, 1.1, 0.0); + int geoId = getObject()->addGeometry(PeriodicBSpline.get()); + // TODO: Put a point on this + + // Act + // TODO: sample before point(s) at a random parameter + int result = getObject()->split(geoId, splitPoint); + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + + // Assert + EXPECT_EQ(result, 0); + EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); + // TODO: confirm sampled point(s) is/are at the same place +} + +TEST_F(SketchObjectTest, testTrimWithoutIntersection) +{ + // Arrange + Part::GeomLineSegment lineSeg; + setupLineSegment(lineSeg); + int geoId = getObject()->addGeometry(&lineSeg); + Base::Vector3d trimPoint(2.0, 3.1, 0.0); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + // Once this line segment is trimmed, nothing should remain + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId - 1); +} + +// TODO: There are other combinations of constraints we may want to test with trim. + +TEST_F(SketchObjectTest, testTrimLineSegmentEnd) +{ + // Arrange + Part::GeomLineSegment lineSeg; + setupLineSegment(lineSeg); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(lineSeg, 0.2)); + Base::Vector3d p1(getPointAtNormalizedParameter(lineSeg, 0.5)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + int geoId = getObject()->addGeometry(&lineSeg); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + // TODO: Once this line segment is trimmed, the curve should be "smaller" + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); + // TODO: There should be a "point-on-object" constraint on the intersecting curves + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); +} + +TEST_F(SketchObjectTest, testTrimLineSegmentMid) +{ + // Arrange + Part::GeomLineSegment lineSeg; + setupLineSegment(lineSeg); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(lineSeg, 0.5)); + Base::Vector3d p1(getPointAtNormalizedParameter(lineSeg, 0.3)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + Base::Vector3d p3(getPointAtNormalizedParameter(lineSeg, 0.7)); + Base::Vector3d p4(p3.x + 0.1, p3.y - 0.1, p3.z); + // to ensure that this line clearly intersects the curve, not just have a point on object + // without explicit constraint + p3.x -= 0.1; + p3.y += 0.1; + Part::GeomLineSegment lineSegCut2; + lineSegCut2.setPoints(p3, p4); + getObject()->addGeometry(&lineSegCut2); + int geoId = getObject()->addGeometry(&lineSeg); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + // TODO: Once this line segment is trimmed, there should be two "smaller" curves in its place + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); + // TODO: There should be a "point-on-object" constraint on the intersecting curves + int numberOfPointOnObjectConstraints = + countConstraintsOfType(getObject(), Sketcher::PointOnObject); + EXPECT_EQ(numberOfPointOnObjectConstraints, 1); + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); + // TODO: Ensure shape is preserved +} + +TEST_F(SketchObjectTest, testTrimCircleEnd) +{ + // Arrange + Part::GeomCircle circle; + setupCircle(circle); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(circle, 0.2)); + Base::Vector3d p1(getPointAtNormalizedParameter(circle, 0.5)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + int geoId = getObject()->addGeometry(&circle); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + // TODO: Once this circle is trimmed, the circle should be deleted. + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId - 1); +} + +TEST_F(SketchObjectTest, testTrimCircleMid) +{ + // Arrange + Part::GeomCircle circle; + setupCircle(circle); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(circle, 0.5)); + Base::Vector3d p1(getPointAtNormalizedParameter(circle, 0.3)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + Base::Vector3d p3(getPointAtNormalizedParameter(circle, 0.7)); + Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); + // to ensure that this line clearly intersects the curve, not just have a point on object + // without explicit constraint + p3.x -= 0.1; + p3.y -= 0.1; + Part::GeomLineSegment lineSegCut2; + lineSegCut2.setPoints(p3, p4); + getObject()->addGeometry(&lineSegCut2); + int geoId = getObject()->addGeometry(&circle); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + // TODO: Once this circle is trimmed, there should be one arc. + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); + // There should be one "coincident" and one "point-on-object" constraint on the intersecting + // curves + int numberOfPointOnObjectConstraints = + countConstraintsOfType(getObject(), Sketcher::PointOnObject); + EXPECT_EQ(numberOfPointOnObjectConstraints, 1); + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); + // TODO: Ensure shape is preserved +} + +TEST_F(SketchObjectTest, testTrimArcOfCircleEnd) +{ + // This should also cover as a representative of arc of conic + + // Arrange + Part::GeomArcOfCircle arcOfCircle; + setupArcOfCircle(arcOfCircle); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(arcOfCircle, 0.2)); + Base::Vector3d p1(getPointAtNormalizedParameter(arcOfCircle, 0.5)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + int geoId = getObject()->addGeometry(&arcOfCircle); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId); + // There should be a "point-on-object" constraint on the intersecting curves + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); +} + +TEST_F(SketchObjectTest, testTrimArcOfCircleMid) +{ + // Arrange + Part::GeomArcOfCircle arcOfCircle; + setupArcOfCircle(arcOfCircle); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(arcOfCircle, 0.5)); + Base::Vector3d p1(getPointAtNormalizedParameter(arcOfCircle, 0.3)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + Base::Vector3d p3(getPointAtNormalizedParameter(arcOfCircle, 0.7)); + Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); + // to ensure that this line clearly intersects the curve, not just have a point on object + // without explicit constraint + p3.x -= 0.1; + p3.y -= 0.1; + Part::GeomLineSegment lineSegCut2; + lineSegCut2.setPoints(p3, p4); + getObject()->addGeometry(&lineSegCut2); + int geoId = getObject()->addGeometry(&arcOfCircle); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + EXPECT_EQ(getObject()->getHighestCurveIndex(), geoId + 1); + // There should be a "point-on-object" constraint on the intersecting curves + int numberOfPointOnObjectConstraints = + countConstraintsOfType(getObject(), Sketcher::PointOnObject); + EXPECT_EQ(numberOfPointOnObjectConstraints, 1); + // There should be 2 coincident constraints: one with lineSegCut1 and one between centers of the + // new arcs + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 2); + // TODO: Ensure shape is preserved +} + +TEST_F(SketchObjectTest, testTrimEllipseEnd) +{ + // Arrange + Part::GeomEllipse ellipse; + setupEllipse(ellipse); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(ellipse, 0.2)); + Base::Vector3d p1(getPointAtNormalizedParameter(ellipse, 0.5)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + int geoId = getObject()->addGeometry(&ellipse); + + // Act + int result = getObject()->trim(geoId, trimPoint); + // remove all internal geometry + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + + // Assert + EXPECT_EQ(result, 0); + // Once this ellipse is trimmed, the ellipse should be deleted. + // Only remaining: line segment + EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); +} + +TEST_F(SketchObjectTest, testTrimEllipseMid) +{ + // Arrange + Part::GeomEllipse ellipse; + setupEllipse(ellipse); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(ellipse, 0.5)); + Base::Vector3d p1(getPointAtNormalizedParameter(ellipse, 0.3)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + Base::Vector3d p3(getPointAtNormalizedParameter(ellipse, 0.7)); + Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); + // to ensure that this line clearly intersects the curve, not just have a point on object + // without explicit constraint + p3.x -= 0.1; + p3.y -= 0.1; + Part::GeomLineSegment lineSegCut2; + lineSegCut2.setPoints(p3, p4); + getObject()->addGeometry(&lineSegCut2); + int geoId = getObject()->addGeometry(&ellipse); + // FIXME: Doing this to avoid trimming only until minor/major axes. Should not be needed. + getObject()->deleteUnusedInternalGeometry(geoId); + + // Act + int result = getObject()->trim(geoId, trimPoint); + // remove all internal geometry + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + + // Assert + EXPECT_EQ(result, 0); + // Once this ellipse is trimmed, there should be one arc and line segments. + EXPECT_EQ(getObject()->getHighestCurveIndex(), 2); + // There should be one "coincident" and one "point-on-object" constraint on the intersecting + // curves + int numberOfPointOnObjectConstraints = + countConstraintsOfType(getObject(), Sketcher::PointOnObject); + EXPECT_EQ(numberOfPointOnObjectConstraints, 1); + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); + // TODO: Ensure shape is preserved +} + +// TODO: Tests for other arcs of conics? + +TEST_F(SketchObjectTest, testTrimPeriodicBSplineEnd) +{ + // Arrange + auto periodicBSpline = createTypicalPeriodicBSpline(); + assert(periodicBSpline); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(*periodicBSpline, 0.2)); + Base::Vector3d p1(getPointAtNormalizedParameter(*periodicBSpline, 0.5)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + int geoId = getObject()->addGeometry(periodicBSpline.get()); + + // Act + int result = getObject()->trim(geoId, trimPoint); + + // Assert + EXPECT_EQ(result, 0); + // FIXME: This will fail because of deleted internal geometry + // Once this periodicBSpline is trimmed, the periodicBSpline should be deleted, leaving only the + // line segment. + EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); + // TODO: There should be a "point-on-object" constraint on the intersecting curves +} + +TEST_F(SketchObjectTest, testTrimPeriodicBSplineMid) +{ + // Arrange + auto periodicBSpline = createTypicalPeriodicBSpline(); + assert(periodicBSpline); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(*periodicBSpline, 0.5)); + Base::Vector3d p1(getPointAtNormalizedParameter(*periodicBSpline, 0.3)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + Base::Vector3d p3(getPointAtNormalizedParameter(*periodicBSpline, 0.7)); + Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); + // to ensure that this line clearly intersects the curve, not just have a point on object + // without explicit constraint + p3.x -= 0.1; + p3.y -= 0.1; + Part::GeomLineSegment lineSegCut2; + lineSegCut2.setPoints(p3, p4); + getObject()->addGeometry(&lineSegCut2); + int geoId = getObject()->addGeometry(periodicBSpline.get()); + + // Act + int result = getObject()->trim(geoId, trimPoint); + // remove all internal geometry + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + + // Assert + EXPECT_EQ(result, 0); + // Only remaining: Two line segments and the B-spline + EXPECT_EQ(getObject()->getHighestCurveIndex(), 2); + // There should be one "coincident" and one "point-on-object" constraint on the intersecting + // curves + int numberOfPointOnObjectConstraints = + countConstraintsOfType(getObject(), Sketcher::PointOnObject); + EXPECT_EQ(numberOfPointOnObjectConstraints, 1); + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); + // TODO: Ensure shape is preserved +} + +TEST_F(SketchObjectTest, testTrimNonPeriodicBSplineEnd) +{ + // This should also cover as a representative of arc of conic + + // Arrange + auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); + assert(nonPeriodicBSpline); + // create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.2)); + Base::Vector3d p1(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.5)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); + + // Act + int result = getObject()->trim(geoId, trimPoint); + // remove all internal geometry + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + + // Assert + EXPECT_EQ(result, 0); + // Only remaining: one line segment and the trimmed B-spline + EXPECT_EQ(getObject()->getHighestCurveIndex(), 1); + // FIXME: There should be a "point-on-object" constraint on the intersecting curves + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); +} + +TEST_F(SketchObjectTest, testTrimNonPeriodicBSplineMid) +{ + // Arrange + auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); + assert(nonPeriodicBSpline); + // TODO: create curves intersecting at the right spots + Base::Vector3d trimPoint(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.5)); + Base::Vector3d p1(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.3)); + Base::Vector3d p2(p1.x + 0.1, p1.y + 0.1, p1.z); + Part::GeomLineSegment lineSegCut1; + lineSegCut1.setPoints(p1, p2); + getObject()->addGeometry(&lineSegCut1); + Base::Vector3d p3(getPointAtNormalizedParameter(*nonPeriodicBSpline, 0.7)); + Base::Vector3d p4(p3.x + 0.1, p3.y + 0.1, p3.z); + // to ensure that this line clearly intersects the curve, not just have a point on object + // without explicit constraint + p3.x -= 0.1; + p3.y -= 0.1; + Part::GeomLineSegment lineSegCut2; + lineSegCut2.setPoints(p3, p4); + getObject()->addGeometry(&lineSegCut2); + int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); + + // Act + int result = getObject()->trim(geoId, trimPoint); + // remove all internal geometry + for (int i = 0; i < getObject()->getHighestCurveIndex(); ++i) { + if (getObject()->getGeometry(i)->is()) { + getObject()->deleteUnusedInternalGeometry(i); + } + } + + // Assert + EXPECT_EQ(result, 0); + // Only remaining: one line segment and the trimmed B-spline + EXPECT_EQ(getObject()->getHighestCurveIndex(), 3); + // There should be a "point-on-object" constraint on the intersecting curves + int numberOfPointOnObjectConstraints = + countConstraintsOfType(getObject(), Sketcher::PointOnObject); + EXPECT_EQ(numberOfPointOnObjectConstraints, 1); + int numberOfCoincidentConstraints = countConstraintsOfType(getObject(), Sketcher::Coincident); + EXPECT_EQ(numberOfCoincidentConstraints, 1); + // TODO: Ensure shape is preserved +} + +TEST_F(SketchObjectTest, testModifyKnotMultInNonPeriodicBSplineToZero) +{ + // Arrange + auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); + assert(nonPeriodicBSpline); + int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); + auto bsp1 = static_cast(getObject()->getGeometry(geoId)); + int oldKnotCount = bsp1->countKnots(); + + // Act + // Try decreasing mult to zero. + // NOTE: we still use OCCT notation of knot index starting with 1 (not 0). + getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); + // Assert + // Knot should disappear. We start with 3 (unique) knots, so expect 2. + auto bsp2 = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp2->countKnots(), oldKnotCount - 1); +} + +TEST_F(SketchObjectTest, testModifyKnotMultInNonPeriodicBSplineToDisallowed) +{ + // Arrange + auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); + assert(nonPeriodicBSpline); + int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); + + // Act and Assert + // TODO: Try modifying such that resultant multiplicity > degree + // TODO: This should immediately throw exception + EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 3), Base::ValueError); + // TODO: Try modifying such that resultant multiplicity < 0 + // TODO: This should immediately throw exception + EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -2), Base::ValueError); +} + +TEST_F(SketchObjectTest, testModifyKnotMultInNonPeriodicBSpline) +{ + // Arrange + auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); + assert(nonPeriodicBSpline); + int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); + + auto bsp = static_cast(getObject()->getGeometry(geoId)); + int oldKnotsNum = bsp->countKnots(); + int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[1]; + + // Act + // TODO: Increase/decrease knot multiplicity normally + getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 1); + // Assert + // This should not alter the sizes of knot and multiplicity vectors. + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum); + // This should increment the multiplicity. + EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot + 1); + // This should still be a non-periodic spline + EXPECT_FALSE(bsp->isPeriodic()); + // TODO: Expect shape is preserved + + // Act + // TODO: Increase/decrease knot multiplicity normally + getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); + // Assert + // This should not alter the sizes of knot and multiplicity vectors. + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum); + // This should increment the multiplicity. + EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot); + // This should still be a non-periodic spline + EXPECT_FALSE(bsp->isPeriodic()); +} + +TEST_F(SketchObjectTest, testModifyKnotMultInPeriodicBSplineToZero) +{ + // Arrange + auto PeriodicBSpline = createTypicalPeriodicBSpline(); + assert(PeriodicBSpline); + int geoId = getObject()->addGeometry(PeriodicBSpline.get()); + auto bsp1 = static_cast(getObject()->getGeometry(geoId)); + int oldKnotCount = bsp1->countKnots(); + + // Act + // Try decreasing mult to zero. + // NOTE: we still use OCCT notation of knot index starting with 1 (not 0). + getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); + // Assert + // Knot should disappear. + auto bsp2 = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp2->countKnots(), oldKnotCount - 1); +} + +TEST_F(SketchObjectTest, testModifyKnotMultInPeriodicBSplineToDisallowed) +{ + // Arrange + auto PeriodicBSpline = createTypicalPeriodicBSpline(); + assert(PeriodicBSpline); + int geoId = getObject()->addGeometry(PeriodicBSpline.get()); + + // Act and Assert + // TODO: Try modifying such that resultant multiplicity > degree + // TODO: This should immediately throw exception + EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 3), Base::ValueError); + // TODO: Try modifying such that resultant multiplicity < 0 + // TODO: This should immediately throw exception + EXPECT_THROW(getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -2), Base::ValueError); +} + +TEST_F(SketchObjectTest, testModifyKnotMultInPeriodicBSpline) +{ + // Arrange + auto PeriodicBSpline = createTypicalPeriodicBSpline(); + assert(PeriodicBSpline); + int geoId = getObject()->addGeometry(PeriodicBSpline.get()); + + auto bsp = static_cast(getObject()->getGeometry(geoId)); + int oldKnotsNum = bsp->countKnots(); + int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[1]; + + // Act + // TODO: Increase/decrease knot multiplicity normally + getObject()->modifyBSplineKnotMultiplicity(geoId, 2, 1); + // Assert + // This should not alter the sizes of knot and multiplicity vectors. + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum); + // This should increment the multiplicity. + EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot + 1); + // This should still be a periodic spline + EXPECT_TRUE(bsp->isPeriodic()); + // TODO: Expect shape is preserved + + // Act + // TODO: Increase/decrease knot multiplicity normally + getObject()->modifyBSplineKnotMultiplicity(geoId, 2, -1); + // Assert + // This should not alter the sizes of knot and multiplicity vectors. + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum); + // This should decrement the multiplicity. + EXPECT_EQ(bsp->getMultiplicities()[1], oldMultiplicityOfTargetKnot); + // This should still be a non-periodic spline + EXPECT_TRUE(bsp->isPeriodic()); +} + +TEST_F(SketchObjectTest, testInsertKnotInNonPeriodicBSpline) +{ + // Arrange + auto nonPeriodicBSpline = createTypicalNonPeriodicBSpline(); + assert(nonPeriodicBSpline); + int geoId = getObject()->addGeometry(nonPeriodicBSpline.get()); + + // Act and Assert + // Try inserting knot with zero multiplicity + // zero multiplicity knot should immediately throw exception + EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 0), Base::ValueError); + + // Act and Assert + // Try inserting knot with multiplicity > degree + // This should immediately throw exception + EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 4), Base::ValueError); + + // Act and Assert + // TODO: Try inserting at an existing knot with resultant multiplicity > degree + // TODO: This should immediately throw exception + // FIXME: Not happening. May be ignoring existing values. + // EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 1.0, 3), Base::ValueError); + + auto bsp = static_cast(getObject()->getGeometry(geoId)); + int oldKnotsNum = bsp->countKnots(); + int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[1]; + + // Act + // Add at a general position (where no knot exists) + getObject()->insertBSplineKnot(geoId, 0.5, 1); + // Assert + // This should add to both the knot and multiplicity "vectors" + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); + // This should still be a non-periodic spline + EXPECT_FALSE(bsp->isPeriodic()); + + // Act + // Add a knot at an existing knot + getObject()->insertBSplineKnot(geoId, 1.0, 1); + // Assert + // This should not alter the sizes of knot and multiplicity vectors. + // (Since we previously added a knot, this means the total is still one more than original) + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); + // This should increment the multiplicity. + EXPECT_EQ(bsp->getMultiplicities()[2], oldMultiplicityOfTargetKnot + 1); + // This should still be a non-periodic spline + EXPECT_FALSE(bsp->isPeriodic()); +} + +TEST_F(SketchObjectTest, testInsertKnotInPeriodicBSpline) +{ + // This should also cover as a representative of arc of conic + + // Arrange + auto PeriodicBSpline = createTypicalPeriodicBSpline(); + assert(PeriodicBSpline); + int geoId = getObject()->addGeometry(PeriodicBSpline.get()); + + // Act and Assert + // Try inserting knot with zero multiplicity + // zero multiplicity knot should immediately throw exception + EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 0), Base::ValueError); + + // Act and Assert + // Try inserting knot with multiplicity > degree + // This should immediately throw exception + EXPECT_THROW(getObject()->insertBSplineKnot(geoId, 0.5, 4), Base::ValueError); + + // Act and Assert + // TODO: Try inserting at an existing knot with resultant multiplicity > degree + // TODO: This should immediately throw exception + + auto bsp = static_cast(getObject()->getGeometry(geoId)); + int oldKnotsNum = bsp->countKnots(); + int oldMultiplicityOfTargetKnot = bsp->getMultiplicities()[2]; + + // Act + // Add at a general position (where no knot exists) + getObject()->insertBSplineKnot(geoId, 0.5, 1); + // Assert + // This should add to both the knot and multiplicity "vectors" + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); + // This should still be a periodic spline + EXPECT_TRUE(bsp->isPeriodic()); + + // Act + // Add a knot at an existing knot + getObject()->insertBSplineKnot(geoId, 1.0, 1); + // Assert + // This should not alter the sizes of knot and multiplicity vectors. + bsp = static_cast(getObject()->getGeometry(geoId)); + EXPECT_EQ(bsp->countKnots(), oldKnotsNum + 1); + // This should increment the multiplicity. + EXPECT_EQ(bsp->getMultiplicities()[3], oldMultiplicityOfTargetKnot + 1); + // This should still be a periodic spline + EXPECT_TRUE(bsp->isPeriodic()); +} + +TEST_F(SketchObjectTest, testJoinCurves) +{ + // Arrange + // Make two curves + Base::Vector3d coordsCenter(0.0, 0.0, 0.0); + double radius = 3.0, startParam = M_PI / 2, endParam = M_PI; + Part::GeomArcOfCircle arcOfCircle; + arcOfCircle.setCenter(coordsCenter); + arcOfCircle.setRadius(radius); + arcOfCircle.setRange(startParam, endParam, true); + int geoId1 = getObject()->addGeometry(&arcOfCircle); + + Base::Vector3d coords1(0.1, 0.0, 0.0); + Base::Vector3d coords2(3.0, 4.0, 0.0); + Part::GeomLineSegment lineSeg; + lineSeg.setPoints(coords1, coords2); + int geoId2 = getObject()->addGeometry(&lineSeg); + + // Act + // Join these curves + getObject()->join(geoId1, Sketcher::PointPos::start, geoId2, Sketcher::PointPos::start); + + // Assert + // Check they are replaced (here it means there is only one curve left after internal + // geometries are removed) + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); +} + +TEST_F(SketchObjectTest, testJoinCurvesWhenTangent) +{ + // Arrange + // Make two curves + Base::Vector3d coordsCenter(0.0, 0.0, 0.0); + double radius = 3.0, startParam = M_PI / 2, endParam = M_PI; + Part::GeomArcOfCircle arcOfCircle; + arcOfCircle.setCenter(coordsCenter); + arcOfCircle.setRadius(radius); + arcOfCircle.setRange(startParam, endParam, true); + int geoId1 = getObject()->addGeometry(&arcOfCircle); + + Base::Vector3d coords1(0.0, 0.0, 0.0); + Base::Vector3d coords2(3.0, 0.0, 0.0); + Part::GeomLineSegment lineSeg; + lineSeg.setPoints(coords1, coords2); + int geoId2 = getObject()->addGeometry(&lineSeg); + + // Add end-to-end tangent between these + auto constraint = new Sketcher::Constraint(); // Ownership will be transferred to the sketch + constraint->Type = Sketcher::ConstraintType::Tangent; + constraint->First = geoId1; + constraint->FirstPos = Sketcher::PointPos::start; + constraint->Second = geoId2; + constraint->SecondPos = Sketcher::PointPos::start; + getObject()->addConstraint(constraint); + + // Act + // Join these curves + getObject()->join(geoId1, Sketcher::PointPos::start, geoId2, Sketcher::PointPos::start, 1); + + // Assert + // Check they are replaced (here it means there is only one curve left after internal + // geometries are removed) + for (int iterGeoId = 0; iterGeoId < getObject()->getHighestCurveIndex(); ++iterGeoId) { + getObject()->deleteUnusedInternalGeometryAndUpdateGeoId(iterGeoId); + } + EXPECT_EQ(getObject()->getHighestCurveIndex(), 0); + // TODO: Check the shape is conserved (how?) + // Check there is no C-0 knot (should be possible for the chosen example) + auto mults = static_cast(getObject()->getGeometry(0)) + ->getMultiplicities(); + EXPECT_TRUE(std::all_of(mults.begin(), mults.end(), [](auto mult) { + return mult >= 1; + })); +} diff --git a/tests/src/Mod/Sketcher/App/SketcherTestHelpers.cpp b/tests/src/Mod/Sketcher/App/SketcherTestHelpers.cpp new file mode 100644 index 0000000000..ae4fb2414e --- /dev/null +++ b/tests/src/Mod/Sketcher/App/SketcherTestHelpers.cpp @@ -0,0 +1,155 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include +#include +#include +#include +#include +#include +#include "SketcherTestHelpers.h" + +void SketchObjectTest::SetUpTestSuite() +{ + tests::initApplication(); +} + +void SketchObjectTest::SetUp() +{ + _docName = App::GetApplication().getUniqueDocumentName("test"); + auto _doc = App::GetApplication().newDocument(_docName.c_str(), "testUser"); + // TODO: Do we add a body newName, or is just adding sketch sufficient for this test? + _sketchobj = static_cast(_doc->addObject("Sketcher::SketchObject")); +} + +void SketchObjectTest::TearDown() +{ + App::GetApplication().closeDocument(_docName.c_str()); +} + +Sketcher::SketchObject* SketchObjectTest::getObject() +{ + return _sketchobj; +} + +namespace SketcherTestHelpers +{ + +using namespace Sketcher; + +void setupLineSegment(Part::GeomLineSegment& lineSeg) +{ + Base::Vector3d coords1(1.0, 2.0, 0.0); + Base::Vector3d coords2(3.0, 4.0, 0.0); + lineSeg.setPoints(coords1, coords2); +} + +void setupCircle(Part::GeomCircle& circle) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + Base::Vector3d splitPoint(2.0, 3.1, 0.0); + double radius = 3.0; + circle.setCenter(coordsCenter); + circle.setRadius(radius); +} + +void setupArcOfCircle(Part::GeomArcOfCircle& arcOfCircle) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double radius = 3.0; + double startParam = M_PI / 3, endParam = M_PI * 1.5; + arcOfCircle.setCenter(coordsCenter); + arcOfCircle.setRadius(radius); + arcOfCircle.setRange(startParam, endParam, true); +} + +void setupEllipse(Part::GeomEllipse& ellipse) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double majorRadius = 4.0; + double minorRadius = 3.0; + ellipse.setCenter(coordsCenter); + ellipse.setMajorRadius(majorRadius); + ellipse.setMinorRadius(minorRadius); +} + +void setupArcOfHyperbola(Part::GeomArcOfHyperbola& arcOfHyperbola) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double majorRadius = 4.0; + double minorRadius = 3.0; + double startParam = M_PI / 3, endParam = M_PI * 1.5; + arcOfHyperbola.setCenter(coordsCenter); + arcOfHyperbola.setMajorRadius(majorRadius); + arcOfHyperbola.setMinorRadius(minorRadius); + arcOfHyperbola.setRange(startParam, endParam, true); +} + +void setupArcOfParabola(Part::GeomArcOfParabola& aop) +{ + Base::Vector3d coordsCenter(1.0, 2.0, 0.0); + double focal = 3.0; + double startParam = -M_PI * 1.5, endParam = M_PI * 1.5; + aop.setCenter(coordsCenter); + aop.setFocal(focal); + aop.setRange(startParam, endParam, true); +} + +std::unique_ptr createTypicalNonPeriodicBSpline() +{ + int degree = 3; + std::vector poles; + poles.emplace_back(1, 0, 0); + poles.emplace_back(1, 1, 0); + poles.emplace_back(1, 0.5, 0); + poles.emplace_back(0, 1, 0); + poles.emplace_back(0, 0, 0); + std::vector weights(5, 1.0); + std::vector knotsNonPeriodic = {0.0, 1.0, 2.0}; + std::vector multiplicitiesNonPeriodic = {degree + 1, 1, degree + 1}; + return std::make_unique(poles, + weights, + knotsNonPeriodic, + multiplicitiesNonPeriodic, + degree, + false); +} + +std::unique_ptr createTypicalPeriodicBSpline() +{ + int degree = 3; + std::vector poles; + poles.emplace_back(1, 0, 0); + poles.emplace_back(1, 1, 0); + poles.emplace_back(1, 0.5, 0); + poles.emplace_back(0, 1, 0); + poles.emplace_back(0, 0, 0); + std::vector weights(5, 1.0); + std::vector knotsPeriodic = {0.0, 0.3, 1.0, 1.5, 1.8, 2.0}; + std::vector multiplicitiesPeriodic(6, 1); + return std::make_unique(poles, + weights, + knotsPeriodic, + multiplicitiesPeriodic, + degree, + true); +} + +int countConstraintsOfType(const Sketcher::SketchObject* obj, const Sketcher::ConstraintType cType) +{ + const std::vector& constraints = obj->Constraints.getValues(); + + int result = std::count_if(constraints.begin(), + constraints.end(), + [&cType](const Sketcher::Constraint* constr) { + return constr->Type == cType; + }); + + return result; +} + +Base::Vector3d getPointAtNormalizedParameter(const Part::GeomCurve& curve, double param) +{ + return curve.pointAtParameter(curve.getFirstParameter() + + (curve.getLastParameter() - curve.getFirstParameter()) * param); +} +} // namespace SketcherTestHelpers diff --git a/tests/src/Mod/Sketcher/App/SketcherTestHelpers.h b/tests/src/Mod/Sketcher/App/SketcherTestHelpers.h index e03655e628..5047a3962a 100644 --- a/tests/src/Mod/Sketcher/App/SketcherTestHelpers.h +++ b/tests/src/Mod/Sketcher/App/SketcherTestHelpers.h @@ -1,5 +1,10 @@ // SPDX-License-Identifier: LGPL-2.1-or-later +#include + +#include + + #include #include #include @@ -8,128 +13,51 @@ #include #include +class SketchObjectTest: public ::testing::Test +{ +protected: + static void SetUpTestSuite(); + void SetUp() override; + void TearDown() override; + Sketcher::SketchObject* getObject(); + +private: + // TODO: use shared_ptr or something else here? + Sketcher::SketchObject* _sketchobj; + std::string _docName; + std::vector allowedTypes {"Vertex", + "Edge", + "ExternalEdge", + "H_Axis", + "V_Axis", + "RootPoint"}; +}; + namespace SketcherTestHelpers { using namespace Sketcher; -void setupLineSegment(Part::GeomLineSegment& lineSeg) -{ - Base::Vector3d coords1(1.0, 2.0, 0.0); - Base::Vector3d coords2(3.0, 4.0, 0.0); - lineSeg.setPoints(coords1, coords2); -} +void setupLineSegment(Part::GeomLineSegment& lineSeg); -void setupCircle(Part::GeomCircle& circle) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - Base::Vector3d splitPoint(2.0, 3.1, 0.0); - double radius = 3.0; - circle.setCenter(coordsCenter); - circle.setRadius(radius); -} +void setupCircle(Part::GeomCircle& circle); -void setupArcOfCircle(Part::GeomArcOfCircle& arcOfCircle) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double radius = 3.0; - double startParam = M_PI / 3, endParam = M_PI * 1.5; - arcOfCircle.setCenter(coordsCenter); - arcOfCircle.setRadius(radius); - arcOfCircle.setRange(startParam, endParam, true); -} +void setupArcOfCircle(Part::GeomArcOfCircle& arcOfCircle); -void setupEllipse(Part::GeomEllipse& ellipse) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double majorRadius = 4.0; - double minorRadius = 3.0; - ellipse.setCenter(coordsCenter); - ellipse.setMajorRadius(majorRadius); - ellipse.setMinorRadius(minorRadius); -} +void setupEllipse(Part::GeomEllipse& ellipse); -void setupArcOfHyperbola(Part::GeomArcOfHyperbola& arcOfHyperbola) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double majorRadius = 4.0; - double minorRadius = 3.0; - double startParam = M_PI / 3, endParam = M_PI * 1.5; - arcOfHyperbola.setCenter(coordsCenter); - arcOfHyperbola.setMajorRadius(majorRadius); - arcOfHyperbola.setMinorRadius(minorRadius); - arcOfHyperbola.setRange(startParam, endParam, true); -} +void setupArcOfHyperbola(Part::GeomArcOfHyperbola& arcOfHyperbola); -void setupArcOfParabola(Part::GeomArcOfParabola& aop) -{ - Base::Vector3d coordsCenter(1.0, 2.0, 0.0); - double focal = 3.0; - double startParam = -M_PI * 1.5, endParam = M_PI * 1.5; - aop.setCenter(coordsCenter); - aop.setFocal(focal); - aop.setRange(startParam, endParam, true); -} +void setupArcOfParabola(Part::GeomArcOfParabola& aop); -std::unique_ptr createTypicalNonPeriodicBSpline() -{ - int degree = 3; - std::vector poles; - poles.emplace_back(1, 0, 0); - poles.emplace_back(1, 1, 0); - poles.emplace_back(1, 0.5, 0); - poles.emplace_back(0, 1, 0); - poles.emplace_back(0, 0, 0); - std::vector weights(5, 1.0); - std::vector knotsNonPeriodic = {0.0, 1.0, 2.0}; - std::vector multiplicitiesNonPeriodic = {degree + 1, 1, degree + 1}; - return std::make_unique(poles, - weights, - knotsNonPeriodic, - multiplicitiesNonPeriodic, - degree, - false); -} +std::unique_ptr createTypicalNonPeriodicBSpline(); -std::unique_ptr createTypicalPeriodicBSpline() -{ - int degree = 3; - std::vector poles; - poles.emplace_back(1, 0, 0); - poles.emplace_back(1, 1, 0); - poles.emplace_back(1, 0.5, 0); - poles.emplace_back(0, 1, 0); - poles.emplace_back(0, 0, 0); - std::vector weights(5, 1.0); - std::vector knotsPeriodic = {0.0, 0.3, 1.0, 1.5, 1.8, 2.0}; - std::vector multiplicitiesPeriodic(6, 1); - return std::make_unique(poles, - weights, - knotsPeriodic, - multiplicitiesPeriodic, - degree, - true); -} +std::unique_ptr createTypicalPeriodicBSpline(); -int countConstraintsOfType(const Sketcher::SketchObject* obj, const Sketcher::ConstraintType cType) -{ - const std::vector& constraints = obj->Constraints.getValues(); - - int result = std::count_if(constraints.begin(), - constraints.end(), - [&cType](const Sketcher::Constraint* constr) { - return constr->Type == cType; - }); - - return result; -} +int countConstraintsOfType(const Sketcher::SketchObject* obj, const Sketcher::ConstraintType cType); // Get point at the parameter after scaling the range to [0, 1]. -Base::Vector3d getPointAtNormalizedParameter(const Part::GeomCurve& curve, double param) -{ - return curve.pointAtParameter(curve.getFirstParameter() - + (curve.getLastParameter() - curve.getFirstParameter()) * param); -} +Base::Vector3d getPointAtNormalizedParameter(const Part::GeomCurve& curve, double param); // TODO: How to set up B-splines here? // It's not straightforward to change everything from a "default" one. From d01e6db9cdde17afb2a8c2d18687785808ca7260 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Sun, 12 Jan 2025 23:17:39 +0530 Subject: [PATCH 074/224] [Sketcher] Refactor `deleteUnusedInternalGeometryWhenBSpline` --- src/Mod/Sketcher/App/SketchObject.cpp | 69 ++++++++++----------------- 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 3beda7f640..b477ecec28 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -6775,12 +6775,9 @@ int SketchObject::deleteUnusedInternalGeometryWhenOneFocus(int GeoId, bool delge int SketchObject::deleteUnusedInternalGeometryWhenBSpline(int GeoId, bool delgeoid) { - const auto* bsp = static_cast(getGeometry(GeoId)); - // First we search existing IA - std::vector > poleGeoIdsAndConstraints(bsp->countPoles(), {GeoEnum::GeoUndef, 0}); - - std::vector > knotGeoIdsAndConstraints(bsp->countKnots(), {GeoEnum::GeoUndef, 0}); + std::map poleGeoIdsAndConstraints; + std::map knotGeoIdsAndConstraints; const std::vector& vals = Constraints.getValues(); @@ -6792,10 +6789,10 @@ int SketchObject::deleteUnusedInternalGeometryWhenBSpline(int GeoId, bool delgeo switch (constr->AlignmentType) { case Sketcher::BSplineControlPoint: - poleGeoIdsAndConstraints[constr->InternalAlignmentIndex].first = constr->First; + poleGeoIdsAndConstraints[constr->First] = 0; break; case Sketcher::BSplineKnotPoint: - knotGeoIdsAndConstraints[constr->InternalAlignmentIndex].first = constr->First; + knotGeoIdsAndConstraints[constr->First] = 0; break; default: return -1; @@ -6804,52 +6801,38 @@ int SketchObject::deleteUnusedInternalGeometryWhenBSpline(int GeoId, bool delgeo std::vector delgeometries; - // TODO: This can become significantly costly if there are lots of constraints and poles - for (auto& [cpGeoId, numConstr] : poleGeoIdsAndConstraints) { - if (cpGeoId == GeoEnum::GeoUndef) { + // Update all control point constraint counts. + // EXCLUDES internal alignment and related constraints. + for (auto const& constr : vals) { + // We do not ignore weight constraints as we did with radius constraints, + // because the radius magnitude no longer makes sense without the B-Spline. + if (constr->Type == Sketcher::InternalAlignment + || constr->Type == Sketcher::Weight) { continue; } - - // look for a circle at geoid index - for (auto const& constr : vals) { - if (constr->Type == Sketcher::InternalAlignment - || constr->Type == Sketcher::Weight - || !constr->involvesGeoId(cpGeoId)) { - continue; - } - if (constr->Type != Sketcher::Equal) { - ++numConstr; - continue; - } - bool firstIsInCPGeoIds = std::any_of(poleGeoIdsAndConstraints.begin(), - poleGeoIdsAndConstraints.end(), - [&constr](const auto& _pair) { - return _pair.first == constr->First; - }); - bool secondIsInCPGeoIds = std::any_of(poleGeoIdsAndConstraints.begin(), - poleGeoIdsAndConstraints.end(), - [&constr](const auto& _pair) { - return _pair.first == constr->Second; - }); - // the equality constraint constrains a pole but it is not interpole - if (firstIsInCPGeoIds != secondIsInCPGeoIds) { - ++numConstr; - } - // We do not ignore weight constraints as we did with radius constraints, - // because the radius magnitude no longer makes sense without the B-Spline. + bool firstIsInCPGeoIds = poleGeoIdsAndConstraints.count(constr->First) == 1; + bool secondIsInCPGeoIds = poleGeoIdsAndConstraints.count(constr->Second) == 1; + if (constr->Type == Sketcher::Equal && firstIsInCPGeoIds == secondIsInCPGeoIds) { + continue; } + // any equality constraint constraining a pole is not interpole + if (firstIsInCPGeoIds) { + ++poleGeoIdsAndConstraints[constr->First]; + } + if (secondIsInCPGeoIds) { + ++poleGeoIdsAndConstraints[constr->Second]; + } + } + for (auto& [cpGeoId, numConstr] : poleGeoIdsAndConstraints) { if (numConstr < 1) { // IA delgeometries.push_back(cpGeoId); } } for (auto& [kGeoId, numConstr] : knotGeoIdsAndConstraints) { - if (kGeoId == GeoEnum::GeoUndef) { - continue; - } - - // look for a point at geoid index + // Update all control point constraint counts. + // INCLUDES internal alignment and related constraints. auto tempGeoID = kGeoId; // C++17 and earlier do not support captured structured bindings numConstr = std::count_if(vals.begin(), vals.end(), [&tempGeoID](const auto& constr) { return constr->involvesGeoId(tempGeoID); From e1d39925c2751df1b78fee790d0dc1a69d49f7c0 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Sun, 22 Dec 2024 06:06:08 +0530 Subject: [PATCH 075/224] [Sketcher] Refactor `SketchObject::delConstraintOnPoint()` Note that for distance constraints we remove even if the constraint is not on the point. --- src/Mod/Sketcher/App/SketchObject.cpp | 198 ++++++++++++++------------ 1 file changed, 103 insertions(+), 95 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index b477ecec28..976907a530 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -2327,125 +2327,133 @@ int SketchObject::delConstraintOnPoint(int VertexId, bool onlyCoincident) return delConstraintOnPoint(GeoId, PosId, onlyCoincident); } -int SketchObject::delConstraintOnPoint(int GeoId, PointPos PosId, bool onlyCoincident) +// clang-format on +int SketchObject::delConstraintOnPoint(int geoId, PointPos posId, bool onlyCoincident) { // no need to check input data validity as this is an sketchobject managed operation. Base::StateLocker lock(managedoperation, true); const std::vector& vals = this->Constraints.getValues(); + std::vector newVals; + newVals.reserve(vals.size()); // check if constraints can be redirected to some other point int replaceGeoId = GeoEnum::GeoUndef; PointPos replacePosId = Sketcher::PointPos::none; - if (!onlyCoincident) { - for (std::vector::const_iterator it = vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Coincident) { - if ((*it)->First == GeoId && (*it)->FirstPos == PosId) { - replaceGeoId = (*it)->Second; - replacePosId = (*it)->SecondPos; - break; - } - else if ((*it)->Second == GeoId && (*it)->SecondPos == PosId) { - replaceGeoId = (*it)->First; - replacePosId = (*it)->FirstPos; - break; - } - } + auto findReplacement = [geoId, posId, &replaceGeoId, &replacePosId, &vals]() { + auto it = std::find_if(vals.begin(), vals.end(), [geoId, posId](auto& constr) { + return constr->Type == Sketcher::Coincident + && constr->involvesGeoIdAndPosId(geoId, posId); + }); + + if (it == vals.end()) { + return; } - } + + if ((*it)->First == geoId && (*it)->FirstPos == posId) { + replaceGeoId = (*it)->Second; + replacePosId = (*it)->SecondPos; + } + else { + replaceGeoId = (*it)->First; + replacePosId = (*it)->FirstPos; + } + }; + + auto transferToReplacement = + [&geoId, &posId, &replaceGeoId, &replacePosId](int& constrGeoId, PointPos& constrPosId) { + if (replaceGeoId == GeoEnum::GeoUndef) { + return false; + } + if (geoId != constrGeoId || posId != constrPosId) { + return false; + } + constrGeoId = replaceGeoId; + constrPosId = replacePosId; + return true; + }; + + findReplacement(); + + auto performCoincidenceChecksOrChanges = [&](auto& constr) -> std::optional { + if (constr->Type != Sketcher::Coincident) { + if (onlyCoincident) { + return true; + } + return std::nullopt; + } + bool firstSucceeded = transferToReplacement(constr->First, constr->FirstPos); + bool secondSucceeded = transferToReplacement(constr->Second, constr->SecondPos); + return (firstSucceeded || secondSucceeded) + && (constr->First != constr->Second || constr->FirstPos != constr->SecondPos); + }; + + auto performOtherConstraintChecksOrChanges = [&](auto& constr) -> std::optional { + switch (constr->Type) { + case Sketcher::Distance: + case Sketcher::DistanceX: + case Sketcher::DistanceY: { + return (transferToReplacement(constr->First, constr->FirstPos) + || transferToReplacement(constr->Second, constr->SecondPos)); + } + case Sketcher::PointOnObject: { + return transferToReplacement(constr->First, constr->FirstPos); + } + case Sketcher::Tangent: + case Sketcher::Perpendicular: { + // we could keep this constraint by converting it to a simple one, but that doesn't + // always work (for example if tangent-via-point is necessary), and it is not really + // worth it + return false; + } + case Sketcher::Vertical: + case Sketcher::Horizontal: + case Sketcher::Symmetric: { + return false; + } + default: + return true; + } + }; // remove or redirect any constraints associated with the given point - std::vector newVals(0); - for (std::vector::const_iterator it = vals.begin(); it != vals.end(); ++it) { - if ((*it)->Type == Sketcher::Coincident) { - if ((*it)->First == GeoId && (*it)->FirstPos == PosId) { - // redirect this constraint - if (replaceGeoId != GeoEnum::GeoUndef - && (replaceGeoId != (*it)->Second || replacePosId != (*it)->SecondPos)) { - (*it)->First = replaceGeoId; - (*it)->FirstPos = replacePosId; - } - else - continue;// skip this constraint + for (auto& constr : vals) { + // keep the constraint if it doesn't involve the point + if (constr->involvesGeoIdAndPosId(geoId, posId)) { + auto didCoincidenceCheckWork = performCoincidenceChecksOrChanges(constr); + if (didCoincidenceCheckWork == true) { + newVals.push_back(constr); + continue; } - else if ((*it)->Second == GeoId && (*it)->SecondPos == PosId) { - // redirect this constraint - if (replaceGeoId != GeoEnum::GeoUndef - && (replaceGeoId != (*it)->First || replacePosId != (*it)->FirstPos)) { - (*it)->Second = replaceGeoId; - (*it)->SecondPos = replacePosId; - } - else - continue;// skip this constraint + else if (didCoincidenceCheckWork == false) { + continue; + } + // The check failed, which means it's not a coincidence constraint and + // `onlyCoincident` is `false` + if (performOtherConstraintChecksOrChanges(constr) == false) { + continue; } } - else if (!onlyCoincident) { - if ((*it)->Type == Sketcher::Distance || (*it)->Type == Sketcher::DistanceX - || (*it)->Type == Sketcher::DistanceY) { - if ((*it)->First == GeoId && (*it)->FirstPos == PointPos::none - && (PosId == PointPos::start || PosId == PointPos::end)) { - // remove the constraint even if it is not directly associated - // with the given point - continue;// skip this constraint - } - else if ((*it)->First == GeoId && (*it)->FirstPos == PosId) { - if (replaceGeoId != GeoEnum::GeoUndef) {// redirect this constraint - (*it)->First = replaceGeoId; - (*it)->FirstPos = replacePosId; - } - else - continue;// skip this constraint - } - else if ((*it)->Second == GeoId && (*it)->SecondPos == PosId) { - if (replaceGeoId != GeoEnum::GeoUndef) {// redirect this constraint - (*it)->Second = replaceGeoId; - (*it)->SecondPos = replacePosId; - } - else - continue;// skip this constraint - } - } - else if ((*it)->Type == Sketcher::PointOnObject) { - if ((*it)->First == GeoId && (*it)->FirstPos == PosId) { - if (replaceGeoId != GeoEnum::GeoUndef) {// redirect this constraint - (*it)->First = replaceGeoId; - (*it)->FirstPos = replacePosId; - } - else - continue;// skip this constraint - } - } - else if ((*it)->Type == Sketcher::Tangent || (*it)->Type == Sketcher::Perpendicular) { - if (((*it)->First == GeoId && (*it)->FirstPos == PosId) - || ((*it)->Second == GeoId && (*it)->SecondPos == PosId)) { - // we could keep the tangency constraint by converting it - // to a simple one but it is not really worth - continue;// skip this constraint - } - } - else if ((*it)->Type == Sketcher::Symmetric) { - if (((*it)->First == GeoId && (*it)->FirstPos == PosId) - || ((*it)->Second == GeoId && (*it)->SecondPos == PosId)) { - continue;// skip this constraint - } - } - else if ((*it)->Type == Sketcher::Vertical || (*it)->Type == Sketcher::Horizontal) { - if (((*it)->First == GeoId && (*it)->FirstPos == PosId) - || ((*it)->Second == GeoId && (*it)->SecondPos == PosId)) { - continue;// skip this constraint - } - } + // for these constraints remove the constraint even if it is not directly associated with + // the given point + if ((constr->Type == Sketcher::Distance || constr->Type == Sketcher::DistanceX + || constr->Type == Sketcher::DistanceY) + && (constr->First == geoId && constr->FirstPos == PointPos::none + && (posId == PointPos::start || posId == PointPos::end))) { + continue; } - newVals.push_back(*it); + newVals.push_back(constr); } + if (newVals.size() < vals.size()) { this->Constraints.setValues(std::move(newVals)); return 0; } - return -1;// no such constraint + return -1; // no such constraint } +// clang-format off void SketchObject::transferFilletConstraints(int geoId1, PointPos posId1, int geoId2, PointPos posId2) From d4ed28888c4abb60bdbe91f03ed6ad83ee5d4df0 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Wed, 8 Jan 2025 10:44:03 +0530 Subject: [PATCH 076/224] [Sketcher] More refactor of `delConstraintOnPoint` --- src/Mod/Sketcher/App/SketchObject.cpp | 60 +++++++++++++-------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 976907a530..43463377b9 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -107,6 +107,7 @@ #include +#include "GeoEnum.h" #include "SketchObject.h" #include "SketchObjectPy.h" #include "SolverGeometryExtension.h" @@ -2375,21 +2376,25 @@ int SketchObject::delConstraintOnPoint(int geoId, PointPos posId, bool onlyCoinc findReplacement(); - auto performCoincidenceChecksOrChanges = [&](auto& constr) -> std::optional { - if (constr->Type != Sketcher::Coincident) { - if (onlyCoincident) { - return true; - } - return std::nullopt; + auto performCoincidenceChecksOrChanges = [&](auto& constr) -> bool { + if (replaceGeoId == GeoEnum::GeoUndef) { + return false; } - bool firstSucceeded = transferToReplacement(constr->First, constr->FirstPos); - bool secondSucceeded = transferToReplacement(constr->Second, constr->SecondPos); - return (firstSucceeded || secondSucceeded) - && (constr->First != constr->Second || constr->FirstPos != constr->SecondPos); + if (constr->involvesGeoIdAndPosId(replaceGeoId, replacePosId)) { + return false; + } + // Assuming `constr` already involves geoId and posId, all conditions are already met + constr->substituteIndexAndPos(geoId, posId, replaceGeoId, replacePosId); + return true; }; - auto performOtherConstraintChecksOrChanges = [&](auto& constr) -> std::optional { + auto performAllConstraintChecksOrChanges = [&](auto& constr) -> std::optional { + if (constr->Type != Sketcher::Coincident && onlyCoincident) { + return true; + } switch (constr->Type) { + case Sketcher::Coincident: + return performCoincidenceChecksOrChanges(constr); case Sketcher::Distance: case Sketcher::DistanceX: case Sketcher::DistanceY: { @@ -2412,37 +2417,28 @@ int SketchObject::delConstraintOnPoint(int geoId, PointPos posId, bool onlyCoinc return false; } default: - return true; + return std::nullopt; } }; // remove or redirect any constraints associated with the given point for (auto& constr : vals) { // keep the constraint if it doesn't involve the point - if (constr->involvesGeoIdAndPosId(geoId, posId)) { - auto didCoincidenceCheckWork = performCoincidenceChecksOrChanges(constr); - if (didCoincidenceCheckWork == true) { - newVals.push_back(constr); + if (!constr->involvesGeoIdAndPosId(geoId, posId)) { + // for these constraints remove the constraint even if it is not directly associated + // with the given point + if ((constr->Type == Sketcher::Distance || constr->Type == Sketcher::DistanceX + || constr->Type == Sketcher::DistanceY) + && (constr->First == geoId && constr->FirstPos == PointPos::none + && (posId == PointPos::start || posId == PointPos::end))) { continue; } - else if (didCoincidenceCheckWork == false) { - continue; - } - // The check failed, which means it's not a coincidence constraint and - // `onlyCoincident` is `false` - if (performOtherConstraintChecksOrChanges(constr) == false) { - continue; - } - } - // for these constraints remove the constraint even if it is not directly associated with - // the given point - if ((constr->Type == Sketcher::Distance || constr->Type == Sketcher::DistanceX - || constr->Type == Sketcher::DistanceY) - && (constr->First == geoId && constr->FirstPos == PointPos::none - && (posId == PointPos::start || posId == PointPos::end))) { + newVals.push_back(constr); continue; } - newVals.push_back(constr); + if (performAllConstraintChecksOrChanges(constr) != false) { + newVals.push_back(constr); + } } if (newVals.size() < vals.size()) { From 809c9f210970240b7d80b426b267f59650b4e0a1 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Wed, 29 Jan 2025 12:05:33 +0100 Subject: [PATCH 077/224] [Sketcher] Incorporate suggestions by hyarion from #18916 --- src/Mod/Sketcher/App/SketchObject.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 43463377b9..95e3689dda 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -2427,16 +2427,18 @@ int SketchObject::delConstraintOnPoint(int geoId, PointPos posId, bool onlyCoinc if (!constr->involvesGeoIdAndPosId(geoId, posId)) { // for these constraints remove the constraint even if it is not directly associated // with the given point - if ((constr->Type == Sketcher::Distance || constr->Type == Sketcher::DistanceX - || constr->Type == Sketcher::DistanceY) - && (constr->First == geoId && constr->FirstPos == PointPos::none - && (posId == PointPos::start || posId == PointPos::end))) { + const bool isOneOfDistanceTypes = constr->Type == Sketcher::Distance + || constr->Type == Sketcher::DistanceX || constr->Type == Sketcher::DistanceY; + const bool involvesEntireCurve = + constr->First == geoId && constr->FirstPos == PointPos::none; + const bool isPosAnEndpoint = posId == PointPos::start || posId == PointPos::end; + if (isOneOfDistanceTypes && involvesEntireCurve && isPosAnEndpoint) { continue; } newVals.push_back(constr); continue; } - if (performAllConstraintChecksOrChanges(constr) != false) { + if (performAllConstraintChecksOrChanges(constr).value_or(true)) { newVals.push_back(constr); } } @@ -3693,7 +3695,7 @@ bool getParamLimitsOfNewGeosForTrim(const SketchObject* obj, std::array& cutPoints, std::vector>& paramsOfNewGeos) { - const auto* geoAsCurve = static_cast(obj->getGeometry(GeoId)); + const auto* geoAsCurve = obj->getGeometry(GeoId); double firstParam = geoAsCurve->getFirstParameter(); double lastParam = geoAsCurve->getLastParameter(); double cut0Param {firstParam}, cut1Param {lastParam}; @@ -3835,7 +3837,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) // Remove internal geometry beforehand for now // FIXME: we should be able to transfer these to new curves smoothly // auto geo = getGeometry(GeoId); - const auto* geoAsCurve = static_cast(getGeometry(GeoId)); + const auto* geoAsCurve = getGeometry(GeoId); //******************* Step A => Detection of intersection - Common to all Geometries //****************************************// @@ -3916,7 +3918,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) std::remove_if( idsOfOldConstraints.begin(), idsOfOldConstraints.end(), - [this, &GeoId, &allConstraints](const auto& i) { + [&GeoId, &allConstraints](const auto& i) { return (allConstraints[i]->involvesGeoIdAndPosId(GeoId, PointPos::start)); }), idsOfOldConstraints.end()); @@ -3925,7 +3927,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) idsOfOldConstraints.erase( std::remove_if(idsOfOldConstraints.begin(), idsOfOldConstraints.end(), - [this, &GeoId, &allConstraints](const auto& i) { + [&GeoId, &allConstraints](const auto& i) { return (allConstraints[i]->involvesGeoIdAndPosId(GeoId, PointPos::end)); }), @@ -3935,7 +3937,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) idsOfOldConstraints.erase( std::remove_if(idsOfOldConstraints.begin(), idsOfOldConstraints.end(), - [this, &GeoId, &allConstraints](const auto& i) { + [&GeoId, &allConstraints](const auto& i) { return (allConstraints[i]->involvesGeoIdAndPosId(GeoId, PointPos::mid)); }), idsOfOldConstraints.end()); From 9e5508513cbfb7a50db2a25c4a9b38e908d775b3 Mon Sep 17 00:00:00 2001 From: Mino-Tsuzuku <42058913+totake0224@users.noreply.github.com> Date: Thu, 30 Jan 2025 21:13:56 +0900 Subject: [PATCH 078/224] #18458 fix SVG import error at non-utf8 native environment. (#19280) --- src/Mod/Draft/importSVG.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 5bd0ed08e0..c15c60b8e6 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -61,7 +61,13 @@ from draftutils import params from draftutils import utils from draftutils.translate import translate from draftutils.messages import _err, _msg, _wrn -from builtins import open as pyopen +import builtins +#redefine pyopen as open with encoding='utf-8' +def utf8_open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): + if encoding is None: + encoding = 'utf-8' + return builtins.open(file, mode, buffering, encoding, errors, newline, closefd, opener) +pyopen = utf8_open if FreeCAD.GuiUp: from PySide import QtWidgets From 0511a4d04df4ad6dd9d3e85cbfcb5f9d08d7f072 Mon Sep 17 00:00:00 2001 From: panintended Date: Thu, 30 Jan 2025 10:40:43 +0100 Subject: [PATCH 079/224] QuickMeasure: display correct angle units Add angle unit user string getter, fix typos for length unit equivalent Fixes #19307 --- src/Mod/Measure/Gui/QuickMeasure.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Mod/Measure/Gui/QuickMeasure.cpp b/src/Mod/Measure/Gui/QuickMeasure.cpp index 9a16a55059..47341e8368 100644 --- a/src/Mod/Measure/Gui/QuickMeasure.cpp +++ b/src/Mod/Measure/Gui/QuickMeasure.cpp @@ -185,12 +185,18 @@ static QString areaStr(double value) return QString::fromStdString(area.getUserString()); } -static QString lenghtStr(double value) +static QString lengthStr(double value) { Base::Quantity dist(value, Base::Unit::Length); return QString::fromStdString(dist.getUserString()); } +static QString angleStr(double value) +{ + Base::Quantity dist(value, Base::Unit::Angle); + return QString::fromStdString(dist.getUserString()); +} + void QuickMeasure::printResult() { MeasureType mtype = measurement->getType(); @@ -206,7 +212,7 @@ void QuickMeasure::printResult() %2").arg(vol.getSafeUserString()).arg(area.getSafeUserString())); }*/ else if (mtype == MeasureType::TwoPlanes) { - print(tr("Nominal distance: %1").arg(lenghtStr(measurement->planePlaneDistance()))); + print(tr("Nominal distance: %1").arg(lengthStr(measurement->planePlaneDistance()))); } else if (mtype == MeasureType::Cone || mtype == MeasureType::Plane) { print(tr("Area: %1").arg(areaStr(measurement->area()))); @@ -214,29 +220,29 @@ void QuickMeasure::printResult() else if (mtype == MeasureType::Cylinder || mtype == MeasureType::Sphere || mtype == MeasureType::Torus) { print(tr("Area: %1, Radius: %2") - .arg(areaStr(measurement->area()), lenghtStr(measurement->radius()))); + .arg(areaStr(measurement->area()), lengthStr(measurement->radius()))); } else if (mtype == MeasureType::Edges) { - print(tr("Total length: %1").arg(lenghtStr(measurement->length()))); + print(tr("Total length: %1").arg(lengthStr(measurement->length()))); } else if (mtype == MeasureType::TwoParallelLines) { - print(tr("Nominal distance: %1").arg(lenghtStr(measurement->lineLineDistance()))); + print(tr("Nominal distance: %1").arg(lengthStr(measurement->lineLineDistance()))); } else if (mtype == MeasureType::TwoLines) { print(tr("Angle: %1, Total length: %2") - .arg(lenghtStr(measurement->angle()), lenghtStr(measurement->length()))); + .arg(angleStr(measurement->angle()), lengthStr(measurement->length()))); } else if (mtype == MeasureType::Line) { - print(tr("Length: %1").arg(lenghtStr(measurement->length()))); + print(tr("Length: %1").arg(lengthStr(measurement->length()))); } else if (mtype == MeasureType::Circle) { - print(tr("Radius: %1").arg(lenghtStr(measurement->radius()))); + print(tr("Radius: %1").arg(lengthStr(measurement->radius()))); } else if (mtype == MeasureType::PointToPoint) { - print(tr("Distance: %1").arg(lenghtStr(measurement->length()))); + print(tr("Distance: %1").arg(lengthStr(measurement->length()))); } else if (mtype == MeasureType::PointToEdge || mtype == MeasureType::PointToSurface) { - print(tr("Minimum distance: %1").arg(lenghtStr(measurement->length()))); + print(tr("Minimum distance: %1").arg(lengthStr(measurement->length()))); } else { print(QString::fromLatin1("")); From 74573818f0e9552d3c8a50ab2a9d10ddb30596fe Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Thu, 30 Jan 2025 09:34:57 +0100 Subject: [PATCH 080/224] Update ondselsolver --- src/3rdParty/OndselSolver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdParty/OndselSolver b/src/3rdParty/OndselSolver index 2e3659c4bc..09d6175a2b 160000 --- a/src/3rdParty/OndselSolver +++ b/src/3rdParty/OndselSolver @@ -1 +1 @@ -Subproject commit 2e3659c4bce3e6885269e0cb3d640261b2a91108 +Subproject commit 09d6175a2ba69e7016fcecc4f384946a2f84f92d From a52f2e50812a40d56f15c7f5628c84fba411b47e Mon Sep 17 00:00:00 2001 From: Furgo <148809153+furgo16@users.noreply.github.com> Date: Sun, 2 Feb 2025 08:02:28 +0100 Subject: [PATCH 081/224] PrefPacks: reset font size in FreeCAD Classic theme --- src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg b/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg index d32f6eafea..d70940da22 100644 --- a/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg +++ b/src/Gui/PreferencePacks/FreeCAD Classic/FreeCAD Classic.cfg @@ -131,6 +131,7 @@ + From e58388a222fd2c27eb3532174edf054c73f99f80 Mon Sep 17 00:00:00 2001 From: Syres916 <46537884+Syres916@users.noreply.github.com> Date: Sun, 2 Feb 2025 22:24:27 +0000 Subject: [PATCH 082/224] [Gui] Fix Close without Saving button size (#19342) --- src/Gui/Dialogs/DlgMacroExecuteImp.cpp | 2 +- src/Gui/MainWindow.cpp | 3 ++- src/Gui/Stylesheets/FreeCAD Dark.qss | 3 ++- src/Gui/Stylesheets/FreeCAD Light.qss | 7 ++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp index 98b4622986..bf15b39e82 100644 --- a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp +++ b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp @@ -569,7 +569,7 @@ void DlgMacroExecuteImp::onToolbarButtonClicked() QAbstractButton* doNotShowAgainButton = msgBox.addButton(tr("Do not show again"), QMessageBox::YesRole); msgBox.setText(tr("Guided Walkthrough")); - msgBox.setObjectName(QString::fromLatin1("macroGuideWalkthrough")); + msgBox.setObjectName(QStringLiteral("macroGuideWalkthrough")); msgBox.setInformativeText(tr("This will guide you in setting up this macro in a custom \ global toolbar. Instructions will be in red text inside the dialog.\n\ \n\ diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 2376fb69d7..00cd9ae045 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -784,6 +784,7 @@ void MainWindow::closeActiveWindow () int MainWindow::confirmSave(const char *docName, QWidget *parent, bool addCheckbox) { QMessageBox box(parent?parent:this); + box.setObjectName(QStringLiteral("confirmSave")); box.setIcon(QMessageBox::Question); box.setWindowFlags(box.windowFlags() | Qt::WindowStaysOnTopHint); box.setWindowTitle(QObject::tr("Unsaved document")); @@ -798,7 +799,7 @@ int MainWindow::confirmSave(const char *docName, QWidget *parent, bool addCheckb box.setDefaultButton(QMessageBox::Save); box.setEscapeButton(QMessageBox::Cancel); - QCheckBox checkBox(QObject::tr("Apply answer to all")); + QCheckBox checkBox(QObject::tr("Apply to all")); ParameterGrp::handle hGrp; if(addCheckbox) { hGrp = App::GetApplication().GetUserParameter(). diff --git a/src/Gui/Stylesheets/FreeCAD Dark.qss b/src/Gui/Stylesheets/FreeCAD Dark.qss index 6711d3021a..0326a321b7 100644 --- a/src/Gui/Stylesheets/FreeCAD Dark.qss +++ b/src/Gui/Stylesheets/FreeCAD Dark.qss @@ -1292,7 +1292,8 @@ QDialogButtonBox QPushButton { min-width: 80px; } -QMessageBox[objectName="macroGuideWalkthrough"] QDialogButtonBox QPushButton { +QMessageBox[objectName="macroGuideWalkthrough"] QDialogButtonBox QPushButton, +QMessageBox[objectName="confirmSave"] QDialogButtonBox QPushButton { min-width: 20px; } /* QToolButton ------------------------------------------------------------ diff --git a/src/Gui/Stylesheets/FreeCAD Light.qss b/src/Gui/Stylesheets/FreeCAD Light.qss index fa2579e8dd..9cafa1cb2a 100644 --- a/src/Gui/Stylesheets/FreeCAD Light.qss +++ b/src/Gui/Stylesheets/FreeCAD Light.qss @@ -1289,7 +1289,8 @@ QDialogButtonBox QPushButton { min-width: 80px; } -QMessageBox[objectName="macroGuideWalkthrough"] QDialogButtonBox QPushButton { +QMessageBox[objectName="macroGuideWalkthrough"] QDialogButtonBox QPushButton, +QMessageBox[objectName="confirmSave"] QDialogButtonBox QPushButton { min-width: 20px; } @@ -1395,12 +1396,12 @@ QToolButton::menu-arrow { /* background-color: transparent; */ } QToolButton::menu-arrow:open { - image: url(qss:images_classic/arrow-Down-black.png); + image: url(qss:images_classic/arrow-down-black.png); width: 18px; height: 18px; } QToolButton::menu-arrow:hover { - image: url(qss:images_classic/arrow-Down-black.png); + image: url(qss:images_classic/arrow-down-black.png); width: 18px; height: 18px; } From 0fbb6e9398aab0913f20234d0f8a4841c203d6ab Mon Sep 17 00:00:00 2001 From: Pascal de Bruijn Date: Mon, 3 Feb 2025 17:34:14 +0100 Subject: [PATCH 083/224] TechDraw: Export with default filename (#19033) * TechDraw: Export with default filename * TechDraw: templates consistent drawing_number/revision_index --- src/Mod/TechDraw/Gui/MDIViewPage.cpp | 48 +++++++++++++------ src/Mod/TechDraw/Gui/MDIViewPage.h | 1 + .../A0_Landscape_ISO5457_minimal.svg | 2 +- .../A1_Landscape_ISO5457_minimal.svg | 2 +- .../A2_Landscape_ISO5457_minimal.svg | 2 +- .../A3_Landscape_ISO5457_minimal.svg | 2 +- .../TechDraw/Templates/A3_Landscape_TD.svg | 2 +- .../A4_Landscape_ISO5457_minimal.svg | 2 +- .../Templates/A4_Portrait_ISO5457_minimal.svg | 2 +- .../TechDraw/Templates/ANSIA_Landscape.svg | 4 +- src/Mod/TechDraw/Templates/ANSIA_Portrait.svg | 4 +- src/Mod/TechDraw/Templates/ANSIB.svg | 4 +- .../TechDraw/Templates/ANSIB_Landscape.svg | 4 +- src/Mod/TechDraw/Templates/ANSIB_Portrait.svg | 4 +- .../TechDraw/Templates/ANSIC_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_A_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_A_Portrait.svg | 2 +- .../TechDraw/Templates/Arch_B_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_B_Portrait.svg | 2 +- .../TechDraw/Templates/Arch_C_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_C_Portrait.svg | 2 +- .../TechDraw/Templates/Arch_D_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_D_Portrait.svg | 2 +- .../TechDraw/Templates/Arch_E1_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_E1_Portrait.svg | 2 +- .../TechDraw/Templates/Arch_E2_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_E2_Portrait.svg | 2 +- .../TechDraw/Templates/Arch_E3_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_E3_Portrait.svg | 2 +- .../TechDraw/Templates/Arch_E_Landscape.svg | 2 +- .../TechDraw/Templates/Arch_E_Portrait.svg | 2 +- .../ISO 5457/ISO7200_titleblock_1_minimal.svg | 2 +- .../ISO 5457/ISO7200_titleblock_2.svg | 2 +- .../ISO 5457/ISO7200_titleblock_4.svg | 2 +- .../ISO 5457/ISO7200_titleblock_5_maximal.svg | 2 +- .../TechDraw/Templates/USLetter_Landscape.svg | 4 +- .../ca/A1_Landscape_ISO5457_minimal.svg | 2 +- .../ca/A2_Landscape_ISO5457_minimal.svg | 2 +- 38 files changed, 76 insertions(+), 57 deletions(-) diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 4944e89635..4246b971bf 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -457,6 +457,22 @@ void MDIViewPage::viewAll() m_vpPage->getQGVPage()->fitInView(m_scene->itemsBoundingRect(), Qt::KeepAspectRatio); } +QString MDIViewPage::defaultFileName() +{ + const std::string separator{"_"}; + + auto doc = getPage()->getDocument(); + std::string docLabel{doc->Label.getValue()}; + std::string pageLabel{getPage()->Label.getValue()}; + auto pageTemplate = dynamic_cast(getPage()->Template.getValue()); + auto textMap = pageTemplate->EditableTexts.getValues(); + auto drawingNumber = textMap["drawing_number"]; + auto revision = textMap["revision_index"]; + auto defaultName = docLabel + separator + pageLabel + separator + drawingNumber + separator + revision; + + return QString::fromStdString(defaultName); +} + void MDIViewPage::saveSVG(std::string filename) { auto vpp = getViewProviderPage(); @@ -474,7 +490,7 @@ void MDIViewPage::saveSVG() filter << QObject::tr("All Files (*.*)"); QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QObject::tr("Export page as SVG"), - QString(), filter.join(QLatin1String(";;"))); + defaultFileName(), filter.join(QLatin1String(";;"))); if (fn.isEmpty()) { return; } @@ -490,15 +506,16 @@ void MDIViewPage::saveDXF(std::string filename) void MDIViewPage::saveDXF() { - QString defaultDir; - QString fileName = Gui::FileDialog::getSaveFileName( - Gui::getMainWindow(), QString::fromUtf8(QT_TR_NOOP("Save DXF file")), defaultDir, - QString::fromUtf8("DXF (*.dxf)")); - if (fileName.isEmpty()) { + QStringList filter; + filter << QStringLiteral("DXF (*.dxf)"); + filter << QObject::tr("All Files (*.*)"); + QString fn = + Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QObject::tr("Export page as DXF"), + defaultFileName(), filter.join(QLatin1String(";;"))); + if (fn.isEmpty()) { return; } - - std::string sFileName = fileName.toUtf8().constData(); + std::string sFileName = fn.toUtf8().constData(); saveDXF(sFileName); } @@ -513,15 +530,16 @@ void MDIViewPage::savePDF(std::string filename) void MDIViewPage::savePDF() { - QString defaultDir; - QString fileName = Gui::FileDialog::getSaveFileName( - Gui::getMainWindow(), QString::fromUtf8(QT_TR_NOOP("Save PDF file")), defaultDir, - QString::fromUtf8("PDF (*.pdf)")); - if (fileName.isEmpty()) { + QStringList filter; + filter << QStringLiteral("PDF (*.pdf)"); + filter << QObject::tr("All Files (*.*)"); + QString fn = + Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QObject::tr("Export page as PDF"), + defaultFileName(), filter.join(QLatin1String(";;"))); + if (fn.isEmpty()) { return; } - - std::string sFileName = fileName.toUtf8().constData(); + std::string sFileName = fn.toUtf8().constData(); savePDF(sFileName); } diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.h b/src/Mod/TechDraw/Gui/MDIViewPage.h index 404347d12c..6843703d4f 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.h +++ b/src/Mod/TechDraw/Gui/MDIViewPage.h @@ -157,6 +157,7 @@ private: QList m_orderedSceneSelection; //items in selection order + QString defaultFileName(); }; class MDIViewPagePy : public Py::PythonExtension diff --git a/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg index 7a82383fd7..1765f2e267 100644 --- a/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A0_Landscape_ISO5457_minimal.svg @@ -237,7 +237,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg index 66f0ca4c3e..3375b0712d 100644 --- a/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A1_Landscape_ISO5457_minimal.svg @@ -190,7 +190,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg index 04bc82b06e..2f9f994195 100644 --- a/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A2_Landscape_ISO5457_minimal.svg @@ -157,7 +157,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg index f6b95768f5..0dfff42a26 100644 --- a/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A3_Landscape_ISO5457_minimal.svg @@ -133,7 +133,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg b/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg index cf981c1026..28d639ad68 100644 --- a/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg +++ b/src/Mod/TechDraw/Templates/A3_Landscape_TD.svg @@ -901,7 +901,7 @@ x="266.50964" y="278.57715" style="line-height:0%" - freecad:editable="DrawingNumber">NUMBER - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg b/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg index 617dc8a078..91c3486856 100644 --- a/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg +++ b/src/Mod/TechDraw/Templates/A4_Portrait_ISO5457_minimal.svg @@ -108,7 +108,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg b/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg index c9eba5a968..5f2d7f9f61 100644 --- a/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg +++ b/src/Mod/TechDraw/Templates/ANSIA_Landscape.svg @@ -52,8 +52,8 @@ Drawing Title 1 Drawing Title 2 Drawing Title 3 - Drawing Number - Rev + Drawing Number + Rev Drawn By Checked By Approved 1 diff --git a/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg b/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg index 6147891942..729b023d5b 100644 --- a/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg +++ b/src/Mod/TechDraw/Templates/ANSIA_Portrait.svg @@ -40,8 +40,8 @@ Drawing Title 1 Drawing Title 2 Drawing Title 3 - Drawing Number - Rev + Drawing Number + Rev Drawn By Checked By Approved 1 diff --git a/src/Mod/TechDraw/Templates/ANSIB.svg b/src/Mod/TechDraw/Templates/ANSIB.svg index 82190e68e5..0c1ec5dd12 100644 --- a/src/Mod/TechDraw/Templates/ANSIB.svg +++ b/src/Mod/TechDraw/Templates/ANSIB.svg @@ -605,7 +605,7 @@ stroke-width="1px" word-spacing="0px" style="line-height:0%;text-decoration-line:none;text-indent:0;text-transform:none" - freecad:editable="DrawingNumber">Drawing Number @@ -620,7 +620,7 @@ stroke-width="1px" word-spacing="0px" style="line-height:0%;text-decoration-line:none;text-indent:0;text-transform:none" - freecad:editable="Revision">Rev diff --git a/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg b/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg index 979fdfb462..7e07608f5f 100644 --- a/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg +++ b/src/Mod/TechDraw/Templates/ANSIB_Landscape.svg @@ -548,7 +548,7 @@ stroke-width="1px" word-spacing="0px" style="line-height:0%;text-decoration-line:none;text-indent:0;text-transform:none" - freecad:editable="DrawingNumber">Drawing Number @@ -564,7 +564,7 @@ stroke-width="1px" word-spacing="0px" style="line-height:0%;text-decoration-line:none;text-indent:0;text-transform:none" - freecad:editable="Revision">Rev diff --git a/src/Mod/TechDraw/Templates/ANSIB_Portrait.svg b/src/Mod/TechDraw/Templates/ANSIB_Portrait.svg index b37751f001..4d12b5bac6 100644 --- a/src/Mod/TechDraw/Templates/ANSIB_Portrait.svg +++ b/src/Mod/TechDraw/Templates/ANSIB_Portrait.svg @@ -398,7 +398,7 @@ stroke-width="1px" word-spacing="0px" style="line-height:0%;text-decoration-line:none;text-indent:0;text-transform:none" - freecad:editable="DrawingNumber">Drawing Number @@ -414,7 +414,7 @@ stroke-width="1px" word-spacing="0px" style="line-height:0%;text-decoration-line:none;text-indent:0;text-transform:none" - freecad:editable="Revision">Rev diff --git a/src/Mod/TechDraw/Templates/ANSIC_Landscape.svg b/src/Mod/TechDraw/Templates/ANSIC_Landscape.svg index cfd64e69f3..784dd7a7e3 100644 --- a/src/Mod/TechDraw/Templates/ANSIC_Landscape.svg +++ b/src/Mod/TechDraw/Templates/ANSIC_Landscape.svg @@ -321,7 +321,7 @@ ANSI C SCALE WEIGHT - NUMBER + NUMBER SHEET TITLE SUBTITLE diff --git a/src/Mod/TechDraw/Templates/Arch_A_Landscape.svg b/src/Mod/TechDraw/Templates/Arch_A_Landscape.svg index 1704829275..3d726e2f8b 100644 --- a/src/Mod/TechDraw/Templates/Arch_A_Landscape.svg +++ b/src/Mod/TechDraw/Templates/Arch_A_Landscape.svg @@ -1239,7 +1239,7 @@ stroke-width=".054953" word-spacing="0px" style="line-height:125%" - freecad:editable="DrawingNumber"> - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_2.svg b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_2.svg index 831835b595..02596c93ac 100644 --- a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_2.svg +++ b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_2.svg @@ -61,7 +61,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_4.svg b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_4.svg index 1b66171c6e..4102e6ebfb 100644 --- a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_4.svg +++ b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_4.svg @@ -67,7 +67,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg index 681bea4ac2..0c40a6d417 100644 --- a/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg +++ b/src/Mod/TechDraw/Templates/ISO 5457/ISO7200_titleblock_5_maximal.svg @@ -78,7 +78,7 @@ - DN + DN AAA YYYY-MM-DD X / Y diff --git a/src/Mod/TechDraw/Templates/USLetter_Landscape.svg b/src/Mod/TechDraw/Templates/USLetter_Landscape.svg index 310f48cd99..1c825f67d2 100644 --- a/src/Mod/TechDraw/Templates/USLetter_Landscape.svg +++ b/src/Mod/TechDraw/Templates/USLetter_Landscape.svg @@ -586,7 +586,7 @@ stroke-width="1px" word-spacing="0px" style="line-height:0%;text-decoration-line:none;text-indent:0;text-transform:none" - freecad:editable="DrawingNumber">X / Y ND Date: Mon, 3 Feb 2025 17:47:01 +0100 Subject: [PATCH 084/224] FEM: Constraint transform - selection error message update (#19192) * FEM: Update TaskFemConstraintTransform.cpp --- src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp index df77b48205..fc1ab404c9 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp @@ -382,12 +382,13 @@ void TaskFemConstraintTransform::addToSelection() } } if (Objects.empty()) { - QMessageBox::warning( - this, - tr("Selection error"), - tr("Only transformable faces can be selected! Apply displacement boundary " - "condition to surface first then apply local coordinate system to " - "surface")); + QMessageBox::warning(this, + tr("Selection error"), + tr("Only transformable faces can be selected! Apply a " + "displacement boundary " + "condition or a force load to a face first then apply " + "local coordinate system to " + "the face.")); Gui::Selection().clearSelection(); return; } From 50c9c910eab330859bd45592eb918f557e4cda7a Mon Sep 17 00:00:00 2001 From: wandererfan Date: Fri, 24 Jan 2025 11:16:38 -0500 Subject: [PATCH 085/224] [TD]fix crash on delete while dialog open (#18120) --- src/Mod/TechDraw/Gui/TaskProjGroup.cpp | 16 ++++++++++++++-- src/Mod/TechDraw/Gui/TaskProjGroup.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp index bdc1c9c06e..323894e3b3 100644 --- a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp @@ -76,6 +76,7 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawView* featView, bool mode) : ui->setupUi(this); m_page = view->findParentPage(); + m_viewName = view->getNameInDocument(); Gui::Document* activeGui = Gui::Application::Instance->getDocument(m_page->getDocument()); Gui::ViewProvider* vp = activeGui->getViewProvider(m_page); auto* dvp = static_cast(vp); @@ -797,10 +798,15 @@ bool TaskProjGroup::apply() bool TaskProjGroup::accept() { - Gui::Document* doc = Gui::Application::Instance->getDocument(view->getDocument()); + Gui::Document* doc = Gui::Application::Instance->getDocument(m_page->getDocument()); if (!doc) { return false; } + auto viewCheck = m_page->getDocument()->getObject(m_viewName.c_str()); + if (!viewCheck) { + // view has been deleted while this dialog is open + return false; + } if (multiView) { multiView->recomputeChildren(); @@ -814,11 +820,17 @@ bool TaskProjGroup::accept() bool TaskProjGroup::reject() { - Gui::Document* doc = Gui::Application::Instance->getDocument(view->getDocument()); + Gui::Document* doc = Gui::Application::Instance->getDocument(m_page->getDocument()); if (!doc) { return false; } + auto viewCheck = m_page->getDocument()->getObject(m_viewName.c_str()); + if (!viewCheck) { + // view has been deleted while this dialog is open + return false; + } + if (getCreateMode()) { //remove the object completely from the document const char* viewName = view->getNameInDocument(); diff --git a/src/Mod/TechDraw/Gui/TaskProjGroup.h b/src/Mod/TechDraw/Gui/TaskProjGroup.h index e6cd3bda98..501123e761 100644 --- a/src/Mod/TechDraw/Gui/TaskProjGroup.h +++ b/src/Mod/TechDraw/Gui/TaskProjGroup.h @@ -116,6 +116,7 @@ private: TechDraw::DrawView* view; TechDraw::DrawProjGroup* multiView; bool m_createMode; + std::string m_viewName; bool blockUpdate{true}; bool blockCheckboxes; From 1f39e6ed8c36fe1a358fb0ef47bb42417a9544bb Mon Sep 17 00:00:00 2001 From: Bas Ruigrok Date: Mon, 3 Feb 2025 17:55:24 +0100 Subject: [PATCH 086/224] Add CLion pixi toolchain script (#19119) * Add CLion pixi toolchain script * Add CLion pixi toolchain script for Windows --- contrib/clion/pixi/pixi-default.bash | 10 ++++++++++ contrib/clion/pixi/pixi-default.bat | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100755 contrib/clion/pixi/pixi-default.bash create mode 100644 contrib/clion/pixi/pixi-default.bat diff --git a/contrib/clion/pixi/pixi-default.bash b/contrib/clion/pixi/pixi-default.bash new file mode 100755 index 0000000000..b14ef9cd8c --- /dev/null +++ b/contrib/clion/pixi/pixi-default.bash @@ -0,0 +1,10 @@ +#!/bin/bash + +# Change to the directory of this script (any subdirectory in the repository should work) +cd "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" + +# If the line above does not work then try uncommenting the line below and insert the absolute path to your FreeCAD repository +# cd "absolute/path/to/FreeCAD" + +# Activate pixi default environment +eval "$(pixi shell-hook)" diff --git a/contrib/clion/pixi/pixi-default.bat b/contrib/clion/pixi/pixi-default.bat new file mode 100644 index 0000000000..559711a83f --- /dev/null +++ b/contrib/clion/pixi/pixi-default.bat @@ -0,0 +1,10 @@ +@echo off +REM Change to the directory of this script (any subdirectory in the repository should work) +cd /d "%~dp0" + +REM Activate pixi default environment +REM Write the output of pixi shell-hook to a temporary batch file and execute it +set TEMP_BATCH_FILE=%TEMP%\pixi_shell_hook_freecad.bat +pixi shell-hook > "%TEMP_BATCH_FILE%" +call "%TEMP_BATCH_FILE%" +del "%TEMP_BATCH_FILE%" \ No newline at end of file From 551c2e48fb6064bc2e115a140f3007883958405f Mon Sep 17 00:00:00 2001 From: tritao Date: Mon, 27 Jan 2025 10:31:58 +0000 Subject: [PATCH 087/224] Gui: Reorganize the selection files into a top `Selection` folder. --- src/Gui/3Dconnexion/navlib/NavlibPivot.cpp | 2 +- src/Gui/ActiveObjectList.cpp | 2 +- src/Gui/CMakeLists.txt | 53 ++++++++++--------- src/Gui/DAGView/DAGModel.cpp | 2 +- src/Gui/DAGView/DAGView.h | 2 +- src/Gui/ManualAlignment.cpp | 2 +- src/Gui/Placement.cpp | 2 +- src/Gui/Placement.h | 2 +- src/Gui/{ => Selection}/Selection.cpp | 0 src/Gui/{ => Selection}/Selection.h | 0 src/Gui/{ => Selection}/SelectionFilter.cpp | 0 src/Gui/{ => Selection}/SelectionFilter.h | 0 src/Gui/{ => Selection}/SelectionFilter.l | 0 src/Gui/{ => Selection}/SelectionFilter.tab.c | 0 src/Gui/{ => Selection}/SelectionFilter.y | 0 src/Gui/{ => Selection}/SelectionFilterPy.cpp | 0 src/Gui/{ => Selection}/SelectionFilterPy.h | 0 src/Gui/{ => Selection}/SelectionObject.cpp | 2 +- src/Gui/{ => Selection}/SelectionObject.h | 0 src/Gui/{ => Selection}/SelectionObjectPy.xml | 2 +- .../{ => Selection}/SelectionObjectPyImp.cpp | 4 +- .../SelectionObserverPython.cpp | 0 .../{ => Selection}/SelectionObserverPython.h | 0 src/Gui/{ => Selection}/SelectionView.cpp | 0 src/Gui/{ => Selection}/SelectionView.h | 0 src/Gui/{ => Selection}/SoFCSelection.cpp | 0 src/Gui/{ => Selection}/SoFCSelection.h | 0 .../{ => Selection}/SoFCSelectionAction.cpp | 0 src/Gui/{ => Selection}/SoFCSelectionAction.h | 0 .../{ => Selection}/SoFCSelectionContext.cpp | 0 .../{ => Selection}/SoFCSelectionContext.h | 0 .../{ => Selection}/SoFCUnifiedSelection.cpp | 0 .../{ => Selection}/SoFCUnifiedSelection.h | 2 +- src/Gui/{ => Selection}/lex.SelectionFilter.c | 0 src/Gui/TaskView/TaskAppearance.h | 2 +- src/Gui/TaskView/TaskSelectLinkProperty.cpp | 4 +- src/Gui/TaskView/TaskSelectLinkProperty.h | 2 +- src/Gui/TaskView/TaskView.h | 2 +- src/Gui/TaskView/TaskWatcher.h | 2 +- src/Gui/ToolHandler.h | 2 +- src/Gui/Tree.h | 2 +- src/Gui/View3DInventorSelection.h | 2 +- src/Gui/View3DInventorViewer.h | 2 +- src/Gui/ViewProviderLink.h | 2 +- src/Gui/propertyeditor/PropertyItem.cpp | 2 +- src/Mod/Assembly/Gui/ViewProviderAssembly.h | 2 +- src/Mod/CAM/Gui/Command.cpp | 4 +- src/Mod/CAM/Gui/ViewProviderPath.cpp | 2 +- src/Mod/CAM/Gui/ViewProviderPath.h | 2 +- src/Mod/Drawing/Gui/Command.cpp | 2 +- src/Mod/Drawing/Gui/TaskDialog.cpp | 2 +- src/Mod/Fem/Gui/Command.cpp | 4 +- src/Mod/Fem/Gui/FemSelectionGate.h | 2 +- src/Mod/Fem/Gui/TaskFemConstraint.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraint.h | 2 +- src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintContact.cpp | 2 +- .../Fem/Gui/TaskFemConstraintDisplacement.cpp | 2 +- .../Fem/Gui/TaskFemConstraintDisplacement.h | 2 +- src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp | 2 +- .../Gui/TaskFemConstraintFluidBoundary.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintForce.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintGear.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintOnBoundary.h | 2 +- .../Gui/TaskFemConstraintPlaneRotation.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp | 2 +- .../Fem/Gui/TaskFemConstraintRigidBody.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp | 2 +- .../Fem/Gui/TaskFemConstraintTemperature.cpp | 2 +- .../Fem/Gui/TaskFemConstraintTemperature.h | 2 +- .../Fem/Gui/TaskFemConstraintTransform.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderAnalysis.cpp | 4 +- src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp | 2 +- .../Gui/ViewProviderFemMeshShapeNetgen.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp | 4 +- .../Fem/Gui/ViewProviderFemPostPipeline.cpp | 2 +- src/Mod/Material/Gui/Command.cpp | 2 +- .../Material/Gui/DlgDisplayPropertiesImp.cpp | 2 +- .../Material/Gui/DlgDisplayPropertiesImp.h | 2 +- src/Mod/Material/Gui/DlgInspectAppearance.cpp | 2 +- src/Mod/Material/Gui/DlgInspectMaterial.cpp | 2 +- src/Mod/Material/Gui/DlgMaterialImp.cpp | 2 +- src/Mod/Material/Gui/DlgMaterialImp.h | 2 +- src/Mod/Measure/Gui/QuickMeasure.cpp | 2 +- src/Mod/Measure/Gui/QuickMeasure.h | 2 +- src/Mod/Measure/Gui/TaskMeasure.h | 2 +- src/Mod/Mesh/Gui/Command.cpp | 2 +- src/Mod/Mesh/Gui/DlgDecimating.cpp | 2 +- src/Mod/Mesh/Gui/DlgSmoothing.cpp | 2 +- src/Mod/Mesh/Gui/MeshSelection.h | 2 +- src/Mod/Mesh/Gui/RemoveComponents.cpp | 2 +- src/Mod/Mesh/Gui/SegmentationBestFit.cpp | 2 +- src/Mod/Mesh/Gui/Selection.h | 2 +- src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp | 2 +- src/Mod/Mesh/Gui/SoFCMeshObject.cpp | 2 +- src/Mod/Mesh/Gui/ViewProvider.cpp | 6 +-- src/Mod/Mesh/Gui/ViewProviderCurvature.cpp | 4 +- src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp | 2 +- src/Mod/Mesh/Gui/ViewProviderTransform.cpp | 2 +- .../Gui/ViewProviderTransformDemolding.cpp | 2 +- src/Mod/Mesh/Gui/Workbench.cpp | 2 +- src/Mod/MeshPart/Gui/Tessellation.cpp | 2 +- src/Mod/Part/App/MeasureClient.cpp | 2 +- src/Mod/Part/Gui/BoxSelection.cpp | 4 +- src/Mod/Part/Gui/Command.cpp | 4 +- src/Mod/Part/Gui/CommandSimple.cpp | 4 +- src/Mod/Part/Gui/DlgBooleanOperation.cpp | 2 +- src/Mod/Part/Gui/DlgFilletEdges.cpp | 8 +-- src/Mod/Part/Gui/DlgFilletEdges.h | 2 +- src/Mod/Part/Gui/DlgPrimitives.cpp | 2 +- src/Mod/Part/Gui/DlgProjectionOnSurface.cpp | 2 +- src/Mod/Part/Gui/DlgRevolution.h | 2 +- src/Mod/Part/Gui/Mirroring.cpp | 2 +- src/Mod/Part/Gui/ShapeFromMesh.cpp | 2 +- src/Mod/Part/Gui/SoBrepEdgeSet.cpp | 2 +- src/Mod/Part/Gui/SoBrepEdgeSet.h | 2 +- src/Mod/Part/Gui/SoBrepFaceSet.cpp | 4 +- src/Mod/Part/Gui/SoBrepFaceSet.h | 2 +- src/Mod/Part/Gui/SoBrepPointSet.cpp | 2 +- src/Mod/Part/Gui/SoBrepPointSet.h | 2 +- src/Mod/Part/Gui/TaskAttacher.cpp | 2 +- src/Mod/Part/Gui/TaskAttacher.h | 2 +- src/Mod/Part/Gui/TaskCheckGeometry.cpp | 2 +- src/Mod/Part/Gui/TaskFaceAppearances.cpp | 2 +- src/Mod/Part/Gui/TaskLoft.cpp | 2 +- src/Mod/Part/Gui/TaskShapeBuilder.cpp | 6 +-- src/Mod/Part/Gui/TaskShapeBuilder.h | 2 +- src/Mod/Part/Gui/TaskSweep.cpp | 6 +-- src/Mod/Part/Gui/TaskThickness.cpp | 6 +-- src/Mod/Part/Gui/ViewProviderCurveNet.cpp | 2 +- src/Mod/Part/Gui/ViewProviderExt.cpp | 4 +- src/Mod/PartDesign/Gui/Command.cpp | 4 +- src/Mod/PartDesign/Gui/ReferenceSelection.h | 2 +- src/Mod/PartDesign/Gui/SketchWorkflow.cpp | 2 +- src/Mod/PartDesign/Gui/SketchWorkflow.h | 2 +- .../PartDesign/Gui/TaskBooleanParameters.cpp | 2 +- .../PartDesign/Gui/TaskChamferParameters.cpp | 2 +- .../PartDesign/Gui/TaskDatumParameters.cpp | 2 +- .../PartDesign/Gui/TaskDraftParameters.cpp | 2 +- .../PartDesign/Gui/TaskDressUpParameters.cpp | 2 +- .../PartDesign/Gui/TaskFilletParameters.cpp | 2 +- .../PartDesign/Gui/TaskHelixParameters.cpp | 2 +- src/Mod/PartDesign/Gui/TaskHoleParameters.cpp | 2 +- .../Gui/TaskLinearPatternParameters.cpp | 2 +- src/Mod/PartDesign/Gui/TaskLoftParameters.cpp | 2 +- .../PartDesign/Gui/TaskMirroredParameters.cpp | 2 +- .../Gui/TaskMultiTransformParameters.cpp | 2 +- src/Mod/PartDesign/Gui/TaskPipeParameters.cpp | 2 +- .../Gui/TaskPolarPatternParameters.cpp | 2 +- .../Gui/TaskRevolutionParameters.cpp | 2 +- .../PartDesign/Gui/TaskScaledParameters.cpp | 4 +- src/Mod/PartDesign/Gui/TaskShapeBinder.cpp | 2 +- .../Gui/TaskSketchBasedParameters.cpp | 2 +- .../Gui/TaskSketchBasedParameters.h | 2 +- .../Gui/TaskThicknessParameters.cpp | 2 +- .../Gui/TaskTransformedParameters.cpp | 2 +- .../Gui/TaskTransformedParameters.h | 2 +- .../PartDesign/Gui/ViewProviderDatumPoint.cpp | 2 +- src/Mod/Points/Gui/Command.cpp | 2 +- src/Mod/Points/Gui/ViewProvider.cpp | 2 +- src/Mod/ReverseEngineering/Gui/Command.cpp | 2 +- .../Gui/FitBSplineSurface.cpp | 2 +- .../Gui/SegmentationManual.cpp | 2 +- src/Mod/Robot/Gui/Command.cpp | 4 +- src/Mod/Robot/Gui/CommandExport.cpp | 2 +- src/Mod/Robot/Gui/CommandInsertRobot.cpp | 2 +- src/Mod/Robot/Gui/CommandTrajectory.cpp | 2 +- src/Mod/Robot/Gui/TaskRobot6Axis.cpp | 2 +- src/Mod/Robot/Gui/TaskTrajectory.h | 2 +- .../Gui/TaskTrajectoryDressUpParameter.cpp | 2 +- src/Mod/Robot/Gui/ViewProviderRobotObject.h | 2 +- src/Mod/Robot/Gui/ViewProviderTrajectory.h | 2 +- src/Mod/Sandbox/Gui/Overlay.cpp | 2 +- src/Mod/Sketcher/Gui/Command.cpp | 4 +- src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp | 4 +- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 6 +-- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 2 +- .../Sketcher/Gui/CommandSketcherBSpline.cpp | 4 +- .../Sketcher/Gui/CommandSketcherOverlay.cpp | 4 +- src/Mod/Sketcher/Gui/CommandSketcherTools.cpp | 4 +- .../Gui/CommandSketcherVirtualSpace.cpp | 4 +- src/Mod/Sketcher/Gui/DrawSketchHandler.h | 2 +- .../Gui/DrawSketchHandlerCarbonCopy.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerExtend.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerExternal.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerFillet.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerSplitting.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerTrimming.h | 2 +- .../Sketcher/Gui/SketcherToolDefaultWidget.h | 2 +- .../Sketcher/Gui/TaskSketcherConstraints.cpp | 4 +- .../Sketcher/Gui/TaskSketcherConstraints.h | 2 +- .../Sketcher/Gui/TaskSketcherCreateCommands.h | 2 +- src/Mod/Sketcher/Gui/TaskSketcherElements.cpp | 4 +- src/Mod/Sketcher/Gui/TaskSketcherElements.h | 2 +- src/Mod/Sketcher/Gui/TaskSketcherTool.h | 2 +- src/Mod/Sketcher/Gui/Utils.cpp | 2 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 6 +-- src/Mod/Sketcher/Gui/ViewProviderSketch.h | 2 +- src/Mod/Surface/Gui/Command.cpp | 4 +- src/Mod/Surface/Gui/TaskFilling.cpp | 2 +- src/Mod/Surface/Gui/TaskFillingEdge.cpp | 2 +- src/Mod/Surface/Gui/TaskFillingEdge.h | 2 +- src/Mod/Surface/Gui/TaskFillingVertex.cpp | 2 +- src/Mod/Surface/Gui/TaskFillingVertex.h | 2 +- src/Mod/Surface/Gui/TaskGeomFillSurface.cpp | 2 +- src/Mod/Surface/Gui/TaskSections.cpp | 2 +- src/Mod/TechDraw/Gui/Command.cpp | 4 +- src/Mod/TechDraw/Gui/CommandAnnotate.cpp | 4 +- src/Mod/TechDraw/Gui/CommandCreateDims.cpp | 4 +- src/Mod/TechDraw/Gui/CommandDecorate.cpp | 4 +- src/Mod/TechDraw/Gui/CommandExtensionDims.cpp | 4 +- src/Mod/TechDraw/Gui/CommandExtensionPack.cpp | 4 +- src/Mod/TechDraw/Gui/CommandHelpers.cpp | 4 +- src/Mod/TechDraw/Gui/CommandStack.cpp | 2 +- src/Mod/TechDraw/Gui/DimensionValidators.cpp | 2 +- src/Mod/TechDraw/Gui/DrawGuiUtil.cpp | 2 +- src/Mod/TechDraw/Gui/DrawGuiUtil.h | 2 +- src/Mod/TechDraw/Gui/MDIViewPage.cpp | 4 +- src/Mod/TechDraw/Gui/MDIViewPage.h | 2 +- src/Mod/TechDraw/Gui/PreferencesGui.cpp | 2 +- src/Mod/TechDraw/Gui/QGIPrimPath.cpp | 2 +- src/Mod/TechDraw/Gui/QGIProjGroup.cpp | 2 +- src/Mod/TechDraw/Gui/QGIView.cpp | 2 +- src/Mod/TechDraw/Gui/QGIViewPart.cpp | 2 +- src/Mod/TechDraw/Gui/QGSPage.cpp | 2 +- src/Mod/TechDraw/Gui/QGVPage.cpp | 2 +- src/Mod/TechDraw/Gui/TaskComplexSection.cpp | 2 +- src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp | 2 +- src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp | 2 +- src/Mod/TechDraw/Gui/TaskDetail.cpp | 2 +- src/Mod/TechDraw/Gui/TaskDimRepair.cpp | 2 +- src/Mod/TechDraw/Gui/TaskDimension.cpp | 4 +- src/Mod/TechDraw/Gui/TaskLineDecor.cpp | 2 +- src/Mod/TechDraw/Gui/TaskLinkDim.cpp | 2 +- src/Mod/TechDraw/Gui/TaskProjection.cpp | 2 +- src/Mod/TechDraw/Gui/TaskSectionView.cpp | 2 +- src/Mod/TechDraw/Gui/ViewProviderBalloon.cpp | 2 +- .../TechDraw/Gui/ViewProviderGeomHatch.cpp | 2 +- src/Mod/TechDraw/Gui/ViewProviderLeader.cpp | 2 +- .../TechDraw/Gui/ViewProviderProjGroup.cpp | 2 +- src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp | 2 +- src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp | 2 +- .../TechDraw/Gui/ViewProviderViewSection.cpp | 2 +- src/Mod/TechDraw/Gui/ViewProviderWeld.cpp | 2 +- .../templateClassPyExport.py | 6 +++ 246 files changed, 303 insertions(+), 296 deletions(-) rename src/Gui/{ => Selection}/Selection.cpp (100%) rename src/Gui/{ => Selection}/Selection.h (100%) rename src/Gui/{ => Selection}/SelectionFilter.cpp (100%) rename src/Gui/{ => Selection}/SelectionFilter.h (100%) rename src/Gui/{ => Selection}/SelectionFilter.l (100%) rename src/Gui/{ => Selection}/SelectionFilter.tab.c (100%) rename src/Gui/{ => Selection}/SelectionFilter.y (100%) rename src/Gui/{ => Selection}/SelectionFilterPy.cpp (100%) rename src/Gui/{ => Selection}/SelectionFilterPy.h (100%) rename src/Gui/{ => Selection}/SelectionObject.cpp (96%) rename src/Gui/{ => Selection}/SelectionObject.h (100%) rename src/Gui/{ => Selection}/SelectionObjectPy.xml (96%) rename src/Gui/{ => Selection}/SelectionObjectPyImp.cpp (95%) rename src/Gui/{ => Selection}/SelectionObserverPython.cpp (100%) rename src/Gui/{ => Selection}/SelectionObserverPython.h (100%) rename src/Gui/{ => Selection}/SelectionView.cpp (100%) rename src/Gui/{ => Selection}/SelectionView.h (100%) rename src/Gui/{ => Selection}/SoFCSelection.cpp (100%) rename src/Gui/{ => Selection}/SoFCSelection.h (100%) rename src/Gui/{ => Selection}/SoFCSelectionAction.cpp (100%) rename src/Gui/{ => Selection}/SoFCSelectionAction.h (100%) rename src/Gui/{ => Selection}/SoFCSelectionContext.cpp (100%) rename src/Gui/{ => Selection}/SoFCSelectionContext.h (100%) rename src/Gui/{ => Selection}/SoFCUnifiedSelection.cpp (100%) rename src/Gui/{ => Selection}/SoFCUnifiedSelection.h (96%) rename src/Gui/{ => Selection}/lex.SelectionFilter.c (100%) diff --git a/src/Gui/3Dconnexion/navlib/NavlibPivot.cpp b/src/Gui/3Dconnexion/navlib/NavlibPivot.cpp index b244b59973..09ccde1878 100644 --- a/src/Gui/3Dconnexion/navlib/NavlibPivot.cpp +++ b/src/Gui/3Dconnexion/navlib/NavlibPivot.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Gui/ActiveObjectList.cpp b/src/Gui/ActiveObjectList.cpp index 0fc064cdb6..1690e116d3 100644 --- a/src/Gui/ActiveObjectList.cpp +++ b/src/Gui/ActiveObjectList.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "ActiveObjectList.h" diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index c87c17e8c6..19c3bcea31 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -49,6 +49,7 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Quarter ${CMAKE_CURRENT_SOURCE_DIR}/PreferencePages + ${CMAKE_CURRENT_SOURCE_DIR}/Selection ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/.. @@ -255,7 +256,7 @@ generate_from_xml(ViewProviderDocumentObjectPy) generate_from_xml(ViewProviderGeometryObjectPy) generate_from_xml(ViewProviderExtensionPy) generate_from_xml(WorkbenchPy) -generate_from_xml(SelectionObjectPy) +generate_from_xml(Selection/SelectionObjectPy) generate_from_xml(LinkViewPy) generate_from_xml(ViewProviderLinkPy) generate_from_xml(AxisOriginPy) @@ -272,7 +273,7 @@ SET(FreeCADGui_XML_SRCS ViewProviderExtensionPy.xml PythonWorkbenchPy.xml WorkbenchPy.xml - SelectionObjectPy.xml + Selection/SelectionObjectPy.xml DocumentPy.xml LinkViewPy.xml ViewProviderLinkPy.xml @@ -709,7 +710,7 @@ SET(Dock_Windows_CPP_SRCS DockWindow.cpp PropertyView.cpp ReportView.cpp - SelectionView.cpp + Selection/SelectionView.cpp ToolBox.cpp Tree.cpp TreeView.cpp @@ -724,7 +725,7 @@ SET(Dock_Windows_HPP_SRCS DockWindow.h PropertyView.h ReportView.h - SelectionView.h + Selection/SelectionView.h ToolBox.h Tree.h TreeView.h @@ -1070,10 +1071,10 @@ SET(Inventor_CPP_SRCS SoFCInteractiveElement.cpp SoFCOffscreenRenderer.cpp SoQtOffscreenRendererPy.cpp - SoFCSelection.cpp - SoFCUnifiedSelection.cpp - SoFCSelectionContext.cpp - SoFCSelectionAction.cpp + Selection/SoFCSelection.cpp + Selection/SoFCUnifiedSelection.cpp + Selection/SoFCSelectionContext.cpp + Selection/SoFCSelectionAction.cpp SoFCVectorizeSVGAction.cpp SoFCVectorizeU3DAction.cpp SoDevicePixelRatioElement.cpp @@ -1102,10 +1103,10 @@ SET(Inventor_SRCS SoFCInteractiveElement.h SoFCOffscreenRenderer.h SoQtOffscreenRendererPy.h - SoFCSelection.h - SoFCUnifiedSelection.h - SoFCSelectionContext.h - SoFCSelectionAction.h + Selection/SoFCSelection.h + Selection/SoFCUnifiedSelection.h + Selection/SoFCSelectionContext.h + Selection/SoFCSelectionAction.h SoFCVectorizeSVGAction.h SoFCVectorizeU3DAction.h SoDevicePixelRatioElement.h @@ -1242,19 +1243,19 @@ SET(Workbench_SRCS SOURCE_GROUP("Workbench" FILES ${Workbench_SRCS}) SET(Selection_SRCS - SelectionObjectPyImp.cpp - SelectionObject.h - SelectionObject.cpp - Selection.h - Selection.cpp - SelectionFilter.h - SelectionFilter.cpp - SelectionFilterPy.h - SelectionFilterPy.cpp - SelectionFilter.y - SelectionFilter.l - SelectionObserverPython.cpp - SelectionObserverPython.h + Selection/SelectionObjectPyImp.cpp + Selection/SelectionObject.h + Selection/SelectionObject.cpp + Selection/Selection.h + Selection/Selection.cpp + Selection/SelectionFilter.h + Selection/SelectionFilter.cpp + Selection/SelectionFilterPy.h + Selection/SelectionFilterPy.cpp + Selection/SelectionFilter.y + Selection/SelectionFilter.l + Selection/SelectionObserverPython.cpp + Selection/SelectionObserverPython.h ) SOURCE_GROUP("Selection" FILES ${Selection_SRCS}) @@ -1412,7 +1413,7 @@ if (EIGEN3_NO_DEPRECATED_COPY) NaviCube.cpp Inventor/SoAutoZoomTranslation.cpp SoFCOffscreenRenderer.cpp - SoFCSelectionAction.cpp + Selection/SoFCSelectionAction.cpp SoFCCSysDragger.cpp Quarter/QuarterWidget.cpp View3DInventorViewer.cpp diff --git a/src/Gui/DAGView/DAGModel.cpp b/src/Gui/DAGView/DAGModel.cpp index 3b05faba97..9dc8a902a9 100644 --- a/src/Gui/DAGView/DAGModel.cpp +++ b/src/Gui/DAGView/DAGModel.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include "DAGModel.h" diff --git a/src/Gui/DAGView/DAGView.h b/src/Gui/DAGView/DAGView.h index 9b9ccd75e9..23fc7b4677 100644 --- a/src/Gui/DAGView/DAGView.h +++ b/src/Gui/DAGView/DAGView.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include "DAGModel.h" diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index f4e1f36ccf..419acfd717 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index 307727c363..7f7cbf74a6 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Gui/Placement.h b/src/Gui/Placement.h index bf6af51282..89d80d3b80 100644 --- a/src/Gui/Placement.h +++ b/src/Gui/Placement.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection/Selection.cpp similarity index 100% rename from src/Gui/Selection.cpp rename to src/Gui/Selection/Selection.cpp diff --git a/src/Gui/Selection.h b/src/Gui/Selection/Selection.h similarity index 100% rename from src/Gui/Selection.h rename to src/Gui/Selection/Selection.h diff --git a/src/Gui/SelectionFilter.cpp b/src/Gui/Selection/SelectionFilter.cpp similarity index 100% rename from src/Gui/SelectionFilter.cpp rename to src/Gui/Selection/SelectionFilter.cpp diff --git a/src/Gui/SelectionFilter.h b/src/Gui/Selection/SelectionFilter.h similarity index 100% rename from src/Gui/SelectionFilter.h rename to src/Gui/Selection/SelectionFilter.h diff --git a/src/Gui/SelectionFilter.l b/src/Gui/Selection/SelectionFilter.l similarity index 100% rename from src/Gui/SelectionFilter.l rename to src/Gui/Selection/SelectionFilter.l diff --git a/src/Gui/SelectionFilter.tab.c b/src/Gui/Selection/SelectionFilter.tab.c similarity index 100% rename from src/Gui/SelectionFilter.tab.c rename to src/Gui/Selection/SelectionFilter.tab.c diff --git a/src/Gui/SelectionFilter.y b/src/Gui/Selection/SelectionFilter.y similarity index 100% rename from src/Gui/SelectionFilter.y rename to src/Gui/Selection/SelectionFilter.y diff --git a/src/Gui/SelectionFilterPy.cpp b/src/Gui/Selection/SelectionFilterPy.cpp similarity index 100% rename from src/Gui/SelectionFilterPy.cpp rename to src/Gui/Selection/SelectionFilterPy.cpp diff --git a/src/Gui/SelectionFilterPy.h b/src/Gui/Selection/SelectionFilterPy.h similarity index 100% rename from src/Gui/SelectionFilterPy.h rename to src/Gui/Selection/SelectionFilterPy.h diff --git a/src/Gui/SelectionObject.cpp b/src/Gui/Selection/SelectionObject.cpp similarity index 96% rename from src/Gui/SelectionObject.cpp rename to src/Gui/Selection/SelectionObject.cpp index 4ff04a135b..f545ff377e 100644 --- a/src/Gui/SelectionObject.cpp +++ b/src/Gui/Selection/SelectionObject.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "SelectionObject.h" #include "Selection.h" diff --git a/src/Gui/SelectionObject.h b/src/Gui/Selection/SelectionObject.h similarity index 100% rename from src/Gui/SelectionObject.h rename to src/Gui/Selection/SelectionObject.h diff --git a/src/Gui/SelectionObjectPy.xml b/src/Gui/Selection/SelectionObjectPy.xml similarity index 96% rename from src/Gui/SelectionObjectPy.xml rename to src/Gui/Selection/SelectionObjectPy.xml index e25a724d34..5cd194e455 100644 --- a/src/Gui/SelectionObjectPy.xml +++ b/src/Gui/Selection/SelectionObjectPy.xml @@ -5,7 +5,7 @@ Name="SelectionObjectPy" Twin="SelectionObject" TwinPointer="SelectionObject" - Include="Gui/SelectionObject.h" + Include="Gui/Selection/SelectionObject.h" Namespace="Gui" Delete="true" FatherInclude="Base/BaseClassPy.h" diff --git a/src/Gui/SelectionObjectPyImp.cpp b/src/Gui/Selection/SelectionObjectPyImp.cpp similarity index 95% rename from src/Gui/SelectionObjectPyImp.cpp rename to src/Gui/Selection/SelectionObjectPyImp.cpp index 27b82372ca..686cb68121 100644 --- a/src/Gui/SelectionObjectPyImp.cpp +++ b/src/Gui/Selection/SelectionObjectPyImp.cpp @@ -31,8 +31,8 @@ // inclusion of the generated files (generated out of SelectionObjectPy.xml) -#include "SelectionObjectPy.h" -#include "SelectionObjectPy.cpp" +#include "Selection/SelectionObjectPy.h" +#include "Selection/SelectionObjectPy.cpp" using namespace Gui; diff --git a/src/Gui/SelectionObserverPython.cpp b/src/Gui/Selection/SelectionObserverPython.cpp similarity index 100% rename from src/Gui/SelectionObserverPython.cpp rename to src/Gui/Selection/SelectionObserverPython.cpp diff --git a/src/Gui/SelectionObserverPython.h b/src/Gui/Selection/SelectionObserverPython.h similarity index 100% rename from src/Gui/SelectionObserverPython.h rename to src/Gui/Selection/SelectionObserverPython.h diff --git a/src/Gui/SelectionView.cpp b/src/Gui/Selection/SelectionView.cpp similarity index 100% rename from src/Gui/SelectionView.cpp rename to src/Gui/Selection/SelectionView.cpp diff --git a/src/Gui/SelectionView.h b/src/Gui/Selection/SelectionView.h similarity index 100% rename from src/Gui/SelectionView.h rename to src/Gui/Selection/SelectionView.h diff --git a/src/Gui/SoFCSelection.cpp b/src/Gui/Selection/SoFCSelection.cpp similarity index 100% rename from src/Gui/SoFCSelection.cpp rename to src/Gui/Selection/SoFCSelection.cpp diff --git a/src/Gui/SoFCSelection.h b/src/Gui/Selection/SoFCSelection.h similarity index 100% rename from src/Gui/SoFCSelection.h rename to src/Gui/Selection/SoFCSelection.h diff --git a/src/Gui/SoFCSelectionAction.cpp b/src/Gui/Selection/SoFCSelectionAction.cpp similarity index 100% rename from src/Gui/SoFCSelectionAction.cpp rename to src/Gui/Selection/SoFCSelectionAction.cpp diff --git a/src/Gui/SoFCSelectionAction.h b/src/Gui/Selection/SoFCSelectionAction.h similarity index 100% rename from src/Gui/SoFCSelectionAction.h rename to src/Gui/Selection/SoFCSelectionAction.h diff --git a/src/Gui/SoFCSelectionContext.cpp b/src/Gui/Selection/SoFCSelectionContext.cpp similarity index 100% rename from src/Gui/SoFCSelectionContext.cpp rename to src/Gui/Selection/SoFCSelectionContext.cpp diff --git a/src/Gui/SoFCSelectionContext.h b/src/Gui/Selection/SoFCSelectionContext.h similarity index 100% rename from src/Gui/SoFCSelectionContext.h rename to src/Gui/Selection/SoFCSelectionContext.h diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/Selection/SoFCUnifiedSelection.cpp similarity index 100% rename from src/Gui/SoFCUnifiedSelection.cpp rename to src/Gui/Selection/SoFCUnifiedSelection.cpp diff --git a/src/Gui/SoFCUnifiedSelection.h b/src/Gui/Selection/SoFCUnifiedSelection.h similarity index 96% rename from src/Gui/SoFCUnifiedSelection.h rename to src/Gui/Selection/SoFCUnifiedSelection.h index c426c1907c..ad22f37411 100644 --- a/src/Gui/SoFCUnifiedSelection.h +++ b/src/Gui/Selection/SoFCUnifiedSelection.h @@ -34,7 +34,7 @@ #include #include "SoFCSelectionContext.h" -#include "View3DInventorViewer.h" +#include "../View3DInventorViewer.h" class SoFullPath; diff --git a/src/Gui/lex.SelectionFilter.c b/src/Gui/Selection/lex.SelectionFilter.c similarity index 100% rename from src/Gui/lex.SelectionFilter.c rename to src/Gui/Selection/lex.SelectionFilter.c diff --git a/src/Gui/TaskView/TaskAppearance.h b/src/Gui/TaskView/TaskAppearance.h index 30b0256924..e6658ec0b3 100644 --- a/src/Gui/TaskView/TaskAppearance.h +++ b/src/Gui/TaskView/TaskAppearance.h @@ -24,7 +24,7 @@ #ifndef GUI_TASKVIEW_TASKAPPERANCE_H #define GUI_TASKVIEW_TASKAPPERANCE_H -#include +#include #include "TaskView.h" diff --git a/src/Gui/TaskView/TaskSelectLinkProperty.cpp b/src/Gui/TaskView/TaskSelectLinkProperty.cpp index e4176d7deb..51c3b630e2 100644 --- a/src/Gui/TaskView/TaskSelectLinkProperty.cpp +++ b/src/Gui/TaskView/TaskSelectLinkProperty.cpp @@ -26,8 +26,8 @@ #include #include #include -#include -#include +#include +#include #include "ui_TaskSelectLinkProperty.h" #include "TaskSelectLinkProperty.h" diff --git a/src/Gui/TaskView/TaskSelectLinkProperty.h b/src/Gui/TaskView/TaskSelectLinkProperty.h index 099179d229..b729370337 100644 --- a/src/Gui/TaskView/TaskSelectLinkProperty.h +++ b/src/Gui/TaskView/TaskSelectLinkProperty.h @@ -25,7 +25,7 @@ #define GUI_TASKVIEW_TaskSelectLinkProperty_H #include "TaskView.h" -#include +#include #include diff --git a/src/Gui/TaskView/TaskView.h b/src/Gui/TaskView/TaskView.h index c15d3ab0a4..f613c4d0d1 100644 --- a/src/Gui/TaskView/TaskView.h +++ b/src/Gui/TaskView/TaskView.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include "TaskWatcher.h" diff --git a/src/Gui/TaskView/TaskWatcher.h b/src/Gui/TaskView/TaskWatcher.h index 9778fe8db5..a9c9d7707b 100644 --- a/src/Gui/TaskView/TaskWatcher.h +++ b/src/Gui/TaskView/TaskWatcher.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace Gui { diff --git a/src/Gui/ToolHandler.h b/src/Gui/ToolHandler.h index 100fa5bd5f..11803c7561 100644 --- a/src/Gui/ToolHandler.h +++ b/src/Gui/ToolHandler.h @@ -29,7 +29,7 @@ #include #include -#include "Selection.h" +#include "Selection/Selection.h" namespace Gui diff --git a/src/Gui/Tree.h b/src/Gui/Tree.h index b643e65686..6c3c37ad99 100644 --- a/src/Gui/Tree.h +++ b/src/Gui/Tree.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include class QLineEdit; diff --git a/src/Gui/View3DInventorSelection.h b/src/Gui/View3DInventorSelection.h index 523258d5da..39f8c38f1d 100644 --- a/src/Gui/View3DInventorSelection.h +++ b/src/Gui/View3DInventorSelection.h @@ -25,7 +25,7 @@ #include #include -#include +#include class SoGroup; class SoNode; diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 1a520e616c..9ef41b6923 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -40,7 +40,7 @@ #include #include "Namespace.h" -#include "Selection.h" +#include "Selection/Selection.h" #include "CornerCrossLetters.h" #include "View3DInventorSelection.h" diff --git a/src/Gui/ViewProviderLink.h b/src/Gui/ViewProviderLink.h index 79ead6d8cf..1d8f3e1b23 100644 --- a/src/Gui/ViewProviderLink.h +++ b/src/Gui/ViewProviderLink.h @@ -25,7 +25,7 @@ #include -#include "SoFCUnifiedSelection.h" +#include "Selection/SoFCUnifiedSelection.h" #include "ViewProviderDocumentObject.h" #include "ViewProviderExtension.h" #include "ViewProviderFeaturePython.h" diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 5e35bbac25..5ac0b03a2c 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Assembly/Gui/ViewProviderAssembly.h b/src/Mod/Assembly/Gui/ViewProviderAssembly.h index 4db69e76be..fc7defe8e2 100644 --- a/src/Mod/Assembly/Gui/ViewProviderAssembly.h +++ b/src/Mod/Assembly/Gui/ViewProviderAssembly.h @@ -28,7 +28,7 @@ #include -#include +#include #include class SoSwitch; diff --git a/src/Mod/CAM/Gui/Command.cpp b/src/Mod/CAM/Gui/Command.cpp index 5dfc86410d..008445f387 100644 --- a/src/Mod/CAM/Gui/Command.cpp +++ b/src/Mod/CAM/Gui/Command.cpp @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/Mod/CAM/Gui/ViewProviderPath.cpp b/src/Mod/CAM/Gui/ViewProviderPath.cpp index 8723fdbf67..87ab0829dd 100644 --- a/src/Mod/CAM/Gui/ViewProviderPath.cpp +++ b/src/Mod/CAM/Gui/ViewProviderPath.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/CAM/Gui/ViewProviderPath.h b/src/Mod/CAM/Gui/ViewProviderPath.h index 6270d8fe97..9cb1428111 100644 --- a/src/Mod/CAM/Gui/ViewProviderPath.h +++ b/src/Mod/CAM/Gui/ViewProviderPath.h @@ -24,7 +24,7 @@ #define PATH_ViewProviderPath_H #include -#include +#include #include #include #include diff --git a/src/Mod/Drawing/Gui/Command.cpp b/src/Mod/Drawing/Gui/Command.cpp index c3f3a8cdf4..5df5fed2eb 100644 --- a/src/Mod/Drawing/Gui/Command.cpp +++ b/src/Mod/Drawing/Gui/Command.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Drawing/Gui/TaskDialog.cpp b/src/Mod/Drawing/Gui/TaskDialog.cpp index 0a9592e74c..3ef5b0d7b1 100644 --- a/src/Mod/Drawing/Gui/TaskDialog.cpp +++ b/src/Mod/Drawing/Gui/TaskDialog.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index 628a135517..610c3839c2 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -42,8 +42,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/FemSelectionGate.h b/src/Mod/Fem/Gui/FemSelectionGate.h index 08f874978a..7048ccecf7 100644 --- a/src/Mod/Fem/Gui/FemSelectionGate.h +++ b/src/Mod/Fem/Gui/FemSelectionGate.h @@ -23,7 +23,7 @@ #ifndef GUI_FemSelectionGate_H #define GUI_FemSelectionGate_H -#include +#include namespace FemGui { diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.cpp b/src/Mod/Fem/Gui/TaskFemConstraint.cpp index 4d13c0c340..4a41e50514 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraint.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.h b/src/Mod/Fem/Gui/TaskFemConstraint.h index 3f6f9189d3..4533e0d2f3 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.h +++ b/src/Mod/Fem/Gui/TaskFemConstraint.h @@ -25,7 +25,7 @@ #define GUI_TASKVIEW_TaskFemConstraint_H #include -#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp b/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp index 9422d8269c..e3169174cd 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index fe8389c3f7..fbf3eb6891 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -33,7 +33,7 @@ #include "Mod/Fem/App/FemConstraintContact.h" #include -#include +#include #include #include "TaskFemConstraintContact.h" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp index 1ae029eb7e..56a390b8b6 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp @@ -32,7 +32,7 @@ #endif #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h index a1ecebdb04..38f2122d9f 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include "TaskFemConstraint.h" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp index 8eb8a6420d..42d6bdbd68 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp index d2bc17aef4..3c597136ce 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp index c9be7ec8c3..283c8d8ad9 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintGear.cpp b/src/Mod/Fem/Gui/TaskFemConstraintGear.cpp index 1473cdedd4..f1a68d685b 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintGear.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintGear.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp index e335c878da..d66113c697 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp @@ -32,7 +32,7 @@ #endif #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintOnBoundary.h b/src/Mod/Fem/Gui/TaskFemConstraintOnBoundary.h index e369bced23..dd4136ba5c 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintOnBoundary.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintOnBoundary.h @@ -26,7 +26,7 @@ #include -#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp index 96968153c6..66758f3a03 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index cf6d55f542..508ca6d262 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -30,7 +30,7 @@ #endif #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp index 9793c3ccf4..a7dc00b416 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp index eb27666d99..1dace9d2a8 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp @@ -30,7 +30,7 @@ #endif #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp index a32e3aaef3..defc1a59c9 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h index 8b424af4ee..c73fd5f69d 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include "TaskFemConstraintOnBoundary.h" diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp index fc1ab404c9..7bba532a29 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp @@ -35,7 +35,7 @@ #endif #include -#include +#include #include #include diff --git a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp index 62b1f59d3d..51bbbe69ed 100644 --- a/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp +++ b/src/Mod/Fem/Gui/ViewProviderAnalysis.cpp @@ -39,8 +39,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp index 9a5008b025..5c0576226d 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp @@ -39,7 +39,7 @@ #include "Gui/Command.h" #include "Gui/Control.h" #include "Gui/Document.h" -#include "Gui/Selection.h" +#include "Gui/Selection/Selection.h" #include "Mod/Fem/App/FemConstraint.h" #include "ViewProviderFemConstraint.h" diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp b/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp index d687985b00..7a3316c5d0 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshShapeNetgen.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include "TaskDlgMeshShapeNetgen.h" #include "ViewProviderFemMeshShapeNetgen.h" diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp index a63647ad27..7d33b08eb7 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp @@ -56,8 +56,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp index b31c9f6e53..88791e2d9a 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Material/Gui/Command.cpp b/src/Mod/Material/Gui/Command.cpp index df07b0999e..cc4e399bd8 100644 --- a/src/Mod/Material/Gui/Command.cpp +++ b/src/Mod/Material/Gui/Command.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "DlgDisplayPropertiesImp.h" #include "DlgInspectAppearance.h" diff --git a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp index 090d723e24..548405c6b2 100644 --- a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.h b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.h index 5c418ea238..7766aba730 100644 --- a/src/Mod/Material/Gui/DlgDisplayPropertiesImp.h +++ b/src/Mod/Material/Gui/DlgDisplayPropertiesImp.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Material/Gui/DlgInspectAppearance.cpp b/src/Mod/Material/Gui/DlgInspectAppearance.cpp index b7d02e0ba0..c73ac260be 100644 --- a/src/Mod/Material/Gui/DlgInspectAppearance.cpp +++ b/src/Mod/Material/Gui/DlgInspectAppearance.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Material/Gui/DlgInspectMaterial.cpp b/src/Mod/Material/Gui/DlgInspectMaterial.cpp index c25586d2b0..c599b7f75b 100644 --- a/src/Mod/Material/Gui/DlgInspectMaterial.cpp +++ b/src/Mod/Material/Gui/DlgInspectMaterial.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Material/Gui/DlgMaterialImp.cpp b/src/Mod/Material/Gui/DlgMaterialImp.cpp index e89c718c73..d5e89e5c09 100644 --- a/src/Mod/Material/Gui/DlgMaterialImp.cpp +++ b/src/Mod/Material/Gui/DlgMaterialImp.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Material/Gui/DlgMaterialImp.h b/src/Mod/Material/Gui/DlgMaterialImp.h index a3bcc25ecf..d7c0813464 100644 --- a/src/Mod/Material/Gui/DlgMaterialImp.h +++ b/src/Mod/Material/Gui/DlgMaterialImp.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Measure/Gui/QuickMeasure.cpp b/src/Mod/Measure/Gui/QuickMeasure.cpp index 47341e8368..153f88a700 100644 --- a/src/Mod/Measure/Gui/QuickMeasure.cpp +++ b/src/Mod/Measure/Gui/QuickMeasure.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Measure/Gui/QuickMeasure.h b/src/Mod/Measure/Gui/QuickMeasure.h index 41ce72d5b7..9970bf2ff7 100644 --- a/src/Mod/Measure/Gui/QuickMeasure.h +++ b/src/Mod/Measure/Gui/QuickMeasure.h @@ -28,7 +28,7 @@ #include -#include +#include class QTimer; diff --git a/src/Mod/Measure/Gui/TaskMeasure.h b/src/Mod/Measure/Gui/TaskMeasure.h index 88e280317a..399641d56c 100644 --- a/src/Mod/Measure/Gui/TaskMeasure.h +++ b/src/Mod/Measure/Gui/TaskMeasure.h @@ -39,7 +39,7 @@ #include #include -#include +#include namespace Gui { diff --git a/src/Mod/Mesh/Gui/Command.cpp b/src/Mod/Mesh/Gui/Command.cpp index 6fc02710da..893aeb6fe6 100644 --- a/src/Mod/Mesh/Gui/Command.cpp +++ b/src/Mod/Mesh/Gui/Command.cpp @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Mesh/Gui/DlgDecimating.cpp b/src/Mod/Mesh/Gui/DlgDecimating.cpp index 3d484e6da4..f4f49a9335 100644 --- a/src/Mod/Mesh/Gui/DlgDecimating.cpp +++ b/src/Mod/Mesh/Gui/DlgDecimating.cpp @@ -23,7 +23,7 @@ #include "PreCompiled.h" #include -#include +#include #include #include diff --git a/src/Mod/Mesh/Gui/DlgSmoothing.cpp b/src/Mod/Mesh/Gui/DlgSmoothing.cpp index 7f6ea93a8b..006a8cf310 100644 --- a/src/Mod/Mesh/Gui/DlgSmoothing.cpp +++ b/src/Mod/Mesh/Gui/DlgSmoothing.cpp @@ -27,7 +27,7 @@ #endif #include -#include +#include #include #include #include diff --git a/src/Mod/Mesh/Gui/MeshSelection.h b/src/Mod/Mesh/Gui/MeshSelection.h index 8ef2ad677a..0d35b8bdad 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.h +++ b/src/Mod/Mesh/Gui/MeshSelection.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #ifndef MESH_GLOBAL_H #include diff --git a/src/Mod/Mesh/Gui/RemoveComponents.cpp b/src/Mod/Mesh/Gui/RemoveComponents.cpp index 6ddc147991..0f8c9644d5 100644 --- a/src/Mod/Mesh/Gui/RemoveComponents.cpp +++ b/src/Mod/Mesh/Gui/RemoveComponents.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include "RemoveComponents.h" #include "ui_RemoveComponents.h" diff --git a/src/Mod/Mesh/Gui/SegmentationBestFit.cpp b/src/Mod/Mesh/Gui/SegmentationBestFit.cpp index 91f5e5ba94..c3a020238a 100644 --- a/src/Mod/Mesh/Gui/SegmentationBestFit.cpp +++ b/src/Mod/Mesh/Gui/SegmentationBestFit.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Mesh/Gui/Selection.h b/src/Mod/Mesh/Gui/Selection.h index 6c3b18068a..1d766e3d4c 100644 --- a/src/Mod/Mesh/Gui/Selection.h +++ b/src/Mod/Mesh/Gui/Selection.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include "MeshSelection.h" diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp index f7bbc491ae..82b3002259 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp @@ -59,7 +59,7 @@ #include #include -#include +#include #include "SoFCIndexedFaceSet.h" diff --git a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp index 33d8c6447f..7ff55890e4 100644 --- a/src/Mod/Mesh/Gui/SoFCMeshObject.cpp +++ b/src/Mod/Mesh/Gui/SoFCMeshObject.cpp @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index 0259acbb71..620f82d049 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -69,11 +69,11 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp index 16ca9b9dfb..b66239b902 100644 --- a/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderCurvature.cpp @@ -51,10 +51,10 @@ #include #include #include -#include #include #include -#include +#include +#include #include #include diff --git a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp index 61c6efd4a5..7c87803a1b 100644 --- a/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderMeshFaceSet.cpp @@ -33,7 +33,7 @@ #endif #include -#include +#include #include #include #include diff --git a/src/Mod/Mesh/Gui/ViewProviderTransform.cpp b/src/Mod/Mesh/Gui/ViewProviderTransform.cpp index f174710b56..933c1e4a07 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransform.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderTransform.cpp @@ -29,7 +29,7 @@ #include #endif -#include +#include #include #include "ViewProviderTransform.h" diff --git a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp index 611c266b4f..0f5feef8b2 100644 --- a/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp +++ b/src/Mod/Mesh/Gui/ViewProviderTransformDemolding.cpp @@ -34,7 +34,7 @@ #endif #include -#include +#include #include #include diff --git a/src/Mod/Mesh/Gui/Workbench.cpp b/src/Mod/Mesh/Gui/Workbench.cpp index 69990caf5b..92824d07ac 100644 --- a/src/Mod/Mesh/Gui/Workbench.cpp +++ b/src/Mod/Mesh/Gui/Workbench.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/MeshPart/Gui/Tessellation.cpp b/src/Mod/MeshPart/Gui/Tessellation.cpp index 0907fd8eb6..875f98433c 100644 --- a/src/Mod/MeshPart/Gui/Tessellation.cpp +++ b/src/Mod/MeshPart/Gui/Tessellation.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/App/MeasureClient.cpp b/src/Mod/Part/App/MeasureClient.cpp index 9b0a0e8290..3e2e9ded86 100644 --- a/src/Mod/Part/App/MeasureClient.cpp +++ b/src/Mod/Part/App/MeasureClient.cpp @@ -62,7 +62,7 @@ using namespace Part; -// From: https://github.com/Celemation/FreeCAD/blob/joel_selection_summary_demo/src/Gui/SelectionSummary.cpp +// From: https://github.com/Celemation/FreeCAD/blob/joel_selection_summary_demo/src/Gui/Selection/SelectionSummary.cpp // Should work with edges and wires static float getLength(TopoDS_Shape& wire){ diff --git a/src/Mod/Part/Gui/BoxSelection.cpp b/src/Mod/Part/Gui/BoxSelection.cpp index 9a18d68d31..e13f29be07 100644 --- a/src/Mod/Part/Gui/BoxSelection.cpp +++ b/src/Mod/Part/Gui/BoxSelection.cpp @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index 205b5addbe..51bd377ad2 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -46,8 +46,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/CommandSimple.cpp b/src/Mod/Part/Gui/CommandSimple.cpp index 6b744b40a9..70d0ee2ea3 100644 --- a/src/Mod/Part/Gui/CommandSimple.cpp +++ b/src/Mod/Part/Gui/CommandSimple.cpp @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include #include #include "DlgPartCylinderImp.h" diff --git a/src/Mod/Part/Gui/DlgBooleanOperation.cpp b/src/Mod/Part/Gui/DlgBooleanOperation.cpp index 449d47ab4d..97a77c80d0 100644 --- a/src/Mod/Part/Gui/DlgBooleanOperation.cpp +++ b/src/Mod/Part/Gui/DlgBooleanOperation.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/DlgFilletEdges.cpp b/src/Mod/Part/Gui/DlgFilletEdges.cpp index a66104fbff..aa26a17ee5 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.cpp +++ b/src/Mod/Part/Gui/DlgFilletEdges.cpp @@ -54,10 +54,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/DlgFilletEdges.h b/src/Mod/Part/Gui/DlgFilletEdges.h index 57df921c9d..bb17992411 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.h +++ b/src/Mod/Part/Gui/DlgFilletEdges.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Part/Gui/DlgPrimitives.cpp b/src/Mod/Part/Gui/DlgPrimitives.cpp index 8617cc58f8..28e537426d 100644 --- a/src/Mod/Part/Gui/DlgPrimitives.cpp +++ b/src/Mod/Part/Gui/DlgPrimitives.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp index d3c6e8134a..bc7448a2d7 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include "DlgProjectionOnSurface.h" diff --git a/src/Mod/Part/Gui/DlgRevolution.h b/src/Mod/Part/Gui/DlgRevolution.h index e028935fe2..834cd795ca 100644 --- a/src/Mod/Part/Gui/DlgRevolution.h +++ b/src/Mod/Part/Gui/DlgRevolution.h @@ -24,7 +24,7 @@ #define PARTGUI_DLGREVOLUTION_H #include -#include +#include #include #include diff --git a/src/Mod/Part/Gui/Mirroring.cpp b/src/Mod/Part/Gui/Mirroring.cpp index 1bed8f06ed..53bc439050 100644 --- a/src/Mod/Part/Gui/Mirroring.cpp +++ b/src/Mod/Part/Gui/Mirroring.cpp @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/ShapeFromMesh.cpp b/src/Mod/Part/Gui/ShapeFromMesh.cpp index 3d64823009..db63862799 100644 --- a/src/Mod/Part/Gui/ShapeFromMesh.cpp +++ b/src/Mod/Part/Gui/ShapeFromMesh.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include "ShapeFromMesh.h" diff --git a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp index d2f52fcd6c..dbb959bea4 100644 --- a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp +++ b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp @@ -46,7 +46,7 @@ # include #endif -#include +#include #include "SoBrepEdgeSet.h" diff --git a/src/Mod/Part/Gui/SoBrepEdgeSet.h b/src/Mod/Part/Gui/SoBrepEdgeSet.h index 6335ef6cd8..c63674af0d 100644 --- a/src/Mod/Part/Gui/SoBrepEdgeSet.h +++ b/src/Mod/Part/Gui/SoBrepEdgeSet.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index 7610c2d16b..fe93c46f7b 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -69,8 +69,8 @@ #endif #include -#include -#include +#include +#include #include "SoBrepFaceSet.h" diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.h b/src/Mod/Part/Gui/SoBrepFaceSet.h index ba760d8318..bab9e49414 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.h +++ b/src/Mod/Part/Gui/SoBrepFaceSet.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include diff --git a/src/Mod/Part/Gui/SoBrepPointSet.cpp b/src/Mod/Part/Gui/SoBrepPointSet.cpp index 5cd3ea626a..def234fcd6 100644 --- a/src/Mod/Part/Gui/SoBrepPointSet.cpp +++ b/src/Mod/Part/Gui/SoBrepPointSet.cpp @@ -43,7 +43,7 @@ # include #endif -#include +#include #include "SoBrepPointSet.h" diff --git a/src/Mod/Part/Gui/SoBrepPointSet.h b/src/Mod/Part/Gui/SoBrepPointSet.h index 53db847f53..1dd87e8c55 100644 --- a/src/Mod/Part/Gui/SoBrepPointSet.h +++ b/src/Mod/Part/Gui/SoBrepPointSet.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index f01c86756c..7d70f4ee69 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/TaskAttacher.h b/src/Mod/Part/Gui/TaskAttacher.h index 360cccefa6..46cc731f2c 100644 --- a/src/Mod/Part/Gui/TaskAttacher.h +++ b/src/Mod/Part/Gui/TaskAttacher.h @@ -25,7 +25,7 @@ #ifndef GUI_TASKVIEW_TaskAttacher_H #define GUI_TASKVIEW_TaskAttacher_H -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index e7e98a73ee..759ed2e114 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/TaskFaceAppearances.cpp b/src/Mod/Part/Gui/TaskFaceAppearances.cpp index a8a5b17748..234cf8a4ac 100644 --- a/src/Mod/Part/Gui/TaskFaceAppearances.cpp +++ b/src/Mod/Part/Gui/TaskFaceAppearances.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/TaskLoft.cpp b/src/Mod/Part/Gui/TaskLoft.cpp index 59066d3fa2..6755ac19af 100644 --- a/src/Mod/Part/Gui/TaskLoft.cpp +++ b/src/Mod/Part/Gui/TaskLoft.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Part/Gui/TaskShapeBuilder.cpp b/src/Mod/Part/Gui/TaskShapeBuilder.cpp index 7307188d60..cacefb8d35 100644 --- a/src/Mod/Part/Gui/TaskShapeBuilder.cpp +++ b/src/Mod/Part/Gui/TaskShapeBuilder.cpp @@ -39,9 +39,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include "TaskShapeBuilder.h" diff --git a/src/Mod/Part/Gui/TaskShapeBuilder.h b/src/Mod/Part/Gui/TaskShapeBuilder.h index 870ff2bd0b..43bd1bf9e4 100644 --- a/src/Mod/Part/Gui/TaskShapeBuilder.h +++ b/src/Mod/Part/Gui/TaskShapeBuilder.h @@ -23,7 +23,7 @@ #ifndef PARTGUI_TASKSHAPEBUILDER_H #define PARTGUI_TASKSHAPEBUILDER_H -#include +#include #include #include diff --git a/src/Mod/Part/Gui/TaskSweep.cpp b/src/Mod/Part/Gui/TaskSweep.cpp index d68cab8fbf..d00a0c8b51 100644 --- a/src/Mod/Part/Gui/TaskSweep.cpp +++ b/src/Mod/Part/Gui/TaskSweep.cpp @@ -45,9 +45,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/src/Mod/Part/Gui/TaskThickness.cpp b/src/Mod/Part/Gui/TaskThickness.cpp index 3146c4c019..85ad7aff51 100644 --- a/src/Mod/Part/Gui/TaskThickness.cpp +++ b/src/Mod/Part/Gui/TaskThickness.cpp @@ -33,9 +33,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp index 7209a0008d..c549610827 100644 --- a/src/Mod/Part/Gui/ViewProviderCurveNet.cpp +++ b/src/Mod/Part/Gui/ViewProviderCurveNet.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include "ViewProviderCurveNet.h" diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 96a0250f32..800253c672 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -79,8 +79,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index dfc15d225a..44222d1005 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -43,8 +43,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/ReferenceSelection.h b/src/Mod/PartDesign/Gui/ReferenceSelection.h index ae402f85a8..6a27bc774d 100644 --- a/src/Mod/PartDesign/Gui/ReferenceSelection.h +++ b/src/Mod/PartDesign/Gui/ReferenceSelection.h @@ -24,7 +24,7 @@ #ifndef GUI_ReferenceSelection_H #define GUI_ReferenceSelection_H -#include +#include #include namespace App { diff --git a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp index 0eb889420f..7cff72aa52 100644 --- a/src/Mod/PartDesign/Gui/SketchWorkflow.cpp +++ b/src/Mod/PartDesign/Gui/SketchWorkflow.cpp @@ -55,7 +55,7 @@ #include #include #include -#include +#include using namespace PartDesignGui; diff --git a/src/Mod/PartDesign/Gui/SketchWorkflow.h b/src/Mod/PartDesign/Gui/SketchWorkflow.h index 4c1dc9c487..4f116063c6 100644 --- a/src/Mod/PartDesign/Gui/SketchWorkflow.h +++ b/src/Mod/PartDesign/Gui/SketchWorkflow.h @@ -25,7 +25,7 @@ #include #include -#include +#include namespace App { class Document; diff --git a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp index 6606e9061b..6fe2e5764a 100644 --- a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index b4cf78b689..3055a92e39 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp index 99094bd583..e80a43e892 100644 --- a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp index 6496641959..15ab17d66e 100644 --- a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp index 1c03cd4ffd..d4163783e0 100644 --- a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp index 0e61fb1f1c..4be4ae6adc 100644 --- a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp index 9d87827b13..2421e6f564 100644 --- a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 1844cec248..c68917ac7d 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp index 13b7fffc1c..a546acf69f 100644 --- a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp index 5247bdc88e..8529a322ea 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include "ui_TaskLoftParameters.h" diff --git a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp index 91bf091697..e7912ff4d6 100644 --- a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp index 565a26f805..77362510a5 100644 --- a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index e90f51086c..0c65626b2e 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp index 61eb9dc368..95df7a06fa 100644 --- a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp index dd563b5c5f..98b0983112 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp b/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp index 2fe2c94c2c..c6b30c4b75 100644 --- a/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp @@ -30,8 +30,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp b/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp index e0032a22cf..c9a285c169 100644 --- a/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/TaskShapeBinder.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp index b21f1a928a..aaf11e0dee 100644 --- a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.h b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.h index f0fed4501c..6a2c2067bd 100644 --- a/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.h +++ b/src/Mod/PartDesign/Gui/TaskSketchBasedParameters.h @@ -25,7 +25,7 @@ #ifndef GUI_TASKVIEW_TaskSketchBasedParameters_H #define GUI_TASKVIEW_TaskSketchBasedParameters_H -#include +#include #include "ViewProvider.h" #include "TaskFeatureParameters.h" diff --git a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp index b6cffe4200..081b2998e1 100644 --- a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp index 65bdfdd204..83f4e4fc25 100644 --- a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/TaskTransformedParameters.h b/src/Mod/PartDesign/Gui/TaskTransformedParameters.h index 8fc17d4ee7..853399d215 100644 --- a/src/Mod/PartDesign/Gui/TaskTransformedParameters.h +++ b/src/Mod/PartDesign/Gui/TaskTransformedParameters.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp index b3140facb9..5951a6db9b 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include "ViewProviderDatumPoint.h" diff --git a/src/Mod/Points/Gui/Command.cpp b/src/Mod/Points/Gui/Command.cpp index b448fe63d6..b84839a640 100644 --- a/src/Mod/Points/Gui/Command.cpp +++ b/src/Mod/Points/Gui/Command.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Points/Gui/ViewProvider.cpp b/src/Mod/Points/Gui/ViewProvider.cpp index 8d85dd09f2..237ca9735a 100644 --- a/src/Mod/Points/Gui/ViewProvider.cpp +++ b/src/Mod/Points/Gui/ViewProvider.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/ReverseEngineering/Gui/Command.cpp b/src/Mod/ReverseEngineering/Gui/Command.cpp index 08460e6ae8..acfbbc2a1a 100644 --- a/src/Mod/ReverseEngineering/Gui/Command.cpp +++ b/src/Mod/ReverseEngineering/Gui/Command.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp b/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp index d09392ded1..93555475e5 100644 --- a/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp +++ b/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp b/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp index 9915c9484d..b50e70cd10 100644 --- a/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp +++ b/src/Mod/ReverseEngineering/Gui/SegmentationManual.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Robot/Gui/Command.cpp b/src/Mod/Robot/Gui/Command.cpp index 432215ead4..3f12910daa 100644 --- a/src/Mod/Robot/Gui/Command.cpp +++ b/src/Mod/Robot/Gui/Command.cpp @@ -30,8 +30,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/Mod/Robot/Gui/CommandExport.cpp b/src/Mod/Robot/Gui/CommandExport.cpp index ec2c16a5f3..7e1562a3d4 100644 --- a/src/Mod/Robot/Gui/CommandExport.cpp +++ b/src/Mod/Robot/Gui/CommandExport.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Robot/Gui/CommandInsertRobot.cpp b/src/Mod/Robot/Gui/CommandInsertRobot.cpp index d990c48d58..d4d9de09d4 100644 --- a/src/Mod/Robot/Gui/CommandInsertRobot.cpp +++ b/src/Mod/Robot/Gui/CommandInsertRobot.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include "TrajectorySimulate.h" diff --git a/src/Mod/Robot/Gui/CommandTrajectory.cpp b/src/Mod/Robot/Gui/CommandTrajectory.cpp index cd232add47..5940074aac 100644 --- a/src/Mod/Robot/Gui/CommandTrajectory.cpp +++ b/src/Mod/Robot/Gui/CommandTrajectory.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Robot/Gui/TaskRobot6Axis.cpp b/src/Mod/Robot/Gui/TaskRobot6Axis.cpp index 08d1deea3c..809df4d69f 100644 --- a/src/Mod/Robot/Gui/TaskRobot6Axis.cpp +++ b/src/Mod/Robot/Gui/TaskRobot6Axis.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include "TaskRobot6Axis.h" #include "ui_TaskRobot6Axis.h" diff --git a/src/Mod/Robot/Gui/TaskTrajectory.h b/src/Mod/Robot/Gui/TaskTrajectory.h index 702c252272..9112bbbd40 100644 --- a/src/Mod/Robot/Gui/TaskTrajectory.h +++ b/src/Mod/Robot/Gui/TaskTrajectory.h @@ -23,7 +23,7 @@ #ifndef GUI_TASKVIEW_TaskTrajectory_H #define GUI_TASKVIEW_TaskTrajectory_H -#include +#include #include #include #include diff --git a/src/Mod/Robot/Gui/TaskTrajectoryDressUpParameter.cpp b/src/Mod/Robot/Gui/TaskTrajectoryDressUpParameter.cpp index 33ea8b3e6e..c16c8d0741 100644 --- a/src/Mod/Robot/Gui/TaskTrajectoryDressUpParameter.cpp +++ b/src/Mod/Robot/Gui/TaskTrajectoryDressUpParameter.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include "TaskTrajectoryDressUpParameter.h" #include "ui_TaskTrajectoryDressUpParameter.h" diff --git a/src/Mod/Robot/Gui/ViewProviderRobotObject.h b/src/Mod/Robot/Gui/ViewProviderRobotObject.h index 3779186d29..a865eed01c 100644 --- a/src/Mod/Robot/Gui/ViewProviderRobotObject.h +++ b/src/Mod/Robot/Gui/ViewProviderRobotObject.h @@ -24,7 +24,7 @@ #define ROBOT_VIEWPROVIDERROBOTOBJECT_H #include -#include +#include #include #include #include diff --git a/src/Mod/Robot/Gui/ViewProviderTrajectory.h b/src/Mod/Robot/Gui/ViewProviderTrajectory.h index 480f5a5a67..f59ba209c7 100644 --- a/src/Mod/Robot/Gui/ViewProviderTrajectory.h +++ b/src/Mod/Robot/Gui/ViewProviderTrajectory.h @@ -23,7 +23,7 @@ #ifndef ROBOT_ViewProviderTrajectory_H #define ROBOT_ViewProviderTrajectory_H -#include +#include #include #include diff --git a/src/Mod/Sandbox/Gui/Overlay.cpp b/src/Mod/Sandbox/Gui/Overlay.cpp index b8df855acd..6597579e51 100644 --- a/src/Mod/Sandbox/Gui/Overlay.cpp +++ b/src/Mod/Sandbox/Gui/Overlay.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/Command.cpp b/src/Mod/Sketcher/Gui/Command.cpp index fda6934924..6d1dd90dfa 100644 --- a/src/Mod/Sketcher/Gui/Command.cpp +++ b/src/Mod/Sketcher/Gui/Command.cpp @@ -45,8 +45,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp index f34f6b038c..8b6b16d565 100644 --- a/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp +++ b/src/Mod/Sketcher/Gui/CommandAlterGeometry.cpp @@ -31,8 +31,8 @@ #include #include #include -#include -#include +#include +#include #include #include "GeometryCreationMode.h" diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 74c26fcad2..8523c4c61c 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -40,9 +40,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 95212cc61a..b3572aaf5e 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index 341ac092e6..18d7df4a1c 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include #include #include "DrawSketchHandler.h" diff --git a/src/Mod/Sketcher/Gui/CommandSketcherOverlay.cpp b/src/Mod/Sketcher/Gui/CommandSketcherOverlay.cpp index 9c0659e887..4dc6673d96 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherOverlay.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherOverlay.cpp @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include #include #include "DrawSketchHandler.h" diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index 26480efefb..72283b79ea 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -43,8 +43,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp b/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp index 95e854b732..6fcfdbfdf9 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherVirtualSpace.cpp @@ -34,8 +34,8 @@ #include #include #include -#include -#include +#include +#include #include "DrawSketchHandler.h" #include "ViewProviderSketch.h" diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.h b/src/Mod/Sketcher/Gui/DrawSketchHandler.h index 2bd01a6059..d64e541af5 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerCarbonCopy.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerCarbonCopy.h index 75fab52e15..277fd04fb1 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerCarbonCopy.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerCarbonCopy.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h index 308558a277..2f76b305b7 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerExtend.h @@ -24,7 +24,7 @@ #define SKETCHERGUI_DrawSketchHandlerExtend_H #include -#include +#include #include #include diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h index 5739156809..e8f1f08261 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerExternal.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h index 0fd4e12442..987d8c9b0b 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerFillet.h @@ -24,7 +24,7 @@ #define SKETCHERGUI_DrawSketchHandlerFillet_H #include -#include +#include #include #include diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h index 604a08ce15..38d7be1236 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerSplitting.h @@ -24,7 +24,7 @@ #define SKETCHERGUI_DrawSketchHandlerSplitting_H #include -#include +#include #include #include diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerTrimming.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerTrimming.h index 23aaeca7dd..2309d83cc5 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerTrimming.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerTrimming.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h index 4432f4f2c6..1f933b01f8 100644 --- a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h +++ b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index fcfdd9dc44..5dcb410a07 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -44,8 +44,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h index 91947832a1..d745dbf456 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h b/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h index e3cb000111..a03303f1cc 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherCreateCommands.h @@ -23,7 +23,7 @@ #ifndef GUI_TASKVIEW_TaskSketcherCreateCommands_H #define GUI_TASKVIEW_TaskSketcherCreateCommands_H -#include +#include #include diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 1dcc07ea74..d7a6177bf2 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -42,8 +42,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.h b/src/Mod/Sketcher/Gui/TaskSketcherElements.h index 6965b44ea1..016acaa741 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.h @@ -28,7 +28,7 @@ #include -#include +#include #include diff --git a/src/Mod/Sketcher/Gui/TaskSketcherTool.h b/src/Mod/Sketcher/Gui/TaskSketcherTool.h index 8a4770ce8c..6dbcd5d97e 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherTool.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherTool.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include namespace App diff --git a/src/Mod/Sketcher/Gui/Utils.cpp b/src/Mod/Sketcher/Gui/Utils.cpp index 91e460eaab..5673ddc582 100644 --- a/src/Mod/Sketcher/Gui/Utils.cpp +++ b/src/Mod/Sketcher/Gui/Utils.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index b1712bba12..f98ec884d5 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -49,9 +49,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index 9bd654f640..9a3ba489db 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/Surface/Gui/Command.cpp b/src/Mod/Surface/Gui/Command.cpp index b5aa0e3a83..633df06552 100644 --- a/src/Mod/Surface/Gui/Command.cpp +++ b/src/Mod/Surface/Gui/Command.cpp @@ -39,8 +39,8 @@ #include #include #include -#include -#include +#include +#include //=========================================================================== diff --git a/src/Mod/Surface/Gui/TaskFilling.cpp b/src/Mod/Surface/Gui/TaskFilling.cpp index 84ec52c057..81e303fc47 100644 --- a/src/Mod/Surface/Gui/TaskFilling.cpp +++ b/src/Mod/Surface/Gui/TaskFilling.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Surface/Gui/TaskFillingEdge.cpp b/src/Mod/Surface/Gui/TaskFillingEdge.cpp index d6b0b2cdbe..0bf76e99cf 100644 --- a/src/Mod/Surface/Gui/TaskFillingEdge.cpp +++ b/src/Mod/Surface/Gui/TaskFillingEdge.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Surface/Gui/TaskFillingEdge.h b/src/Mod/Surface/Gui/TaskFillingEdge.h index 6753c08944..272c522adf 100644 --- a/src/Mod/Surface/Gui/TaskFillingEdge.h +++ b/src/Mod/Surface/Gui/TaskFillingEdge.h @@ -25,7 +25,7 @@ #define SURFACEGUI_TASKFILLINGEDGE_H #include -#include +#include #include #include #include diff --git a/src/Mod/Surface/Gui/TaskFillingVertex.cpp b/src/Mod/Surface/Gui/TaskFillingVertex.cpp index d972a0da48..e214793e17 100644 --- a/src/Mod/Surface/Gui/TaskFillingVertex.cpp +++ b/src/Mod/Surface/Gui/TaskFillingVertex.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Surface/Gui/TaskFillingVertex.h b/src/Mod/Surface/Gui/TaskFillingVertex.h index 65ec895296..310e04dbe2 100644 --- a/src/Mod/Surface/Gui/TaskFillingVertex.h +++ b/src/Mod/Surface/Gui/TaskFillingVertex.h @@ -24,7 +24,7 @@ #define SURFACEGUI_TASKFILLINGVERTEX_H #include -#include +#include #include #include #include diff --git a/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp b/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp index fe5054ce93..ab4b794b97 100644 --- a/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp +++ b/src/Mod/Surface/Gui/TaskGeomFillSurface.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/Surface/Gui/TaskSections.cpp b/src/Mod/Surface/Gui/TaskSections.cpp index b2fbf5bfda..4a6ce1b354 100644 --- a/src/Mod/Surface/Gui/TaskSections.cpp +++ b/src/Mod/Surface/Gui/TaskSections.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index 40c882b890..0478f97aaa 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -44,8 +44,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index 5b0979a37b..20c9882855 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -33,8 +33,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp index a47ce46e38..3a25bf80de 100644 --- a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp @@ -46,8 +46,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/CommandDecorate.cpp b/src/Mod/TechDraw/Gui/CommandDecorate.cpp index e57a1dbd3e..687c6a5d33 100644 --- a/src/Mod/TechDraw/Gui/CommandDecorate.cpp +++ b/src/Mod/TechDraw/Gui/CommandDecorate.cpp @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp b/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp index c7202baf28..31cca2c5ac 100644 --- a/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandExtensionDims.cpp @@ -39,8 +39,8 @@ # include # include # include -# include -# include +# include +# include # include # include diff --git a/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp b/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp index 8448ed2054..e6880759e3 100644 --- a/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp +++ b/src/Mod/TechDraw/Gui/CommandExtensionPack.cpp @@ -41,8 +41,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/CommandHelpers.cpp b/src/Mod/TechDraw/Gui/CommandHelpers.cpp index e054bebf74..b996b9bb20 100644 --- a/src/Mod/TechDraw/Gui/CommandHelpers.cpp +++ b/src/Mod/TechDraw/Gui/CommandHelpers.cpp @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/CommandStack.cpp b/src/Mod/TechDraw/Gui/CommandStack.cpp index b2a8426d4a..2b3a462205 100644 --- a/src/Mod/TechDraw/Gui/CommandStack.cpp +++ b/src/Mod/TechDraw/Gui/CommandStack.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/DimensionValidators.cpp b/src/Mod/TechDraw/Gui/DimensionValidators.cpp index 8484c7b5ed..96b23511d5 100644 --- a/src/Mod/TechDraw/Gui/DimensionValidators.cpp +++ b/src/Mod/TechDraw/Gui/DimensionValidators.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp b/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp index 6cf16d5d3c..a36782442f 100644 --- a/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp +++ b/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/DrawGuiUtil.h b/src/Mod/TechDraw/Gui/DrawGuiUtil.h index d5b3fc2c02..28ab308143 100644 --- a/src/Mod/TechDraw/Gui/DrawGuiUtil.h +++ b/src/Mod/TechDraw/Gui/DrawGuiUtil.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 4246b971bf..f45650dd87 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -51,8 +51,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.h b/src/Mod/TechDraw/Gui/MDIViewPage.h index 6843703d4f..82beab9a60 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.h +++ b/src/Mod/TechDraw/Gui/MDIViewPage.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include "ViewProviderPage.h" diff --git a/src/Mod/TechDraw/Gui/PreferencesGui.cpp b/src/Mod/TechDraw/Gui/PreferencesGui.cpp index 12ed49ece8..664ada4a47 100644 --- a/src/Mod/TechDraw/Gui/PreferencesGui.cpp +++ b/src/Mod/TechDraw/Gui/PreferencesGui.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/QGIPrimPath.cpp b/src/Mod/TechDraw/Gui/QGIPrimPath.cpp index b9e2982c0e..44aa86a0f5 100644 --- a/src/Mod/TechDraw/Gui/QGIPrimPath.cpp +++ b/src/Mod/TechDraw/Gui/QGIPrimPath.cpp @@ -32,7 +32,7 @@ #include -#include +#include #include diff --git a/src/Mod/TechDraw/Gui/QGIProjGroup.cpp b/src/Mod/TechDraw/Gui/QGIProjGroup.cpp index cd55cf93c3..1d6ec17461 100644 --- a/src/Mod/TechDraw/Gui/QGIProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/QGIProjGroup.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/QGIView.cpp b/src/Mod/TechDraw/Gui/QGIView.cpp index f636104eed..89bdd5e34c 100644 --- a/src/Mod/TechDraw/Gui/QGIView.cpp +++ b/src/Mod/TechDraw/Gui/QGIView.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index d11f7a7acd..8ba0969136 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/QGSPage.cpp b/src/Mod/TechDraw/Gui/QGSPage.cpp index fae504888d..96f0badef9 100644 --- a/src/Mod/TechDraw/Gui/QGSPage.cpp +++ b/src/Mod/TechDraw/Gui/QGSPage.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index ebad0c7080..233554eb33 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp index 1e801cc395..d6f20ad2a9 100644 --- a/src/Mod/TechDraw/Gui/TaskComplexSection.cpp +++ b/src/Mod/TechDraw/Gui/TaskComplexSection.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include "Widgets/CompassWidget.h" diff --git a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp index 0a145bc904..a1a7604e4f 100644 --- a/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp +++ b/src/Mod/TechDraw/Gui/TaskCosmeticCircle.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp b/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp index 3ac9ed6087..5b83340515 100644 --- a/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp +++ b/src/Mod/TechDraw/Gui/TaskCosmeticLine.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskDetail.cpp b/src/Mod/TechDraw/Gui/TaskDetail.cpp index 6e901578e9..291ee60812 100644 --- a/src/Mod/TechDraw/Gui/TaskDetail.cpp +++ b/src/Mod/TechDraw/Gui/TaskDetail.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskDimRepair.cpp b/src/Mod/TechDraw/Gui/TaskDimRepair.cpp index 05384a7690..15c3baf335 100644 --- a/src/Mod/TechDraw/Gui/TaskDimRepair.cpp +++ b/src/Mod/TechDraw/Gui/TaskDimRepair.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskDimension.cpp b/src/Mod/TechDraw/Gui/TaskDimension.cpp index 60094479a4..7f83ed375a 100644 --- a/src/Mod/TechDraw/Gui/TaskDimension.cpp +++ b/src/Mod/TechDraw/Gui/TaskDimension.cpp @@ -31,8 +31,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskLineDecor.cpp b/src/Mod/TechDraw/Gui/TaskLineDecor.cpp index 3995d9f434..ad4bfc79b9 100644 --- a/src/Mod/TechDraw/Gui/TaskLineDecor.cpp +++ b/src/Mod/TechDraw/Gui/TaskLineDecor.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskLinkDim.cpp b/src/Mod/TechDraw/Gui/TaskLinkDim.cpp index a1fe165e2d..f838e1008a 100644 --- a/src/Mod/TechDraw/Gui/TaskLinkDim.cpp +++ b/src/Mod/TechDraw/Gui/TaskLinkDim.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskProjection.cpp b/src/Mod/TechDraw/Gui/TaskProjection.cpp index 9c2e2aa227..067b67ff94 100644 --- a/src/Mod/TechDraw/Gui/TaskProjection.cpp +++ b/src/Mod/TechDraw/Gui/TaskProjection.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/TaskSectionView.cpp b/src/Mod/TechDraw/Gui/TaskSectionView.cpp index 6fc54b7c16..c107da24b5 100644 --- a/src/Mod/TechDraw/Gui/TaskSectionView.cpp +++ b/src/Mod/TechDraw/Gui/TaskSectionView.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderBalloon.cpp b/src/Mod/TechDraw/Gui/ViewProviderBalloon.cpp index 0471fed01b..1c5f952823 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderBalloon.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderBalloon.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderGeomHatch.cpp b/src/Mod/TechDraw/Gui/ViewProviderGeomHatch.cpp index e4af820e28..4b6b40961b 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderGeomHatch.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderGeomHatch.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderLeader.cpp b/src/Mod/TechDraw/Gui/ViewProviderLeader.cpp index 79fee565eb..54ab2a34ef 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderLeader.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderLeader.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp b/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp index 4cba9d6aff..edf5503436 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderProjGroup.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp b/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp index 7379d11cc2..5c8da54999 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp index a33c81fb69..fcead39ce0 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewPart.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderViewSection.cpp b/src/Mod/TechDraw/Gui/ViewProviderViewSection.cpp index 2195410174..bedc15c6b3 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderViewSection.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderViewSection.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp b/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp index 8b046d7f2b..a0678bbcc6 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderWeld.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include "PreferencesGui.h" #include "TaskWeldingSymbol.h" diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index 885d889bae..ccd443ec19 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -27,6 +27,12 @@ class TemplateClassPyExport(template.ModelTemplate): return s print("TemplateClassPyExport", path + exportName) + + # Create the subdir it necessary + subpath = os.path.dirname(path + exportName) + if not os.path.exists(subpath): + os.makedirs(subpath) + # Imp.cpp must not exist, neither in path nor in dirname if not os.path.exists(path + exportName + "Imp.cpp"): if not os.path.exists(dirname + exportName + "Imp.cpp"): From 1dc6f7c1c0a428d2122d81728be18b13f83bb387 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Mon, 3 Feb 2025 16:58:24 +0000 Subject: [PATCH 088/224] CAM: Tool Bit Library Fixes (#18973) * remove unused else * Enable reloading / re-selection of libraries * Reload the libraries when exiting the editor * Clear the model to prevent duplicate entries * add missing docstring to reduce linting warnings * Maintain any previous library selection when editing --- src/Mod/CAM/Path/Tool/Gui/BitLibrary.py | 85 +++++++++++++++++++------ 1 file changed, 64 insertions(+), 21 deletions(-) diff --git a/src/Mod/CAM/Path/Tool/Gui/BitLibrary.py b/src/Mod/CAM/Path/Tool/Gui/BitLibrary.py index 9ea2d355dc..8604a1575c 100644 --- a/src/Mod/CAM/Path/Tool/Gui/BitLibrary.py +++ b/src/Mod/CAM/Path/Tool/Gui/BitLibrary.py @@ -59,6 +59,7 @@ translate = FreeCAD.Qt.translate def checkWorkingDir(): + """Check the tool library directory writable and configure a new library if required""" # users shouldn't use the example toolbits and libraries. # working directory should be writable Path.Log.track() @@ -97,7 +98,8 @@ def checkWorkingDir(): Path.Preferences.setLastPathToolBit("{}{}Bit".format(workingdir, os.path.sep)) Path.Log.debug("setting workingdir to: {}".format(workingdir)) - # Copy only files of default Path/Tool folder to working directory (targeting the README.md help file) + # Copy only files of default Path/Tool folder to working directory + # (targeting the README.md help file) src_toolfiles = os.listdir(defaultdir) for file_name in src_toolfiles: if file_name in ["README.md"]: @@ -216,6 +218,7 @@ class _TableView(PySide.QtGui.QTableView): self._copyTool(uuid, dst + i) def dropEvent(self, event): + """Handle drop events on the tool table""" Path.Log.track() mime = event.mimeData() data = mime.data("application/x-qstandarditemmodeldatalist") @@ -247,6 +250,7 @@ class ModelFactory: """ Path.Log.track() path = Path.Preferences.lastPathToolLibrary() + model.clear() if os.path.isdir(path): # opening all tables in a directory libFiles = [f for f in glob.glob(path + os.path.sep + "*.fctl")] @@ -394,15 +398,16 @@ class ToolBitSelector(object): self.factory = ModelFactory() self.toolModel = PySide.QtGui.QStandardItemModel(0, len(self.columnNames())) self.libraryModel = PySide.QtGui.QStandardItemModel(0, len(self.columnNames())) - self.factory.find_libraries(self.libraryModel) self.setupUI() self.title = self.form.windowTitle() def columnNames(self): + """Define the column names to display""" return ["#", "Tool"] def currentLibrary(self, shortNameOnly): + """Get the file path for the current tool library""" libfile = Path.Preferences.lastFileToolLibrary() if libfile is None or libfile == "": return "" @@ -411,6 +416,7 @@ class ToolBitSelector(object): return libfile def loadData(self): + """Load the toolbits for the selected tool library""" Path.Log.track() self.toolModel.clear() self.toolModel.setHorizontalHeaderLabels(self.columnNames()) @@ -422,40 +428,58 @@ class ToolBitSelector(object): # Get the data for the selected index libPath = self.libraryModel.item(currentIndex).data(_PathRole) self.factory.library_open(self.toolModel, libPath) - else: - pass self.toolModel.takeColumn(3) self.toolModel.takeColumn(2) - def setupUI(self): + def loadToolLibraries(self): + """ + Load the tool libraries in to self.libraryModel + and populate the tooldock form combobox with the + libraries names + """ Path.Log.track() - self.loadData() # Load the initial data for the tool model - self.form.tools.setModel(self.toolModel) - self.form.tools.selectionModel().selectionChanged.connect(self.enableButtons) - self.form.tools.doubleClicked.connect(partial(self.selectedOrAllToolControllers)) + # Get the current library so we can try and maintain any previous selection + current_lib = self.currentLibrary(True) # True to get short name only + + # load the tool libraries + self.factory.find_libraries(self.libraryModel) # Set the library model to the combobox self.form.cboLibraries.setModel(self.libraryModel) + # Set the current library as the selected item in the combobox + currentIndex = self.form.cboLibraries.findText(current_lib) + + # Set the selected library as the currentIndex in the combobox + if currentIndex == -1 and self.libraryModel.rowCount() > 0: + # If current library is not found, default to the first item + currentIndex = 0 + + self.form.cboLibraries.setCurrentIndex(currentIndex) + + def setupUI(self): + """Setup the form and load the tooltable data""" + Path.Log.track() + # Connect the library change to reload data and update tooltip self.form.cboLibraries.currentIndexChanged.connect(self.loadData) self.form.cboLibraries.currentIndexChanged.connect(self.updateLibraryTooltip) - # Set the current library as the selected item in the combobox - current_lib = self.currentLibrary(True) # True to get short name only - currentIndex = self.form.cboLibraries.findText(current_lib) - if currentIndex == -1 and self.libraryModel.rowCount() > 0: - # If current library is not found, default to the first item - currentIndex = 0 - self.form.cboLibraries.setCurrentIndex(currentIndex) - self.updateLibraryTooltip(currentIndex) # Initialize the tooltip + # Load the tool libraries. + # This will trigger a change in current index of the cboLibraries combobox + self.loadToolLibraries() + + self.form.tools.setModel(self.toolModel) + self.form.tools.selectionModel().selectionChanged.connect(self.enableButtons) + self.form.tools.doubleClicked.connect(partial(self.selectedOrAllToolControllers)) self.form.libraryEditorOpen.clicked.connect(self.libraryEditorOpen) self.form.addToolController.clicked.connect(self.selectedOrAllToolControllers) def updateLibraryTooltip(self, index): + """Add a tooltip to the combobox""" if index != -1: item = self.libraryModel.item(index) if item: @@ -467,15 +491,18 @@ class ToolBitSelector(object): self.form.cboLibraries.setToolTip(translate("CAM_Toolbit", "No library selected")) def enableButtons(self): + """Enable button to add tool controller when a tool is selected""" + # Set buttons inactive + self.form.addToolController.setEnabled(False) selected = len(self.form.tools.selectedIndexes()) >= 1 if selected: jobs = len([1 for j in FreeCAD.ActiveDocument.Objects if j.Name[:3] == "Job"]) >= 1 - self.form.addToolController.setEnabled(selected and jobs) + self.form.addToolController.setEnabled(selected and jobs) def libraryEditorOpen(self): library = ToolBitLibrary() library.open() - self.loadData() + self.loadToolLibraries() def selectedOrAllTools(self): """ @@ -565,6 +592,7 @@ class ToolBitLibrary(object): self.title = self.form.windowTitle() def toolBitNew(self): + """Create a new toolbit""" Path.Log.track() # select the shape file @@ -596,6 +624,7 @@ class ToolBitLibrary(object): self.librarySave() def toolBitExisting(self): + """Add an existing toolbit to the library""" filenames = PathToolBitGui.GetToolFiles() @@ -612,6 +641,7 @@ class ToolBitLibrary(object): self.librarySave() def toolDelete(self): + """Delete a tool""" Path.Log.track() selectedRows = set([index.row() for index in self.toolTableView.selectedIndexes()]) for row in sorted(list(selectedRows), key=lambda r: -r): @@ -635,6 +665,7 @@ class ToolBitLibrary(object): return self.form.exec_() def libraryPath(self): + """Select and load a tool library""" Path.Log.track() path = PySide.QtGui.QFileDialog.getExistingDirectory( self.form, "Tool Library Path", Path.Preferences.lastPathToolLibrary() @@ -646,6 +677,7 @@ class ToolBitLibrary(object): self.loadData() def cleanupDocument(self): + """Clean up the document""" # This feels like a hack. Remove the toolbit object # remove the editor from the dialog # re-enable all the controls @@ -658,6 +690,7 @@ class ToolBitLibrary(object): self.lockoff() def accept(self): + """Handle accept signal""" self.editor.accept() self.temptool.Proxy.saveToFile(self.temptool, self.temptool.File) self.librarySave() @@ -665,9 +698,11 @@ class ToolBitLibrary(object): self.cleanupDocument() def reject(self): + """Handle reject signal""" self.cleanupDocument() def lockon(self): + """Set the state of the form widgets: inactive""" self.toolTableView.setEnabled(False) self.form.toolCreate.setEnabled(False) self.form.toolDelete.setEnabled(False) @@ -679,6 +714,7 @@ class ToolBitLibrary(object): self.form.librarySave.setEnabled(False) def lockoff(self): + """Set the state of the form widgets: active""" self.toolTableView.setEnabled(True) self.form.toolCreate.setEnabled(True) self.form.toolDelete.setEnabled(True) @@ -691,6 +727,7 @@ class ToolBitLibrary(object): self.form.librarySave.setEnabled(True) def toolEdit(self, selected): + """Edit the selected tool bit""" Path.Log.track() item = self.toolModel.item(selected.row(), 0) @@ -721,6 +758,7 @@ class ToolBitLibrary(object): print("all done") def libraryNew(self): + """Create a new tool library""" TooltableTypeJSON = translate("CAM_ToolBit", "Tooltable JSON (*.fctl)") filename = PySide.QtGui.QFileDialog.getSaveFileName( @@ -744,6 +782,7 @@ class ToolBitLibrary(object): self.loadData() def librarySave(self): + """Save the tool library""" library = {} tools = [] library["version"] = 1 @@ -771,6 +810,7 @@ class ToolBitLibrary(object): self.form.close() def libPaths(self): + """Get the file path for the last used tool library""" lib = Path.Preferences.lastFileToolLibrary() loc = Path.Preferences.lastPathToolLibrary() @@ -785,6 +825,7 @@ class ToolBitLibrary(object): ] def loadData(self, path=None): + """Load tooltable data""" Path.Log.track(path) self.toolTableView.setUpdatesEnabled(False) self.form.TableList.setUpdatesEnabled(False) @@ -821,6 +862,7 @@ class ToolBitLibrary(object): self.form.TableList.setUpdatesEnabled(True) def setupUI(self): + """Setup the form and load the tool library data""" Path.Log.track() self.form.TableList.setModel(self.listModel) self.toolTableView.setModel(self.toolModel) @@ -846,7 +888,7 @@ class ToolBitLibrary(object): self.toolSelect([], []) def librarySaveAs(self, path): - + """Save the tooltable to a format to use with an external system""" TooltableTypeJSON = translate("CAM_ToolBit", "Tooltable JSON (*.fctl)") TooltableTypeLinuxCNC = translate("CAM_ToolBit", "LinuxCNC tooltable (*.tbl)") TooltableTypeCamotics = translate("CAM_ToolBit", "CAMotics tooltable (*.json)") @@ -874,7 +916,7 @@ class ToolBitLibrary(object): self.librarySave() def libararySaveLinuxCNC(self, path): - # linuxcnc line template + """Export the tool table to a file for use with linuxcnc""" LIN = "T{} P{} X{} Y{} Z{} A{} B{} C{} U{} V{} W{} D{} I{} J{} Q{}; {}" with open(path, "w") as fp: fp.write(";\n") @@ -938,6 +980,7 @@ class ToolBitLibrary(object): Path.Log.error("Could not find tool #{} ".format(toolNr)) def libararySaveCamotics(self, path): + """Export the tool table to a file for use with camotics""" SHAPEMAP = { "ballend": "Ballnose", From ff8e99f3856b727717ce2da566f36cb5a5942fdf Mon Sep 17 00:00:00 2001 From: tritao Date: Sun, 19 Jan 2025 16:05:29 +0000 Subject: [PATCH 089/224] App: Provide temporary document creation flag to Python `App.loadDocument`. --- src/App/Application.cpp | 24 +++++++++++----------- src/App/Application.h | 12 +++++++---- src/App/ApplicationPy.cpp | 28 +++++++++++++++++--------- src/Gui/Application.cpp | 4 +++- src/Mod/Import/App/ImportOCAF2.cpp | 5 ++++- src/Mod/PartDesign/App/ShapeBinder.cpp | 19 +++++++++-------- 6 files changed, 57 insertions(+), 35 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 6ab625095d..0fc1cf62a2 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -453,7 +453,7 @@ void Application::renameDocument(const char *OldName, const char *NewName) throw Base::RuntimeError("Renaming document internal name is no longer allowed!"); } -Document* Application::newDocument(const char * Name, const char * UserName, bool createView, bool tempDoc) +Document* Application::newDocument(const char * Name, const char * UserName, DocumentCreateFlags CreateFlags) { auto getNameAndLabel = [this](const char * Name, const char * UserName) -> std::tuple { bool defaultName = (!Name || Name[0] == '\0'); @@ -487,10 +487,10 @@ Document* Application::newDocument(const char * Name, const char * UserName, boo auto tuple = getNameAndLabel(Name, UserName); std::string name = std::get<0>(tuple); std::string userName = std::get<1>(tuple); - name = getUniqueDocumentName(name.c_str(), tempDoc); + name = getUniqueDocumentName(name.c_str(), CreateFlags.temporary); // return the temporary document if it exists - if (tempDoc) { + if (CreateFlags.temporary) { auto it = DocMap.find(name); if (it != DocMap.end() && it->second->testStatus(Document::TempDoc)) return it->second; @@ -498,7 +498,7 @@ Document* Application::newDocument(const char * Name, const char * UserName, boo // create the FreeCAD document std::unique_ptr newDoc(new Document(name.c_str())); - newDoc->setStatus(Document::TempDoc, tempDoc); + newDoc->setStatus(Document::TempDoc, CreateFlags.temporary); auto oldActiveDoc = _pActiveDoc; auto doc = newDoc.release(); // now owned by the Application @@ -539,13 +539,13 @@ Document* Application::newDocument(const char * Name, const char * UserName, boo Py::Module("FreeCAD").setAttr(std::string("ActiveDocument"), active); } - signalNewDocument(*_pActiveDoc, createView); + signalNewDocument(*_pActiveDoc, CreateFlags.createView); // set the UserName after notifying all observers _pActiveDoc->Label.setValue(userName); // set the old document active again if the new is temporary - if (tempDoc && oldActiveDoc) + if (CreateFlags.temporary && oldActiveDoc) setActiveDocument(oldActiveDoc); return doc; @@ -701,9 +701,9 @@ public: } }; -Document* Application::openDocument(const char * FileName, bool createView) { +Document* Application::openDocument(const char * FileName, DocumentCreateFlags createFlags) { std::vector filenames(1,FileName); - auto docs = openDocuments(filenames, nullptr, nullptr, nullptr, createView); + auto docs = openDocuments(filenames, nullptr, nullptr, nullptr, createFlags); if(!docs.empty()) return docs.front(); return nullptr; @@ -748,7 +748,7 @@ std::vector Application::openDocuments(const std::vector const std::vector *paths, const std::vector *labels, std::vector *errs, - bool createView) + DocumentCreateFlags createFlags) { std::vector res(filenames.size(), nullptr); if (filenames.empty()) @@ -812,7 +812,7 @@ std::vector Application::openDocuments(const std::vector label = (*labels)[count].c_str(); } - auto doc = openDocumentPrivate(path, name.c_str(), label, isMainDoc, createView, std::move(objNames)); + auto doc = openDocumentPrivate(path, name.c_str(), label, isMainDoc, createFlags, std::move(objNames)); FC_DURATION_PLUS(timing.d1,t1); if (doc) { timings[doc].d1 += timing.d1; @@ -951,7 +951,7 @@ std::vector Application::openDocuments(const std::vector Document* Application::openDocumentPrivate(const char * FileName, const char *propFileName, const char *label, - bool isMainDoc, bool createView, + bool isMainDoc, DocumentCreateFlags createFlags, std::vector &&objNames) { FileInfo File(FileName); @@ -1022,8 +1022,8 @@ Document* Application::openDocumentPrivate(const char * FileName, // to only contain valid ASCII characters but the user name will be kept. if(!label) label = name.c_str(); - Document* newDoc = newDocument(name.c_str(),label,isMainDoc && createView); + Document* newDoc = newDocument(name.c_str(), label, createFlags); newDoc->FileName.setValue(propFileName==FileName?File.filePath():propFileName); try { diff --git a/src/App/Application.h b/src/App/Application.h index e2a32adefe..a2be53861b 100644 --- a/src/App/Application.h +++ b/src/App/Application.h @@ -69,6 +69,10 @@ enum class MessageOption { Throw, /**< Throw an exception. */ }; +struct DocumentCreateFlags { + bool createView {true}; + bool temporary {false}; +}; /** The Application * The root of the whole application @@ -94,13 +98,13 @@ public: * the user and stored in the App::Document::Name property. */ App::Document* newDocument(const char * Name=nullptr, const char * UserName=nullptr, - bool createView=true, bool tempDoc=false); + DocumentCreateFlags CreateFlags=DocumentCreateFlags()); /// Closes the document \a name and removes it from the application. bool closeDocument(const char* name); /// find a unique document name std::string getUniqueDocumentName(const char *Name, bool tempDoc=false) const; /// Open an existing document from a file - App::Document* openDocument(const char * FileName=nullptr, bool createView=true); + App::Document* openDocument(const char * FileName=nullptr, DocumentCreateFlags createFlags = DocumentCreateFlags{}); /** Open multiple documents * * @param filenames: input file names @@ -122,7 +126,7 @@ public: const std::vector *paths=nullptr, const std::vector *labels=nullptr, std::vector *errs=nullptr, - bool createView = true); + DocumentCreateFlags createFlags = DocumentCreateFlags{}); /// Retrieve the active document App::Document* getActiveDocument() const; /// Retrieve a named document @@ -486,7 +490,7 @@ protected: /// open single document only App::Document* openDocumentPrivate(const char * FileName, const char *propFileName, - const char *label, bool isMainDoc, bool createView, std::vector &&objNames); + const char *label, bool isMainDoc, DocumentCreateFlags createFlags, std::vector &&objNames); /// Helper class for App::Document to signal on close/abort transaction class AppExport TransactionSignaller { diff --git a/src/App/ApplicationPy.cpp b/src/App/ApplicationPy.cpp index 7303d7e56c..33ad33c5ad 100644 --- a/src/App/ApplicationPy.cpp +++ b/src/App/ApplicationPy.cpp @@ -149,12 +149,13 @@ PyMethodDef Application::Methods[] = { {"openDocument", reinterpret_cast(reinterpret_cast(Application::sOpenDocument)), METH_VARARGS | METH_KEYWORDS, - "openDocument(filepath,hidden=False) -> object\n" + "openDocument(filepath,hidden=False,temporary=False) -> object\n" "Create a document and load the project file into the document.\n\n" "filepath: file path to an existing file. If the file doesn't exist\n" " or the file cannot be loaded an I/O exception is thrown.\n" " In this case the document is kept alive.\n" - "hidden: whether to hide document 3D view."}, + "hidden: whether to hide document 3D view.\n" + "temporary: whether to hide document in the tree view."}, // {"saveDocument", (PyCFunction) Application::sSaveDocument, METH_VARARGS, // "saveDocument(string) -- Save the document to a file."}, // {"saveDocumentAs", (PyCFunction) Application::sSaveDocumentAs, METH_VARARGS}, @@ -339,23 +340,30 @@ PyObject* Application::sOpenDocument(PyObject* /*self*/, PyObject* args, PyObjec { char* Name; PyObject* hidden = Py_False; - static const std::array kwlist {"name", "hidden", nullptr}; + PyObject* temporary = Py_False; + static const std::array kwlist {"name", "hidden", "temporary", nullptr}; if (!Base::Wrapped_ParseTupleAndKeywords(args, kwd, - "et|O!", + "et|O!O!", kwlist, "utf-8", &Name, &PyBool_Type, - &hidden)) { + &hidden, + &PyBool_Type, + &temporary)) { return nullptr; } std::string EncodedName = std::string(Name); PyMem_Free(Name); try { + DocumentCreateFlags createFlags; + createFlags.createView = !Base::asBoolean(hidden); + createFlags.temporary = Base::asBoolean(temporary); + // return new document return (GetApplication() - .openDocument(EncodedName.c_str(), !Base::asBoolean(hidden)) + .openDocument(EncodedName.c_str(), createFlags) ->getPyObject()); } catch (const Base::Exception& e) { @@ -393,11 +401,13 @@ PyObject* Application::sNewDocument(PyObject* /*self*/, PyObject* args, PyObject PY_TRY { + DocumentCreateFlags createFlags; + createFlags.createView = !Base::asBoolean(hidden); + createFlags.temporary = Base::asBoolean(temp); + App::Document* doc = GetApplication().newDocument(docName, usrName, - !Base::asBoolean(hidden), - Base::asBoolean(temp)); - PyMem_Free(docName); + createFlags); PyMem_Free(usrName); return doc->getPyObject(); } diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index dec82e9aa0..383c6c87d2 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -2562,7 +2562,9 @@ App::Document* Application::reopen(App::Document* doc) } for (auto& file : docs) { - App::GetApplication().openDocument(file.c_str(), false); + App::DocumentCreateFlags createFlags; + createFlags.createView = false; + App::GetApplication().openDocument(file.c_str(), createFlags); } } diff --git a/src/Mod/Import/App/ImportOCAF2.cpp b/src/Mod/Import/App/ImportOCAF2.cpp index d4446afc4c..1cabfbb9f6 100644 --- a/src/Mod/Import/App/ImportOCAF2.cpp +++ b/src/Mod/Import/App/ImportOCAF2.cpp @@ -411,7 +411,10 @@ App::Document* ImportOCAF2::getDocument(App::Document* doc, TDF_Label label) return doc; } - auto newDoc = App::GetApplication().newDocument(name.c_str(), name.c_str(), false); + App::DocumentCreateFlags createFlags; + createFlags.createView = false; + auto newDoc = App::GetApplication().newDocument(name.c_str(), name.c_str(), createFlags); + std::ostringstream ss; Base::FileInfo fi(doc->FileName.getValue()); std::string path = fi.dirPath(); diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index 4bb358f3cb..895473d183 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -597,8 +597,11 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) { recomputeCopy = true; clearCopiedObjects(); - auto tmpDoc = App::GetApplication().newDocument( - "_tmp_binder", nullptr, false, true); + App::DocumentCreateFlags createFlags; + createFlags.createView = false; + createFlags.temporary = true; + + auto tmpDoc = App::GetApplication().newDocument("_tmp_binder", nullptr, createFlags); tmpDoc->setUndoMode(0); auto objs = tmpDoc->copyObject({ obj }, true, true); if (!objs.empty()) { @@ -618,21 +621,21 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) { std::vector props; getPropertyList(props); // lambda for copying values of copy-on-change properties - const auto copyPropertyValues = [this, &recomputeCopy, &props, copied](const bool to_support) { + const auto copyPropertyValues = [this, &recomputeCopy, &props, copied](const bool to_support) { for (auto prop : props) { if (!App::LinkBaseExtension::isCopyOnChangeProperty(this, *prop)) continue; - // we only copy read-only and output properties from support to binder - if (!to_support && !(prop->testStatus(App::Property::Output) && prop->testStatus(App::Property::ReadOnly))) - continue; + // we only copy read-only and output properties from support to binder + if (!to_support && !(prop->testStatus(App::Property::Output) && prop->testStatus(App::Property::ReadOnly))) + continue; auto p = copied->getPropertyByName(prop->getName()); if (p && p->getContainer() == copied && p->getTypeId() == prop->getTypeId() && !p->isSame(*prop)) { recomputeCopy = true; - auto* const from = to_support ? prop : p; - auto* const to = to_support ? p : prop; + auto* const from = to_support ? prop : p; + auto* const to = to_support ? p : prop; std::unique_ptr pcopy(from->Copy()); to->Paste(*pcopy); From 58d64e2442dd32d8b87fe9e0c138163d851f19df Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Fri, 24 Jan 2025 09:02:01 -0600 Subject: [PATCH 090/224] GUI: Disable legacy spnav code when legacy is false We don't ever want to connect to both libspnav and NavLib --- src/Gui/View3DInventorViewer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index ff57cede1b..87876bf13a 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -569,7 +569,11 @@ void View3DInventorViewer::init() //filter a few qt events viewerEventFilter = new ViewerEventFilter; installEventFilter(viewerEventFilter); - getEventFilter()->registerInputDevice(new SpaceNavigatorDevice); + ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath( + "User parameter:BaseApp/Preferences/View"); + if (hViewGrp->GetBool("LegacySpaceMouseDevices", false)) { + getEventFilter()->registerInputDevice(new SpaceNavigatorDevice); + } getEventFilter()->registerInputDevice(new GesturesDevice(this)); try{ From 5ac886fa0e82701bc8af8dbf637d7e8cb63db7fc Mon Sep 17 00:00:00 2001 From: Pascal de Bruijn Date: Thu, 2 Jan 2025 17:39:25 +0100 Subject: [PATCH 091/224] Add proper PDF creator metadata --- src/Gui/ApplicationPy.cpp | 10 ++++++++++ src/Gui/EditorView.cpp | 10 ++++++++++ src/Gui/MDIView.cpp | 10 ++++++++++ src/Gui/View3DInventor.cpp | 11 +++++++++++ src/Mod/Drawing/Gui/DrawingView.cpp | 9 +++++++++ src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 11 +++++++++++ src/Mod/TechDraw/Gui/PagePrinter.cpp | 17 +++++++++++++++++ 7 files changed, 78 insertions(+) diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index fbe522eef1..defc585675 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -36,6 +36,7 @@ #include +#include #include #include #include @@ -777,6 +778,15 @@ PyObject* ApplicationPy::sExport(PyObject * /*self*/, PyObject *args) printer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); + + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + view->print(&printer); } } diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index 0f7e94fb67..69c39d2b77 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -56,6 +56,7 @@ #include #include #include +#include using namespace Gui; @@ -511,6 +512,15 @@ void EditorView::printPdf() printer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); + + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + d->textEdit->document()->print(&printer); } } diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index 3b3554664f..c3ece9aed2 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -39,6 +39,7 @@ #include #include +#include #include "MDIView.h" #include "MDIViewPy.h" @@ -264,6 +265,15 @@ void MDIView::printPdf() printer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); + + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + print(&printer); } } diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 864f99dd66..c67043589f 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -50,6 +50,8 @@ # include #endif + +#include #include #include #include @@ -257,6 +259,15 @@ void View3DInventor::printPdf() printer.setOutputFormat(QPrinter::PdfFormat); printer.setPageOrientation(QPageLayout::Landscape); printer.setOutputFileName(filename); + + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + print(&printer); } } diff --git a/src/Mod/Drawing/Gui/DrawingView.cpp b/src/Mod/Drawing/Gui/DrawingView.cpp index d554d00fa5..18061976e0 100644 --- a/src/Mod/Drawing/Gui/DrawingView.cpp +++ b/src/Mod/Drawing/Gui/DrawingView.cpp @@ -529,6 +529,15 @@ void DrawingView::printPdf() printer.setFullPage(true); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); + + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + printer.setCreator(QString::fromUtf8("%1 Drawing %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + printer.setPageOrientation(m_orientation); QList items = listWidget->selectedItems(); if (items.size() == 1) { diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index fb276b562a..d11f287ac9 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -23,6 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +#include #include #include #include @@ -30,6 +31,7 @@ #include #endif +#include #include #include #include @@ -307,6 +309,15 @@ void SheetView::printPdf() printer.setPageOrientation(QPageLayout::Landscape); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); + + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + printer.setCreator(QString::fromUtf8("%1 Spreadsheet %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + print(&printer); } } diff --git a/src/Mod/TechDraw/Gui/PagePrinter.cpp b/src/Mod/TechDraw/Gui/PagePrinter.cpp index 5ce473f019..06c23813bf 100644 --- a/src/Mod/TechDraw/Gui/PagePrinter.cpp +++ b/src/Mod/TechDraw/Gui/PagePrinter.cpp @@ -188,6 +188,15 @@ void PagePrinter::printAllPdf(QPrinter* printer, App::Document* doc) pdfWriter.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); pdfWriter.setTitle(documentName); + + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + pdfWriter.setCreator(QString::fromUtf8("%1 TechDraw %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + pdfWriter.setResolution(printer->resolution()); QPageLayout pageLayout = printer->pageLayout(); // we want to set the layout for the first page before we make the painter(&pdfWriter) or the layout for the first page will @@ -356,6 +365,14 @@ void PagePrinter::printPdf(ViewProviderPage* vpPage, const std::string& file) pdfWriter.setTitle(documentName); // default pdfWriter dpi is 1200. + QString appname = QCoreApplication::applicationName(); + auto config = App::Application::Config(); + QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); + QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); + QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); + pdfWriter.setCreator(QString::fromUtf8("%1 TechDraw %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + // set up the page layout auto dPage = vpPage->getDrawPage(); double width = A4Heightmm; // default to A4 Landscape 297 x 210 From bbaccbb207c5c4513123c491c52320fcfe22a86b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:47:24 +0000 Subject: [PATCH 092/224] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/Mod/Drawing/Gui/DrawingView.cpp | 3 ++- src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Mod/Drawing/Gui/DrawingView.cpp b/src/Mod/Drawing/Gui/DrawingView.cpp index 18061976e0..802b12a3fc 100644 --- a/src/Mod/Drawing/Gui/DrawingView.cpp +++ b/src/Mod/Drawing/Gui/DrawingView.cpp @@ -536,7 +536,8 @@ void DrawingView::printPdf() QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator(QString::fromUtf8("%1 Drawing %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + printer.setCreator( + QString::fromUtf8("%1 Drawing %2.%3.%4%5").arg(appname, major, minor, point, suffix)); printer.setPageOrientation(m_orientation); QList items = listWidget->selectedItems(); diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index d11f287ac9..189484b667 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -316,7 +316,8 @@ void SheetView::printPdf() QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator(QString::fromUtf8("%1 Spreadsheet %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + printer.setCreator(QString::fromUtf8("%1 Spreadsheet %2.%3.%4%5") + .arg(appname, major, minor, point, suffix)); print(&printer); } From 417e188256722709bdd1be63658c7a3766c90d1a Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 29 Jan 2025 10:50:19 +0100 Subject: [PATCH 093/224] App: Add utility method to get app name with version included --- src/App/Application.cpp | 12 ++++++++++++ src/App/Application.h | 1 + src/App/PreCompiled.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 0fc1cf62a2..0498634b8e 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -38,6 +38,7 @@ # include # include # include +# include #endif #ifdef FC_OS_WIN32 @@ -1145,6 +1146,17 @@ std::string Application::getExecutableName() return mConfig["ExeName"]; } +std::string Application::getNameWithVersion() +{ + auto appname = QCoreApplication::applicationName().toStdString(); + auto config = App::Application::Config(); + auto major = config["BuildVersionMajor"]; + auto minor = config["BuildVersionMinor"]; + auto point = config["BuildVersionPoint"]; + auto suffix = config["BuildVersionSuffix"]; + return fmt::format("{} {}.{}.{}{}", appname, major, minor, point, suffix); +} + std::string Application::getTempPath() { return mConfig["AppTempPath"]; diff --git a/src/App/Application.h b/src/App/Application.h index a2be53861b..2646737233 100644 --- a/src/App/Application.h +++ b/src/App/Application.h @@ -413,6 +413,7 @@ public: //@{ static std::string getHomePath(); static std::string getExecutableName(); + static std::string getNameWithVersion(); /*! Returns the temporary directory. By default, this is set to the system's temporary directory but can be customized by the user. diff --git a/src/App/PreCompiled.h b/src/App/PreCompiled.h index 66ec6e5a34..0523bf5744 100644 --- a/src/App/PreCompiled.h +++ b/src/App/PreCompiled.h @@ -102,6 +102,8 @@ #include #include +#include + #endif //_PreComp_ #endif // APP_PRECOMPILED_H From d242ac706e4ad74b79c89092e9e413eb5160c28e Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 29 Jan 2025 11:52:54 +0100 Subject: [PATCH 094/224] Gui: Migrate to using App::Application::getNameWithVersion --- src/Gui/ApplicationPy.cpp | 13 ++----------- src/Gui/EditorView.cpp | 11 +---------- src/Gui/MDIView.cpp | 10 +--------- src/Gui/MainWindow.cpp | 7 +------ src/Gui/View3DInventor.cpp | 10 +--------- 5 files changed, 6 insertions(+), 45 deletions(-) diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index defc585675..16dc543900 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -36,7 +36,6 @@ #include -#include #include #include #include @@ -774,19 +773,11 @@ PyObject* ApplicationPy::sExport(PyObject * /*self*/, PyObject *args) view3d->viewAll(); } QPrinter printer(QPrinter::ScreenResolution); - // setPdfVersion sets the printied PDF Version to comply with PDF/A-1b, more details under: https://www.kdab.com/creating-pdfa-documents-qt/ + // setPdfVersion sets the printed PDF Version to comply with PDF/A-1b, more details under: https://www.kdab.com/creating-pdfa-documents-qt/ printer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); - - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); - + printer.setCreator(QString::fromStdString(App::Application::getNameWithVersion())); view->print(&printer); } } diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index 69c39d2b77..8eefb03515 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -56,7 +56,6 @@ #include #include #include -#include using namespace Gui; @@ -512,15 +511,7 @@ void EditorView::printPdf() printer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); - - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); - + printer.setCreator(QString::fromStdString(App::Application::getNameWithVersion())); d->textEdit->document()->print(&printer); } } diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index c3ece9aed2..8a420a29c5 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -265,15 +265,7 @@ void MDIView::printPdf() printer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); - - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); - + printer.setCreator(QString::fromStdString(App::Application::getNameWithVersion())); print(&printer); } } diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 00cd9ae045..cdb6bda72f 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -2306,12 +2306,7 @@ void MainWindow::setWindowTitle(const QString& string) if (showVersion) { // set main window title with FreeCAD Version - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - title = QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix); + title = QString::fromStdString(App::Application::getNameWithVersion()); } else { title = appname; diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index c67043589f..c38243c473 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -259,15 +259,7 @@ void View3DInventor::printPdf() printer.setOutputFormat(QPrinter::PdfFormat); printer.setPageOrientation(QPageLayout::Landscape); printer.setOutputFileName(filename); - - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator(QString::fromUtf8("%1 %2.%3.%4%5").arg(appname, major, minor, point, suffix)); - + printer.setCreator(QString::fromStdString(App::Application::getNameWithVersion())); print(&printer); } } From 3ec49d8b8fefe941aef74929afdc910080dad7e3 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 29 Jan 2025 11:54:04 +0100 Subject: [PATCH 095/224] Spreadsheet: Migrate to using App::Application::getNameWithVersion --- src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index 189484b667..61be1aca8e 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -23,7 +23,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -#include #include #include #include @@ -309,16 +308,7 @@ void SheetView::printPdf() printer.setPageOrientation(QPageLayout::Landscape); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); - - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator(QString::fromUtf8("%1 Spreadsheet %2.%3.%4%5") - .arg(appname, major, minor, point, suffix)); - + printer.setCreator(QString::fromStdString(App::Application::getNameWithVersion())); print(&printer); } } From 52cb5af18f17ffe4660d06ef7e7f1aebdc84bbfa Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 29 Jan 2025 11:54:26 +0100 Subject: [PATCH 096/224] TD: Migrate to using App::Application::getNameWithVersion --- src/Mod/TechDraw/Gui/PagePrinter.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/Mod/TechDraw/Gui/PagePrinter.cpp b/src/Mod/TechDraw/Gui/PagePrinter.cpp index 06c23813bf..20a7f4bf9a 100644 --- a/src/Mod/TechDraw/Gui/PagePrinter.cpp +++ b/src/Mod/TechDraw/Gui/PagePrinter.cpp @@ -188,14 +188,8 @@ void PagePrinter::printAllPdf(QPrinter* printer, App::Document* doc) pdfWriter.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b); pdfWriter.setTitle(documentName); - - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - pdfWriter.setCreator(QString::fromUtf8("%1 TechDraw %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + pdfWriter.setCreator(QString::fromStdString(App::Application::getNameWithVersion()) + + QLatin1String(" TechDraw")); pdfWriter.setResolution(printer->resolution()); QPageLayout pageLayout = printer->pageLayout(); @@ -365,13 +359,8 @@ void PagePrinter::printPdf(ViewProviderPage* vpPage, const std::string& file) pdfWriter.setTitle(documentName); // default pdfWriter dpi is 1200. - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - pdfWriter.setCreator(QString::fromUtf8("%1 TechDraw %2.%3.%4%5").arg(appname, major, minor, point, suffix)); + pdfWriter.setCreator(QString::fromStdString(App::Application::getNameWithVersion()) + + QLatin1String(" TechDraw")); // set up the page layout auto dPage = vpPage->getDrawPage(); From a64927a9d8d3b4ab7a240b2579c3cdadb9520c9f Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 29 Jan 2025 11:54:46 +0100 Subject: [PATCH 097/224] Drawing: Migrate to using App::Application::getNameWithVersion --- src/Mod/Drawing/Gui/DrawingView.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Mod/Drawing/Gui/DrawingView.cpp b/src/Mod/Drawing/Gui/DrawingView.cpp index 802b12a3fc..607c63c59d 100644 --- a/src/Mod/Drawing/Gui/DrawingView.cpp +++ b/src/Mod/Drawing/Gui/DrawingView.cpp @@ -529,16 +529,7 @@ void DrawingView::printPdf() printer.setFullPage(true); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(filename); - - QString appname = QCoreApplication::applicationName(); - auto config = App::Application::Config(); - QString major = QString::fromUtf8(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromUtf8(config["BuildVersionMinor"].c_str()); - QString point = QString::fromUtf8(config["BuildVersionPoint"].c_str()); - QString suffix = QString::fromUtf8(config["BuildVersionSuffix"].c_str()); - printer.setCreator( - QString::fromUtf8("%1 Drawing %2.%3.%4%5").arg(appname, major, minor, point, suffix)); - + printer.setCreator(QString::fromStdString(App::Application::getNameWithVersion())); printer.setPageOrientation(m_orientation); QList items = listWidget->selectedItems(); if (items.size() == 1) { From f818aa514ce39375684abebea8bf0387fe7fe6d8 Mon Sep 17 00:00:00 2001 From: xtemp09 Date: Fri, 24 Jan 2025 14:22:28 +0700 Subject: [PATCH 098/224] Change FocusPolicy of some PrefWidgets to StrongFocus This commit mollifies the issue #17684 by making the PrefWidgets receive mouse wheel events only when they have both focus and the mouse pointer at the widget. --- src/Gui/PrefWidgets.cpp | 45 +++++++++++++++++++++++++++++++++++++++++ src/Gui/PrefWidgets.h | 5 +++++ 2 files changed, 50 insertions(+) diff --git a/src/Gui/PrefWidgets.cpp b/src/Gui/PrefWidgets.cpp index 445392c041..f22dc64dfe 100644 --- a/src/Gui/PrefWidgets.cpp +++ b/src/Gui/PrefWidgets.cpp @@ -169,6 +169,15 @@ void PrefWidget::failedToRestore(const QString& name) const PrefSpinBox::PrefSpinBox ( QWidget * parent ) : QSpinBox(parent), PrefWidget() { + setFocusPolicy(Qt::FocusPolicy::StrongFocus); +} + +void PrefSpinBox::wheelEvent(QWheelEvent *event) +{ + if (hasFocus()) + QSpinBox::wheelEvent(event); + else + event->ignore(); } PrefSpinBox::~PrefSpinBox() = default; @@ -201,6 +210,15 @@ void PrefSpinBox::savePreferences() PrefDoubleSpinBox::PrefDoubleSpinBox ( QWidget * parent ) : QDoubleSpinBox(parent), PrefWidget() { + setFocusPolicy(Qt::FocusPolicy::StrongFocus); +} + +void PrefDoubleSpinBox::wheelEvent(QWheelEvent *event) +{ + if (hasFocus()) + QDoubleSpinBox::wheelEvent(event); + else + event->ignore(); } PrefDoubleSpinBox::~PrefDoubleSpinBox() = default; @@ -332,6 +350,15 @@ void PrefFileChooser::savePreferences() PrefComboBox::PrefComboBox ( QWidget * parent ) : QComboBox(parent), PrefWidget() { + setFocusPolicy(Qt::FocusPolicy::StrongFocus); +} + +void PrefComboBox::wheelEvent(QWheelEvent *event) +{ + if (hasFocus()) + QComboBox::wheelEvent(event); + else + event->ignore(); } PrefComboBox::~PrefComboBox() = default; @@ -566,6 +593,15 @@ void PrefColorButton::savePreferences() PrefUnitSpinBox::PrefUnitSpinBox ( QWidget * parent ) : QuantitySpinBox(parent), PrefWidget() { + setFocusPolicy(Qt::FocusPolicy::StrongFocus); +} + +void PrefUnitSpinBox::wheelEvent(QWheelEvent *event) +{ + if (hasFocus()) + QuantitySpinBox::wheelEvent(event); + else + event->ignore(); } PrefUnitSpinBox::~PrefUnitSpinBox() = default; @@ -662,6 +698,7 @@ PrefQuantitySpinBox::PrefQuantitySpinBox (QWidget * parent) : QuantitySpinBox(parent) , d_ptr(new PrefQuantitySpinBoxPrivate()) { + setFocusPolicy(Qt::FocusPolicy::StrongFocus); } PrefQuantitySpinBox::~PrefQuantitySpinBox() = default; @@ -708,6 +745,14 @@ void PrefQuantitySpinBox::contextMenuEvent(QContextMenuEvent *event) } } +void PrefQuantitySpinBox::wheelEvent(QWheelEvent *event) +{ + if (hasFocus()) + QuantitySpinBox::wheelEvent(event); + else + event->ignore(); +} + void PrefQuantitySpinBox::restorePreferences() { Q_D(PrefQuantitySpinBox); diff --git a/src/Gui/PrefWidgets.h b/src/Gui/PrefWidgets.h index d1f1b5ede3..c805f7d063 100644 --- a/src/Gui/PrefWidgets.h +++ b/src/Gui/PrefWidgets.h @@ -123,6 +123,7 @@ public: ~PrefSpinBox() override; protected: + void wheelEvent(QWheelEvent *event) override; // restore from/save to parameters void restorePreferences() override; void savePreferences() override; @@ -143,6 +144,7 @@ public: ~PrefDoubleSpinBox() override; protected: + void wheelEvent(QWheelEvent *event) override; // restore from/save to parameters void restorePreferences() override; void savePreferences() override; @@ -236,6 +238,7 @@ public: ~PrefComboBox() override; protected: + void wheelEvent(QWheelEvent *event) override; // restore from/save to parameters void restorePreferences() override; void savePreferences() override; @@ -351,6 +354,7 @@ public: ~PrefUnitSpinBox() override; protected: + void wheelEvent(QWheelEvent *event) override; // restore from/save to parameters void restorePreferences() override; void savePreferences() override; @@ -391,6 +395,7 @@ public: protected: void contextMenuEvent(QContextMenuEvent * event) override; + void wheelEvent(QWheelEvent *event) override; // restore from/save to parameters void restorePreferences() override; void savePreferences() override; From 12c10543e4a8f208365691e787f73a2c429ad624 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Fri, 24 Jan 2025 13:35:06 +0100 Subject: [PATCH 099/224] Material: rename Materials_Edit command For consistency it should be Material_Edit. --- src/Mod/Material/Gui/CMakeLists.txt | 2 +- src/Mod/Material/Gui/Command.cpp | 26 +++++++++---------- src/Mod/Material/Gui/MaterialTreeWidget.cpp | 2 +- src/Mod/Material/Gui/Resources/Material.qrc | 2 +- .../{Materials_Edit.svg => Material_Edit.svg} | 0 src/Mod/Material/Gui/Workbench.cpp | 8 +++--- src/Mod/Material/MaterialEditor.py | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) rename src/Mod/Material/Gui/Resources/icons/{Materials_Edit.svg => Material_Edit.svg} (100%) diff --git a/src/Mod/Material/Gui/CMakeLists.txt b/src/Mod/Material/Gui/CMakeLists.txt index 43af6edaa4..0214613322 100644 --- a/src/Mod/Material/Gui/CMakeLists.txt +++ b/src/Mod/Material/Gui/CMakeLists.txt @@ -141,7 +141,7 @@ endif(FREECAD_USE_PCH) SET(MatGuiIcon_SVG Resources/icons/list.svg - Resources/icons/Materials_Edit.svg + Resources/icons/Material_Edit.svg Resources/icons/MaterialWorkbench.svg Resources/icons/multiline.svg Resources/icons/preferences-material.svg diff --git a/src/Mod/Material/Gui/Command.cpp b/src/Mod/Material/Gui/Command.cpp index cc4e399bd8..fe36ed5102 100644 --- a/src/Mod/Material/Gui/Command.cpp +++ b/src/Mod/Material/Gui/Command.cpp @@ -41,27 +41,27 @@ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //=========================================================================== -// Materials_Edit +// Material_Edit //=========================================================================== -DEF_STD_CMD_A(CmdMaterialsEdit) +DEF_STD_CMD_A(CmdMaterialEdit) -CmdMaterialsEdit::CmdMaterialsEdit() - : Command("Materials_Edit") +CmdMaterialEdit::CmdMaterialEdit() + : Command("Material_Edit") { sAppModule = "Material"; sGroup = QT_TR_NOOP("Material"); sMenuText = QT_TR_NOOP("Edit..."); sToolTipText = QT_TR_NOOP("Edit material properties"); - sWhatsThis = "Materials_Edit"; + sWhatsThis = "Material_Edit"; sStatusTip = sToolTipText; - sPixmap = "Materials_Edit"; + sPixmap = "Material_Edit"; } -void CmdMaterialsEdit::activated(int iMsg) +void CmdMaterialEdit::activated(int iMsg) { Q_UNUSED(iMsg); - Base::Console().Log("Materials_Edit\n"); + Base::Console().Log("Material_Edit\n"); static QPointer dlg = nullptr; if (!dlg) { @@ -71,7 +71,7 @@ void CmdMaterialsEdit::activated(int iMsg) dlg->show(); } -bool CmdMaterialsEdit::isActive() +bool CmdMaterialEdit::isActive() { // return (hasActiveDocument() && !Gui::Control().activeDialog()); return true; @@ -119,7 +119,7 @@ StdCmdSetMaterial::StdCmdSetMaterial() sToolTipText = QT_TR_NOOP("Sets the material of the selected object"); sWhatsThis = "Std_SetMaterial"; sStatusTip = QT_TR_NOOP("Sets the material of the selected object"); - sPixmap = "Materials_Edit"; + sPixmap = "Material_Edit"; // sAccel = "Ctrl+D"; // eType = Alter3DView; } @@ -148,7 +148,7 @@ CmdInspectAppearance::CmdInspectAppearance() sToolTipText = QT_TR_NOOP("Inspect the appearance properties of the selected object"); sWhatsThis = "Materials_InspectAppearance"; sStatusTip = QT_TR_NOOP("Inspect the appearance properties of the selected object"); - // sPixmap = "Materials_Edit"; + // sPixmap = "Material_Edit"; } void CmdInspectAppearance::activated(int iMsg) @@ -175,7 +175,7 @@ CmdInspectMaterial::CmdInspectMaterial() sToolTipText = QT_TR_NOOP("Inspect the material properties of the selected object"); sWhatsThis = "Materials_InspectMaterial"; sStatusTip = QT_TR_NOOP("Inspect the material properties of the selected object"); - // sPixmap = "Materials_Edit"; + // sPixmap = "Material_Edit"; } void CmdInspectMaterial::activated(int iMsg) @@ -195,7 +195,7 @@ void CreateMaterialCommands() { Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager(); - rcCmdMgr.addCommand(new CmdMaterialsEdit()); + rcCmdMgr.addCommand(new CmdMaterialEdit()); rcCmdMgr.addCommand(new StdCmdSetAppearance()); rcCmdMgr.addCommand(new StdCmdSetMaterial()); rcCmdMgr.addCommand(new CmdInspectAppearance()); diff --git a/src/Mod/Material/Gui/MaterialTreeWidget.cpp b/src/Mod/Material/Gui/MaterialTreeWidget.cpp index 4a37d36617..823d424318 100644 --- a/src/Mod/Material/Gui/MaterialTreeWidget.cpp +++ b/src/Mod/Material/Gui/MaterialTreeWidget.cpp @@ -255,7 +255,7 @@ void MaterialTreeWidget::editorClicked(bool checked) setMaterial(material->getUUID()); } - // Gui::Application::Instance->commandManager().runCommandByName("Materials_Edit"); + // Gui::Application::Instance->commandManager().runCommandByName("Material_Edit"); // Toggle the open state // setExpanded(!m_expanded); } diff --git a/src/Mod/Material/Gui/Resources/Material.qrc b/src/Mod/Material/Gui/Resources/Material.qrc index 3e9650798d..0ba4ea086e 100644 --- a/src/Mod/Material/Gui/Resources/Material.qrc +++ b/src/Mod/Material/Gui/Resources/Material.qrc @@ -2,7 +2,7 @@ icons/list.svg icons/MaterialWorkbench.svg - icons/Materials_Edit.svg + icons/Material_Edit.svg icons/multiline.svg icons/preferences-material.svg icons/preview-rendered.svg diff --git a/src/Mod/Material/Gui/Resources/icons/Materials_Edit.svg b/src/Mod/Material/Gui/Resources/icons/Material_Edit.svg similarity index 100% rename from src/Mod/Material/Gui/Resources/icons/Materials_Edit.svg rename to src/Mod/Material/Gui/Resources/icons/Material_Edit.svg diff --git a/src/Mod/Material/Gui/Workbench.cpp b/src/Mod/Material/Gui/Workbench.cpp index b988ef4791..ac79812837 100644 --- a/src/Mod/Material/Gui/Workbench.cpp +++ b/src/Mod/Material/Gui/Workbench.cpp @@ -49,8 +49,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const Gui::MenuItem* material = new Gui::MenuItem; root->insertItem(item, material); - material->setCommand("&Materials"); - *material << "Materials_Edit"; + material->setCommand("&Material"); + *material << "Material_Edit"; return root; } @@ -60,8 +60,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const Gui::ToolBarItem* root = StdWorkbench::setupToolBars(); Gui::ToolBarItem* material = new Gui::ToolBarItem(root); - material->setCommand("Materials"); - *material << "Materials_Edit"; + material->setCommand("Material"); + *material << "Material_Edit"; return root; } diff --git a/src/Mod/Material/MaterialEditor.py b/src/Mod/Material/MaterialEditor.py index 2b060b8bd6..1c2e3e3882 100644 --- a/src/Mod/Material/MaterialEditor.py +++ b/src/Mod/Material/MaterialEditor.py @@ -950,7 +950,7 @@ def openEditor(obj=None, prop=None): # editor = MaterialEditor(obj, prop) # editor.exec_() # else: - FreeCADGui.runCommand('Materials_Edit',0) + FreeCADGui.runCommand('Material_Edit',0) def editMaterial(material=None, card_path=None, category="Solid"): From 89f307b7a2fe518d0cba04ff2e54ad00996bc5d1 Mon Sep 17 00:00:00 2001 From: mwganson Date: Fri, 24 Jan 2025 17:24:37 -0600 Subject: [PATCH 100/224] [Part TopoShapeExpansion] move shape transform from make element copy into ruled surface function since it does not work well when copying vertex objects --- src/Mod/Part/App/TopoShapeExpansion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mod/Part/App/TopoShapeExpansion.cpp b/src/Mod/Part/App/TopoShapeExpansion.cpp index 133f8af8de..710950afa9 100644 --- a/src/Mod/Part/App/TopoShapeExpansion.cpp +++ b/src/Mod/Part/App/TopoShapeExpansion.cpp @@ -2203,8 +2203,8 @@ TopoShape& TopoShape::makeElementRuledSurface(const std::vector& shap // if both shapes are sub-elements of one common shape then the fill // algorithm leads to problems if the shape has set a placement. The // workaround is to copy the sub-shape - S1 = S1.makeElementCopy(); - S2 = S2.makeElementCopy(); + S1.setTransform(S1.getTransform()); + S2.setTransform(S2.getTransform()); if (orientation == 0) { // Automatic @@ -3427,7 +3427,7 @@ TopoShape::makeElementCopy(const TopoShape& shape, const char* op, bool copyGeom TopoShape tmp(shape); tmp.setShape(BRepBuilderAPI_Copy(shape.getShape(), copyGeom, copyMesh).Shape(), false); - tmp.setTransform(shape.getTransform()); + if (op || (shape.Tag && shape.Tag != Tag)) { setShape(tmp._Shape); initCache(); From 2225e7c32f199a504273de7db1a2ac3af1003018 Mon Sep 17 00:00:00 2001 From: mwganson Date: Sat, 25 Jan 2025 13:14:32 -0600 Subject: [PATCH 101/224] [Mesh Python] Mesh.show() returns python object, update documentation for Mesh.show(), Part.show(), and Points.show() --- src/Mod/Mesh/App/AppMeshPy.cpp | 5 ++--- src/Mod/Part/App/AppPartPy.cpp | 3 ++- src/Mod/Points/App/AppPointsPy.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Mod/Mesh/App/AppMeshPy.cpp b/src/Mod/Mesh/App/AppMeshPy.cpp index 6ec639a3c4..cfcbf3e0ef 100644 --- a/src/Mod/Mesh/App/AppMeshPy.cpp +++ b/src/Mod/Mesh/App/AppMeshPy.cpp @@ -82,7 +82,7 @@ public: add_varargs_method("show", &Module::show, "show(shape,[string]) -- Add the mesh to the active document or create " - "one if no document exists."); + "one if no document exists. Returns document object."); add_varargs_method("createBox", &Module::createBox, "Create a solid mesh box"); add_varargs_method("createPlane", &Module::createPlane, "Create a mesh XY plane normal +Z"); add_varargs_method("createSphere", &Module::createSphere, "Create a tessellated sphere"); @@ -311,8 +311,7 @@ private: } // copy the data pcFeature->Mesh.setValue(*mo); - - return Py::None(); + return Py::asObject(pcFeature->getPyObject()); } Py::Object createBox(const Py::Tuple& args) { diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index 3c5e718f92..05cf1dc500 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -425,7 +425,8 @@ public: "read(string) -- Load the file and return the shape." ); add_varargs_method("show",&Module::show, - "show(shape,[string]) -- Add the shape to the active document or create one if no document exists." + "show(shape,[string]) -- Add the shape to the active document or create one if no document exists.\n" + "Returns document object." ); add_varargs_method("getFacets",&Module::getFacets, "getFacets(shape): simplified mesh generation" diff --git a/src/Mod/Points/App/AppPointsPy.cpp b/src/Mod/Points/App/AppPointsPy.cpp index 4fd98d8e86..e5f1d49e1e 100644 --- a/src/Mod/Points/App/AppPointsPy.cpp +++ b/src/Mod/Points/App/AppPointsPy.cpp @@ -55,7 +55,7 @@ public: add_varargs_method("show", &Module::show, "show(points,[string]) -- Add the points to the active document or " - "create one if no document exists."); + "create one if no document exists. Returns document object."); initialize("This module is the Points module."); // register with Python } From 34a3d3d4396e261e2824ff90c1d63f00babd3796 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:48:06 +0000 Subject: [PATCH 102/224] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 1b2427a2b785cc4aac97c19bb4b9a0de063f9547 → 8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b](https://github.com/psf/black/compare/1b2427a2b785cc4aac97c19bb4b9a0de063f9547...8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 023bc14284..4654bbb76a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,7 @@ repos: - id: check-added-large-files - id: mixed-line-ending - repo: https://github.com/psf/black - rev: 1b2427a2b785cc4aac97c19bb4b9a0de063f9547 # frozen: 24.10.0 + rev: 8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b # frozen: 25.1.0 hooks: - id: black args: ['--line-length', '100'] From 17e17cccb54df6fe0e37080aac68827efab4ec5d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:50:53 +0000 Subject: [PATCH 103/224] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/Mod/AddonManager/Addon.py | 2 +- src/Mod/AddonManager/AddonManagerOptions.py | 2 +- src/Mod/AddonManager/AddonStats.py | 2 +- .../addonmanager_widget_addon_buttons.py | 2 +- .../addonmanager_widget_filter_selector.py | 2 +- .../addonmanager_widget_global_buttons.py | 4 +- .../addonmanager_widget_progress_bar.py | 2 +- .../Widgets/addonmanager_widget_search.py | 2 +- .../addonmanager_widget_view_control_bar.py | 2 +- .../addonmanager_widget_view_selector.py | 2 +- .../addonmanager_connection_checker.py | 2 +- src/Mod/AddonManager/addonmanager_devmode.py | 2 +- .../addonmanager_devmode_add_content.py | 4 +- .../addonmanager_devmode_license_selector.py | 2 +- .../addonmanager_devmode_licenses_table.py | 2 +- .../addonmanager_devmode_metadata_checker.py | 2 +- .../addonmanager_devmode_people_table.py | 2 +- .../addonmanager_devmode_person_editor.py | 2 +- .../addonmanager_devmode_predictor.py | 2 +- .../addonmanager_devmode_validators.py | 2 +- src/Mod/AddonManager/addonmanager_firstrun.py | 2 +- .../AddonManager/addonmanager_installer.py | 2 +- src/Mod/AddonManager/addonmanager_licenses.py | 4 +- src/Mod/AddonManager/addonmanager_macro.py | 2 +- .../addonmanager_python_deps_gui.py | 4 +- .../addonmanager_readme_controller.py | 2 +- .../AddonManager/addonmanager_uninstaller.py | 2 +- .../AddonManager/addonmanager_utilities.py | 2 +- .../addonmanager_workers_installation.py | 2 +- .../addonmanager_workers_startup.py | 2 +- .../addonmanager_workers_utility.py | 2 +- src/Mod/AddonManager/composite_view.py | 2 +- src/Mod/AddonManager/install_to_toolbar.py | 2 +- src/Mod/AddonManager/package_list.py | 2 +- src/Mod/CAM/Path/Main/Gui/Fixture.py | 2 +- src/Mod/CAM/Path/Op/Gui/Selection.py | 2 +- src/Mod/CAM/Path/Post/Command.py | 2 +- src/Mod/CAM/PathScripts/PathUtils.py | 2 +- src/Mod/Fem/femguiutils/migrate_gui.py | 2 +- src/Mod/Fem/femsolver/run.py | 2 +- src/Mod/Fem/femsolver/settings.py | 2 +- src/Mod/Fem/femtools/constants.py | 2 +- src/Mod/Fem/femtools/femutils.py | 2 +- src/Mod/Fem/femtools/membertools.py | 2 +- src/Mod/Fem/femtools/migrate_app.py | 2 +- src/Mod/Mesh/BuildRegularGeoms.py | 6 +-- src/Mod/MeshPart/InitGui.py | 1 + src/Mod/Test/GuiDocument.py | 40 +++++++++---------- src/Tools/_TEMPLATEPY_/InitGui.py | 1 + src/Tools/_TEMPLATE_/InitGui.py | 1 + src/Tools/updatecrowdin.py | 4 -- 51 files changed, 75 insertions(+), 76 deletions(-) diff --git a/src/Mod/AddonManager/Addon.py b/src/Mod/AddonManager/Addon.py index 7266dba998..d028429689 100644 --- a/src/Mod/AddonManager/Addon.py +++ b/src/Mod/AddonManager/Addon.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines the Addon class to encapsulate information about FreeCAD Addons """ +"""Defines the Addon class to encapsulate information about FreeCAD Addons""" import os import re diff --git a/src/Mod/AddonManager/AddonManagerOptions.py b/src/Mod/AddonManager/AddonManagerOptions.py index 4b1d7e2300..783f1a733a 100644 --- a/src/Mod/AddonManager/AddonManagerOptions.py +++ b/src/Mod/AddonManager/AddonManagerOptions.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Contains a the Addon Manager's preferences dialog management class """ +"""Contains a the Addon Manager's preferences dialog management class""" import os diff --git a/src/Mod/AddonManager/AddonStats.py b/src/Mod/AddonManager/AddonStats.py index 60c329dcc8..4cf7b319ac 100644 --- a/src/Mod/AddonManager/AddonStats.py +++ b/src/Mod/AddonManager/AddonStats.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Classes and structures related to Addon sidecar information """ +"""Classes and structures related to Addon sidecar information""" from __future__ import annotations from dataclasses import dataclass diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_addon_buttons.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_addon_buttons.py index 8c65c5998c..e5ffc3fdc1 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_addon_buttons.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_addon_buttons.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines a QWidget-derived class for displaying the single-addon buttons. """ +"""Defines a QWidget-derived class for displaying the single-addon buttons.""" from enum import Enum, auto diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py index a8fb528dc4..308335e3c9 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_filter_selector.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines a QWidget-derived class for displaying the view selection buttons. """ +"""Defines a QWidget-derived class for displaying the view selection buttons.""" from enum import IntEnum diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_global_buttons.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_global_buttons.py index cce7336890..67833201bd 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_global_buttons.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_global_buttons.py @@ -21,9 +21,9 @@ # * * # *************************************************************************** -""" Defines a QWidget-derived class for displaying a set of buttons that affect the Addon +"""Defines a QWidget-derived class for displaying a set of buttons that affect the Addon Manager as a whole (rather than a specific Addon). Typically inserted at the bottom of the Addon -Manager main window. """ +Manager main window.""" try: import FreeCAD diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_progress_bar.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_progress_bar.py index 2e069a5baf..1e9c0a1f20 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_progress_bar.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_progress_bar.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines a QWidget-derived class for displaying the cache load status. """ +"""Defines a QWidget-derived class for displaying the cache load status.""" try: import FreeCAD diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_search.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_search.py index 7da8b1c271..339f31fcdf 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_search.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_search.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines a QWidget-derived class for displaying the view selection buttons. """ +"""Defines a QWidget-derived class for displaying the view selection buttons.""" try: import FreeCAD diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_view_control_bar.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_view_control_bar.py index 9343b030e1..3d44a18954 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_view_control_bar.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_view_control_bar.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines a class derived from QWidget for displaying the bar at the top of the addons list. """ +"""Defines a class derived from QWidget for displaying the bar at the top of the addons list.""" from enum import IntEnum, auto diff --git a/src/Mod/AddonManager/Widgets/addonmanager_widget_view_selector.py b/src/Mod/AddonManager/Widgets/addonmanager_widget_view_selector.py index 3049d23194..7a65a0f655 100644 --- a/src/Mod/AddonManager/Widgets/addonmanager_widget_view_selector.py +++ b/src/Mod/AddonManager/Widgets/addonmanager_widget_view_selector.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines a QWidget-derived class for displaying the view selection buttons. """ +"""Defines a QWidget-derived class for displaying the view selection buttons.""" from enum import IntEnum diff --git a/src/Mod/AddonManager/addonmanager_connection_checker.py b/src/Mod/AddonManager/addonmanager_connection_checker.py index ac3c08aa14..1b721ce761 100644 --- a/src/Mod/AddonManager/addonmanager_connection_checker.py +++ b/src/Mod/AddonManager/addonmanager_connection_checker.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" System for checking the network connection status asynchronously. """ +"""System for checking the network connection status asynchronously.""" import FreeCAD diff --git a/src/Mod/AddonManager/addonmanager_devmode.py b/src/Mod/AddonManager/addonmanager_devmode.py index 860b9ab934..4888ae6076 100644 --- a/src/Mod/AddonManager/addonmanager_devmode.py +++ b/src/Mod/AddonManager/addonmanager_devmode.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Classes to manage "Developer Mode" """ +"""Classes to manage "Developer Mode" """ import os import datetime diff --git a/src/Mod/AddonManager/addonmanager_devmode_add_content.py b/src/Mod/AddonManager/addonmanager_devmode_add_content.py index c5994ccbab..f990f643ec 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_add_content.py +++ b/src/Mod/AddonManager/addonmanager_devmode_add_content.py @@ -21,8 +21,8 @@ # * * # *************************************************************************** -""" Contains a class for adding a single content item, as well as auxiliary classes for -its dependent dialog boxes. """ +"""Contains a class for adding a single content item, as well as auxiliary classes for +its dependent dialog boxes.""" import os from typing import Optional, Tuple, List diff --git a/src/Mod/AddonManager/addonmanager_devmode_license_selector.py b/src/Mod/AddonManager/addonmanager_devmode_license_selector.py index 72db565694..2e6441d9f8 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_license_selector.py +++ b/src/Mod/AddonManager/addonmanager_devmode_license_selector.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Contains a class to manage selection of a license for an Addon. """ +"""Contains a class to manage selection of a license for an Addon.""" import os from datetime import date diff --git a/src/Mod/AddonManager/addonmanager_devmode_licenses_table.py b/src/Mod/AddonManager/addonmanager_devmode_licenses_table.py index 1d52568471..26e29c434c 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_licenses_table.py +++ b/src/Mod/AddonManager/addonmanager_devmode_licenses_table.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Contains a wrapper class for a table listing authors and maintainers """ +"""Contains a wrapper class for a table listing authors and maintainers""" import os diff --git a/src/Mod/AddonManager/addonmanager_devmode_metadata_checker.py b/src/Mod/AddonManager/addonmanager_devmode_metadata_checker.py index d1ec922836..efae4ab928 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_metadata_checker.py +++ b/src/Mod/AddonManager/addonmanager_devmode_metadata_checker.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Metadata validation functions """ +"""Metadata validation functions""" from typing import List diff --git a/src/Mod/AddonManager/addonmanager_devmode_people_table.py b/src/Mod/AddonManager/addonmanager_devmode_people_table.py index e6caca269a..048100bff4 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_people_table.py +++ b/src/Mod/AddonManager/addonmanager_devmode_people_table.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Contains a wrapper class for a table listing authors and maintainers """ +"""Contains a wrapper class for a table listing authors and maintainers""" import os diff --git a/src/Mod/AddonManager/addonmanager_devmode_person_editor.py b/src/Mod/AddonManager/addonmanager_devmode_person_editor.py index 4c1fbda24c..12f5d2a31a 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_person_editor.py +++ b/src/Mod/AddonManager/addonmanager_devmode_person_editor.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Contains a class to handle editing a person (from a Metadata standpoint). """ +"""Contains a class to handle editing a person (from a Metadata standpoint).""" import os from typing import Tuple # Needed until Py 3.9, when tuple supports this directly diff --git a/src/Mod/AddonManager/addonmanager_devmode_predictor.py b/src/Mod/AddonManager/addonmanager_devmode_predictor.py index 278ada4e87..012e0eb6c5 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_predictor.py +++ b/src/Mod/AddonManager/addonmanager_devmode_predictor.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Class to guess metadata based on folder contents. Note that one of the functions +"""Class to guess metadata based on folder contents. Note that one of the functions of this file is to guess the license being applied to the new software package based in its contents. It is up to the user to make the final determination about whether the selected license is the correct one, and inclusion here shouldn't be construed as diff --git a/src/Mod/AddonManager/addonmanager_devmode_validators.py b/src/Mod/AddonManager/addonmanager_devmode_validators.py index 000f2aaefc..c4c7e71fda 100644 --- a/src/Mod/AddonManager/addonmanager_devmode_validators.py +++ b/src/Mod/AddonManager/addonmanager_devmode_validators.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Validators used for various line edits """ +"""Validators used for various line edits""" import keyword diff --git a/src/Mod/AddonManager/addonmanager_firstrun.py b/src/Mod/AddonManager/addonmanager_firstrun.py index 2fc9f8a3b1..2b8cbeb378 100644 --- a/src/Mod/AddonManager/addonmanager_firstrun.py +++ b/src/Mod/AddonManager/addonmanager_firstrun.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Class to display a first-run dialog for the Addon Manager """ +"""Class to display a first-run dialog for the Addon Manager""" import os diff --git a/src/Mod/AddonManager/addonmanager_installer.py b/src/Mod/AddonManager/addonmanager_installer.py index d3f2f7de1b..059f0fc0c1 100644 --- a/src/Mod/AddonManager/addonmanager_installer.py +++ b/src/Mod/AddonManager/addonmanager_installer.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Contains the classes to manage Addon installation: intended as a stable API, safe for external +"""Contains the classes to manage Addon installation: intended as a stable API, safe for external code to call and to rely upon existing. See classes AddonInstaller and MacroInstaller for details. """ import json diff --git a/src/Mod/AddonManager/addonmanager_licenses.py b/src/Mod/AddonManager/addonmanager_licenses.py index 5781c093a2..46af254959 100644 --- a/src/Mod/AddonManager/addonmanager_licenses.py +++ b/src/Mod/AddonManager/addonmanager_licenses.py @@ -21,9 +21,9 @@ # * * # *************************************************************************** -""" Utilities for working with licenses. Based on SPDX info downloaded from +"""Utilities for working with licenses. Based on SPDX info downloaded from https://github.com/spdx/license-list-data and stored as part of the FreeCAD repo, loaded into a Qt -resource. """ +resource.""" import json diff --git a/src/Mod/AddonManager/addonmanager_macro.py b/src/Mod/AddonManager/addonmanager_macro.py index 2af34c7b2c..9858076f9c 100644 --- a/src/Mod/AddonManager/addonmanager_macro.py +++ b/src/Mod/AddonManager/addonmanager_macro.py @@ -22,7 +22,7 @@ # * * # *************************************************************************** -""" Unified handler for FreeCAD macros that can be obtained from different sources. """ +"""Unified handler for FreeCAD macros that can be obtained from different sources.""" import os import re diff --git a/src/Mod/AddonManager/addonmanager_python_deps_gui.py b/src/Mod/AddonManager/addonmanager_python_deps_gui.py index 4419b1635c..eb669a8cdc 100644 --- a/src/Mod/AddonManager/addonmanager_python_deps_gui.py +++ b/src/Mod/AddonManager/addonmanager_python_deps_gui.py @@ -21,9 +21,9 @@ # * * # *************************************************************************** -""" Provides classes and support functions for managing the automatically-installed +"""Provides classes and support functions for managing the automatically-installed Python library dependencies. No support is provided for uninstalling those dependencies -because pip's uninstall function does not support the target directory argument. """ +because pip's uninstall function does not support the target directory argument.""" import json import os diff --git a/src/Mod/AddonManager/addonmanager_readme_controller.py b/src/Mod/AddonManager/addonmanager_readme_controller.py index 7507db4afd..d7b1624a9f 100644 --- a/src/Mod/AddonManager/addonmanager_readme_controller.py +++ b/src/Mod/AddonManager/addonmanager_readme_controller.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" A Qt Widget for displaying Addon README information """ +"""A Qt Widget for displaying Addon README information""" import FreeCAD from Addon import Addon diff --git a/src/Mod/AddonManager/addonmanager_uninstaller.py b/src/Mod/AddonManager/addonmanager_uninstaller.py index bf709f9172..448031e890 100644 --- a/src/Mod/AddonManager/addonmanager_uninstaller.py +++ b/src/Mod/AddonManager/addonmanager_uninstaller.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Contains the classes to manage Addon removal: intended as a stable API, safe for +"""Contains the classes to manage Addon removal: intended as a stable API, safe for external code to call and to rely upon existing. See classes AddonUninstaller and MacroUninstaller for details.""" import json diff --git a/src/Mod/AddonManager/addonmanager_utilities.py b/src/Mod/AddonManager/addonmanager_utilities.py index a82f29f6d7..fd90358a52 100644 --- a/src/Mod/AddonManager/addonmanager_utilities.py +++ b/src/Mod/AddonManager/addonmanager_utilities.py @@ -22,7 +22,7 @@ # * * # *************************************************************************** -""" Utilities to work across different platforms, providers and python versions """ +"""Utilities to work across different platforms, providers and python versions""" from datetime import datetime from typing import Optional, Any diff --git a/src/Mod/AddonManager/addonmanager_workers_installation.py b/src/Mod/AddonManager/addonmanager_workers_installation.py index ff3e063ece..635b2650ab 100644 --- a/src/Mod/AddonManager/addonmanager_workers_installation.py +++ b/src/Mod/AddonManager/addonmanager_workers_installation.py @@ -22,7 +22,7 @@ # * * # *************************************************************************** -""" Worker thread classes for Addon Manager installation and removal """ +"""Worker thread classes for Addon Manager installation and removal""" # pylint: disable=c-extension-no-member,too-few-public-methods,too-many-instance-attributes diff --git a/src/Mod/AddonManager/addonmanager_workers_startup.py b/src/Mod/AddonManager/addonmanager_workers_startup.py index c84b226c6a..3b0bf82b10 100644 --- a/src/Mod/AddonManager/addonmanager_workers_startup.py +++ b/src/Mod/AddonManager/addonmanager_workers_startup.py @@ -22,7 +22,7 @@ # * * # *************************************************************************** -""" Worker thread classes for Addon Manager startup """ +"""Worker thread classes for Addon Manager startup""" import hashlib import json import os diff --git a/src/Mod/AddonManager/addonmanager_workers_utility.py b/src/Mod/AddonManager/addonmanager_workers_utility.py index 48b8d360bd..5c8aa1b538 100644 --- a/src/Mod/AddonManager/addonmanager_workers_utility.py +++ b/src/Mod/AddonManager/addonmanager_workers_utility.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Misc. worker thread classes for the FreeCAD Addon Manager. """ +"""Misc. worker thread classes for the FreeCAD Addon Manager.""" from typing import Optional diff --git a/src/Mod/AddonManager/composite_view.py b/src/Mod/AddonManager/composite_view.py index d9c429d5df..c20a724225 100644 --- a/src/Mod/AddonManager/composite_view.py +++ b/src/Mod/AddonManager/composite_view.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Provides a class for showing the list view and detail view at the same time. """ +"""Provides a class for showing the list view and detail view at the same time.""" import base64 diff --git a/src/Mod/AddonManager/install_to_toolbar.py b/src/Mod/AddonManager/install_to_toolbar.py index c40af1bf39..9f3ba038b8 100644 --- a/src/Mod/AddonManager/install_to_toolbar.py +++ b/src/Mod/AddonManager/install_to_toolbar.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" A collection of functions to handle installing a macro icon to the toolbar. """ +"""A collection of functions to handle installing a macro icon to the toolbar.""" import os diff --git a/src/Mod/AddonManager/package_list.py b/src/Mod/AddonManager/package_list.py index 921337af50..b4590b776f 100644 --- a/src/Mod/AddonManager/package_list.py +++ b/src/Mod/AddonManager/package_list.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -""" Defines the PackageList QWidget for displaying a list of Addons. """ +"""Defines the PackageList QWidget for displaying a list of Addons.""" import datetime import threading diff --git a/src/Mod/CAM/Path/Main/Gui/Fixture.py b/src/Mod/CAM/Path/Main/Gui/Fixture.py index e701db08f5..51f4644330 100644 --- a/src/Mod/CAM/Path/Main/Gui/Fixture.py +++ b/src/Mod/CAM/Path/Main/Gui/Fixture.py @@ -20,7 +20,7 @@ # * * # *************************************************************************** -""" Used to create CNC machine fixture offsets such as G54,G55, etc...""" +"""Used to create CNC machine fixture offsets such as G54,G55, etc...""" import FreeCAD import FreeCADGui diff --git a/src/Mod/CAM/Path/Op/Gui/Selection.py b/src/Mod/CAM/Path/Op/Gui/Selection.py index 547a6521e4..ff0e033a02 100644 --- a/src/Mod/CAM/Path/Op/Gui/Selection.py +++ b/src/Mod/CAM/Path/Op/Gui/Selection.py @@ -21,7 +21,7 @@ # * * # *************************************************************************** -"""Selection gates and observers to control selectability while building Path operations """ +"""Selection gates and observers to control selectability while building Path operations""" import FreeCAD import FreeCADGui diff --git a/src/Mod/CAM/Path/Post/Command.py b/src/Mod/CAM/Path/Post/Command.py index 9fa9be28c1..275052860b 100644 --- a/src/Mod/CAM/Path/Post/Command.py +++ b/src/Mod/CAM/Path/Post/Command.py @@ -21,7 +21,7 @@ # *************************************************************************** """Post Process command that will make use of the Output File and Post -Processor entries in PathJob """ +Processor entries in PathJob""" import FreeCAD diff --git a/src/Mod/CAM/PathScripts/PathUtils.py b/src/Mod/CAM/PathScripts/PathUtils.py index 0b48c04b1e..10a846456c 100644 --- a/src/Mod/CAM/PathScripts/PathUtils.py +++ b/src/Mod/CAM/PathScripts/PathUtils.py @@ -19,7 +19,7 @@ # * USA * # * * # *************************************************************************** -"""PathUtils -common functions used in PathScripts for filtering, sorting, and generating gcode toolpath data """ +"""PathUtils -common functions used in PathScripts for filtering, sorting, and generating gcode toolpath data""" import FreeCAD from FreeCAD import Vector diff --git a/src/Mod/Fem/femguiutils/migrate_gui.py b/src/Mod/Fem/femguiutils/migrate_gui.py index 709f5bc829..bd7f7a8024 100644 --- a/src/Mod/Fem/femguiutils/migrate_gui.py +++ b/src/Mod/Fem/femguiutils/migrate_gui.py @@ -20,7 +20,7 @@ # * USA * # * * # *************************************************************************** -""" Class and methods to migrate old FEM Gui objects +"""Class and methods to migrate old FEM Gui objects see module end as well as forum topic https://forum.freecad.org/viewtopic.php?&t=46218 diff --git a/src/Mod/Fem/femsolver/run.py b/src/Mod/Fem/femsolver/run.py index 1678f52ced..d3fcb18f4e 100644 --- a/src/Mod/Fem/femsolver/run.py +++ b/src/Mod/Fem/femsolver/run.py @@ -21,7 +21,7 @@ # * USA * # * * # *************************************************************************** -""" Execute Solver and obtain Reports and Results. +"""Execute Solver and obtain Reports and Results. Integral part of the Solver Framework which contains components responsible for executing the solver in the background. Also provides an asynchronous diff --git a/src/Mod/Fem/femsolver/settings.py b/src/Mod/Fem/femsolver/settings.py index 57d9319a33..c9af5eb92d 100644 --- a/src/Mod/Fem/femsolver/settings.py +++ b/src/Mod/Fem/femsolver/settings.py @@ -21,7 +21,7 @@ # * USA * # * * # *************************************************************************** -""" Query FEM specific settings including solver settings. +"""Query FEM specific settings including solver settings. Query settings from the hierarchically organized settings/parameter system of FreeCAD related to the FEM module. The collection of independent functions use diff --git a/src/Mod/Fem/femtools/constants.py b/src/Mod/Fem/femtools/constants.py index 1964fd317a..ac2e29d9e0 100644 --- a/src/Mod/Fem/femtools/constants.py +++ b/src/Mod/Fem/femtools/constants.py @@ -20,7 +20,7 @@ # * USA * # * * # *************************************************************************** -""" Collection of natural constants for the Fem module. +"""Collection of natural constants for the Fem module. This module contains natural constants for the Fem module. All constants are in SI units. diff --git a/src/Mod/Fem/femtools/femutils.py b/src/Mod/Fem/femtools/femutils.py index af96a46be6..baa22be276 100644 --- a/src/Mod/Fem/femtools/femutils.py +++ b/src/Mod/Fem/femtools/femutils.py @@ -22,7 +22,7 @@ # * USA * # * * # *************************************************************************** -""" Collection of functions for the Fem module. +"""Collection of functions for the Fem module. This module contains function for extracting relevant parts of geometry and a few unrelated function useful at various places in the Fem module. diff --git a/src/Mod/Fem/femtools/membertools.py b/src/Mod/Fem/femtools/membertools.py index 44fbfd5340..48d97c162a 100644 --- a/src/Mod/Fem/femtools/membertools.py +++ b/src/Mod/Fem/femtools/membertools.py @@ -21,7 +21,7 @@ # * USA * # * * # *************************************************************************** -""" Collection of functions for the Fem module. +"""Collection of functions for the Fem module. This module contains function for managing a analysis and all the different types of objects it contains, helper for executing a simulation. diff --git a/src/Mod/Fem/femtools/migrate_app.py b/src/Mod/Fem/femtools/migrate_app.py index 902fcbcc2c..8b97e5b1ce 100644 --- a/src/Mod/Fem/femtools/migrate_app.py +++ b/src/Mod/Fem/femtools/migrate_app.py @@ -20,7 +20,7 @@ # * USA * # * * # *************************************************************************** -""" Class and methods to migrate old FEM App objects +"""Class and methods to migrate old FEM App objects see module end as well as forum topic https://forum.freecad.org/viewtopic.php?&t=46218 diff --git a/src/Mod/Mesh/BuildRegularGeoms.py b/src/Mod/Mesh/BuildRegularGeoms.py index 4be4b09cfe..ef34996c5e 100644 --- a/src/Mod/Mesh/BuildRegularGeoms.py +++ b/src/Mod/Mesh/BuildRegularGeoms.py @@ -7,9 +7,9 @@ Return value are list of vectors, 3 vectors define a facet. Sample code for creating a mesh: - facets = Cube(3.0, 4.0, 5.0) - m = Mesh.newMesh() - m.addFacets(facets) + facets = Cube(3.0, 4.0, 5.0) + m = Mesh.newMesh() + m.addFacets(facets) """ diff --git a/src/Mod/MeshPart/InitGui.py b/src/Mod/MeshPart/InitGui.py index c4cea6af20..38cee8a100 100644 --- a/src/Mod/MeshPart/InitGui.py +++ b/src/Mod/MeshPart/InitGui.py @@ -31,6 +31,7 @@ class MeshPartWorkbench(Workbench): "MeshPart workbench object" + Icon = """ /* XPM */ static const char *MeshPart_Box[]={ diff --git a/src/Mod/Test/GuiDocument.py b/src/Mod/Test/GuiDocument.py index f5980e959b..595a131001 100644 --- a/src/Mod/Test/GuiDocument.py +++ b/src/Mod/Test/GuiDocument.py @@ -1,25 +1,25 @@ # SPDX-License-Identifier: LGPL-2.1-or-later """************************************************************************** - * * - * Copyright (c) 2024 Ondsel * - * * - * This file is part of FreeCAD. * - * * - * FreeCAD is free software: you can redistribute it and/or modify it * - * under the terms of the GNU Lesser General Public License as * - * published by the Free Software Foundation, either version 2.1 of the * - * License, or (at your option) any later version. * - * * - * 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 Lesser General Public * - * License along with FreeCAD. If not, see * - * . * - * * - ***************************************************************************/""" +* * +* Copyright (c) 2024 Ondsel * +* * +* This file is part of FreeCAD. * +* * +* FreeCAD is free software: you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as * +* published by the Free Software Foundation, either version 2.1 of the * +* License, or (at your option) any later version. * +* * +* 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 Lesser General Public * +* License along with FreeCAD. If not, see * +* . * +* * +***************************************************************************/""" import FreeCAD, FreeCADGui, unittest diff --git a/src/Tools/_TEMPLATEPY_/InitGui.py b/src/Tools/_TEMPLATEPY_/InitGui.py index b6721b7f85..c99dce969e 100644 --- a/src/Tools/_TEMPLATEPY_/InitGui.py +++ b/src/Tools/_TEMPLATEPY_/InitGui.py @@ -6,6 +6,7 @@ class _TEMPLATEPY_Workbench(Workbench): "_TEMPLATEPY_ workbench object" + Icon = FreeCAD.getResourceDir() + "Mod/_TEMPLATEPY_/Resources/icons/_TEMPLATEPY_Workbench.svg" MenuText = "_TEMPLATEPY_" ToolTip = "_TEMPLATEPY_ workbench" diff --git a/src/Tools/_TEMPLATE_/InitGui.py b/src/Tools/_TEMPLATE_/InitGui.py index 6ebe346b82..b1f37f69ef 100644 --- a/src/Tools/_TEMPLATE_/InitGui.py +++ b/src/Tools/_TEMPLATE_/InitGui.py @@ -4,6 +4,7 @@ class _TEMPLATE_Workbench(Workbench): "_TEMPLATE_ workbench object" + MenuText = "_TEMPLATE_" ToolTip = "_TEMPLATE_ workbench" diff --git a/src/Tools/updatecrowdin.py b/src/Tools/updatecrowdin.py index f7b601e91c..79a4520ad1 100755 --- a/src/Tools/updatecrowdin.py +++ b/src/Tools/updatecrowdin.py @@ -341,7 +341,6 @@ def load_token(): def updateqrc(qrcpath, lncode): - "updates a qrc file with the given translation entry" # print("opening " + qrcpath + "...") @@ -398,7 +397,6 @@ def updateqrc(qrcpath, lncode): def updateTranslatorCpp(lncode): - "updates the Translator.cpp file with the given translation entry" cppfile = os.path.join(os.path.dirname(__file__), "..", "Gui", "Language", "Translator.cpp") @@ -440,7 +438,6 @@ def updateTranslatorCpp(lncode): def doFile(tsfilepath, targetpath, lncode, qrcpath): - "updates a single ts file, and creates a corresponding qm file" basename = os.path.basename(tsfilepath)[:-3] @@ -475,7 +472,6 @@ def doFile(tsfilepath, targetpath, lncode, qrcpath): def doLanguage(lncode): - "treats a single language" if lncode == "en": From 0ce232b38aa2c14295bf2b01fd4a9ec0c96268e7 Mon Sep 17 00:00:00 2001 From: Mino-Tsuzuku <42058913+totake0224@users.noreply.github.com> Date: Tue, 4 Feb 2025 19:33:43 +0900 Subject: [PATCH 104/224] * Move pyopen with encoding to utils. (#19377) and modify all importing library to use pyopen with encoding. with this change, DXF OCA AirfoilDAT with multibyte sequence always read as utf-8. --- src/Mod/Draft/draftutils/utils.py | 7 +++++++ src/Mod/Draft/importAirfoilDAT.py | 3 +-- src/Mod/Draft/importDXF.py | 13 ++++++++++++- src/Mod/Draft/importOCA.py | 2 +- src/Mod/Draft/importSVG.py | 8 +------- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Mod/Draft/draftutils/utils.py b/src/Mod/Draft/draftutils/utils.py index 0c9d4a7de3..76f58081f0 100644 --- a/src/Mod/Draft/draftutils/utils.py +++ b/src/Mod/Draft/draftutils/utils.py @@ -43,6 +43,7 @@ import FreeCAD as App from draftutils import params from draftutils.messages import _wrn, _err, _log from draftutils.translate import translate +from builtins import open # TODO: move the functions that require the graphical interface # This module should not import any graphical commands; those should be @@ -1197,4 +1198,10 @@ def use_instead(function, version=""): else: _wrn(translate("draft", "This function will be deprecated. Please use '{}'.") .format(function)) + +def pyopen(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): + if encoding is None: + encoding = 'utf-8' + return open(file, mode, buffering, encoding, errors, newline, closefd, opener) + ## @} diff --git a/src/Mod/Draft/importAirfoilDAT.py b/src/Mod/Draft/importAirfoilDAT.py index 13e3d3d047..3488ed85a6 100644 --- a/src/Mod/Draft/importAirfoilDAT.py +++ b/src/Mod/Draft/importAirfoilDAT.py @@ -44,8 +44,7 @@ import Draft import Part from FreeCAD import Vector from FreeCAD import Console as FCC -from builtins import open as pyopen - +from draftutils.utils import pyopen if FreeCAD.GuiUp: from draftutils.translate import translate diff --git a/src/Mod/Draft/importDXF.py b/src/Mod/Draft/importDXF.py index 3dae1e6d2c..1c3e5933c6 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -67,7 +67,7 @@ from Draft import LinearDimension from draftobjects.dimension import _Dimension from draftutils import params from draftutils import utils -from builtins import open as pyopen +from draftutils.utils import pyopen gui = FreeCAD.GuiUp draftui = None @@ -1928,7 +1928,16 @@ def addObject(shape, name="Shape", layer=None): newob = shape if layer: lay = locateLayer(layer) + # For old style layers, which are just groups if hasattr(lay, "Group"): + pass + # For new Draft Layers + elif hasattr(lay, "Proxy") and hasattr(lay.Proxy, "Group"): + lay = lay.Proxy + else: + lay = None + + if lay != None: if lay not in layerObjects: l = [] layerObjects[lay] = l @@ -1936,6 +1945,8 @@ def addObject(shape, name="Shape", layer=None): l = layerObjects[lay] l.append(newob) + + formatObject(newob) return newob diff --git a/src/Mod/Draft/importOCA.py b/src/Mod/Draft/importOCA.py index d88ad488ff..810cd25d8e 100644 --- a/src/Mod/Draft/importOCA.py +++ b/src/Mod/Draft/importOCA.py @@ -44,7 +44,7 @@ import FreeCAD, os, Part, DraftVecUtils, DraftGeomUtils from FreeCAD import Vector from FreeCAD import Console as FCC from draftutils import params -from builtins import open as pyopen +from draftutils.utils import pyopen if FreeCAD.GuiUp: from draftutils.translate import translate diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index c15c60b8e6..e60cbd83ba 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -61,13 +61,7 @@ from draftutils import params from draftutils import utils from draftutils.translate import translate from draftutils.messages import _err, _msg, _wrn -import builtins -#redefine pyopen as open with encoding='utf-8' -def utf8_open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): - if encoding is None: - encoding = 'utf-8' - return builtins.open(file, mode, buffering, encoding, errors, newline, closefd, opener) -pyopen = utf8_open +from draftutils.utils import pyopen if FreeCAD.GuiUp: from PySide import QtWidgets From 714a4e15e2b1ecb7452d1b7592aeaa6144674e69 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Tue, 4 Feb 2025 11:53:05 +0100 Subject: [PATCH 105/224] Draft: fix three issues with DraftGui.py (#19343) Fixes #19305. Fixes #19324. Issues above caused by #19179. Also removes automask code as it did not work properly in several cases. For example if the working plane was set to Front and the Global option was checked only the X coordinate could be entered. --- src/Mod/Draft/DraftGui.py | 94 ++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 41 deletions(-) diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index d25129460c..8868164d36 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -187,9 +187,11 @@ class DraftToolBar: self.fillmode = True self.mask = None self.alock = False - self.x = 0 - self.y = 0 - self.z = 0 + self.x = 0 # coord of the point as displayed in the task panel (global/local and relative/absolute) + self.y = 0 # idem + self.z = 0 # idem + self.new_point = FreeCAD.Vector() # global point value + self.last_point = FreeCAD.Vector() # idem self.lvalue = 0 self.pvalue = 90 self.avalue = 0 @@ -757,6 +759,8 @@ class DraftToolBar: self.x = 0 self.y = 0 self.z = 0 + self.new_point = FreeCAD.Vector() + self.last_point = FreeCAD.Vector() self.pointButton.show() if rel: self.isRelative.show() todo.delay(self.setFocus, None) @@ -967,12 +971,14 @@ class DraftToolBar: params.set_param("RelativeMode", bool(val)) self.relativeMode = bool(val) self.checkLocal() + self.displayPoint(self.new_point, self.get_last_point()) self.updateSnapper() def setGlobal(self, val): params.set_param("GlobalMode", bool(val)) self.globalMode = bool(val) self.checkLocal() + self.displayPoint(self.new_point, self.get_last_point()) self.updateSnapper() def setFill(self, val): @@ -1020,14 +1026,14 @@ class DraftToolBar: def validatePoint(self): """function for checking and sending numbers entered manually""" if self.sourceCmd or self.pointcallback: - if (self.labelRadius.isVisible()): + if self.labelRadius.isVisible(): try: rad = self.radius except (ValueError, AttributeError): print("debug: DraftGui.validatePoint: AttributeError") else: self.sourceCmd.numericRadius(rad) - elif (self.labelx.isVisible()): + elif self.labelx.isVisible(): try: numx = self.x numy = self.y @@ -1035,21 +1041,12 @@ class DraftToolBar: except (ValueError, AttributeError): print("debug: DraftGui.validatePoint: AttributeError") else: - num_vec = FreeCAD.Vector(numx, numy, numz) + delta = FreeCAD.Vector(numx, numy, numz) if self.pointcallback: - self.pointcallback(num_vec, self.globalMode, self.relativeMode) + self.pointcallback(delta, self.globalMode, self.relativeMode) else: - plane = WorkingPlane.get_working_plane(update=False) - ref_vec = FreeCAD.Vector(0, 0, 0) - if plane and not self.globalMode: - num_vec = plane.get_global_coords(num_vec, as_vector=True) - ref_vec = plane.get_global_coords(ref_vec) - if self.relativeMode and self.sourceCmd.node: - ref_vec = self.sourceCmd.node[-1] - - numx, numy, numz = num_vec + ref_vec - self.sourceCmd.numericInput(numx, numy, numz) - + self.new_point = self.get_new_point(delta) + self.sourceCmd.numericInput(*self.new_point) elif self.textValue.isVisible(): return False else: @@ -1111,33 +1108,34 @@ class DraftToolBar: txt = txt[0].upper() spec = False + self.last_point = self.get_last_point() # Most frequently used shortcuts first: if txt == _get_incmd_shortcut("Relative"): if self.isRelative.isVisible(): self.isRelative.setChecked(not self.isRelative.isChecked()) - self.relativeMode = self.isRelative.isChecked() + # setRelative takes care of rest spec = True elif txt == _get_incmd_shortcut("Global"): if self.isGlobal.isVisible(): self.isGlobal.setChecked(not self.isGlobal.isChecked()) - self.globalMode = self.isGlobal.isChecked() + # setGlobal takes care of rest spec = True elif txt == _get_incmd_shortcut("Length"): if self.lengthValue.isVisible(): self.constrain("angle") - self.displayPoint() + self.displayPoint(self.new_point, self.last_point) spec = True elif txt == _get_incmd_shortcut("RestrictX"): self.constrain("x") - self.displayPoint() + self.displayPoint(self.new_point, self.last_point) spec = True elif txt == _get_incmd_shortcut("RestrictY"): self.constrain("y") - self.displayPoint() + self.displayPoint(self.new_point, self.last_point) spec = True elif txt == _get_incmd_shortcut("RestrictZ"): self.constrain("z") - self.displayPoint() + self.displayPoint(self.new_point, self.last_point) spec = True elif txt == _get_incmd_shortcut("Copy"): if self.isCopy.isVisible(): @@ -1198,6 +1196,7 @@ class DraftToolBar: widget.setProperty("text",v) widget.setFocus() widget.selectAll() + self.updateSnapper() def updateSnapper(self): """updates the snapper track line if applicable""" @@ -1206,16 +1205,8 @@ class DraftToolBar: if hasattr(FreeCADGui,"Snapper") \ and FreeCADGui.Snapper.trackLine \ and FreeCADGui.Snapper.trackLine.Visible: - # code below matches portion of validatePoint - delta = FreeCAD.Vector(self.x, self.y, self.z) - plane = WorkingPlane.get_working_plane(update=False) - ref_vec = FreeCAD.Vector(0, 0, 0) - if plane and not self.globalMode: - delta = plane.get_global_coords(delta, as_vector=True) - ref_vec = plane.get_global_coords(ref_vec) - if self.relativeMode and self.sourceCmd.node: - ref_vec = self.sourceCmd.node[-1] - FreeCADGui.Snapper.trackLine.p2(delta + ref_vec) + point = self.get_new_point(FreeCAD.Vector(self.x, self.y, self.z)) + FreeCADGui.Snapper.trackLine.p2(point) def setMouseMode(self, mode=True): """Sets self.mouse True (default) or False and sets a timer @@ -1264,6 +1255,9 @@ class DraftToolBar: else: last = plane.position + self.new_point = FreeCAD.Vector(point) + self.last_point = FreeCAD.Vector(last) + if self.relativeMode: if self.globalMode: delta = point - last @@ -1288,13 +1282,6 @@ class DraftToolBar: self.lengthValue.setText(display_external(length,None,'Length')) #if not self.angleLock.isChecked(): self.angleValue.setText(display_external(phi,None,'Angle')) - if not mask: - # automask, phi is rounded to identify one of the below cases - phi = round(phi, Draft.precision()) - if phi in [0,180,-180]: - mask = "x" - elif phi in [90,270,-90,-270]: - mask = "y" # set masks if (mask == "x") or (self.mask == "x"): @@ -1509,6 +1496,7 @@ class DraftToolBar: self.mask = val if hasattr(FreeCADGui,"Snapper"): FreeCADGui.Snapper.mask = val + self.new_point = FreeCADGui.Snapper.constrain(self.new_point, self.get_last_point()) def changeXValue(self, d): if self.display_point_active: @@ -1572,6 +1560,7 @@ class DraftToolBar: def toggleAngle(self,b): self.alock = self.angleLock.isChecked() self.update_cartesian_coords() + self.updateSnapper() if self.alock: if not self.globalMode: plane = WorkingPlane.get_working_plane(update=False) @@ -1603,6 +1592,27 @@ class DraftToolBar: self.yValue.setText(display_external(self.y,None,'Length')) self.zValue.setText(display_external(self.z,None,'Length')) + def get_last_point(self): + """Get the last point in the GCS.""" + if hasattr(self.sourceCmd, "node") and self.sourceCmd.node: + return self.sourceCmd.node[-1] + return self.last_point + + def get_new_point(self, delta): + """Get the new point in the GCS. + + The delta vector (from the task panel) can be global/local + and relative/absolute. + """ + plane = WorkingPlane.get_working_plane(update=False) + base_point = FreeCAD.Vector() + if plane and not self.globalMode: + delta = plane.get_global_coords(delta, as_vector=True) + base_point = plane.position + if self.relativeMode: + base_point = self.get_last_point() + return base_point + delta + #--------------------------------------------------------------------------- # TaskView operations #--------------------------------------------------------------------------- @@ -1655,6 +1665,8 @@ class DraftToolBar: self.x = 0 self.y = 0 self.z = 0 + self.new_point = FreeCAD.Vector() + self.last_point = FreeCAD.Vector() self.lvalue = 0 self.pvalue = 90 self.avalue = 0 From a2ab84c6b162f619051d239ee50655dfbe517126 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Tue, 4 Feb 2025 11:54:33 +0100 Subject: [PATCH 106/224] Draft: improvements for gui_groups.py (#19312) * Draft: improvements for gui_groups.py * All actions are handled as transactions to make them undoable. * In the Draft_AutoGroup menu groups are separated from layers. * The Draft_NewLayer.svg icon is used for the New layer option. * Selecting that option prompts for a layer name and also activates that layer. * Icons and separators have been added to the Draft_AddToGroup menu. * The task panel of that command has been replaced with a QInputDialog.getText dialog for consistency. * Forgot "..." somewhere * Wrong year in the copyright notice. * Minor tooltip tweaks --- src/Mod/Draft/DraftGui.py | 9 +- src/Mod/Draft/draftguitools/gui_groups.py | 328 ++++++++++++---------- 2 files changed, 182 insertions(+), 155 deletions(-) diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 8868164d36..5c0e8bb7aa 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -1408,10 +1408,15 @@ class DraftToolBar: self.fontsize = fontsize def popupMenu(self,llist,ilist=None,pos=None): - """pops up a menu filled with the given list""" + """pops up a menu filled with the given list + + "---" in llist inserts a separator + """ self.groupmenu = QtWidgets.QMenu() for i,l in enumerate(llist): - if ilist: + if "---" in l: + self.groupmenu.addSeparator() + elif ilist: self.groupmenu.addAction(ilist[i],l) else: self.groupmenu.addAction(l) diff --git a/src/Mod/Draft/draftguitools/gui_groups.py b/src/Mod/Draft/draftguitools/gui_groups.py index 1e6df9a290..898a0549e4 100644 --- a/src/Mod/Draft/draftguitools/gui_groups.py +++ b/src/Mod/Draft/draftguitools/gui_groups.py @@ -1,7 +1,8 @@ # *************************************************************************** -# * (c) 2009, 2010 Yorik van Havre * -# * (c) 2009, 2010 Ken Cline * -# * (c) 2020 Eliud Cabrera Castillo * +# * Copyright (c) 2009, 2010 Yorik van Havre * +# * Copyright (c) 2009, 2010 Ken Cline * +# * Copyright (c) 2020 Eliud Cabrera Castillo * +# * Copyright (c) 2025 FreeCAD Project Association * # * * # * This file is part of the FreeCAD CAx development system. * # * * @@ -34,14 +35,15 @@ to the construction group. ## \addtogroup draftguitools # @{ -import PySide.QtCore as QtCore -from PySide.QtCore import QT_TRANSLATE_NOOP +from PySide import QtCore from PySide import QtWidgets +from PySide.QtCore import QT_TRANSLATE_NOOP import FreeCAD as App import FreeCADGui as Gui import Draft_rc from draftguitools import gui_base +from draftmake import make_layer from draftutils import groups from draftutils import params from draftutils import utils @@ -63,77 +65,81 @@ class AddToGroup(gui_base.GuiCommandNeedsSelection): """ def __init__(self): - super(AddToGroup, self).__init__(name=translate("draft", "Add to group")) - self.ungroup = translate("draft", "Ungroup") - #add new group string option - self.addNewGroupStr = "+ " + translate("draft", "Add new group") + super().__init__(name="Draft_AddToGroup") def GetResources(self): """Set icon, menu and tooltip.""" - return {'Pixmap': 'Draft_AddToGroup', - 'MenuText': QT_TRANSLATE_NOOP("Draft_AddToGroup", "Move to group..."), - 'ToolTip': QT_TRANSLATE_NOOP("Draft_AddToGroup", "Moves the selected objects to an existing group, or removes them from any group.\nCreate a group first to use this tool.")} + return {"Pixmap": "Draft_AddToGroup", + "MenuText": QT_TRANSLATE_NOOP("Draft_AddToGroup", "Add to group..."), + "ToolTip": QT_TRANSLATE_NOOP("Draft_AddToGroup", "Adds the selected objects to a group, or removes them from any group.")} def Activated(self): """Execute when the command is called.""" - super(AddToGroup, self).Activated() + super().Activated() - self.groups = [self.ungroup] - self.groups.extend(groups.get_group_names()) + if not hasattr(Gui, "draftToolBar"): + return - self.labels = [self.ungroup] - for group in self.groups: - obj = self.doc.getObject(group) - if obj: - self.labels.append(obj.Label) - #add new group option - self.labels.append(self.addNewGroupStr) - - # It uses the `DraftToolBar` class defined in the `DraftGui` module - # and globally initialized in the `Gui` namespace, - # in order to pop up a menu with group labels - # or the default `Ungroup` text. - # Once the desired option is chosen - # it launches the `proceed` method. self.ui = Gui.draftToolBar + objs = [obj for obj in self.doc.Objects if groups.is_group(obj)] + objs.sort(key=lambda obj: obj.Label) + self.objects = [None] \ + + [None] \ + + objs + self.labels = [translate("draft", "Ungroup")] \ + + ["---"] \ + + [obj.Label for obj in objs] \ + + ["---"] \ + + [translate("draft", "Add to new group...")] + self.icons = [self.ui.getIcon(":/icons/list-remove.svg")] \ + + [None] \ + + [obj.ViewObject.Icon for obj in objs] \ + + [None] \ + + [self.ui.getIcon(":/icons/list-add.svg")] + + # It uses the `DraftToolBar` class defined in the `DraftGui` module and + # globally initialized in the `Gui` namespace to pop up a menu. + # Once the desired option is chosen it launches the `proceed` method. self.ui.sourceCmd = self - self.ui.popupMenu(self.labels) + self.ui.popupMenu(self.labels, self.icons) - - def proceed(self, labelname): + def proceed(self, option): """Place the selected objects in the chosen group or ungroup them. Parameters ---------- - labelname: str - The passed string with the name of the group. - It puts the selected objects inside this group. + option: str + The passed string. """ - # If the selected group matches the ungroup label, - # remove the selection from all groups. - if labelname == self.ungroup: + self.ui.sourceCmd = None + + if option == self.labels[0]: + # "Ungroup" + self.doc.openTransaction(translate("draft", "Ungroup")) for obj in Gui.Selection.getSelection(): try: groups.ungroup(obj) except Exception: pass - else: - # Deactivate the source command of the `DraftToolBar` class - # so that it doesn't do more with this command. - self.ui.sourceCmd = None + self.doc.commitTransaction() + self.doc.recompute() + return - #if new group is selected then launch AddNamedGroup - if labelname == self.addNewGroupStr: - add=AddNamedGroup() - add.Activated() - else: - #else add selection to the selected group - if labelname in self.labels : - i = self.labels.index(labelname) - g = self.doc.getObject(self.groups[i]) - moveToGroup(g) + if option == self.labels[-1]: + # "Add to new group..." + grp = AddNamedGroup() # handles transaction + grp.Activated() + return + + # Group has been selected + self.doc.openTransaction(translate("draft", "Add to group")) + i = self.labels.index(option) + grp = self.objects[i] + moveToGroup(grp) + self.doc.commitTransaction() + self.doc.recompute() -Gui.addCommand('Draft_AddToGroup', AddToGroup()) +Gui.addCommand("Draft_AddToGroup", AddToGroup()) def moveToGroup(group): @@ -150,24 +156,22 @@ def moveToGroup(group): except Exception: pass - App.activeDocument().recompute(None, True, True) - class SelectGroup(gui_base.GuiCommandNeedsSelection): """GuiCommand for the Draft_SelectGroup tool.""" def __init__(self): - super(SelectGroup, self).__init__(name=translate("draft","Select group")) + super().__init__(name="Draft_SelectGroup") def GetResources(self): """Set icon, menu and tooltip.""" - return {'Pixmap': 'Draft_SelectGroup', - 'MenuText': QT_TRANSLATE_NOOP("Draft_SelectGroup", "Select group"), - 'ToolTip': QT_TRANSLATE_NOOP("Draft_SelectGroup", "Selects the contents of selected groups. For selected non-group objects, the contents of the group they are in is selected.")} + return {"Pixmap": "Draft_SelectGroup", + "MenuText": QT_TRANSLATE_NOOP("Draft_SelectGroup", "Select group"), + "ToolTip": QT_TRANSLATE_NOOP("Draft_SelectGroup", "Selects the contents of selected groups. For selected non-group objects, the contents of the group they are in is selected.")} def Activated(self): """Execute when the command is called.""" - super(SelectGroup, self).Activated() + super().Activated() sel = Gui.Selection.getSelection() subs = [] @@ -194,20 +198,20 @@ class SelectGroup(gui_base.GuiCommandNeedsSelection): App.Console.PrintMessage(msg + "\n") -Gui.addCommand('Draft_SelectGroup', SelectGroup()) +Gui.addCommand("Draft_SelectGroup", SelectGroup()) class SetAutoGroup(gui_base.GuiCommandSimplest): """GuiCommand for the Draft_AutoGroup tool.""" def __init__(self): - super(SetAutoGroup, self).__init__(name=translate("draft","Autogroup")) + super().__init__(name="Draft_AutoGroup") def GetResources(self): """Set icon, menu and tooltip.""" - return {'Pixmap': 'Draft_AutoGroup', - 'MenuText': QT_TRANSLATE_NOOP("Draft_AutoGroup", "Autogroup"), - 'ToolTip': QT_TRANSLATE_NOOP("Draft_AutoGroup", "Select a group to add all Draft and BIM objects to.")} + return {"Pixmap": "Draft_AutoGroup", + "MenuText": QT_TRANSLATE_NOOP("Draft_AutoGroup", "Autogroup"), + "ToolTip": QT_TRANSLATE_NOOP("Draft_AutoGroup", "Select a layer or group to add new Draft and BIM objects to.")} def Activated(self): """Execute when the command is called. @@ -215,78 +219,104 @@ class SetAutoGroup(gui_base.GuiCommandSimplest): It calls the `setAutogroup` method of the `DraftToolBar` class installed inside the global `Gui` namespace. """ - super(SetAutoGroup, self).Activated() + super().Activated() if not hasattr(Gui, "draftToolBar"): return - # It uses the `DraftToolBar` class defined in the `DraftGui` module - # and globally initialized in the `Gui` namespace to run - # some actions. - # If there is only a group selected, it runs the `AutoGroup` method. + # It uses the `DraftToolBar` class defined in the `DraftGui` module and + # globally initialized in the `Gui` namespace to run some actions. + # If a layer or group is selected, it runs the `AutoGroup` method. self.ui = Gui.draftToolBar - s = Gui.Selection.getSelection() - if len(s) == 1: - if (utils.get_type(s[0]) == "Layer" + sel = Gui.Selection.getSelection() + if len(sel) == 1: + if (utils.get_type(sel[0]) == "Layer" or (params.get_param("AutogroupAddGroups") - and groups.is_group(s[0]))): - self.ui.setAutoGroup(s[0].Name) + and groups.is_group(sel[0]))): + self.ui.setAutoGroup(sel[0].Name) return - # Otherwise it builds a list of layers, with names and icons, + # Otherwise it builds a list of layers and groups, with labels and icons, # including the options "None" and "Add new layer". - grps = [o for o in self.doc.Objects if utils.get_type(o) == "Layer"] if params.get_param("AutogroupAddGroups"): - grps.extend([o for o in self.doc.Objects if groups.is_group(o)]) - grps.sort(key=lambda grp: grp.Label) - self.groups = [translate("draft", "None")] + [o.Name for o in grps] - self.labels = [translate("draft", "None")] - self.icons = [self.ui.getIcon(":/icons/button_invalid.svg")] - for grp in grps: - self.labels.append(grp.Label) - self.icons.append(grp.ViewObject.Icon) - self.labels.append(translate("draft", "Add new Layer")) - self.icons.append(self.ui.getIcon(":/icons/document-new.svg")) + grps = [obj for obj in self.doc.Objects if groups.is_group(obj)] + grps.sort(key=lambda obj: obj.Label) + else: + grps = [] + lyrs = [obj for obj in self.doc.Objects if utils.get_type(obj) == "Layer"] + lyrs.sort(key=lambda obj: obj.Label) + self.names = [None] \ + + [None] \ + + [obj.Name for obj in grps] \ + + [None] \ + + [obj.Name for obj in lyrs] + self.labels = [translate("draft", "None")] \ + + ["---"] \ + + [obj.Label for obj in grps] \ + + ["---"] \ + + [obj.Label for obj in lyrs] \ + + ["---"] \ + + [translate("draft", "New layer...")] + self.icons = [self.ui.getIcon(":/icons/button_invalid.svg")] \ + + [None] \ + + [obj.ViewObject.Icon for obj in grps] \ + + [None] \ + + [obj.ViewObject.Icon for obj in lyrs] \ + + [None] \ + + [self.ui.getIcon(":/icons/Draft_NewLayer.svg")] - # With the lists created is uses the interface - # to pop up a menu with layer options. - # Once the desired option is chosen - # it launches the `proceed` method. + # With the created lists it uses the interface to pop up a menu with options. + # Once the desired option is chosen it launches the `proceed` method. self.ui.sourceCmd = self pos = self.ui.autoGroupButton.mapToGlobal(QtCore.QPoint(0, self.ui.autoGroupButton.geometry().height())) self.ui.popupMenu(self.labels, self.icons, pos) - def proceed(self, labelname): + def proceed(self, option): """Set the defined autogroup, or create a new layer. Parameters ---------- - labelname: str - The passed string with the name of the group or layer. + option: str + The passed string. """ - # Deactivate the source command of the `DraftToolBar` class - # so that it doesn't do more with this command - # when it finishes. self.ui.sourceCmd = None - if labelname in self.labels: - if labelname == self.labels[0]: - # First option "None" deactivates autogrouping - self.ui.setAutoGroup(None) - elif labelname == self.labels[-1]: - # Last option "Add new layer" creates new layer - Gui.runCommand("Draft_Layer") - else: - # Set autogroup to the chosen layer - i = self.labels.index(labelname) - self.ui.setAutoGroup(self.groups[i]) + if option == self.labels[0]: + # "None" + self.ui.setAutoGroup(None) + return + + if option == self.labels[-1]: + # "New layer..." + txt, ok = QtWidgets.QInputDialog.getText( + None, + translate("draft", "Create new layer"), + translate("draft", "Layer name:"), + text=translate("draft", "Layer", "Object label") + ) + if not ok: + return + if not txt: + return + self.doc.openTransaction(translate("draft", "New layer")) + lyr = make_layer.make_layer(name=txt, line_color=None, shape_color=None, + line_width=None, draw_style=None, transparency=None) + self.doc.commitTransaction() + self.doc.recompute() + self.ui.setAutoGroup(lyr.Name) # this... + # self.ui.autoGroupButton.setDown(False) # or this? + return + + # Layer or group has been selected + i = self.labels.index(option) + self.ui.setAutoGroup(self.names[i]) -Gui.addCommand('Draft_AutoGroup', SetAutoGroup()) +Gui.addCommand("Draft_AutoGroup", SetAutoGroup()) class AddToConstruction(gui_base.GuiCommandNeedsSelection): - """Gui Command for the AddToConstruction tool. + """GuiCommand for the Draft_AddConstruction tool. It adds the selected objects to the construction group defined in the `DraftToolBar` class which is initialized @@ -299,21 +329,22 @@ class AddToConstruction(gui_base.GuiCommandNeedsSelection): """ def __init__(self): - super(AddToConstruction, self).__init__(name=translate("draft","Add to construction group")) + super().__init__(name="Draft_AddConstruction") def GetResources(self): """Set icon, menu and tooltip.""" - return {'Pixmap': 'Draft_AddConstruction', - 'MenuText': QT_TRANSLATE_NOOP("Draft_AddConstruction", "Add to construction group"), - 'ToolTip': QT_TRANSLATE_NOOP("Draft_AddConstruction", "Adds the selected objects to the construction group,\nand changes their appearance to the construction style.\nIt creates a construction group if it doesn't exist.")} + return {"Pixmap": "Draft_AddConstruction", + "MenuText": QT_TRANSLATE_NOOP("Draft_AddConstruction", "Add to construction group"), + "ToolTip": QT_TRANSLATE_NOOP("Draft_AddConstruction", "Adds the selected objects to the construction group,\nand changes their appearance to the construction style.\nThe construction group is created if it doesn't exist.")} def Activated(self): """Execute when the command is called.""" - super(AddToConstruction, self).Activated() + super().Activated() if not hasattr(Gui, "draftToolBar"): return + self.doc.openTransaction(translate("draft", "Add to construction group")) col = params.get_param("constructioncolor") | 0x000000FF # Get the construction group or create it if it doesn't exist @@ -324,7 +355,6 @@ class AddToConstruction(gui_base.GuiCommandNeedsSelection): for obj in Gui.Selection.getSelection(): grp.addObject(obj) - # Change the appearance to the construction colors vobj = obj.ViewObject if "TextColor" in vobj.PropertiesList: @@ -338,58 +368,50 @@ class AddToConstruction(gui_base.GuiCommandNeedsSelection): if hasattr(vobj, "Transparency"): vobj.Transparency = 80 + self.doc.commitTransaction() + self.doc.recompute() + Draft_AddConstruction = AddToConstruction -Gui.addCommand('Draft_AddConstruction', AddToConstruction()) +Gui.addCommand("Draft_AddConstruction", AddToConstruction()) class AddNamedGroup(gui_base.GuiCommandSimplest): + """GuiCommand for the Draft_AddNamedGroup tool. - """Gui Command for the addGroup tool. - It adds a new named group + It adds a new named group. """ - def __init__(self): - super().__init__(name=translate("draft", "Add a new group with a given name")) + def __init__(self): + super().__init__(name="Draft_AddNamedGroup") def GetResources(self): """Set icon, menu and tooltip.""" - return {'Pixmap': 'Draft_AddNamedGroup', - 'MenuText': QT_TRANSLATE_NOOP("Draft_AddNamedGroup", "Add a new named group"), - 'ToolTip': QT_TRANSLATE_NOOP("Draft_AddNamedGroup", "Add a new group with a given name.")} - + return {"Pixmap": "Draft_AddNamedGroup", + "MenuText": QT_TRANSLATE_NOOP("Draft_AddNamedGroup", "New named group"), + "ToolTip": QT_TRANSLATE_NOOP("Draft_AddNamedGroup", "Adds a group with a given name.")} def Activated(self): super().Activated() - panel = Ui_AddNamedGroup() - Gui.Control.showDialog(panel) - panel.name.setFocus() + + txt, ok = QtWidgets.QInputDialog.getText( + None, + translate("draft", "Create new group"), + translate("draft", "Group name:"), + text=translate("draft", "Group", "Object label") + ) + if not ok: + return + if not txt: + return + self.doc.openTransaction(translate("draft", "New named group")) + grp = self.doc.addObject("App::DocumentObjectGroup", translate("draft", "Group")) + grp.Label = txt + moveToGroup(grp) + self.doc.commitTransaction() + self.doc.recompute() -Draft_AddNamedGroup = AddNamedGroup -Gui.addCommand('Draft_AddNamedGroup', AddNamedGroup()) - - -class Ui_AddNamedGroup(): - """ - User interface for addgroup tool - simple label and line edit in dialogbox - """ - def __init__(self): - self.form = QtWidgets.QWidget() - self.form.setWindowTitle(translate("draft", "Add group")) - row = QtWidgets.QHBoxLayout(self.form) - lbl = QtWidgets.QLabel(translate("draft", "Group name") + ":") - self.name = QtWidgets.QLineEdit() - row.addWidget(lbl) - row.addWidget(self.name) - - - def accept(self): - group = App.activeDocument().addObject("App::DocumentObjectGroup",translate("draft", "Group")) - group.Label=self.name.text() - moveToGroup(group) - Gui.Control.closeDialog() - +Gui.addCommand("Draft_AddNamedGroup", AddNamedGroup()) ## @} From 99db16c6c08c0539df1dec5dcc46eb6e0a151d4d Mon Sep 17 00:00:00 2001 From: Furgo <148809153+furgo16@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:52:26 +0100 Subject: [PATCH 107/224] BIM: Connect "only visible" checkbox signal to corresponding slot (#19201) * BIM: Classification dialog => connect only visible checkbox to signal, save its state * BIM: rename classification dialog, do not use default name * BIM: add icons to classification dropdown box --- src/Mod/BIM/Resources/ui/dialogClassification.ui | 2 +- src/Mod/BIM/bimcommands/BimClassification.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Mod/BIM/Resources/ui/dialogClassification.ui b/src/Mod/BIM/Resources/ui/dialogClassification.ui index 58c858321a..511042cf16 100644 --- a/src/Mod/BIM/Resources/ui/dialogClassification.ui +++ b/src/Mod/BIM/Resources/ui/dialogClassification.ui @@ -1,7 +1,7 @@ Dialog - + 0 diff --git a/src/Mod/BIM/bimcommands/BimClassification.py b/src/Mod/BIM/bimcommands/BimClassification.py index 490d298888..6038f3ba9b 100644 --- a/src/Mod/BIM/bimcommands/BimClassification.py +++ b/src/Mod/BIM/bimcommands/BimClassification.py @@ -29,6 +29,7 @@ import os QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP translate = FreeCAD.Qt.translate +PARAMS = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM") class BIM_Classification: @@ -63,11 +64,15 @@ class BIM_Classification: # load the form and set the tree model up self.form = FreeCADGui.PySideUic.loadUi(":/ui/dialogClassification.ui") self.form.setWindowIcon(QtGui.QIcon(":/icons/BIM_Classification.svg")) + self.form.groupMode.setItemIcon(0, QtGui.QIcon(":/icons/Arch_SectionPlane_Tree.svg")) # Alphabetical + self.form.groupMode.setItemIcon(1, QtGui.QIcon(":/icons/IFC.svg")) # Type + self.form.groupMode.setItemIcon(2, QtGui.QIcon(":/icons/Arch_Material.svg")) # Material + self.form.groupMode.setItemIcon(3, QtGui.QIcon(":/icons/Document.svg")) # Model structure # restore saved values - p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM") - w = p.GetInt("BimClassificationDialogWidth", 629) - h = p.GetInt("BimClassificationDialogHeight", 516) + self.form.onlyVisible.setChecked(PARAMS.GetInt("BimClassificationVisibleState", 0)) + w = PARAMS.GetInt("BimClassificationDialogWidth", 629) + h = PARAMS.GetInt("BimClassificationDialogHeight", 516) self.form.resize(w, h) # add modified search box from bimmaterial @@ -151,6 +156,7 @@ class BIM_Classification: self.form.treeClass.itemDoubleClicked.connect(self.apply) self.form.search.up.connect(self.onUpArrow) self.form.search.down.connect(self.onDownArrow) + self.form.onlyVisible.stateChanged.connect(self.onVisible) # center the dialog over FreeCAD window mw = FreeCADGui.getMainWindow() @@ -650,6 +656,10 @@ class BIM_Classification: if self.form.treeClass.itemBelow(i): self.form.treeClass.setCurrentItem(self.form.treeClass.itemBelow(i)) + def onVisible(self, index): + PARAMS.SetInt("BimClassificationVisibleState", index) + self.updateObjects() + def getIcon(self,obj): """returns a QIcon for an object""" From c0e8b1c505be511c14f721df7cbd897a23bb4d5e Mon Sep 17 00:00:00 2001 From: james <81617086+je-cook@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:04:23 +0000 Subject: [PATCH 108/224] upgrade threejs and encoding fix --- src/Mod/BIM/importers/importWebGL.py | 41 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/Mod/BIM/importers/importWebGL.py b/src/Mod/BIM/importers/importWebGL.py index b1ce15cd45..0fe80752b0 100644 --- a/src/Mod/BIM/importers/importWebGL.py +++ b/src/Mod/BIM/importers/importWebGL.py @@ -70,6 +70,7 @@ import numpy as np disableCompression = False # Compress object data before sending to JS base = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#$%&()*+-:;/=>?@[]^_,.{|}~`" # safe str chars for js in all cases baseFloat = ",.-0123456789" +threejs_version = "0.172.0" def getHTMLTemplate(): @@ -110,23 +111,31 @@ def getHTMLTemplate(): select { width: 170px; } +