Skip to content

Commit

Permalink
Merge branch 'FreeCAD:main' into pipe_beam_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FEA-eng authored Feb 16, 2024
2 parents 92b9c6c + 43723b6 commit 054ef03
Show file tree
Hide file tree
Showing 49 changed files with 1,160 additions and 563 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/PROBLEM_REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ body:
options:
- Addon Manager
- Arch
- Assembly
- Core
- Draft
- Expressions
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/issue-metrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Monthly issue metrics
on:
workflow_dispatch:
schedule:
- cron: '0 0 15 * *'

permissions:
issues: write
pull-requests: read

jobs:
build:
name: issue metrics
runs-on: ubuntu-latest

steps:

- name: Get dates for last month
shell: bash
run: |
# Calculate the first day of the previous month
first_day=$(date -d "last month" +%Y-%m-01)
# Calculate the last day of the previous month
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
#Set an environment variable with the date range
echo "$first_day..$last_day"
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
- name: Run issue-metrics tool
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:FreeCAD/FreeCAD is:issue created:${{ env.last_month }} -reason:"not planned"'

- name: Create issue
uses: peter-evans/create-issue-from-file@v4
with:
title: Monthly issue metrics report
token: ${{ secrets.GITHUB_TOKEN }}
content-filepath: ./issue_metrics.md
assignees: maxwxyz
28 changes: 0 additions & 28 deletions src/App/Expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <sstream>
#include <stack>
#include <string>
#include <regex>

#include <App/Application.h>
#include <App/DocumentObject.h>
Expand Down Expand Up @@ -518,29 +517,6 @@ Py::Object pyFromQuantity(const Quantity &quantity) {
}
}

static const std::regex REGEX_QUANTITY(
R"(\s*)"
R"(([-+]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?))" // value
R"(\s*)"
R"(([^\s]+)?)" // unit
R"(\s*)"
);

// https://github.com/FreeCAD/FreeCAD/issues/11825
Quantity parseQuantityFromText(std::string text) {
std::smatch match;
if (std::regex_match(text, match, REGEX_QUANTITY)) {
std::string value_text = match[1];
std::string unit_text = match[3];
double value = std::stod(value_text);
Unit unit = Unit(QString::fromStdString(unit_text));
return Quantity(value, unit);
} else {
std::string error_message = "Failed to parse to Quantity: text='" + text + "'";
PARSER_THROW(error_message);
}
}

Quantity anyToQuantity(const App::any &value, const char *msg) {
if (is_type(value,typeid(Quantity))) {
return cast<Quantity>(value);
Expand All @@ -554,10 +530,6 @@ Quantity anyToQuantity(const App::any &value, const char *msg) {
return Quantity(cast<float>(value));
} else if (is_type(value,typeid(double))) {
return Quantity(cast<double>(value));
} else if (is_type(value,typeid(const char*))) {
return parseQuantityFromText(std::string(cast<const char*>(value)));
} else if (is_type(value,typeid(std::string))) {
return parseQuantityFromText(cast<std::string>(value));
}
if(!msg)
msg = "Failed to convert to Quantity";
Expand Down
1 change: 0 additions & 1 deletion src/App/Expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ using ExpressionPtr = std::unique_ptr<Expression>;

AppExport bool isAnyEqual(const App::any &v1, const App::any &v2);
AppExport Base::Quantity anyToQuantity(const App::any &value, const char *errmsg = nullptr);
AppExport Base::Quantity parseQuantityFromText(std::string text);

// Map of depending objects to a map of depending property name to the full referencing object identifier
using ExpressionDeps = std::map<App::DocumentObject*, std::map<std::string, std::vector<ObjectIdentifier> > >;
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Assembly/Gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${COIN3D_INCLUDE_DIRS}
${OCC_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
)

set(AssemblyGui_LIBS
Expand Down
110 changes: 0 additions & 110 deletions src/Mod/Draft/draftguitools/gui_line_add_delete.py

This file was deleted.

1 change: 0 additions & 1 deletion src/Mod/Draft/draftmake/make_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from draftobjects.array import Array

if App.GuiUp:
from draftutils.todo import ToDo
from draftviewproviders.view_array import ViewProviderDraftArray
from draftviewproviders.view_draftlink import ViewProviderDraftLink

Expand Down
1 change: 0 additions & 1 deletion src/Mod/Draft/draftmake/make_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from draftutils import gui_utils

if App.GuiUp:
from draftutils.todo import ToDo
from draftviewproviders.view_clone import ViewProviderClone


Expand Down
3 changes: 0 additions & 3 deletions src/Mod/Draft/draftmake/make_patharray.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
from draftobjects.pathtwistedarray import PathTwistedArray

if App.GuiUp:
from draftutils.todo import ToDo
from draftviewproviders.view_array import ViewProviderDraftArray
from draftviewproviders.view_draftlink import ViewProviderDraftLink

Expand Down Expand Up @@ -300,8 +299,6 @@ def make_path_array(base_object, path_object, count=4,
ViewProviderDraftArray(new_obj.ViewObject)
gui_utils.formatObject(new_obj, new_obj.Base)
new_obj.ViewObject.Proxy.resetColors(new_obj.ViewObject)
# Workaround to trigger update of DiffuseColor:
ToDo.delay(reapply_diffuse_color, new_obj.ViewObject)
new_obj.Base.ViewObject.hide()
gui_utils.select(new_obj)

Expand Down
1 change: 0 additions & 1 deletion src/Mod/Draft/draftmake/make_pointarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from draftobjects.pointarray import PointArray

if App.GuiUp:
from draftutils.todo import ToDo
from draftviewproviders.view_array import ViewProviderDraftArray
from draftviewproviders.view_draftlink import ViewProviderDraftLink

Expand Down
23 changes: 23 additions & 0 deletions src/Mod/Fem/App/FemConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ Constraint::Constraint()
App::PropertyType(App::Prop_Output),
"Scale used for drawing constraints"); // OvG: Add scale parameter inherited
// by all derived constraints
ADD_PROPERTY_TYPE(Points,
(Base::Vector3d()),
"Constraint",
App::PropertyType(App::Prop_ReadOnly | App::Prop_Output | App::Prop_Hidden),
"Points where symbols are drawn");
ADD_PROPERTY_TYPE(Normals,
(Base::Vector3d()),
"Constraint",
App::PropertyType(App::Prop_ReadOnly | App::Prop_Output | App::Prop_Hidden),
"Normals where symbols are drawn");

Points.setValues(std::vector<Base::Vector3d>());
Normals.setValues(std::vector<Base::Vector3d>());

References.setScope(App::LinkScope::Global);
}
Expand Down Expand Up @@ -165,6 +178,16 @@ void Constraint::onChanged(const App::Property* prop)
}
}
}

