Compare commits

..

34 Commits

Author SHA1 Message Date
Adrian Insaurralde Avalos 256fc7eff3 AddonManager: fix create_pip_call 2025-08-05 17:19:07 -03:00
Adrián Insaurralde Avalos ccc98966e6 WindowsInstaller: use --safe-mode in freecadcmd commands [skip ci] 2025-08-05 10:50:56 -03:00
Adrian Insaurralde Avalos b0127687c2 bump version to 1.0.2 2025-08-03 20:01:51 -03:00
chris 8637434db9 Backport fix for #20656 - fix compilation with occt 7.9 2025-08-03 19:54:58 -03:00
github-actions[bot] 199b4c81d1 [Backport releases/FreeCAD-1-0] Import: DXF, handle non-standard 8859_1 encoding (#22840)
* Import: DXF, handle non-standard 8859_1 encoding (#21905)

* Import: improve DXF importer exception handling

* Import: DXF, pinpoint erroneous header section when reading

* Import: tackle 8859_1 non-standard encoding name

(cherry picked from commit 1e29a3273f)

* Use `Base::RuntimeError` instead of `Base::Exception` since it's constructor is protected in 1.0

---------

Co-authored-by: Furgo <148809153+furgo16@users.noreply.github.com>
Co-authored-by: Adrian Insaurralde Avalos <adrianinsaval@gmail.com>
2025-08-02 11:57:09 -03:00
github-actions[bot] 34b70663d1 Assembly: Fix crash 20614 (#22844)
* Assembly: Fix crash 20614 (#22538)

(cherry picked from commit facfbeb47e)

* adapt to `getMovingPartFromRef` from 1.0 branch

* fix `Console().Warning` has PascalCase name in 1.0

---------

Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com>
Co-authored-by: Adrian Insaurralde Avalos <adrianinsaval@gmail.com>
2025-08-01 09:28:01 -03:00
Syres916 1bcf27e1aa [Measure] Fix seg fault in MeasurePosition::execute if subElements is empty (#22016)
* [Measure] take into account if subElements is empty

* [Measure] Remove unnecessary else block

(cherry picked from commit 7e6775d2c0)
2025-07-31 11:18:58 -03:00
Jakub Klinkovský 8c8a418c95 Use vtkUnstructuredGrid::GetLinks instead of vtkUnstructuredGrid::GetCellLinks for VTK >= 9.3
The vtkUnstructuredGrid::GetCellLinks has been deprecated in VTK 9.3 and
silently removed in 9.5:

https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/release/9.3.md
(cherry picked from commit 3d2b7dc9c7)
2025-07-31 11:18:36 -03:00
jffmichi 7317eb3035 CAM: remove redundant move after drilling
(cherry picked from commit 3bce6e3fc9)
2025-07-31 11:17:18 -03:00
Syres916 1dea8f3ca9 [1.0] [Gui] Fix wildcard call disconnects warnings Qt6.9 2025-07-31 10:41:52 -03:00
Syres916 19c54a8a66 [1.0] [GUI] Remove dark fringe around letters 2025-07-31 10:41:34 -03:00
Syres916 e6b82ca9e1 [1.0] [Points] Add e57 to import file extensions 2025-07-31 10:41:18 -03:00
Syres916 7d6bcbc03a [TechDraw] update to align with newer templates 2025-07-31 10:41:03 -03:00
Syres916 8588a85fa1 [1.0] [TechDraw] Fix Qt6 compatability of FillTemplateFields tool 2025-07-31 10:40:46 -03:00
Adrian Insaurralde Avalos faa260f0ce conda ci: use conda cdt packages and run on ubuntu 24.04 2025-07-30 17:53:54 -03:00
Adrian Insaurralde Avalos 42299aefca conda ci: pin compilers on linux and macos 2025-07-30 17:53:54 -03:00
Chris Hennes 3f5f828c25 Tests: Save/restore Materials user prefs
(cherry picked from commit d54ff81870)
2025-07-30 17:53:54 -03:00
Chris Hennes 18dd3f83ed Tests: Ensure tests use a fixture that inits app
(cherry picked from commit 25f1d28468)
2025-07-30 17:53:54 -03:00
Syres916 2255548c52 [CAM] write the post file with UTF-8 encoding
Based on #20421, Fixes #18698
2025-07-28 13:14:44 -03:00
Roy-043 48226c3346 BIM: fix Arch_SectionPlane 'Toggle Cutview' issue 2025-07-11 15:53:40 +02:00
Roy-043 552309b38e Update BimTDPage.py 2025-07-11 15:49:48 +02:00
Roy-043 b78dd00d31 Update ArchSchedule.py 2025-07-11 15:48:52 +02:00
Roy-043 872d98d7df Update ArchAxis.py 2025-07-11 15:47:13 +02:00
Roy-043 8502c09b45 Update BimProjectManager.py 2025-07-11 15:41:04 +02:00
Roy-043 34f8982b81 Update ArchMaterial.py 2025-07-11 15:39:29 +02:00
Roy-043 5921f4cd03 BIM: fix filtering out level issue (#22059)
* Update ifc_status.py

* Update ifc_tools.py
2025-07-11 15:37:08 +02:00
Roy-043 c78d633d07 BIM: fix index error in ifc_viewproviders.py
Fixes #21912
2025-07-11 15:36:21 +02:00
Roy-043 a8bf9a5f41 BIM: Roof add tolerance to parallel check (#21814)
Fixes #21796.
2025-07-11 15:35:29 +02:00
Benjamin Guest e23a81e0c4 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
2025-06-13 20:28:36 -03:00
tritao 010d37deda Standardize on Py::Long type for Python bindings. 2025-05-15 19:59:08 -03:00
Roy-043 5391e21d4e BIM: fix BIM_WPView command (#20741)
* BIM: fix BIM_WPView command

The BIM_WPView command did not work properly. This was mainly due to a faulty import.

* Updated to avoid a linter warning
2025-05-15 11:28:19 +02:00
Roy-043 e94e1d9260 BIM: BIM_Leader would create a wire with fewer than 2 points
If the BIM_Leader was escaped without clicking a point, or after cicking only 1 point, a Draft_Wire object would still be created.
2025-05-15 11:26:29 +02:00
Roy-043 1331b1f4b7 Merge pull request #20529 from Roy-043/Draft-fix-alignment-of-dim-arrows
Draft: fix alignment of dim arrows
2025-05-15 11:25:40 +02:00
Adrian Insaurralde Avalos ba50b8ce79 fedora rpm packaging: fix inverted pcl_enabled conditionals [skip ci] 2025-05-14 09:59:15 -03:00
93 changed files with 753 additions and 503 deletions
+4 -4
View File
@@ -57,11 +57,11 @@ jobs:
with:
artifactBasename: Ubuntu_20-04-${{ github.run_id }}
Ubuntu_22-04_Conda:
Ubuntu_24-04_Conda:
needs: [Prepare]
uses: ./.github/workflows/sub_buildUbuntu2204Conda.yml
uses: ./.github/workflows/sub_buildUbuntu2404Conda.yml
with:
artifactBasename: Ubuntu_22-04_Conda-${{ github.run_id }}
artifactBasename: Ubuntu_24-04_Conda-${{ github.run_id }}
Windows:
needs: [Prepare]
@@ -84,7 +84,7 @@ jobs:
Pixi,
MacOS_13_Conda_Apple,
Ubuntu_20-04,
Ubuntu_22-04_Conda,
Ubuntu_24-04_Conda,
Windows,
Lint
]
@@ -24,7 +24,7 @@
# This is a build and test workflow for CI of FreeCAD.
# This workflow aims at building and testing FreeCAD on a Conda environment on Linux.
name: Build Ubuntu 22.04 (Conda)
name: Build Ubuntu 24.04 (Conda)
on:
workflow_call:
inputs:
@@ -45,7 +45,7 @@ on:
jobs:
Build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
continue-on-error: ${{ inputs.allowedToFail }}
env:
CCACHE_DIR: ${{ github.workspace }}/ccache
+1 -1
View File
@@ -31,7 +31,7 @@ project(FreeCAD)
set(PACKAGE_VERSION_MAJOR "1")
set(PACKAGE_VERSION_MINOR "0")
set(PACKAGE_VERSION_PATCH "1") # number of patch release (e.g. "4" for the 0.18.4 release)
set(PACKAGE_VERSION_PATCH "2") # number of patch release (e.g. "4" for the 0.18.4 release)
set(PACKAGE_VERSION_SUFFIX "") # either "dev" for development snapshot or "" (empty string)
set(PACKAGE_BUILD_VERSION "0") # used when the same FreeCAD version will be re-released (for example using an updated LibPack)
+3
View File
@@ -140,6 +140,9 @@ if(OCC_FOUND)
TKHLR
TKFeat
)
if (OCC_VERSION_STRING VERSION_GREATER_EQUAL 7.9.0)
list(APPEND OCC_LIBRARIES TKExpress)
endif ()
set(OCC_OCAF_LIBRARIES
TKBin
TKBinL
+57 -53
View File
@@ -3,63 +3,67 @@ channels:
- conda-forge
dependencies:
- conda-forge/noarch::conda-libmamba-solver==24.7.0
- libspnav # [linux]
- kernel-headers_linux-64 # [linux and x86_64]
- libdrm-cos7-x86_64 # [linux and x86_64]
- libselinux-cos7-x86_64 # [linux and x86_64]
- libsepol-cos7-x86_64 # [linux and x86_64]
- libx11-common-cos7-x86_64 # [linux and x86_64]
- libx11-cos7-x86_64 # [linux and x86_64]
- libxau-cos7-x86_64 # [linux and x86_64]
- libxcb-cos7-x86_64 # [linux and x86_64]
- libxdamage-cos7-x86_64 # [linux and x86_64]
- libxext-cos7-x86_64 # [linux and x86_64]
- libxfixes-cos7-x86_64 # [linux and x86_64]
- libxi-cos7-x86_64 # [linux and x86_64]
- libxi-devel-cos7-x86_64 # [linux and x86_64]
- libxxf86vm-cos7-x86_64 # [linux and x86_64]
- mesa-dri-drivers-cos7-x86_64 # [linux and x86_64]
- mesa-libegl-cos7-x86_64 # [linux and x86_64]
- mesa-libegl-devel-cos7-x86_64 # [linux and x86_64]
- mesa-libgl-cos7-x86_64 # [linux and x86_64]
- mesa-libgl-devel-cos7-x86_64 # [linux and x86_64]
- pixman-cos7-x86_64 # [linux and x86_64]
- sysroot_linux-64 # [linux and x86_64]
- xorg-x11-server-common-cos7-x86_64 # [linux and x86_64]
- xorg-x11-server-xvfb-cos7-x86_64 # [linux and x86_64]
- kernel-headers_linux-aarch64 # [linux and aarch64]
- libdrm-cos7-aarch64 # [linux and aarch64]
- libglvnd-cos7-aarch64 # [linux and aarch64]
- libglvnd-glx-cos7-aarch64 # [linux and aarch64]
- libselinux-cos7-aarch64 # [linux and aarch64]
- libsepol-cos7-aarch64 # [linux and aarch64]
- libx11-common-cos7-aarch64 # [linux and aarch64]
- libx11-cos7-aarch64 # [linux and aarch64]
- libxau-cos7-aarch64 # [linux and aarch64]
- libxcb-cos7-aarch64 # [linux and aarch64]
- libxdamage-cos7-aarch64 # [linux and aarch64]
- libxext-cos7-aarch64 # [linux and aarch64]
- libxfixes-cos7-aarch64 # [linux and aarch64]
- libxi-cos7-aarch64 # [linux and aarch64]
- libxi-devel-cos7-aarch64 # [linux and aarch64]
- libxxf86vm-cos7-aarch64 # [linux and aarch64]
- mesa-dri-drivers-cos7-aarch64 # [linux and aarch64]
- mesa-khr-devel-cos7-aarch64 # [linux and aarch64]
- mesa-libegl-cos7-aarch64 # [linux and aarch64]
- mesa-libegl-devel-cos7-aarch64 # [linux and aarch64]
- mesa-libgbm-cos7-aarch64 # [linux and aarch64]
- mesa-libgl-cos7-aarch64 # [linux and aarch64]
- mesa-libgl-devel-cos7-aarch64 # [linux and aarch64]
- mesa-libglapi-cos7-aarch64 # [linux and aarch64]
- pixman-cos7-aarch64 # [linux and aarch64]
- sysroot_linux-aarch64 # [linux and aarch64]
- xorg-x11-server-common-cos7-aarch64 # [linux and aarch64]
- xorg-x11-server-xvfb-cos7-aarch64 # [linux and aarch64]
- sed # [unix]
- libspnav # [linux]
- kernel-headers_linux-64 # [linux and x86_64]
- libdrm-conda-x86_64 # [linux and x86_64]
- libselinux-conda-x86_64 # [linux and x86_64]
- libsepol-conda-x86_64 # [linux and x86_64]
- libx11-common-conda-x86_64 # [linux and x86_64]
- libx11-conda-x86_64 # [linux and x86_64]
- libxau-conda-x86_64 # [linux and x86_64]
- libxcb-conda-x86_64 # [linux and x86_64]
- libxdamage-conda-x86_64 # [linux and x86_64]
- libxext-conda-x86_64 # [linux and x86_64]
- libxfixes-conda-x86_64 # [linux and x86_64]
- libxi-conda-x86_64 # [linux and x86_64]
- libxi-devel-conda-x86_64 # [linux and x86_64]
- libxxf86vm-conda-x86_64 # [linux and x86_64]
- mesa-dri-drivers-conda-x86_64 # [linux and x86_64]
- mesa-libegl-conda-x86_64 # [linux and x86_64]
- mesa-libegl-devel-conda-x86_64 # [linux and x86_64]
- mesa-libgl-conda-x86_64 # [linux and x86_64]
- mesa-libgl-devel-conda-x86_64 # [linux and x86_64]
- pixman-conda-x86_64 # [linux and x86_64]
- sysroot_linux-64 # [linux and x86_64]
- xorg-x11-server-common-conda-x86_64 # [linux and x86_64]
- xorg-x11-server-xvfb-conda-x86_64 # [linux and x86_64]
- kernel-headers_linux-aarch64 # [linux and aarch64]
- libdrm-conda-aarch64 # [linux and aarch64]
- libglvnd-conda-aarch64 # [linux and aarch64]
- libglvnd-glx-conda-aarch64 # [linux and aarch64]
- libselinux-conda-aarch64 # [linux and aarch64]
- libsepol-conda-aarch64 # [linux and aarch64]
- libx11-common-conda-aarch64 # [linux and aarch64]
- libx11-conda-aarch64 # [linux and aarch64]
- libxau-conda-aarch64 # [linux and aarch64]
- libxcb-conda-aarch64 # [linux and aarch64]
- libxdamage-conda-aarch64 # [linux and aarch64]
- libxext-conda-aarch64 # [linux and aarch64]
- libxfixes-conda-aarch64 # [linux and aarch64]
- libxi-conda-aarch64 # [linux and aarch64]
- libxi-devel-conda-aarch64 # [linux and aarch64]
- libxxf86vm-conda-aarch64 # [linux and aarch64]
- mesa-dri-drivers-conda-aarch64 # [linux and aarch64]
- mesa-khr-devel-conda-aarch64 # [linux and aarch64]
- mesa-libegl-conda-aarch64 # [linux and aarch64]
- mesa-libegl-devel-conda-aarch64 # [linux and aarch64]
- mesa-libgbm-conda-aarch64 # [linux and aarch64]
- mesa-libgl-conda-aarch64 # [linux and aarch64]
- mesa-libgl-devel-conda-aarch64 # [linux and aarch64]
- mesa-libglapi-conda-aarch64 # [linux and aarch64]
- pixman-conda-aarch64 # [linux and aarch64]
- sysroot_linux-aarch64 # [linux and aarch64]
- xorg-x11-server-common-conda-aarch64 # [linux and aarch64]
- xorg-x11-server-xvfb-conda-aarch64 # [linux and aarch64]
- sed # [unix]
- ccache
- cmake
- coin3d
- compilers
- gcc==13.3.* # [linux]
- gxx==13.3.* # [linux]
- clang==18.1.* # [osx]
- clangxx==18.1.* # [osx]
- conda
- conda-devenv
- debugpy
+3 -3
View File
@@ -33,7 +33,7 @@
Name: %{name}
Epoch: 1
Version: 1.0.1
Version: 1.0.2
Release: {{{git_commit_no}}}%{?dist}
Summary: A general purpose 3D CAD modeler
Group: Applications/Engineering
@@ -97,7 +97,7 @@ BuildRequires: openmpi-devel
BuildRequires: med-devel
BuildRequires: libkdtree++-devel
%if ! %{pcl_enabled}
%if %{pcl_enabled}
BuildRequires: pcl-devel
%endif
BuildRequires: python3
@@ -217,7 +217,7 @@ LDFLAGS='-Wl,--as-needed -Wl,--no-undefined'; export LDFLAGS
-DCOIN3D_INCLUDE_DIR=%{_includedir}/Coin4 \
-DCOIN3D_DOC_PATH=%{_datadir}/Coin4/Coin \
-DUSE_OCC=TRUE \
%if ! %{pcl_enabled}
%if %{pcl_enabled}
-DFREECAD_USE_PCL:BOOL=ON \
%else
-DFREECAD_USE_PCL:BOOL=OFF \
@@ -96,7 +96,11 @@ public:
vtkCellLinks* GetLinks()
{
#ifdef VTK_CELL_ARRAY_V2
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
return static_cast<vtkCellLinks*>(vtkUnstructuredGrid::GetLinks());
#else
return static_cast<vtkCellLinks*>(GetCellLinks());
#endif
#else
return Links;
#endif
+4
View File
@@ -4713,7 +4713,11 @@ void SMDS_Mesh::dumpGrid(string ficdump)
}
ficcon << "-------------------------------- connectivity " << nbPoints << endl;
#ifdef VTK_CELL_ARRAY_V2
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks *links = static_cast<vtkCellLinks*>(myGrid->GetLinks());
#else
vtkCellLinks *links = static_cast<vtkCellLinks*>(myGrid->GetCellLinks());
#endif
#else
vtkCellLinks *links = myGrid->GetCellLinks();
#endif
+24
View File
@@ -69,7 +69,11 @@ void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, do
SMDS_UnstructuredGrid * grid = mesh->getGrid();
vtkPoints *points = grid->GetPoints();
points->InsertPoint(myVtkID, x, y, z);
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetLinks());
#else
SMDS_CellLinks *cellLinks = dynamic_cast<SMDS_CellLinks*>(grid->GetCellLinks());
#endif
assert(cellLinks);
cellLinks->ResizeForPoint( myVtkID );
}
@@ -191,7 +195,11 @@ public:
SMDS_ElemIteratorPtr SMDS_MeshNode::
GetInverseElementIterator(SMDSAbs_ElementType type) const
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
#endif
//MESSAGE("myID " << myID << " ncells " << l.ncells);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
@@ -251,7 +259,11 @@ elementsIterator(SMDSAbs_ElementType type) const
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
else
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
#endif
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
}
@@ -350,7 +362,11 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*> (ME);
assert(cell);
SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks *Links = static_cast<vtkCellLinks*>(grid->GetLinks());
#else
vtkCellLinks *Links = static_cast<vtkCellLinks*>(grid->GetCellLinks());
#endif
Links->ResizeCellList(myVtkID, 1);
Links->AddCellReference(cell->getVtkId(), myVtkID);
}
@@ -366,7 +382,11 @@ void SMDS_MeshNode::ClearInverseElements()
bool SMDS_MeshNode::emptyInverseElements()
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
#endif
return (l.ncells == 0);
}
@@ -378,7 +398,11 @@ bool SMDS_MeshNode::emptyInverseElements()
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
{
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks())->GetLink(myVtkID);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
#endif
if ( type == SMDSAbs_All )
return l.ncells;
@@ -11348,7 +11348,11 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
{
int oldId = *itn;
//MESSAGE(" node " << oldId);
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetLinks())->GetLink(oldId);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
#endif
for (int i=0; i<l.ncells; i++)
{
int vtkId = l.cells[i];
@@ -11708,7 +11712,11 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
{
int oldId = itnod->first;
//MESSAGE(" node " << oldId);
#if VTK_VERSION_NUMBER_QUICK >= 90300000000
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetLinks())->GetLink(oldId);
#else
vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
#endif
for (int i = 0; i < l.ncells; i++)
{
int vtkId = l.cells[i];
+3 -3
View File
@@ -851,7 +851,7 @@ PyObject *Application::sCheckLinkDepth(PyObject * /*self*/, PyObject *args)
return nullptr;
PY_TRY {
return Py::new_reference_to(Py::Int(GetApplication().checkLinkDepth(depth, MessageOption::Throw)));
return Py::new_reference_to(Py::Long(GetApplication().checkLinkDepth(depth, MessageOption::Throw)));
}PY_CATCH;
}
@@ -926,7 +926,7 @@ PyObject *Application::sSetActiveTransaction(PyObject * /*self*/, PyObject *args
return nullptr;
PY_TRY {
Py::Int ret(GetApplication().setActiveTransaction(name, Base::asBoolean(persist)));
Py::Long ret(GetApplication().setActiveTransaction(name, Base::asBoolean(persist)));
return Py::new_reference_to(ret);
}PY_CATCH;
}
@@ -943,7 +943,7 @@ PyObject *Application::sGetActiveTransaction(PyObject * /*self*/, PyObject *args
Py_Return;
Py::Tuple ret(2);
ret.setItem(0,Py::String(name));
ret.setItem(1,Py::Int(id));
ret.setItem(1,Py::Long(id));
return Py::new_reference_to(ret);
}PY_CATCH;
}
+2 -2
View File
@@ -117,7 +117,7 @@
<Documentation>
<UserDocu>Geometry Tag</UserDocu>
</Documentation>
<Parameter Name="Tag" Type="Int"/>
<Parameter Name="Tag" Type="Long"/>
</Attribute>
<Attribute Name="Hasher">
<Documentation>
@@ -129,7 +129,7 @@
<Documentation>
<UserDocu>Get the current element map size</UserDocu>
</Documentation>
<Parameter Name="ElementMapSize" Type="Int" />
<Parameter Name="ElementMapSize" Type="Long" />
</Attribute>
<Attribute Name="ElementMap">
<Documentation>
+15 -15
View File
@@ -106,9 +106,9 @@ PyObject* ComplexGeoDataPy::getFacesFromSubElement(PyObject *args)
Py::List facet;
for (const auto & it : facets) {
Py::Tuple f(3);
f.setItem(0,Py::Int(int(it.I1)));
f.setItem(1,Py::Int(int(it.I2)));
f.setItem(2,Py::Int(int(it.I3)));
f.setItem(0,Py::Long(int(it.I1)));
f.setItem(1,Py::Long(int(it.I2)));
f.setItem(2,Py::Long(int(it.I3)));
facet.append(f);
}
tuple.setItem(1, facet);
@@ -141,8 +141,8 @@ PyObject* ComplexGeoDataPy::getLinesFromSubElement(PyObject *args)
Py::List line;
for (const auto & it : lines) {
Py::Tuple l(2);
l.setItem(0,Py::Int((int)it.I1));
l.setItem(1,Py::Int((int)it.I2));
l.setItem(0,Py::Long((int)it.I1));
l.setItem(1,Py::Long((int)it.I2));
line.append(l);
}
tuple.setItem(1, line);
@@ -204,8 +204,8 @@ PyObject* ComplexGeoDataPy::getLines(PyObject *args)
Py::List line;
for (const auto & it : lines) {
Py::Tuple l(2);
l.setItem(0,Py::Int((int)it.I1));
l.setItem(1,Py::Int((int)it.I2));
l.setItem(0,Py::Long((int)it.I1));
l.setItem(1,Py::Long((int)it.I2));
line.append(l);
}
tuple.setItem(1, line);
@@ -236,9 +236,9 @@ PyObject* ComplexGeoDataPy::getFaces(PyObject *args)
Py::List facet;
for (const auto & it : facets) {
Py::Tuple f(3);
f.setItem(0,Py::Int((int)it.I1));
f.setItem(1,Py::Int((int)it.I2));
f.setItem(2,Py::Int((int)it.I3));
f.setItem(0,Py::Long((int)it.I1));
f.setItem(1,Py::Long((int)it.I2));
f.setItem(2,Py::Long((int)it.I3));
facet.append(f);
}
tuple.setItem(1, facet);
@@ -494,9 +494,9 @@ Py::Dict ComplexGeoDataPy::getElementReverseMap() const
return ret;
}
Py::Int ComplexGeoDataPy::getElementMapSize() const
Py::Long ComplexGeoDataPy::getElementMapSize() const
{
return Py::Int((long)getComplexGeoDataPtr()->getElementMapSize());
return Py::Long((long)getComplexGeoDataPtr()->getElementMapSize());
}
void ComplexGeoDataPy::setHasher(Py::Object obj)
@@ -559,12 +559,12 @@ Py::String ComplexGeoDataPy::getElementMapVersion() const
}
Py::Int ComplexGeoDataPy::getTag() const
Py::Long ComplexGeoDataPy::getTag() const
{
return Py::Int(getComplexGeoDataPtr()->Tag);
return Py::Long(getComplexGeoDataPtr()->Tag);
}
void ComplexGeoDataPy::setTag(Py::Int tag)
void ComplexGeoDataPy::setTag(Py::Long tag)
{
getComplexGeoDataPtr()->Tag = tag;
}
+1 -1
View File
@@ -305,7 +305,7 @@ or None if the GUI is not up</UserDocu>
<Documentation>
<UserDocu>The unique identifier (among its document) of this object</UserDocu>
</Documentation>
<Parameter Name="ID" Type="Int"/>
<Parameter Name="ID" Type="Long"/>
</Attribute>
<Attribute Name="Removing" ReadOnly="true">
<Documentation>
+2 -2
View File
@@ -776,8 +776,8 @@ int DocumentObjectPy::setCustomAttributes(const char* , PyObject *)
return 0;
}
Py::Int DocumentObjectPy::getID() const {
return Py::Int(getDocumentObjectPtr()->getID());
Py::Long DocumentObjectPy::getID() const {
return Py::Long(getDocumentObjectPtr()->getID());
}
Py::Boolean DocumentObjectPy::getRemoving() const {
+4 -4
View File
@@ -301,25 +301,25 @@ sort: whether to topologically sort the return list
<Documentation>
<UserDocu>The Undo mode of the Document (0 = no Undo, 1 = Undo/Redo)</UserDocu>
</Documentation>
<Parameter Name="UndoMode" Type="Int" />
<Parameter Name="UndoMode" Type="Long" />
</Attribute>
<Attribute Name="UndoRedoMemSize" ReadOnly="true">
<Documentation>
<UserDocu>The size of the Undo stack in byte</UserDocu>
</Documentation>
<Parameter Name="UndoRedoMemSize" Type="Int" />
<Parameter Name="UndoRedoMemSize" Type="Long" />
</Attribute>
<Attribute Name="UndoCount" ReadOnly="true">
<Documentation>
<UserDocu>Number of possible Undos</UserDocu>
</Documentation>
<Parameter Name="UndoCount" Type="Int" />
<Parameter Name="UndoCount" Type="Long" />
</Attribute>
<Attribute Name="RedoCount" ReadOnly="true">
<Documentation>
<UserDocu>Number of possible Redos</UserDocu>
</Documentation>
<Parameter Name="RedoCount" Type="Int"/>
<Parameter Name="RedoCount" Type="Long"/>
</Attribute>
<Attribute Name="UndoNames" ReadOnly="true">
<Documentation>
+11 -11
View File
@@ -319,7 +319,7 @@ PyObject* DocumentPy::addObject(PyObject *args, PyObject *kwd)
if (view)
pyvp = Py::Object(view);
if (pyvp.isNone())
pyvp = Py::Int(1);
pyvp = Py::Long(1);
// 'pyvp' is the python class with the implementation for ViewProvider
if (pyvp.hasAttr("__vobject__")) {
pyvp.setAttr("__vobject__", pyftr.getAttr("ViewObject"));
@@ -583,7 +583,7 @@ PyObject* DocumentPy::recompute(PyObject * args)
return nullptr;
}
return Py::new_reference_to(Py::Int(objectCount));
return Py::new_reference_to(Py::Long(objectCount));
} PY_CATCH;
}
@@ -758,30 +758,30 @@ Py::List DocumentPy::getRootObjectsIgnoreLinks() const
return res;
}
Py::Int DocumentPy::getUndoMode() const
Py::Long DocumentPy::getUndoMode() const
{
return Py::Int(getDocumentPtr()->getUndoMode());
return Py::Long(getDocumentPtr()->getUndoMode());
}
void DocumentPy::setUndoMode(Py::Int arg)
void DocumentPy::setUndoMode(Py::Long arg)
{
getDocumentPtr()->setUndoMode(arg);
}
Py::Int DocumentPy::getUndoRedoMemSize() const
Py::Long DocumentPy::getUndoRedoMemSize() const
{
return Py::Int((long)getDocumentPtr()->getUndoMemSize());
return Py::Long((long)getDocumentPtr()->getUndoMemSize());
}
Py::Int DocumentPy::getUndoCount() const
Py::Long DocumentPy::getUndoCount() const
{
return Py::Int((long)getDocumentPtr()->getAvailableUndos());
return Py::Long((long)getDocumentPtr()->getAvailableUndos());
}
Py::Int DocumentPy::getRedoCount() const
Py::Long DocumentPy::getRedoCount() const
{
return Py::Int((long)getDocumentPtr()->getAvailableRedos());
return Py::Long((long)getDocumentPtr()->getAvailableRedos());
}
Py::List DocumentPy::getUndoNames() const
+7 -7
View File
@@ -264,12 +264,12 @@ bool FeaturePythonImp::getSubObject(DocumentObject *&ret, const char *subname,
args.setItem(0, Py::Object(object->getPyObject(), true));
if(!subname) subname = "";
args.setItem(1,Py::String(subname));
args.setItem(2,Py::Int(pyObj?2:1));
args.setItem(2,Py::Long(pyObj?2:1));
Base::MatrixPy *pyMat = new Base::MatrixPy(new Base::Matrix4D);
if(_mat) *pyMat->getMatrixPtr() = *_mat;
args.setItem(3,Py::asObject(pyMat));
args.setItem(4,Py::Boolean(transform));
args.setItem(5,Py::Int(depth));
args.setItem(5,Py::Long(depth));
Py::Object res(Base::pyCall(py_getSubObject.ptr(),args.ptr()));
if(res.isNone()) {
@@ -320,7 +320,7 @@ bool FeaturePythonImp::getSubObjects(std::vector<std::string> &ret, int reason)
try {
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
args.setItem(1, Py::Int(reason));
args.setItem(1, Py::Long(reason));
Py::Object res(Base::pyCall(py_getSubObjects.ptr(),args.ptr()));
if(!res.isTrue())
return true;
@@ -359,7 +359,7 @@ bool FeaturePythonImp::getLinkedObject(DocumentObject *&ret, bool recurse,
if(_mat) *pyMat->getMatrixPtr() = *_mat;
args.setItem(2,Py::asObject(pyMat));
args.setItem(3,Py::Boolean(transform));
args.setItem(4,Py::Int(depth));
args.setItem(4,Py::Long(depth));
Py::Object res(Base::pyCall(py_getLinkedObject.ptr(),args.ptr()));
if(!res.isTrue()) {
@@ -432,7 +432,7 @@ int FeaturePythonImp::isElementVisible(const char *element) const {
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
args.setItem(1,Py::String(element?element:""));
return Py::Int(Base::pyCall(py_isElementVisible.ptr(),args.ptr()));
return Py::Long(Base::pyCall(py_isElementVisible.ptr(),args.ptr()));
}
catch (Py::Exception&) {
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
@@ -453,7 +453,7 @@ int FeaturePythonImp::setElementVisible(const char *element, bool visible) {
args.setItem(0, Py::Object(object->getPyObject(), true));
args.setItem(1,Py::String(element?element:""));
args.setItem(2,Py::Boolean(visible));
return Py::Int(Base::pyCall(py_setElementVisible.ptr(),args.ptr()));
return Py::Long(Base::pyCall(py_setElementVisible.ptr(),args.ptr()));
}
catch (Py::Exception&) {
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
@@ -534,7 +534,7 @@ int FeaturePythonImp::canLoadPartial() const {
try {
Py::Tuple args(1);
args.setItem(0, Py::Object(object->getPyObject(), true));
Py::Int ret(Base::pyCall(py_canLoadPartial.ptr(),args.ptr()));
Py::Long ret(Base::pyCall(py_canLoadPartial.ptr(),args.ptr()));
return ret;
}
catch (Py::Exception&) {
+1 -1
View File
@@ -364,7 +364,7 @@ App::DocumentObjectExecReturn *LinkBaseExtension::extensionExecute() {
} else {
const auto &elements = _getElementListValue();
for(int i=0; i<_getElementCountValue(); ++i) {
args.setItem(2, Py::Int(i));
args.setItem(2, Py::Long(i));
if(i < (int)elements.size())
args.setItem(3, Py::asObject(elements[i]->getPyObject()));
else
+1 -1
View File
@@ -238,7 +238,7 @@ PyObject* LinkBaseExtensionPy::setLink(PyObject *_args)
PyObject *key, *value;
Py_ssize_t pos = 0;
while(PyDict_Next(pcObj, &pos, &key, &value))
parseLink(ext,Py::Int(key),value);
parseLink(ext,Py::Long(key),value);
}else if(PySequence_Check(pcObj)) {
ext->setLink(-1,nullptr);
Py::Sequence seq(pcObj);
+12 -12
View File
@@ -626,16 +626,16 @@ Py::Object ObjectIdentifier::Component::get(const Py::Object &pyobj) const {
res = pyobj.getAttr(getName());
} else if(isArray()) {
if(pyobj.isMapping())
res = Py::Mapping(pyobj).getItem(Py::Int(begin));
res = Py::Mapping(pyobj).getItem(Py::Long(begin));
else
res = Py::Sequence(pyobj).getItem(begin);
}else if(isMap())
res = Py::Mapping(pyobj).getItem(getName());
else {
assert(isRange());
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
end!=INT_MAX?Py::Int(end).ptr():nullptr,
step!=1?Py::Int(step).ptr():nullptr),true);
Py::Object slice(PySlice_New(Py::Long(begin).ptr(),
end!=INT_MAX?Py::Long(end).ptr():nullptr,
step!=1?Py::Long(step).ptr():nullptr),true);
PyObject *r = PyObject_GetItem(pyobj.ptr(),slice.ptr());
if(!r)
Base::PyException::ThrowException();
@@ -654,16 +654,16 @@ void ObjectIdentifier::Component::set(Py::Object &pyobj, const Py::Object &value
Base::PyException::ThrowException();
} else if(isArray()) {
if(pyobj.isMapping())
Py::Mapping(pyobj).setItem(Py::Int(begin),value);
Py::Mapping(pyobj).setItem(Py::Long(begin),value);
else
Py::Sequence(pyobj).setItem(begin,value);
}else if(isMap())
Py::Mapping(pyobj).setItem(getName(),value);
else {
assert(isRange());
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
end!=INT_MAX?Py::Int(end).ptr():nullptr,
step!=1?Py::Int(step).ptr():nullptr),true);
Py::Object slice(PySlice_New(Py::Long(begin).ptr(),
end!=INT_MAX?Py::Long(end).ptr():nullptr,
step!=1?Py::Long(step).ptr():nullptr),true);
if(PyObject_SetItem(pyobj.ptr(),slice.ptr(),value.ptr())<0)
Base::PyException::ThrowException();
}
@@ -674,16 +674,16 @@ void ObjectIdentifier::Component::del(Py::Object &pyobj) const {
pyobj.delAttr(getName());
else if(isArray()) {
if(pyobj.isMapping())
Py::Mapping(pyobj).delItem(Py::Int(begin));
Py::Mapping(pyobj).delItem(Py::Long(begin));
else
PySequence_DelItem(pyobj.ptr(),begin);
} else if(isMap())
Py::Mapping(pyobj).delItem(getName());
else {
assert(isRange());
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
end!=INT_MAX?Py::Int(end).ptr():nullptr,
step!=1?Py::Int(step).ptr():nullptr),true);
Py::Object slice(PySlice_New(Py::Long(begin).ptr(),
end!=INT_MAX?Py::Long(end).ptr():nullptr,
step!=1?Py::Long(step).ptr():nullptr),true);
if(PyObject_DelItem(pyobj.ptr(),slice.ptr())<0)
Base::PyException::ThrowException();
}
+2 -2
View File
@@ -267,7 +267,7 @@ PyObject* PropertyContainerPy::setPropertyStatus(PyObject *args)
status.set(it->second, value);
}
else if (item.isNumeric()) {
int v = Py::Int(item);
int v = Py::Long(item);
if (v < 0) {
value = false;
v = -v;
@@ -323,7 +323,7 @@ PyObject* PropertyContainerPy::getPropertyStatus(PyObject *args)
}
}
if (!found)
ret.append(Py::Int(static_cast<long>(i)));
ret.append(Py::Long(static_cast<long>(i)));
}
}
return Py::new_reference_to(ret);
+3 -3
View File
@@ -478,7 +478,7 @@ void PropertyEnumeration::setPyObject(PyObject *value)
if(seq.size() == 2) {
Py::Object v(seq[0].ptr());
if(!v.isString() && v.isSequence()) {
idx = Py::Int(seq[1].ptr());
idx = Py::Long(seq[1].ptr());
seq = v;
}
}
@@ -579,14 +579,14 @@ bool PropertyEnumeration::getPyPathValue(const ObjectIdentifier &path, Py::Objec
else {
Py::Tuple tuple(2);
tuple.setItem(0, res);
tuple.setItem(1, Py::Int(getValue()));
tuple.setItem(1, Py::Long(getValue()));
r = tuple;
}
} else if (p == ".String") {
auto v = getValueAsString();
r = Py::String(v?v:"");
} else
r = Py::Int(getValue());
r = Py::Long(getValue());
return true;
}
+3 -3
View File
@@ -40,13 +40,13 @@ base64: indicate if the input 'txt' is base64 encoded binary data
<Documentation>
<UserDocu>Return count of used hashes</UserDocu>
</Documentation>
<Parameter Name="Count" Type="Int" />
<Parameter Name="Count" Type="Long" />
</Attribute>
<Attribute Name="Size" ReadOnly="true">
<Documentation>
<UserDocu>Return the size of the hashes</UserDocu>
</Documentation>
<Parameter Name="Size" Type="Int"/>
<Parameter Name="Size" Type="Long"/>
</Attribute>
<Attribute Name="SaveAll">
<Documentation>
@@ -58,7 +58,7 @@ base64: indicate if the input 'txt' is base64 encoded binary data
<Documentation>
<UserDocu>Data length exceed this threshold will be hashed before storing</UserDocu>
</Documentation>
<Parameter Name="Threshold" Type="Int"/>
<Parameter Name="Threshold" Type="Long"/>
</Attribute>
<Attribute Name="Table" ReadOnly="true">
<Documentation>
+2 -2
View File
@@ -24,7 +24,7 @@
<Documentation>
<UserDocu>Return the integer value of this ID</UserDocu>
</Documentation>
<Parameter Name="Value" Type="Int"/>
<Parameter Name="Value" Type="Long"/>
</Attribute>
<Attribute Name="Related" ReadOnly="true">
<Documentation>
@@ -54,7 +54,7 @@
<Documentation>
<UserDocu>Geometry index. Only meaningful for geometry element name</UserDocu>
</Documentation>
<Parameter Name="Index" Type="Int"/>
<Parameter Name="Index" Type="Long"/>
</Attribute>
<ClassDeclarations>private:
friend class StringID;
+2 -2
View File
@@ -212,7 +212,7 @@ PyObject* MatrixPy::number_power_handler(PyObject* self, PyObject* other, PyObje
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
long b = Py::Int(other);
long b = Py::Long(other);
if (b == 0) {
return new MatrixPy(Matrix4D());
}
@@ -363,7 +363,7 @@ PyObject* MatrixPy::hasScale(PyObject* args)
ScaleType type = getMatrixPtr()->hasScale(tol);
Py::Module mod("FreeCAD");
return Py::new_reference_to(
mod.callMemberFunction("ScaleType", Py::TupleN(Py::Int(static_cast<int>(type)))));
mod.callMemberFunction("ScaleType", Py::TupleN(Py::Long(static_cast<int>(type)))));
}
PyObject* MatrixPy::decompose(PyObject* args)
+1 -1
View File
@@ -26,7 +26,7 @@ Class to dump and restore the content of an object.</UserDocu>
<Documentation>
<UserDocu>Memory size of the object in bytes.</UserDocu>
</Documentation>
<Parameter Name="MemSize" Type="Int"/>
<Parameter Name="MemSize" Type="Long"/>
</Attribute>
<Methode Name="dumpContent" Keyword="true" Const="true">
<Documentation>
+2 -2
View File
@@ -52,9 +52,9 @@ Py::String PersistencePy::getContent() const
return {writer.getString()};
}
Py::Int PersistencePy::getMemSize() const
Py::Long PersistencePy::getMemSize() const
{
return Py::Int((long)getPersistencePtr()->getMemSize());
return Py::Long((long)getPersistencePtr()->getMemSize());
}
PyObject* PersistencePy::dumpContent(PyObject* args, PyObject* kwds)
+5 -5
View File
@@ -641,9 +641,9 @@ Py::Dict QuantityPy::getFormat() const
QuantityFormat fmt = getQuantityPtr()->getFormat();
Py::Dict dict;
dict.setItem("Precision", Py::Int(fmt.precision));
dict.setItem("Precision", Py::Long(fmt.precision));
dict.setItem("NumberFormat", Py::Char(fmt.toFormat()));
dict.setItem("Denominator", Py::Int(fmt.denominator));
dict.setItem("Denominator", Py::Long(fmt.denominator));
return dict;
}
@@ -652,14 +652,14 @@ void QuantityPy::setFormat(Py::Dict arg)
QuantityFormat fmt = getQuantityPtr()->getFormat();
if (arg.hasKey("Precision")) {
Py::Int prec(arg.getItem("Precision"));
Py::Long prec(arg.getItem("Precision"));
fmt.precision = static_cast<int>(prec);
}
if (arg.hasKey("NumberFormat")) {
Py::Object item = arg.getItem("NumberFormat");
if (item.isNumeric()) {
int format = static_cast<int>(Py::Int(item));
int format = static_cast<int>(Py::Long(item));
if (format < 0 || format > QuantityFormat::Scientific) {
throw Py::ValueError("Invalid format value");
}
@@ -681,7 +681,7 @@ void QuantityPy::setFormat(Py::Dict arg)
}
if (arg.hasKey("Denominator")) {
Py::Int denom(arg.getItem("Denominator"));
Py::Long denom(arg.getItem("Denominator"));
int fracInch = static_cast<int>(denom);
// check that the value is positive and a power of 2
if (fracInch <= 0) {
+2 -2
View File
@@ -1560,7 +1560,7 @@ void PythonGroupCommand::activated(int iMsg)
if (cmd.hasAttr("Activated")) {
Py::Callable call(cmd.getAttr("Activated"));
Py::Tuple args(1);
args.setItem(0, Py::Int(iMsg));
args.setItem(0, Py::Long(iMsg));
Py::Object ret = call.apply(args);
}
// If the command group doesn't implement the 'Activated' method then invoke the command directly
@@ -1640,7 +1640,7 @@ Action * PythonGroupCommand::createAction()
if (cmd.hasAttr("GetDefaultCommand")) {
Py::Callable call2(cmd.getAttr("GetDefaultCommand"));
Py::Int def(call2.apply(args));
Py::Long def(call2.apply(args));
defaultId = static_cast<int>(def);
}
+1 -1
View File
@@ -223,7 +223,7 @@ obj : Gui.ViewProvider</UserDocu>
<Documentation>
<UserDocu>Current edit mode. Only meaningful when there is a current object in edit.</UserDocu>
</Documentation>
<Parameter Name="EditMode" Type="Int" />
<Parameter Name="EditMode" Type="Long" />
</Attribute>
<Attribute Name="Document" ReadOnly="true">
<Documentation>
+3 -3
View File
@@ -471,7 +471,7 @@ Py::Object DocumentPy::getInEditInfo() const {
return Py::None();
return Py::TupleN(Py::Object(vp->getObject()->getPyObject(),true),
Py::String(subname),Py::String(subelement),Py::Int(mode));
Py::String(subname),Py::String(subelement),Py::Long(mode));
}
void DocumentPy::setInEditInfo(Py::Object arg)
@@ -486,12 +486,12 @@ void DocumentPy::setInEditInfo(Py::Object arg)
pyobj)->getViewProviderDocumentObjectPtr(),subname);
}
Py::Int DocumentPy::getEditMode() const
Py::Long DocumentPy::getEditMode() const
{
int mode = -1;
getDocumentPtr()->getInEdit(nullptr,nullptr,&mode);
return Py::Int(mode);
return Py::Long(mode);
}
Py::Boolean DocumentPy::getTransacting() const
+1 -1
View File
@@ -154,7 +154,7 @@ Return a tuple(path,detail) for the coin3D SoPath and SoDetail of the element
<Documentation>
<UserDocu>Set the element size to create an array of linked object</UserDocu>
</Documentation>
<Parameter Name="Count" Type="Int" />
<Parameter Name="Count" Type="Long" />
</Attribute>
<Methode Name="getChildren" Const="true">
<Documentation>
+5 -5
View File
@@ -83,7 +83,7 @@ PyObject* LinkViewPy::setMaterial(PyObject *args) {
Py_ssize_t pos = 0;
std::map<int,App::Material*> materials;
while(PyDict_Next(pyObj, &pos, &key, &value)) {
Py::Int idx(key);
Py::Long idx(key);
if(value == Py_None)
materials[(int)idx] = nullptr;
else if(!PyObject_TypeCheck(value,&App::MaterialPy::Type)) {
@@ -135,7 +135,7 @@ PyObject* LinkViewPy::setTransform(PyObject *args) {
Py_ssize_t pos = 0;
std::map<int,Base::Matrix4D*> mat;
while(PyDict_Next(pyObj, &pos, &key, &value)) {
Py::Int idx(key);
Py::Long idx(key);
if(!PyObject_TypeCheck(value,&Base::MatrixPy::Type)) {
PyErr_SetString(PyExc_TypeError, "exepcting a type of Matrix");
return nullptr;
@@ -384,11 +384,11 @@ PyObject* LinkViewPy::getChildren(PyObject *args) {
return Py::new_reference_to(ret);
}
Py::Int LinkViewPy::getCount() const {
return Py::Int(getLinkViewPtr()->getSize());
Py::Long LinkViewPy::getCount() const {
return Py::Long(getLinkViewPtr()->getSize());
}
void LinkViewPy::setCount(Py::Int count) {
void LinkViewPy::setCount(Py::Long count) {
try {
getLinkViewPtr()->setSize((int)count);
} catch (const Base::Exception& e) {
+4 -4
View File
@@ -50,7 +50,7 @@ Py::Object PythonStdout::getattr(const char *name)
{
if (strcmp(name, "softspace") == 0) {
int i=0;
return Py::Int(i);
return Py::Long(i);
}
return getattr_methods(name);
}
@@ -114,7 +114,7 @@ Py::Object PythonStderr::getattr(const char *name)
{
if (strcmp(name, "softspace") == 0) {
int i=0;
return Py::Int(i);
return Py::Long(i);
}
return getattr_methods(name);
}
@@ -175,7 +175,7 @@ Py::Object OutputStdout::getattr(const char *name)
{
if (strcmp(name, "softspace") == 0) {
int i=0;
return Py::Int(i);
return Py::Long(i);
}
return getattr_methods(name);
}
@@ -236,7 +236,7 @@ Py::Object OutputStderr::getattr(const char *name)
{
if (strcmp(name, "softspace") == 0) {
int i=0;
return Py::Int(i);
return Py::Long(i);
}
return getattr_methods(name);
}
+17 -12
View File
@@ -401,34 +401,39 @@ public:
*/
void addQObject(QObject* obj, PyObject* pyobj)
{
const auto PyW_unique_name = QString::number(reinterpret_cast <quintptr> (pyobj));
auto PyW_invalidator = findChild <QObject *> (PyW_unique_name, Qt::FindDirectChildrenOnly);
// static array to contain created connections so they can be safely disconnected later
static std::map<QObject*, QMetaObject::Connection> connections = {};
const auto PyW_uniqueName = QString::number(reinterpret_cast<quintptr>(pyobj));
auto PyW_invalidator = findChild<QObject*>(PyW_uniqueName, Qt::FindDirectChildrenOnly);
if (PyW_invalidator == nullptr) {
PyW_invalidator = new QObject(this);
PyW_invalidator->setObjectName(PyW_unique_name);
PyW_invalidator->setObjectName(PyW_uniqueName);
Py_INCREF (pyobj);
}
else {
PyW_invalidator->disconnect();
else if (connections[PyW_invalidator]) {
disconnect(connections[PyW_invalidator]);
connections.erase(PyW_invalidator);
}
auto destroyedFun = [pyobj](){
auto destroyedFun = [pyobj]() {
Base::PyGILStateLocker lock;
auto sbk_ptr = reinterpret_cast <SbkObject *> (pyobj);
if (sbk_ptr != nullptr) {
Shiboken::Object::setValidCpp(sbk_ptr, false);
if (auto sbkPtr = reinterpret_cast<SbkObject*>(pyobj); sbkPtr != nullptr) {
Shiboken::Object::setValidCpp(sbkPtr, false);
}
else {
Base::Console().DeveloperError("WrapperManager", "A QObject has just been destroyed after its Pythonic wrapper.\n");
}
Py_DECREF (pyobj);
};
QObject::connect(PyW_invalidator, &QObject::destroyed, this, destroyedFun);
QObject::connect(obj, &QObject::destroyed, PyW_invalidator, &QObject::deleteLater);
}
connections[PyW_invalidator] = connect(PyW_invalidator, &QObject::destroyed, this, destroyedFun);
connect(obj, &QObject::destroyed, PyW_invalidator, &QObject::deleteLater);
}
private:
void wrapQApplication()
+4 -2
View File
@@ -78,6 +78,7 @@ SoDatumLabel::SoDatumLabel()
SO_NODE_ADD_FIELD(name, ("Helvetica"));
SO_NODE_ADD_FIELD(size, (10.F));
SO_NODE_ADD_FIELD(lineWidth, (2.F));
SO_NODE_ADD_FIELD(sampling, (2.F));
SO_NODE_ADD_FIELD(datumtype, (SoDatumLabel::DISTANCE));
@@ -131,7 +132,8 @@ void SoDatumLabel::drawImage()
QColor front;
front.setRgbF(t[0],t[1], t[2]);
QImage image(w, h,QImage::Format_ARGB32_Premultiplied);
QImage image(w * sampling.getValue(), h * sampling.getValue(), QImage::Format_ARGB32_Premultiplied);
image.setDevicePixelRatio(sampling.getValue());
image.fill(0x00000000);
QPainter painter(&image);
@@ -1070,7 +1072,7 @@ void SoDatumLabel::getDimension(float scale, int& srcw, int& srch)
srch = imgsize[1];
float aspectRatio = (float) srcw / (float) srch;
this->imgHeight = scale * (float) (srch);
this->imgHeight = scale * (float) (srch) / sampling.getValue();
this->imgWidth = aspectRatio * (float) this->imgHeight;
}
+1
View File
@@ -85,6 +85,7 @@ public:
SoSFVec3f norm;
SoSFImage image;
SoSFFloat lineWidth;
SoSFFloat sampling;
bool useAntialiasing;
protected:
+21 -21
View File
@@ -1274,8 +1274,8 @@ Py::Object View3DInventorPy::getCursorPos()
auto viewer = getView3DIventorPtr()->getViewer();
SbVec2s vec = viewer->fromQPoint(pos);
Py::Tuple tuple(2);
tuple.setItem(0, Py::Int(vec[0]));
tuple.setItem(1, Py::Int(vec[1]));
tuple.setItem(0, Py::Long(vec[0]));
tuple.setItem(1, Py::Long(vec[1]));
return tuple;
}
catch (const Py::Exception&) {
@@ -1292,13 +1292,13 @@ Py::Object View3DInventorPy::getObjectInfo(const Py::Tuple& args)
try {
//Note: For gcc (4.2) we need the 'const' keyword to avoid the compiler error:
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Int' requested
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Long' requested
//We should report this problem to the PyCXX project as in the documentation an
//example without the 'const' keyword is used.
//Or we can also write Py::Int x(tuple[0]);
//Or we can also write Py::Long x(tuple[0]);
const Py::Tuple tuple(object);
Py::Int x(tuple[0]);
Py::Int y(tuple[1]);
Py::Long x(tuple[0]);
Py::Long y(tuple[1]);
// As this method could be called during a SoHandleEventAction scene
// graph traversal we must not use a second SoHandleEventAction as
@@ -1398,13 +1398,13 @@ Py::Object View3DInventorPy::getObjectsInfo(const Py::Tuple& args)
try {
//Note: For gcc (4.2) we need the 'const' keyword to avoid the compiler error:
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Int' requested
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Long' requested
//We should report this problem to the PyCXX project as in the documentation an
//example without the 'const' keyword is used.
//Or we can also write Py::Int x(tuple[0]);
//Or we can also write Py::Long x(tuple[0]);
const Py::Tuple tuple(object);
Py::Int x(tuple[0]);
Py::Int y(tuple[1]);
Py::Long x(tuple[0]);
Py::Long y(tuple[1]);
// As this method could be called during a SoHandleEventAction scene
// graph traversal we must not use a second SoHandleEventAction as
@@ -1506,8 +1506,8 @@ Py::Object View3DInventorPy::getSize()
try {
SbVec2s size = getView3DIventorPtr()->getViewer()->getSoRenderManager()->getSize();
Py::Tuple tuple(2);
tuple.setItem(0, Py::Int(size[0]));
tuple.setItem(1, Py::Int(size[1]));
tuple.setItem(0, Py::Long(size[0]));
tuple.setItem(1, Py::Long(size[1]));
return tuple;
}
catch (const Py::Exception&) {
@@ -1521,8 +1521,8 @@ Py::Object View3DInventorPy::getPointOnFocalPlane(const Py::Tuple& args)
if (!PyArg_ParseTuple(args.ptr(), "hh", &x, &y)) {
PyErr_Clear();
Py::Tuple t(args[0]);
x = (int)Py::Int(t[0]);
y = (int)Py::Int(t[1]);
x = (int)Py::Long(t[0]);
y = (int)Py::Long(t[1]);
}
try {
SbVec3f pt = getView3DIventorPtr()->getViewer()->getPointOnFocalPlane(SbVec2s(x,y));
@@ -1556,8 +1556,8 @@ Py::Object View3DInventorPy::getPointOnViewport(const Py::Tuple& args)
try {
SbVec2s pt = getView3DIventorPtr()->getViewer()->getPointOnViewport(SbVec3f(vx,vy,vz));
Py::Tuple tuple(2);
tuple.setItem(0, Py::Int(pt[0]));
tuple.setItem(1, Py::Int(pt[1]));
tuple.setItem(0, Py::Long(pt[0]));
tuple.setItem(1, Py::Long(pt[1]));
return tuple;
}
@@ -1575,8 +1575,8 @@ Py::Object View3DInventorPy::projectPointToLine(const Py::Tuple& args)
if (!PyArg_ParseTuple(args.ptr(), "hh", &x, &y)) {
PyErr_Clear();
Py::Tuple t(args[0]);
x = (int)Py::Int(t[0]);
y = (int)Py::Int(t[1]);
x = (int)Py::Long(t[0]);
y = (int)Py::Long(t[1]);
}
try {
SbVec3f pt1, pt2;
@@ -1635,8 +1635,8 @@ void View3DInventorPy::eventCallback(void * ud, SoEventCallback * n)
dict.setItem("Time", Py::String(std::string(e->getTime().formatDate("%Y-%m-%d %H:%M:%S").getString())));
SbVec2s p = n->getEvent()->getPosition();
Py::Tuple pos(2);
pos.setItem(0, Py::Int(p[0]));
pos.setItem(1, Py::Int(p[1]));
pos.setItem(0, Py::Long(p[0]));
pos.setItem(1, Py::Long(p[1]));
// Position
dict.setItem("Position", pos);
// Shift, Ctrl, Alt down
@@ -2509,7 +2509,7 @@ Py::Object View3DInventorPy::setCornerCrossSize(const Py::Tuple& args)
Py::Object View3DInventorPy::getCornerCrossSize()
{
int size = getView3DIventorPtr()->getViewer()->getFeedbackSize();
return Py::Int(size);
return Py::Long(size);
}
Py::Object View3DInventorPy::cast_to_base()
+4 -4
View File
@@ -267,8 +267,8 @@ Py::Object View3DInventorViewerPy::seekToPoint(const Py::Tuple& args)
_viewer->seekToPoint(hitpoint);
}
else {
Py::Int x(tuple[0]);
Py::Int y(tuple[1]);
Py::Long x(tuple[0]);
Py::Long y(tuple[1]);
SbVec2s hitpoint ((long)x,(long)y);
_viewer->seekToPoint(hitpoint);
@@ -334,8 +334,8 @@ Py::Object View3DInventorViewerPy::getPointOnFocalPlane(const Py::Tuple& args)
if (!PyArg_ParseTuple(args.ptr(), "hh", &x, &y)) {
PyErr_Clear();
Py::Tuple t(args[0]);
x = (int)Py::Int(t[0]);
y = (int)Py::Int(t[1]);
x = (int)Py::Long(t[0]);
y = (int)Py::Long(t[1]);
}
try {
SbVec3f pt = _viewer->getPointOnFocalPlane(SbVec2s(x,y));
+6 -6
View File
@@ -356,7 +356,7 @@ ViewProviderFeaturePythonImp::setEdit(int ModNum)
try {
if (has__object__) {
Py::Tuple args(1);
args.setItem(0, Py::Int(ModNum));
args.setItem(0, Py::Long(ModNum));
Py::Object ret(Base::pyCall(py_setEdit.ptr(),args.ptr()));
if (ret.isNone())
return NotImplemented;
@@ -367,7 +367,7 @@ ViewProviderFeaturePythonImp::setEdit(int ModNum)
else {
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
args.setItem(1, Py::Int(ModNum));
args.setItem(1, Py::Long(ModNum));
Py::Object ret(Base::pyCall(py_setEdit.ptr(),args.ptr()));
if (ret.isNone())
return NotImplemented;
@@ -397,7 +397,7 @@ ViewProviderFeaturePythonImp::unsetEdit(int ModNum)
try {
if (has__object__) {
Py::Tuple args(1);
args.setItem(0, Py::Int(ModNum));
args.setItem(0, Py::Long(ModNum));
Py::Object ret(Base::pyCall(py_unsetEdit.ptr(),args.ptr()));
if (ret.isNone())
return NotImplemented;
@@ -408,7 +408,7 @@ ViewProviderFeaturePythonImp::unsetEdit(int ModNum)
else {
Py::Tuple args(2);
args.setItem(0, Py::Object(object->getPyObject(), true));
args.setItem(1, Py::Int(ModNum));
args.setItem(1, Py::Long(ModNum));
Py::Object ret(Base::pyCall(py_unsetEdit.ptr(),args.ptr()));
if (ret.isNone())
return NotImplemented;
@@ -439,7 +439,7 @@ ViewProviderFeaturePythonImp::setEditViewer(View3DInventorViewer *viewer, int Mo
Py::Tuple args(3);
args.setItem(0, Py::Object(object->getPyObject(),true));
args.setItem(1, Py::Object(viewer->getPyObject(),true));
args.setItem(2, Py::Int(ModNum));
args.setItem(2, Py::Long(ModNum));
Py::Object ret(Base::pyCall(py_setEditViewer.ptr(),args.ptr()));
return ret.isTrue()?Accepted:Rejected;
}
@@ -649,7 +649,7 @@ void ViewProviderFeaturePythonImp::finishRestoring()
Py::Object vp = Proxy.getValue();
if (vp.isNone()) {
object->show();
Proxy.setValue(Py::Int(1));
Proxy.setValue(Py::Long(1));
} else {
_FC_PY_CALL_CHECK(finishRestoring,return);
Base::pyCall(py_finishRestoring.ptr());
+1 -1
View File
@@ -314,7 +314,7 @@ view: View3DInventorPy
<Documentation>
<UserDocu>Get/Set the default display mode in turns of coin node index.</UserDocu>
</Documentation>
<Parameter Name="DefaultNode" Type="Int" />
<Parameter Name="DefaultNode" Type="Long" />
</Attribute>
<Attribute Name="IV" ReadOnly="true">
<Documentation>
+5 -5
View File
@@ -304,7 +304,7 @@ PyObject* ViewProviderPy::replaceObject(PyObject *args)
int ret = getViewProviderPtr()->replaceObject(
static_cast<App::DocumentObjectPy*>(oldObj)->getDocumentObjectPtr(),
static_cast<App::DocumentObjectPy*>(newObj)->getDocumentObjectPtr());
return Py::new_reference_to(Py::Int(ret));
return Py::new_reference_to(Py::Long(ret));
}
PY_CATCH;
}
@@ -456,7 +456,7 @@ PyObject* ViewProviderPy::partialRender(PyObject* args)
}
}
Py::Int ret(getViewProviderPtr()->partialRender(values, Base::asBoolean(clear)));
Py::Long ret(getViewProviderPtr()->partialRender(values, Base::asBoolean(clear)));
return Py::new_reference_to(ret);
}
@@ -677,12 +677,12 @@ Py::Object ViewProviderPy::getIcon() const
return wrap.fromQIcon(new QIcon(icon));
}
Py::Int ViewProviderPy::getDefaultMode() const
Py::Long ViewProviderPy::getDefaultMode() const
{
return Py::Int((long)getViewProviderPtr()->getDefaultMode());
return Py::Long((long)getViewProviderPtr()->getDefaultMode());
}
void ViewProviderPy::setDefaultMode(Py::Int arg)
void ViewProviderPy::setDefaultMode(Py::Long arg)
{
return getViewProviderPtr()->setDefaultMode(arg);
}
+1 -1
View File
@@ -584,7 +584,7 @@ Py::Object PyResource::value(const Py::Tuple& args)
item = Py::Long(static_cast<unsigned long>(v.toUInt()));
break;
case QMetaType::Int:
item = Py::Int(v.toInt());
item = Py::Long(v.toInt());
break;
default:
item = Py::String("");
@@ -585,7 +585,7 @@ def create_pip_call(args: List[str]) -> List[str]:
call_args = ["pip", "--disable-pip-version-check"]
call_args.extend(args)
elif appimage:
python_exe = fci.DataPaths.home_dir + "bin/python"
python_exe = fci.DataPaths().home_dir + "bin/python"
call_args = [python_exe, "-m", "pip", "--disable-pip-version-check"]
call_args.extend(args)
else:
+23 -1
View File
@@ -1273,7 +1273,7 @@ AssemblyObject::makeMbdJoint(App::DocumentObject* joint)
JointType jointType = getJointType(joint);
std::shared_ptr<ASMTJoint> mbdJoint = makeMbdJointOfType(joint, jointType);
if (!mbdJoint) {
if (!mbdJoint || !isMbDJointValid(joint)) {
return {};
}
@@ -1581,6 +1581,28 @@ int AssemblyObject::slidingPartIndex(App::DocumentObject* joint)
return slidingFound;
}
bool AssemblyObject::isMbDJointValid(App::DocumentObject* joint)
{
// When dragging a part, we are bundling fixed parts together.
// This may lead to a conflicting joint that is self referencing a MbD part.
// The solver crash when fed such a bad joint. So we make sure it does not happen.
App::DocumentObject* part1 = getMovingPartFromRef(joint, "Reference1");
App::DocumentObject* part2 = getMovingPartFromRef(joint, "Reference2");
if (!part1 || !part2) {
return false;
}
// If this joint is self-referential it must be ignored.
if (getMbDPart(part1) == getMbDPart(part2)) {
Base::Console().Warning(
"Assembly: Ignoring joint (%s) because its parts are connected by a fixed "
"joint bundle. This joint is a conflicting or redundant constraint.\n",
joint->getFullLabel());
return false;
}
return true;
}
AssemblyObject::MbDPartData AssemblyObject::getMbDData(App::DocumentObject* part)
{
auto it = objectPartMap.find(part);
+2
View File
@@ -245,6 +245,8 @@ public:
std::vector<AssemblyLink*> getSubAssemblies();
void updateGroundedJointsPlacements();
bool isMbDJointValid(App::DocumentObject* joint);
private:
std::shared_ptr<MbD::ASMTAssembly> mbdAssembly;
+21 -20
View File
@@ -95,28 +95,29 @@ class _Axis:
pl = obj.Placement
geoms = []
dist = 0
if obj.Distances and obj.Length.Value:
if len(obj.Distances) == len(obj.Angles):
for i in range(len(obj.Distances)):
if hasattr(obj.Length,"Value"):
l = obj.Length.Value
else:
l = obj.Length
dist += obj.Distances[i]
ang = math.radians(obj.Angles[i])
p1 = Vector(dist,0,0)
p2 = Vector(dist+(l/math.cos(ang))*math.sin(ang),l,0)
distances = [0]
angles = [0]
if hasattr(obj, "Distances"):
distances = obj.Distances
if hasattr(obj, "Angles"):
angles = obj.Angles
if distances and obj.Length.Value:
if angles and len(distances) == len(angles):
for i in range(len(distances)):
dist += distances[i]
ang = math.radians(angles[i])
ln = obj.Length.Value
ln = 100 * ln if abs(math.cos(ang)) < 0.01 else ln / math.cos(ang)
unitvec = Vector(math.sin(ang), math.cos(ang), 0)
p1 = Vector(dist, 0, 0)
p2 = p1 + unitvec * ln
if hasattr(obj,"Limit") and obj.Limit.Value:
p3 = p2.sub(p1)
p3.normalize()
p3.multiply(-obj.Limit.Value)
p4 = p1.sub(p2)
p4.normalize()
p4.multiply(-obj.Limit.Value)
geoms.append(Part.LineSegment(p1,p1.add(p4)).toShape())
geoms.append(Part.LineSegment(p2,p2.add(p3)).toShape())
p3 = unitvec * obj.Limit.Value
p4 = unitvec * -obj.Limit.Value
geoms.append(Part.LineSegment(p1, p1 + p3).toShape())
geoms.append(Part.LineSegment(p2, p2 + p4).toShape())
else:
geoms.append(Part.LineSegment(p1,p2).toShape())
geoms.append(Part.LineSegment(p1, p2).toShape())
if geoms:
sh = Part.Compound(geoms)
obj.Shape = sh
+11 -5
View File
@@ -272,12 +272,18 @@ class _ArchMaterial:
def execute(self,obj):
if obj.Material:
if FreeCAD.GuiUp:
c = None
t = None
if "DiffuseColor" in obj.Material:
c = tuple([float(f) for f in obj.Material['DiffuseColor'].strip("()").strip("[]").split(",")])
for p in obj.InList:
if hasattr(p,"Material") and ( (not hasattr(p.ViewObject,"UseMaterialColor")) or p.ViewObject.UseMaterialColor):
if p.Material.Name == obj.Name:
p.ViewObject.ShapeColor = c
c = tuple([float(f) for f in obj.Material["DiffuseColor"].strip("()").strip("[]").split(",")])
if "Transparency" in obj.Material:
t = int(obj.Material["Transparency"])
for p in obj.InList:
if hasattr(p,"Material") \
and p.Material.Name == obj.Name \
and getattr(obj.ViewObject,"UseMaterialColor",True):
if c: p.ViewObject.ShapeColor = c
if t: p.ViewObject.Transparency = t
return
def dumps(self):
+2 -2
View File
@@ -320,11 +320,11 @@ class _Roof(ArchComponent.Component):
runs = []
if ((not 0 <= profilNext2["idrel"] < numEdges)
and 0.0 < profilNext2["angle"] < 90.0
and vecCurr.getAngle(vecNext2) == math.pi):
and math.isclose(vecCurr.getAngle(vecNext2), math.pi, abs_tol=1e-7)):
runs.append((self.helperCalcApex(profilCurr, profilNext2)))
if ((not 0 <= profilBack2["idrel"] < numEdges)
and 0.0 < profilBack2["angle"] < 90.0
and vecCurr.getAngle(vecBack2) == math.pi):
and math.isclose(vecCurr.getAngle(vecBack2), math.pi, abs_tol=1e-7)):
runs.append((self.helperCalcApex(profilCurr, profilBack2)))
runs.sort()
if len(runs) != 0 and runs[0] != profilCurr["run"]:
-3
View File
@@ -537,9 +537,6 @@ class ArchScheduleTaskPanel:
mw = FreeCADGui.getMainWindow()
self.form.move(mw.frameGeometry().topLeft() + mw.rect().center() - self.form.rect().center())
# maintain above FreeCAD window
self.form.setWindowFlags(self.form.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
self.form.show()
def add(self):
+1 -1
View File
@@ -1145,7 +1145,7 @@ class _ViewProviderSectionPlane:
actionToggleCutview = QtGui.QAction(QtGui.QIcon(":/icons/Draft_Edit.svg"),
translate("Arch", "Toggle Cutview"),
menu)
actionToggleCutview.triggered.connect(lambda f=self.toggleCutview, arg=vobj: f(arg))
actionToggleCutview.triggered.connect(lambda: self.toggleCutview(vobj))
menu.addAction(actionToggleCutview)
def edit(self):
+17 -36
View File
@@ -52,45 +52,26 @@ class BIM_Leader(gui_lines.Line):
def finish(self, closed=False, cont=False):
import DraftVecUtils
from draftutils import params
self.end_callbacks(self.call)
self.removeTemporaryObject()
if getattr(self,"oldWP",None):
FreeCAD.DraftWorkingPlane = self.oldWP
if hasattr(Gui, "Snapper"):
FreeCADGui.Snapper.setGrid()
FreeCADGui.Snapper.restack()
self.oldWP = None
rot, sup, pts, fil = self.getStrings()
if self.node:
if len(self.node) > 1:
rot, sup, pts, fil = self.getStrings()
base = DraftVecUtils.toString(self.node[0])
else:
base = DraftVecUtils.toString(FreeCAD.Vector())
color = FreeCAD.ParamGet(
"User parameter:BaseApp/Preferences/Mod/Draft"
).GetUnsigned("DefaultTextColor", 255)
r = ((color >> 24) & 0xFF) / 255.0
g = ((color >> 16) & 0xFF) / 255.0
b = ((color >> 8) & 0xFF) / 255.0
cmd_list = [
"pl = FreeCAD.Placement()",
"pl.Rotation.Q = " + rot,
"pl.Base = " + base,
"points = " + pts,
"leader = Draft.makeWire(points,placement=pl)",
"leader.ViewObject.LineColor = "
+ str(
(
r,
g,
b,
)
),
"leader.ViewObject.EndArrow = True",
"Draft.autogroup(leader)",
"FreeCAD.ActiveDocument.recompute()",
]
FreeCADGui.addModule("Draft")
self.commit(translate("BIM", "Create Leader"), cmd_list)
color = params.get_param("DefaultTextColor") | 0x000000FF
cmd_list = [
"pl = FreeCAD.Placement()",
"pl.Rotation.Q = " + rot,
"pl.Base = " + base,
"points = " + pts,
"leader = Draft.make_wire(points, placement=pl)",
"leader.ViewObject.LineColor = " + str(color),
"leader.ViewObject.EndArrow = True",
"Draft.autogroup(leader)",
"FreeCAD.ActiveDocument.recompute()",
]
FreeCADGui.addModule("Draft")
self.commit(translate("BIM", "Create Leader"), cmd_list)
super(gui_lines.Line, self).finish()
if self.ui and self.ui.continueMode:
self.Activated()
@@ -375,10 +375,6 @@ class BIM_ProjectManager:
+ "\n"
)
s += "groups=" + ";;".join(groups) + "\n"
s += "levelsWP=" + str(int(self.form.levelsWP.isChecked())) + "\n"
s += "levelsAxis=" + str(int(self.form.levelsAxis.isChecked())) + "\n"
s += (
"addHumanFigure="
+ str(int(self.form.addHumanFigure.isChecked()))
@@ -468,10 +464,6 @@ class BIM_ProjectManager:
groups = s[1].split(";;")
self.form.groupsList.clear()
self.form.groupsList.addItems(groups)
elif s[0] == "levelsWP":
self.form.levelsWP.setChecked(bool(int(s[1])))
elif s[0] == "levelsAxis":
self.form.levelsAxis.setChecked(bool(int(s[1])))
elif s[0] == "addHumanFigure":
self.form.addHumanFigure.setChecked(bool(int(s[1])))
+1
View File
@@ -102,6 +102,7 @@ class BIM_TDPage:
page.Scale = FreeCAD.ParamGet(
"User parameter:BaseApp/Preferences/Mod/BIM"
).GetFloat("DefaultPageScale", 0.01)
page.ViewObject.show()
FreeCAD.ActiveDocument.recompute()
+17 -27
View File
@@ -89,7 +89,7 @@ class BIM_WPView:
"MenuText": QT_TRANSLATE_NOOP("BIM_WPView", "Working Plane View"),
"ToolTip": QT_TRANSLATE_NOOP(
"BIM_WPView",
"Aligns the view on the current item in BIM Views window or on the current working plane",
"Aligns the view to the current item in BIM Views window or to the current working plane",
),
"Accel": "9",
}
@@ -99,32 +99,22 @@ class BIM_WPView:
return v
def Activated(self):
done = False
try:
import BimViews
except ImportError:
pass
else:
v = BimViews.findWidget()
if v:
i = v.tree.currentItem()
if i:
# Aligning on current widget item
BimViews.show(i)
done = True
elif hasattr(v, "lastSelected"):
BimViews.show(v.lastSelected)
# Aligning on stored widget item
done = True
elif hasattr(FreeCAD, "DraftWorkingPlane"):
if hasattr(FreeCAD.DraftWorkingPlane, "lastBuildingPart"):
BimViews.show(FreeCAD.DraftWorkingPlane.lastBuildingPart)
done = True
if not done:
# Aligning on current working plane
c = FreeCADGui.ActiveDocument.ActiveView.getCameraNode()
r = FreeCAD.DraftWorkingPlane.getRotation().Rotation.Q
c.orientation.setValue(r)
from bimcommands import BimViews
import WorkingPlane
vm = BimViews.findWidget()
if vm:
sel = vm.tree.selectedItems()
if sel:
# Aligning to current widget item
BimViews.show(sel[0])
return
if hasattr(vm, "lastSelected"):
# Aligning to stored widget item
BimViews.show(vm.lastSelected)
return
# Aligning to current working plane
WorkingPlane.get_working_plane().align_view()
FreeCADGui.addCommand("BIM_WPView", BIM_WPView())
+1 -3
View File
@@ -307,14 +307,12 @@ def filter_out(objs):
nobjs.append(obj)
elif obj.isDerivedFrom("Mesh::Feature"):
nobjs.append(obj)
elif obj.isDerivedFrom("App::DocumentObjectGroup"):
elif Draft.is_group(obj):
if filter_out(obj.Group):
# only append groups that contain exportable objects
nobjs.append(obj)
else:
print("DEBUG: Filtering out",obj.Label)
elif obj.isDerivedFrom("Mesh::Feature"):
nobjs.append(obj)
elif obj.isDerivedFrom("App::Feature"):
if Draft.get_type(obj) in ("Dimension","LinearDimension","Layer","Text","DraftText"):
nobjs.append(obj)
+1 -1
View File
@@ -1334,7 +1334,7 @@ def get_orphan_elements(ifcfile):
products = ifcfile.by_type("IfcElement")
products = [p for p in products if not p.Decomposes]
products = [p for p in products if not p.ContainedInStructure]
products = [p for p in products if not getattr(p, "ContainedInStructure", [])]
products = [
p for p in products if not hasattr(p, "VoidsElements") or not p.VoidsElements
]
+1 -1
View File
@@ -216,7 +216,7 @@ class ifc_vp_object:
"""Recursively gets the children only used by this object"""
children = []
for child in obj.OutList:
if len(child.InList) == 1 and child.InList[1] == obj:
if len(child.InList) == 1 and child.InList[0] == obj:
children.append(child)
children.extend(self.getOwnChildren(child))
return children
+1 -1
View File
@@ -666,7 +666,7 @@ Py::List AreaPy::getShapes() const
Area* area = getAreaPtr();
const std::list<Area::Shape>& shapes = area->getChildren();
for (auto& s : shapes) {
ret.append(Py::TupleN(Part::shape2pyshape(s.shape), Py::Int(s.op)));
ret.append(Py::TupleN(Part::shape2pyshape(s.shape), Py::Long(s.op)));
}
return ret;
}
+1 -1
View File
@@ -39,7 +39,7 @@
<Documentation>
<UserDocu>Returns the cell's category as an integer</UserDocu>
</Documentation>
<Parameter Name="SourceCategory" Type="Int"/>
<Parameter Name="SourceCategory" Type="Long"/>
</Attribute>
<Attribute Name="SourceCategoryName" ReadOnly="true">
<Documentation>
+2 -2
View File
@@ -134,10 +134,10 @@ Py::Long VoronoiCellPy::getSourceIndex() const
return Py::Long(index);
}
Py::Int VoronoiCellPy::getSourceCategory() const
Py::Long VoronoiCellPy::getSourceCategory() const
{
VoronoiCell* c = getVoronoiCellFromPy(this);
return Py::Int(c->ptr->source_category());
return Py::Long(c->ptr->source_category());
}
Py::String VoronoiCellPy::getSourceCategoryName() const
-3
View File
@@ -309,9 +309,6 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
# Cancel canned drilling cycle
self.commandlist.append(Path.Command("G80"))
command = Path.Command("G0", {"Z": obj.SafeHeight.Value})
self.commandlist.append(command)
machine.addCommand(command)
# Apply feedrates to commands
PathFeedRate.setFeedRate(self.commandlist, obj.ToolController)
+5 -5
View File
@@ -131,7 +131,7 @@ class CommandPathPost:
if dlg.exec_():
filename = dlg.selectedFiles()[0]
Path.Log.debug(filename)
with open(filename, "w") as f:
with open(filename, "w", encoding="utf-8") as f:
f.write(gcode)
else:
return
@@ -140,7 +140,7 @@ class CommandPathPost:
while os.path.isfile(filename):
base, ext = os.path.splitext(filename)
filename = f"{base}-1{ext}"
with open(filename, "w") as f:
with open(filename, "w", encoding="utf-8") as f:
f.write(gcode)
elif policy == "Open File Dialog on conflict":
@@ -153,16 +153,16 @@ class CommandPathPost:
if dlg.exec_():
filename = dlg.selectedFiles()[0]
Path.Log.debug(filename)
with open(filename, "w") as f:
with open(filename, "w", encoding="utf-8") as f:
f.write(gcode)
else:
return
else:
with open(filename, "w") as f:
with open(filename, "w", encoding="utf-8") as f:
f.write(gcode)
else: # Overwrite
with open(filename, "w") as f:
with open(filename, "w", encoding="utf-8") as f:
f.write(gcode)
FreeCAD.Console.PrintMessage(f"File written to {filename}\n")
@@ -723,11 +723,6 @@ class ViewProviderLinearDimension(ViewProviderDimensionBase):
if not hasattr(vobj, "ArrowType"):
return
if self.p3.x < self.p2.x:
inv = False
else:
inv = True
# Set scale
symbol = utils.ARROW_TYPES.index(vobj.ArrowType)
s = vobj.ArrowSize.Value * vobj.ScaleMultiplier
@@ -745,7 +740,7 @@ class ViewProviderLinearDimension(ViewProviderDimensionBase):
else:
s1.addChild(self.trans1)
s1.addChild(gui_utils.dim_symbol(symbol, invert=not inv))
s1.addChild(gui_utils.dim_symbol(symbol, invert=False))
self.marks.addChild(s1)
s2 = coin.SoSeparator()
@@ -754,7 +749,7 @@ class ViewProviderLinearDimension(ViewProviderDimensionBase):
else:
s2.addChild(self.trans2)
s2.addChild(gui_utils.dim_symbol(symbol, invert=inv))
s2.addChild(gui_utils.dim_symbol(symbol, invert=True))
self.marks.addChild(s2)
self.node_wld.insertChild(self.marks, 2)
+92 -38
View File
@@ -12,11 +12,14 @@
#include <iomanip>
#include <iostream>
#include <sstream>
#include <exception>
#include <string>
#include "dxf.h"
#include <App/Application.h>
#include <App/Color.h>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/FileInfo.h>
#include <Base/Interpreter.h>
#include <Base/Stream.h>
@@ -2564,6 +2567,12 @@ bool CDxfRead::ResolveEncoding()
// Also some DXF files have the codepage name in uppercase so we lowercase it.
m_encoding = m_CodePage;
std::transform(m_encoding.begin(), m_encoding.end(), m_encoding.begin(), ::tolower);
// Add mapping for common non-standard encoding names.
if (m_encoding == "8859_1") {
m_encoding = "iso-8859-1"; // Replace with a name Python understands
}
// NOLINTNEXTLINE(readability/nolint)
#define ANSI_ENCODING_PREFIX "ansi_" // NOLINT(cppcoreguidelines-macro-usage)
if (m_encoding.rfind(ANSI_ENCODING_PREFIX, 0) == 0 && m_encoding.rfind("ansi_x3", 0) != 0) {
@@ -2579,7 +2588,11 @@ bool CDxfRead::ResolveEncoding()
Base::PyGILStateLocker lock;
PyObject* pyDecoder = PyCodec_Decoder(m_encoding.c_str());
if (pyDecoder == nullptr) {
return false; // A key error exception will have been placed.
// PyCodec_Decoder failed, which means Python could not find the encoding.
// This sets a Python LookupError. We clear this low-level error because
// our caller will throw a more informative, high-level exception.
PyErr_Clear();
return false;
}
PyObject* pyUTF8Decoder = PyCodec_Decoder("utf_8");
assert(pyUTF8Decoder != nullptr);
@@ -2628,64 +2641,98 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
return;
}
StartImport();
// Loop reading the sections.
while (get_next_record()) {
if (m_record_type != eObjectType) {
ImportError("Found type %d record when expecting start of a SECTION or EOF\n",
(int)m_record_type);
continue;
try {
StartImport();
// Loop reading the sections.
while (get_next_record()) {
if (m_record_type != eObjectType) {
ImportError("Found type %d record when expecting start of a SECTION or EOF\n",
(int)m_record_type);
continue;
}
if (IsObjectName("EOF")) { // TODO: Check for drivel beyond EOF record
break;
}
if (!IsObjectName("SECTION")) {
ImportError("Found %s record when expecting start of a SECTION\n",
m_record_data.c_str());
continue;
}
if (!ReadSection()) {
throw Base::RuntimeError("Failed to read DXF section (returned false).");
}
}
if (IsObjectName("EOF")) { // TODO: Check for drivel beyond EOF record
break;
}
if (!IsObjectName("SECTION")) {
ImportError("Found %s record when expecting start of a SECTION\n",
m_record_data.c_str());
continue;
}
if (!ReadSection()) {
return;
FinishImport();
// Flush out any unsupported features messages
if (!m_unsupportedFeaturesNoted.empty()) {
ImportError("Unsupported DXF features:\n");
for (auto& featureInfo : m_unsupportedFeaturesNoted) {
ImportError("%s: %d time(s) first at line %d\n",
featureInfo.first,
featureInfo.second.first,
featureInfo.second.second);
}
}
}
FinishImport();
// FLush out any unsupported features messages
if (!m_unsupportedFeaturesNoted.empty()) {
ImportError("Unsupported DXF features:\n");
for (auto& featureInfo : m_unsupportedFeaturesNoted) {
ImportError("%s: %d time(s) first at line %d\n",
featureInfo.first,
featureInfo.second.first,
featureInfo.second.second);
}
catch (const Base::Exception& e) {
// This catches specific FreeCAD exceptions and re-throws them.
throw;
}
catch (const std::exception& e) {
// This catches all standard C++ exceptions and converts them
// to a FreeCAD exception, which the binding layer can handle.
throw Base::RuntimeError(e.what());
}
catch (...) {
// This is a catch-all for any other non-standard C++ exceptions.
throw Base::RuntimeError(
"An unknown, non-standard C++ exception occurred during DXF import.");
}
}
bool CDxfRead::ReadSection()
{
if (!get_next_record()) {
ImportError("Unclosed SECTION at end of file\n");
return false;
throw Base::RuntimeError("Unexpected end of file after SECTION tag.");
}
if (m_record_type != eName) {
ImportError("Ignored SECTION with no name record\n");
return ReadIgnoredSection();
}
if (IsObjectName("HEADER")) {
return ReadHeaderSection();
if (!ReadHeaderSection()) {
throw Base::RuntimeError("Failed while reading HEADER section.");
}
return true;
}
if (IsObjectName("TABLES")) {
return ReadTablesSection();
if (!ReadTablesSection()) {
throw Base::RuntimeError("Failed while reading TABLES section.");
}
return true;
}
if (IsObjectName("BLOCKS")) {
return ReadBlocksSection();
if (!ReadBlocksSection()) {
throw Base::RuntimeError("Failed while reading BLOCKS section.");
}
return true;
}
if (IsObjectName("ENTITIES")) {
return ReadEntitiesSection();
if (!ReadEntitiesSection()) {
throw Base::RuntimeError("Failed while reading ENTITIES section.");
}
return true;
}
return ReadIgnoredSection();
if (!ReadIgnoredSection()) {
throw Base::RuntimeError("Failed while reading an unknown/ignored section.");
}
return true;
}
void CDxfRead::ProcessLayerReference(CDxfRead* object, void* target)
{
if (object->Layers.count(object->m_record_data) == 0) {
@@ -2774,11 +2821,18 @@ bool CDxfRead::ReadHeaderSection()
if (m_record_type != eVariableName) {
continue; // Quietly ignore unknown record types
}
// Store the variable name before we try to read its value.
std::string currentVarName = m_record_data;
if (!ReadVariable()) {
return false;
// If ReadVariable returns false, throw an exception with the variable name.
throw Base::RuntimeError("Failed while reading value for HEADER variable: "
+ currentVarName);
}
}
return false;
// If the loop finishes without finding ENDSEC, it's an error.
throw Base::RuntimeError("Unexpected end of file inside HEADER section.");
}
bool CDxfRead::ReadVariable()
+2 -2
View File
@@ -25,13 +25,13 @@
<Documentation>
<UserDocu>The number of rows in the array.</UserDocu>
</Documentation>
<Parameter Name="Rows" Type="Int"/>
<Parameter Name="Rows" Type="Long"/>
</Attribute>
<Attribute Name="Columns" ReadOnly="true">
<Documentation>
<UserDocu>The number of columns in the array.</UserDocu>
</Documentation>
<Parameter Name="Columns" Type="Int"/>
<Parameter Name="Columns" Type="Long"/>
</Attribute>
<Methode Name="getRow" ReadOnly="true">
<Documentation>
+4 -4
View File
@@ -81,14 +81,14 @@ Py::List Array2DPy::getArray() const
return list;
}
Py::Int Array2DPy::getRows() const
Py::Long Array2DPy::getRows() const
{
return Py::Int(getMaterial2DArrayPtr()->rows());
return Py::Long(getMaterial2DArrayPtr()->rows());
}
Py::Int Array2DPy::getColumns() const
Py::Long Array2DPy::getColumns() const
{
return Py::Int(getMaterial2DArrayPtr()->columns());
return Py::Long(getMaterial2DArrayPtr()->columns());
}
PyObject* Array2DPy::getRow(PyObject* args)
+2 -2
View File
@@ -25,13 +25,13 @@
<Documentation>
<UserDocu>The number of columns in the array.</UserDocu>
</Documentation>
<Parameter Name="Columns" Type="Int"/>
<Parameter Name="Columns" Type="Long"/>
</Attribute>
<Attribute Name="Depth" ReadOnly="true">
<Documentation>
<UserDocu>The depth of the array (3rd dimension).</UserDocu>
</Documentation>
<Parameter Name="Columns" Type="Int"/>
<Parameter Name="Columns" Type="Long"/>
</Attribute>
<Methode Name="getRows" ReadOnly="true">
<Documentation>
+4 -4
View File
@@ -83,14 +83,14 @@ Py::List Array3DPy::getArray() const
return list;
}
Py::Int Array3DPy::getColumns() const
Py::Long Array3DPy::getColumns() const
{
return Py::Int(getMaterial3DArrayPtr()->columns());
return Py::Long(getMaterial3DArrayPtr()->columns());
}
Py::Int Array3DPy::getDepth() const
Py::Long Array3DPy::getDepth() const
{
return Py::Int(getMaterial3DArrayPtr()->depth());
return Py::Long(getMaterial3DArrayPtr()->depth());
}
PyObject* Array3DPy::getRows(PyObject* args)
+3 -1
View File
@@ -95,7 +95,9 @@ App::DocumentObjectExecReturn* MeasurePosition::execute()
{
const App::DocumentObject* object = Element.getValue();
const std::vector<std::string>& subElements = Element.getSubValues();
if (subElements.empty()) {
return {};
}
App::SubObjectT subject {object, subElements.front().c_str()};
auto info = getMeasureInfo(subject);
+2 -2
View File
@@ -1048,7 +1048,7 @@ private:
if (!PyLong_Check(value)) {
throw Py::ValueError(err);
}
int order = Py::Int(value);
int order = Py::Long(value);
params.orders[s] = static_cast<TopoShape::Continuity>(order);
return;
});
@@ -1125,7 +1125,7 @@ private:
if (!PyLong_Check(value)) {
throw Py::ValueError(err);
}
int order = Py::Int(value);
int order = Py::Long(value);
params.orders[s] = static_cast<TopoShape::Continuity>(order);
return;
});
+1 -1
View File
@@ -65,7 +65,7 @@ PyObject *PartFeaturePy::getElementHistory(PyObject *args, PyObject *kwds) {
} else
ret.setItem(0, Py::Object(history.obj->getPyObject(), true));
} else
ret.setItem(0, Py::Int(history.tag));
ret.setItem(0, Py::Long(history.tag));
tmp.clear();
ret.setItem(1, Py::String(history.element.appendToBuffer(tmp)));
Py::List intermedates;
+4 -4
View File
@@ -1889,7 +1889,7 @@ PyObject* TopoShapePy::countElement(PyObject *args)
return nullptr;
PY_TRY {
return Py::new_reference_to(Py::Int((long)getTopoShapePtr()->countSubShapes(input)));
return Py::new_reference_to(Py::Long((long)getTopoShapePtr()->countSubShapes(input)));
}
PY_CATCH_OCC
}
@@ -2362,10 +2362,10 @@ PyObject* TopoShapePy::findSubShape(PyObject* args)
for (auto& s : getPyShapes(pyobj)) {
int index = getTopoShapePtr()->findShape(s.getShape());
if (index > 0) {
res.append(Py::TupleN(Py::String(s.shapeName()), Py::Int(index)));
res.append(Py::TupleN(Py::String(s.shapeName()), Py::Long(index)));
}
else {
res.append(Py::TupleN(Py::Object(), Py::Int(0)));
res.append(Py::TupleN(Py::Object(), Py::Long(0)));
}
}
if (PySequence_Check(pyobj)) {
@@ -2652,7 +2652,7 @@ PyObject* TopoShapePy::getElementHistory(PyObject* args)
Py_Return;
}
Py::Tuple ret(3);
ret.setItem(0, Py::Int(tag));
ret.setItem(0, Py::Long(tag));
std::string tmp;
ret.setItem(1, Py::String(original.appendToBuffer(tmp)));
Py::List pyHistory;
+1 -1
View File
@@ -81,7 +81,7 @@ void CmdPointsImport::activated(int iMsg)
Gui::getMainWindow(),
QString(),
QString(),
QString::fromLatin1("%1 (*.asc *.pcd *.ply);;%2 (*.*)")
QStringLiteral("%1 (*.asc *.pcd *.ply *.e57);;%2 (*.*)")
.arg(QObject::tr("Point formats"), QObject::tr("All Files")));
if (fn.isEmpty()) {
return;
+2 -2
View File
@@ -114,7 +114,7 @@ private:
args.setItem(3,vector.apply(xyz));
args.setItem(4,Py::Float(radius));
args.setItem(5,Py::Int((int)0));
args.setItem(5,Py::Long((int)0));
Py::Tuple ret(method.apply(args));
Py::Object S1(ret.getItem(0));
Py::Object S2(ret.getItem(1));
@@ -154,7 +154,7 @@ private:
args.setItem(2,Py::Vector(l2));
args.setItem(3,Py::Vector(Base::Vector3d(0,0,1)));
args.setItem(4,Py::Float(radius));
//args.setItem(5,Py::Int((int)0));
//args.setItem(5,Py::Long((int)0));
args.setItem(5,Py::Long((long)1));
Py::Tuple ret(method.apply(args));
Py::Vector S1(ret.getItem(0));
+4 -4
View File
@@ -2399,7 +2399,7 @@ Py::List SketchObjectPy::getConflictingConstraints() const
Py::List conflicting;
for (auto cid : conflictinglist) {
conflicting.append(Py::Int(cid));
conflicting.append(Py::Long(cid));
}
return conflicting;
@@ -2412,7 +2412,7 @@ Py::List SketchObjectPy::getRedundantConstraints() const
Py::List redundant;
for (auto cid : redundantlist) {
redundant.append(Py::Int(cid));
redundant.append(Py::Long(cid));
}
return redundant;
@@ -2425,7 +2425,7 @@ Py::List SketchObjectPy::getPartiallyRedundantConstraints() const
Py::List redundant;
for (auto cid : redundantlist) {
redundant.append(Py::Int(cid));
redundant.append(Py::Long(cid));
}
return redundant;
@@ -2438,7 +2438,7 @@ Py::List SketchObjectPy::getMalformedConstraints() const
Py::List malformed;
for (auto cid : malformedlist) {
malformed.append(Py::Int(cid));
malformed.append(Py::Long(cid));
}
return malformed;
+1 -1
View File
@@ -178,7 +178,7 @@ PyObject* SketchPy::movePoint(PyObject* args)
Py::Long SketchPy::getConstraint() const
{
// return Py::Int();
// return Py::Long();
throw Py::AttributeError("Not yet implemented");
}
@@ -1,10 +1,11 @@
CreatedByChkLst,ScaleChkLst,LabelChkLst,CommentChkLst,CompanyChkLst,LicenseChkLst,CreatedDateChkLst,LastModifiedDateChkLst
"author_name","fc-sc","drawing_title","freecad_drawing","nomsuperviseur","copyright","datedecreation","fc-date"
"nomauteur","echelle","document_type","titleline-1","companyname","rights","fecha2","date"
"nomauteur","echelle","title","titleline-1","companyname","rights","fecha2","date"
"authorname","масштаб","titre","sous_titre","compagnyname",,"date-1","dateverification"
"designed_by_name","escala","название","subtitulo","compagny",,"creationdate","дата"
"designed by name","scale","titulo", "subtitle",,,,"fecha3"
"nom auteur","fc-scale","drawing_name",,,,,"date-2"
,,"fc-title",,,,,"checkdate"
,,"titleline-1",,,,,
"nom auteur","fc-scale","drawing_name","supplementary_title_1",,,,"date-2"
"creator",,"fc-title",,,,,"checkdate"
,,"titleline-1",,,,,"date_of_issue"
,,"freecad",,,,,
,,"document_type",,,,,
1 CreatedByChkLst ScaleChkLst LabelChkLst CommentChkLst CompanyChkLst LicenseChkLst CreatedDateChkLst LastModifiedDateChkLst
2 author_name fc-sc drawing_title freecad_drawing nomsuperviseur copyright datedecreation fc-date
3 nomauteur echelle document_type title titleline-1 companyname rights fecha2 date
4 authorname масштаб titre sous_titre compagnyname date-1 dateverification
5 designed_by_name escala название subtitulo compagny creationdate дата
6 designed by name scale titulo subtitle fecha3
7 nom auteur fc-scale drawing_name supplementary_title_1 date-2
8 creator fc-title checkdate
9 titleline-1 date_of_issue
10 freecad
11 document_type
+1 -1
View File
@@ -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);
}
+22 -11
View File
@@ -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<QGCustomText*>(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 bouding 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 bouding rect
m_frame->setRect(tightBoundingRect());
}
void QGIDatumLabel::setLineWidth(double lineWidth)
@@ -466,7 +477,7 @@ void QGIDatumLabel::setFont(QFont font)
QFont tFont(font);
double fontSize = font.pixelSize();
double tolAdj = getTolAdjust();
tFont.setPixelSize((int)(fontSize * tolAdj));
tFont.setPixelSize(std::max(1, (int)(fontSize * tolAdj)));
m_tolTextOver->setFont(tFont);
m_tolTextUnder->setFont(tFont);
updateFrameRect();
+1
View File
@@ -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,
@@ -152,7 +152,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t1, 0, 0)
self.cb1 = QtGui.QCheckBox(updateCb)
self.cb1.setObjectName(key)
self.cb1.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb1, "setCheckState"):
self.cb1.setCheckState(QtCore.Qt.Checked)
else:
self.cb1.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb1, 0, 1)
u1 = QtGui.QLabel(updateTxt)
self.la.addWidget(u1, 0, 2)
@@ -169,7 +172,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t2, 1, 0)
self.cb2 = QtGui.QCheckBox(updateCb)
self.cb2.setObjectName(key)
self.cb2.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb2, "setCheckState"):
self.cb2.setCheckState(QtCore.Qt.Checked)
else:
self.cb2.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb2, 1, 1)
u2 = QtGui.QLabel(updateTxt)
self.la.addWidget(u2, 1, 2)
@@ -189,7 +195,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t3, 2, 0)
self.cb3 = QtGui.QCheckBox(updateCb)
self.cb3.setObjectName(key)
self.cb3.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb3, "setCheckState"):
self.cb3.setCheckState(QtCore.Qt.Checked)
else:
self.cb3.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb3, 2, 1)
u3 = QtGui.QLabel(updateTxt)
self.la.addWidget(u3, 2, 2)
@@ -206,7 +215,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t4, 3, 0)
self.cb4 = QtGui.QCheckBox(updateCb)
self.cb4.setObjectName(key)
self.cb4.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb4, "setCheckState"):
self.cb4.setCheckState(QtCore.Qt.Checked)
else:
self.cb4.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb4, 3, 1)
u4 = QtGui.QLabel(updateTxt)
self.la.addWidget(u4, 3, 2)
@@ -223,7 +235,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t5, 4, 0)
self.cb5 = QtGui.QCheckBox(updateCb)
self.cb5.setObjectName(key)
self.cb5.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb5, "setCheckState"):
self.cb5.setCheckState(QtCore.Qt.Checked)
else:
self.cb5.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb5, 4, 1)
u5 = QtGui.QLabel(updateTxt)
self.la.addWidget(u5, 4, 2)
@@ -240,7 +255,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t6, 5, 0)
self.cb6 = QtGui.QCheckBox(updateCb)
self.cb6.setObjectName(key)
self.cb6.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb6, "setCheckState"):
self.cb6.setCheckState(QtCore.Qt.Checked)
else:
self.cb6.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb6, 5, 1)
u6 = QtGui.QLabel(updateTxt)
self.la.addWidget(u6, 5, 2)
@@ -257,7 +275,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t7, 6, 0)
self.cb7 = QtGui.QCheckBox(updateCb)
self.cb7.setObjectName(key)
self.cb7.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb7, "setCheckState"):
self.cb7.setCheckState(QtCore.Qt.Checked)
else:
self.cb7.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb7, 6, 1)
u7 = QtGui.QLabel(updateTxt)
self.la.addWidget(u7, 6, 2)
@@ -303,7 +324,10 @@ class TaskFillTemplateFields:
self.la.addWidget(t8, 7, 0)
self.cb8 = QtGui.QCheckBox(updateCb)
self.cb8.setObjectName(key)
self.cb8.setChecked(QtCore.Qt.Checked)
if hasattr(self.cb8, "setCheckState"):
self.cb8.setCheckState(QtCore.Qt.Checked)
else:
self.cb8.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cb8, 7, 1)
u8 = QtGui.QLabel(updateTxt)
self.la.addWidget(u8, 7, 2)
@@ -350,7 +374,10 @@ class TaskFillTemplateFields:
"Update All",
)
)
self.cbAll.setChecked(QtCore.Qt.Checked)
if hasattr(self.cbAll, "setCheckState"):
self.cbAll.setCheckState(QtCore.Qt.Checked)
else:
self.cbAll.setChecked(QtCore.Qt.Checked)
self.la.addWidget(self.cbAll, 8, 1)
self.cbAll.clicked.connect(self.on_cbAll_clicked)
@@ -391,11 +418,17 @@ class TaskFillTemplateFields:
def on_cbAll_clicked(self):
if self.cbAll.isChecked():
for cbEach in self.checkBoxList:
cbEach.setChecked(QtCore.Qt.Checked)
if hasattr(cbEach, "setCheckState"):
cbEach.setCheckState(QtCore.Qt.Checked)
else:
cbEach.setChecked(QtCore.Qt.Checked)
self.button.setEnabled(True)
else:
for cbEach in self.checkBoxList:
cbEach.setChecked(QtCore.Qt.Unchecked)
if hasattr(cbEach, "setCheckState"):
cbEach.setCheckState(QtCore.Qt.Checked)
else:
cbEach.setChecked(QtCore.Qt.Checked)
self.button.setEnabled(False)
def on_cb1_clicked(self):
+19 -6
View File
@@ -2,41 +2,54 @@
#define FC_OS_MACOSX 1
#include "App/ProgramOptionsUtilities.h"
#include <src/App/InitApplication.h>
using namespace App::Util;
using Spr = std::pair<std::string, std::string>;
TEST(ApplicationTest, fCustomSyntaxLookup)
class ApplicationTest: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
TEST_F(ApplicationTest, fCustomSyntaxLookup)
{
Spr res {customSyntax("-display")};
Spr exp {"display", "null"};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxMac)
TEST_F(ApplicationTest, fCustomSyntaxMac)
{
Spr res {customSyntax("-psn_stuff")};
Spr exp {"psn", "stuff"};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxWidgetCount)
TEST_F(ApplicationTest, fCustomSyntaxWidgetCount)
{
Spr res {customSyntax("-widgetcount")};
Spr exp {"widgetcount", ""};
EXPECT_EQ(res, exp);
}
TEST(ApplicationTest, fCustomSyntaxNotFound)
TEST_F(ApplicationTest, fCustomSyntaxNotFound)
{
Spr res {customSyntax("-displayx")};
Spr exp {"", ""};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxAmpersand)
TEST_F(ApplicationTest, fCustomSyntaxAmpersand)
{
Spr res {customSyntax("@freddie")};
Spr exp {"response-file", "freddie"};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxEmptyIn)
TEST_F(ApplicationTest, fCustomSyntaxEmptyIn)
{
Spr res {customSyntax("")};
Spr exp {"", ""};
+44 -32
View File
@@ -1,10 +1,22 @@
#include <gtest/gtest.h>
#include <src/App/InitApplication.h>
#include "App/ExpressionParser.h"
#include "App/ExpressionTokenizer.h"
class Expression: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
// clang-format off
TEST(Expression, tokenize)
TEST_F(Expression, tokenize)
{
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromUtf8(""), 10), QString());
// 0.0000 deg-
@@ -15,7 +27,7 @@ TEST(Expression, tokenize)
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromUtf8("0.00000 deg"), 11), QString::fromLatin1("deg"));
}
TEST(Expression, tokenizeCompletion)
TEST_F(Expression, tokenizeCompletion)
{
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromUtf8("My Cube"), 7), QString::fromUtf8("MyCube"));
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromUtf8("My Cube0"), 8), QString::fromUtf8("MyCube0"));
@@ -24,7 +36,7 @@ TEST(Expression, tokenizeCompletion)
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromUtf8("My Cube 1"), 9), QString::fromUtf8("MyCube1"));
}
TEST(Expression, tokenizeQuantity)
TEST_F(Expression, tokenizeQuantity)
{
auto result = App::ExpressionParser::tokenize("0.00000 deg");
EXPECT_EQ(result.size(), 2);
@@ -36,7 +48,7 @@ TEST(Expression, tokenizeQuantity)
EXPECT_EQ(std::get<2>(result[1]), "deg");
}
TEST(Expression, tokenizeFunc)
TEST_F(Expression, tokenizeFunc)
{
auto result = App::ExpressionParser::tokenize("sin(0.00000)");
EXPECT_EQ(result.size(), 3);
@@ -50,7 +62,7 @@ TEST(Expression, tokenizeFunc)
EXPECT_EQ(std::get<2>(result[2]), ")");
}
TEST(Expression, tokenizeOne)
TEST_F(Expression, tokenizeOne)
{
auto result = App::ExpressionParser::tokenize("1");
EXPECT_EQ(result.size(), 1);
@@ -59,7 +71,7 @@ TEST(Expression, tokenizeOne)
EXPECT_EQ(std::get<2>(result[0]), "1");
}
TEST(Expression, tokenizeNum)
TEST_F(Expression, tokenizeNum)
{
auto result = App::ExpressionParser::tokenize("1.2341");
EXPECT_EQ(result.size(), 1);
@@ -68,7 +80,7 @@ TEST(Expression, tokenizeNum)
EXPECT_EQ(std::get<2>(result[0]), "1.2341");
}
TEST(Expression, tokenizeID)
TEST_F(Expression, tokenizeID)
{
auto result = App::ExpressionParser::tokenize("Something");
EXPECT_EQ(result.size(), 1);
@@ -77,7 +89,7 @@ TEST(Expression, tokenizeID)
EXPECT_EQ(std::get<2>(result[0]), "Something");
}
TEST(Expression, tokenizeUnit)
TEST_F(Expression, tokenizeUnit)
{
auto result = App::ExpressionParser::tokenize("km");
EXPECT_EQ(result.size(), 1);
@@ -86,7 +98,7 @@ TEST(Expression, tokenizeUnit)
EXPECT_EQ(std::get<2>(result[0]), "km");
}
TEST(Expression, tokenizeUSUnit)
TEST_F(Expression, tokenizeUSUnit)
{
auto result = App::ExpressionParser::tokenize("\"");
EXPECT_EQ(result.size(), 1);
@@ -95,7 +107,7 @@ TEST(Expression, tokenizeUSUnit)
EXPECT_EQ(std::get<2>(result[0]), "\"");
}
TEST(Expression, tokenizeInt)
TEST_F(Expression, tokenizeInt)
{
auto result = App::ExpressionParser::tokenize("123456");
EXPECT_EQ(result.size(), 1);
@@ -104,7 +116,7 @@ TEST(Expression, tokenizeInt)
EXPECT_EQ(std::get<2>(result[0]), "123456");
}
TEST(Expression, tokenizePi)
TEST_F(Expression, tokenizePi)
{
auto result = App::ExpressionParser::tokenize("pi");
EXPECT_EQ(result.size(), 1);
@@ -113,7 +125,7 @@ TEST(Expression, tokenizePi)
EXPECT_EQ(std::get<2>(result[0]), "pi");
}
TEST(Expression, tokenizeE)
TEST_F(Expression, tokenizeE)
{
auto result = App::ExpressionParser::tokenize("e");
EXPECT_EQ(result.size(), 1);
@@ -122,7 +134,7 @@ TEST(Expression, tokenizeE)
EXPECT_EQ(std::get<2>(result[0]), "e");
}
TEST(Expression, tokenizeConstant)
TEST_F(Expression, tokenizeConstant)
{
auto result = App::ExpressionParser::tokenize("True False true false None");
EXPECT_EQ(result.size(), 5);
@@ -135,7 +147,7 @@ TEST(Expression, tokenizeConstant)
EXPECT_EQ(std::get<0>(result[4]), App::ExpressionParser::CONSTANT);
}
TEST(Expression, tokenizeEqual)
TEST_F(Expression, tokenizeEqual)
{
auto result = App::ExpressionParser::tokenize("==");
EXPECT_EQ(result.size(), 1);
@@ -144,7 +156,7 @@ TEST(Expression, tokenizeEqual)
EXPECT_EQ(std::get<2>(result[0]), "==");
}
TEST(Expression, tokenizeNotEqual)
TEST_F(Expression, tokenizeNotEqual)
{
auto result = App::ExpressionParser::tokenize("!=");
EXPECT_EQ(result.size(), 1);
@@ -153,7 +165,7 @@ TEST(Expression, tokenizeNotEqual)
EXPECT_EQ(std::get<2>(result[0]), "!=");
}
TEST(Expression, tokenizeLessThan)
TEST_F(Expression, tokenizeLessThan)
{
auto result = App::ExpressionParser::tokenize("<");
EXPECT_EQ(result.size(), 1);
@@ -162,7 +174,7 @@ TEST(Expression, tokenizeLessThan)
EXPECT_EQ(std::get<2>(result[0]), "<");
}
TEST(Expression, tokenizeLessThanEqual)
TEST_F(Expression, tokenizeLessThanEqual)
{
auto result = App::ExpressionParser::tokenize("<=");
EXPECT_EQ(result.size(), 1);
@@ -171,7 +183,7 @@ TEST(Expression, tokenizeLessThanEqual)
EXPECT_EQ(std::get<2>(result[0]), "<=");
}
TEST(Expression, tokenizeGreaterThan)
TEST_F(Expression, tokenizeGreaterThan)
{
auto result = App::ExpressionParser::tokenize(">");
EXPECT_EQ(result.size(), 1);
@@ -180,7 +192,7 @@ TEST(Expression, tokenizeGreaterThan)
EXPECT_EQ(std::get<2>(result[0]), ">");
}
TEST(Expression, tokenizeGreaterThanEqual)
TEST_F(Expression, tokenizeGreaterThanEqual)
{
auto result = App::ExpressionParser::tokenize(">=");
EXPECT_EQ(result.size(), 1);
@@ -189,7 +201,7 @@ TEST(Expression, tokenizeGreaterThanEqual)
EXPECT_EQ(std::get<2>(result[0]), ">=");
}
TEST(Expression, tokenizeMinus)
TEST_F(Expression, tokenizeMinus)
{
auto result = App::ExpressionParser::tokenize("1-1");
EXPECT_EQ(result.size(), 3);
@@ -198,7 +210,7 @@ TEST(Expression, tokenizeMinus)
EXPECT_EQ(std::get<2>(result[1]), "-");
}
TEST(Expression, tokenizeCell1)
TEST_F(Expression, tokenizeCell1)
{
auto result = App::ExpressionParser::tokenize("$A$12");
EXPECT_EQ(result.size(), 1);
@@ -207,7 +219,7 @@ TEST(Expression, tokenizeCell1)
EXPECT_EQ(std::get<2>(result[0]), "$A$12");
}
TEST(Expression, tokenizeCell2)
TEST_F(Expression, tokenizeCell2)
{
auto result = App::ExpressionParser::tokenize("A$12");
EXPECT_EQ(result.size(), 1);
@@ -216,7 +228,7 @@ TEST(Expression, tokenizeCell2)
EXPECT_EQ(std::get<2>(result[0]), "A$12");
}
TEST(Expression, tokenizeCell3)
TEST_F(Expression, tokenizeCell3)
{
auto result = App::ExpressionParser::tokenize("$A12");
EXPECT_EQ(result.size(), 1);
@@ -225,7 +237,7 @@ TEST(Expression, tokenizeCell3)
EXPECT_EQ(std::get<2>(result[0]), "$A12");
}
TEST(Expression, tokenizeString)
TEST_F(Expression, tokenizeString)
{
auto result = App::ExpressionParser::tokenize("<<Test>>");
EXPECT_EQ(result.size(), 1);
@@ -234,27 +246,27 @@ TEST(Expression, tokenizeString)
EXPECT_EQ(std::get<2>(result[0]), "<<Test>>");
}
TEST(Expression, tokenizeExponent)
TEST_F(Expression, tokenizeExponent)
{
// TODO
}
TEST(Expression, tokenizeNumAndUnit)
TEST_F(Expression, tokenizeNumAndUnit)
{
// TODO
}
TEST(Expression, tokenizePos)
TEST_F(Expression, tokenizePos)
{
// TODO
}
TEST(Expression, tokenizeNeg)
TEST_F(Expression, tokenizeNeg)
{
// TODO
}
TEST(Expression, tokenizePi_rad)
TEST_F(Expression, tokenizePi_rad)
{
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromLatin1("p"), 1), QString::fromLatin1("p"));
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromLatin1("pi"), 2), QString());
@@ -265,13 +277,13 @@ TEST(Expression, tokenizePi_rad)
EXPECT_EQ(App::ExpressionTokenizer().perform(QString::fromLatin1("pi rad"), 2), QString());
}
TEST(Expression, toString)
TEST_F(Expression, toString)
{
App::UnitExpression expr{nullptr, Base::Quantity{}, "pi rad"};
EXPECT_EQ(expr.toString(), "pi rad");
}
TEST(Expression, test_pi_rad)
TEST_F(Expression, test_pi_rad)
{
auto constant = std::make_unique<App::ConstantExpression>(nullptr, "pi");
auto unit = std::make_unique<App::UnitExpression>(nullptr, Base::Quantity{}, "rad");
@@ -280,7 +292,7 @@ TEST(Expression, test_pi_rad)
op.release();
}
TEST(Expression, test_e_rad)
TEST_F(Expression, test_e_rad)
{
auto constant = std::make_unique<App::ConstantExpression>(nullptr, "e");
auto unit = std::make_unique<App::UnitExpression>(nullptr, Base::Quantity{}, "rad");
+19 -8
View File
@@ -1,21 +1,32 @@
#include <gtest/gtest.h>
#include <Base/Axis.h>
TEST(Axis, TestDefault)
#include <src/App/InitApplication.h>
class Axis: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
TEST_F(Axis, TestDefault)
{
Base::Axis axis;
EXPECT_EQ(axis.getBase(), Base::Vector3d());
EXPECT_EQ(axis.getDirection(), Base::Vector3d());
}
TEST(Axis, TestCustom)
TEST_F(Axis, TestCustom)
{
Base::Axis axis(Base::Vector3d(0, 0, 1), Base::Vector3d(1, 1, 1));
EXPECT_EQ(axis.getBase(), Base::Vector3d(0, 0, 1));
EXPECT_EQ(axis.getDirection(), Base::Vector3d(1, 1, 1));
}
TEST(Axis, TestSetter)
TEST_F(Axis, TestSetter)
{
Base::Axis axis;
axis.setBase(Base::Vector3d(0, 0, 1));
@@ -24,7 +35,7 @@ TEST(Axis, TestSetter)
EXPECT_EQ(axis.getDirection(), Base::Vector3d(1, 1, 1));
}
TEST(Axis, TestAssign)
TEST_F(Axis, TestAssign)
{
Base::Axis axis;
Base::Axis move;
@@ -35,7 +46,7 @@ TEST(Axis, TestAssign)
EXPECT_EQ(move.getDirection(), Base::Vector3d(1, 1, 1));
}
TEST(Axis, TestReverse)
TEST_F(Axis, TestReverse)
{
Base::Axis axis(Base::Vector3d(0, 0, 1), Base::Vector3d(1, 1, 1));
axis.reverse();
@@ -43,7 +54,7 @@ TEST(Axis, TestReverse)
EXPECT_EQ(axis.getDirection(), Base::Vector3d(-1, -1, -1));
}
TEST(Axis, TestReversed)
TEST_F(Axis, TestReversed)
{
Base::Axis axis(Base::Vector3d(0, 0, 1), Base::Vector3d(1, 1, 1));
Base::Axis rev(axis.reversed());
@@ -52,7 +63,7 @@ TEST(Axis, TestReversed)
EXPECT_EQ(rev.getDirection(), Base::Vector3d(-1, -1, -1));
}
TEST(Axis, TestMove)
TEST_F(Axis, TestMove)
{
Base::Axis axis(Base::Vector3d(0, 0, 1), Base::Vector3d(1, 1, 1));
axis.move(Base::Vector3d(1, 2, 3));
@@ -60,7 +71,7 @@ TEST(Axis, TestMove)
EXPECT_EQ(axis.getDirection(), Base::Vector3d(1, 1, 1));
}
TEST(Axis, TestMult)
TEST_F(Axis, TestMult)
{
Base::Axis axis(Base::Vector3d(0, 0, 1), Base::Vector3d(0, 0, 1));
axis *= Base::Placement(Base::Vector3d(1, 1, 1), Base::Rotation(1, 0, 0, 0));
+13 -1
View File
@@ -2,5 +2,17 @@
#include "Gui/Assistant.h"
TEST(Assistant, first)
#include <src/App/InitApplication.h>
class Assistant: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
TEST_F(Assistant, first)
{}
@@ -45,10 +45,9 @@
class TestMaterialFilter : public ::testing::Test {
protected:
static void SetUpTestSuite() {
if (App::Application::GetARGC() == 0) {
tests::initApplication();
}
static void SetUpTestSuite()
{
tests::initApplication();
}
void SetUp() override {
@@ -72,6 +71,14 @@ protected:
hGrp->SetBool("UseMaterialsFromConfigDir", false);
hGrp->SetBool("UseMaterialsFromCustomDir", true);
auto param = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Material/Editor");
param->SetBool("ShowFavorites", true);
param->SetBool("ShowRecent", true);
param->SetBool("ShowEmptyFolders", false);
param->SetBool("ShowEmptyLibraries", true);
param->SetBool("ShowLegacy", false);
_materialManager->refresh();
_library = _materialManager->getLibrary(QLatin1String("Custom"));
@@ -88,19 +95,33 @@ protected:
hGrp->SetBool("UseMaterialsFromConfigDir", _useUserDir);
hGrp->SetBool("UseMaterialsFromCustomDir", _useCustomDir);
hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Material/Editor");
hGrp->SetBool("ShowFavorites", _includeFavorites);
hGrp->SetBool("ShowRecent", _includeRecent);
hGrp->SetBool("ShowEmptyFolders", _includeFolders);
hGrp->SetBool("ShowEmptyLibraries", _includeLibraries);
hGrp->SetBool("ShowLegacy", _includeLegacy);
_materialManager->refresh();
}
Materials::ModelManager* _modelManager;
Materials::MaterialManager* _materialManager;
Materials::ModelManager* _modelManager {};
Materials::MaterialManager* _materialManager {};
std::shared_ptr<Materials::MaterialLibrary> _library;
QString _testMaterialUUID;
std::string _customDir;
bool _useBuiltInDir;
bool _useWorkbenchDir;
bool _useUserDir;
bool _useCustomDir;
bool _useBuiltInDir {};
bool _useWorkbenchDir {};
bool _useUserDir {};
bool _useCustomDir {};
bool _includeFavorites {};
bool _includeRecent {};
bool _includeFolders {};
bool _includeLibraries {};
bool _includeLegacy {};
const char* UUIDAcrylicLegacy = ""; // This can't be known until it is loaded
const char* UUIDAluminumAppearance = "3c6d0407-66b3-48ea-a2e8-ee843edf0311";
+16 -5
View File
@@ -2,8 +2,19 @@
#include <Mod/Mesh/App/Mesh.h>
#include <Mod/Mesh/App/Core/Grid.h>
#include <src/App/InitApplication.h>
class MeshTest: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
// NOLINTBEGIN(cppcoreguidelines-*,readability-*)
TEST(MeshTest, TestDefault)
TEST_F(MeshTest, TestDefault)
{
MeshCore::MeshKernel kernel;
Base::Vector3f p1 {0, 0, 0};
@@ -16,7 +27,7 @@ TEST(MeshTest, TestDefault)
EXPECT_EQ(kernel.CountFacets(), 1);
}
TEST(MeshTest, TestGrid1OfPlanarMesh)
TEST_F(MeshTest, TestGrid1OfPlanarMesh)
{
MeshCore::MeshKernel kernel;
Base::Vector3f p1 {0, 0, 0};
@@ -36,7 +47,7 @@ TEST(MeshTest, TestGrid1OfPlanarMesh)
EXPECT_EQ(countZ, 1);
}
TEST(MeshTest, TestGrid2OfPlanarMesh)
TEST_F(MeshTest, TestGrid2OfPlanarMesh)
{
MeshCore::MeshKernel kernel;
Base::Vector3f p1 {0, 0, 0};
@@ -56,7 +67,7 @@ TEST(MeshTest, TestGrid2OfPlanarMesh)
EXPECT_EQ(countZ, 1);
}
TEST(MeshTest, TestGrid1OfAlmostPlanarMesh)
TEST_F(MeshTest, TestGrid1OfAlmostPlanarMesh)
{
MeshCore::MeshKernel kernel;
Base::Vector3f p1 {0, 0, 0};
@@ -76,7 +87,7 @@ TEST(MeshTest, TestGrid1OfAlmostPlanarMesh)
EXPECT_EQ(countZ, 1);
}
TEST(MeshTest, TestGrid2OfAlmostPlanarMesh)
TEST_F(MeshTest, TestGrid2OfAlmostPlanarMesh)
{
MeshCore::MeshKernel kernel;
Base::Vector3f p1 {0, 0, 0};
+13 -2
View File
@@ -5,6 +5,9 @@
#include <TopAbs_ShapeEnum.hxx>
#include <QObject>
#include <src/App/InitApplication.h>
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wextra-semi")
QT_WARNING_DISABLE_CLANG("-Woverloaded-virtual")
@@ -17,8 +20,16 @@ QT_WARNING_DISABLE_CLANG("-Woverloaded-virtual")
#include <StdMeshers_QuadranglePreference.hxx>
QT_WARNING_POP
class SMesh: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
// NOLINTBEGIN
TEST(SMesh, testMefisto)
TEST_F(SMesh, testMefisto)
{
TopoDS_Solid box = BRepPrimAPI_MakeBox(10.0, 10.0, 10.0).Solid();
@@ -64,7 +75,7 @@ TEST(SMesh, testMefisto)
delete gen;
}
TEST(SMesh, testStdMeshers)
TEST_F(SMesh, testStdMeshers)
{
TopoDS_Solid box = BRepPrimAPI_MakeBox(10.0, 10.0, 10.0).Solid();
+14 -3
View File
@@ -7,9 +7,20 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <src/App/InitApplication.h>
class TestTopoDS_Shape: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
// NOLINTBEGIN
// clang-format off
TEST(TopoDS_Shape, TestCastEdgeToVertex)
TEST_F(TestTopoDS_Shape, TestCastEdgeToVertex)
{
BRepBuilderAPI_MakeEdge mkEdge(gp_Pnt(0, 0, 0), gp_Pnt(10, 0, 0));
TopoDS_Edge edge = mkEdge.Edge();
@@ -18,7 +29,7 @@ TEST(TopoDS_Shape, TestCastEdgeToVertex)
EXPECT_TRUE(vertex.IsNull());
}
TEST(TopoDS_Shape, TestCastNullVertex)
TEST_F(TestTopoDS_Shape, TestCastNullVertex)
{
TopoDS_Vertex vertex1;
TopoDS_Vertex vertex2;
@@ -26,7 +37,7 @@ TEST(TopoDS_Shape, TestCastNullVertex)
EXPECT_TRUE(vertex2.IsNull());
}
TEST(TopoDS_Shape, TestCastNullEdge)
TEST_F(TestTopoDS_Shape, TestCastNullEdge)
{
TopoDS_Edge edge;
TopoDS_Vertex vertex;
+10 -1
View File
@@ -15,7 +15,16 @@
// NOLINTBEGIN(readability-magic-numbers,cppcoreguidelines-avoid-magic-numbers)
TEST(ShapeRelationKey, HistoryTraceTypeComparison)
class ShapeRelationKey: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
TEST_F(ShapeRelationKey, HistoryTraceTypeComparison)
{
// Arrange
Data::MappedName mappedName {"mappedName"};
+4 -4
View File
@@ -33,10 +33,10 @@ SetCompressor /SOLID lzma
#!define APP_VERSION_PATCH 0
# get version info from freecadcmd
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_MAJOR \$\"{App.Version()[0]}\$\"')$\">${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_MINOR \$\"{App.Version()[1]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_PATCH \$\"{App.Version()[2]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe -c $\"print(f'!define APP_VERSION_REVISION \$\"{App.Version()[3].split()[0]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_MAJOR \$\"{App.Version()[0]}\$\"')$\">${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_MINOR \$\"{App.Version()[1]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_PATCH \$\"{App.Version()[2]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!system "${FILES_FREECAD}\bin\freecadcmd.exe --safe-mode -c $\"print(f'!define APP_VERSION_REVISION \$\"{App.Version()[3].split()[0]}\$\"')$\">>${__FILEDIR__}\version.nsh" = 0
!include "${__FILEDIR__}\version.nsh"
!delfile "${__FILEDIR__}\version.nsh"