std::vector<Base::Vector3d> points;
std::vector<Base::Vector3d> normals;
int scale = 1;
if (getPoints(points, normals, &scale)) {
Points.setValues(points);
Normals.setValues(normals);
Scale.setValue(scale);
Points.touch();
}
}

App::DocumentObject::onChanged(prop);
Expand Down
4 changes: 4 additions & 0 deletions src/Mod/Fem/App/FemConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class FemExport Constraint: public App::DocumentObject
*/
App::PropertyInteger Scale;

// Read-only (calculated values). These trigger changes in the ViewProvider
App::PropertyVectorList Points;
App::PropertyVectorList Normals;

/**
* @brief Updates @ref NormalDirection.
*
Expand Down
26 changes: 0 additions & 26 deletions src/Mod/Fem/App/FemConstraintContact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,6 @@ ConstraintContact::ConstraintContact()
"ConstraintContact",
App::PropertyType(App::Prop_None),
"Stick slope");

ADD_PROPERTY_TYPE(Points,
(Base::Vector3d()),
"ConstraintContact",
App::PropertyType(App::Prop_ReadOnly | App::Prop_Output),
"Points where symbols are drawn");
ADD_PROPERTY_TYPE(Normals,
(Base::Vector3d()),
"ConstraintContact",
App::PropertyType(App::Prop_ReadOnly | App::Prop_Output),
"Normals where symbols are drawn");
/* */
Points.setValues(std::vector<Base::Vector3d>());
Normals.setValues(std::vector<Base::Vector3d>());
}

App::DocumentObjectExecReturn* ConstraintContact::execute()
Expand All @@ -87,18 +73,6 @@ const char* ConstraintContact::getViewProviderName() const
void ConstraintContact::onChanged(const App::Property* prop)
{
Constraint::onChanged(prop);

if (prop == &References) {
std::vector<Base::Vector3d> points;
std::vector<Base::Vector3d> normals;
int scale = 1; // OvG: Enforce use of scale
if (getPoints(points, normals, &scale)) {
Points.setValues(points);
Normals.setValues(normals);
Scale.setValue(scale); // OvG: Scale
Points.touch(); // This triggers ViewProvider::updateData()
}
}
}

void ConstraintContact::handleChangedPropertyType(Base::XMLReader& reader,
Expand Down
4 changes: 0 additions & 4 deletions src/Mod/Fem/App/FemConstraintContact.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ class FemExport ConstraintContact: public Fem::Constraint
/// Constructor
ConstraintContact();

// Read-only (calculated values). These trigger changes in the ViewProvider
App::PropertyVectorList Points;
App::PropertyVectorList Normals;

/*Note*/
// Constraint parameters
/******
Expand Down
Loading

0 comments on commit 054ef03

Please sign in to comment.