Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'CloudCompare/CloudCompare'
ref: a452997aabb81f3a9d80b982946bff50f9384d00
ref: fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313
submodules: recursive

- name: Clone PythonRuntime
Expand All @@ -35,7 +35,7 @@ jobs:

- name: Install Dependencies
run: |
conda install -c conda-forge qt>=6.9.* ninja doxygen
conda install -c conda-forge qt6-main==6.8.3 ninja doxygen
pip install pytest pybind11<3.0 numpy

- name: Configure MSVC console
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'CloudCompare/CloudCompare'
ref: a452997aabb81f3a9d80b982946bff50f9384d00
ref: fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313
submodules: recursive

- name: Clone PythonRuntime
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'CloudCompare/CloudCompare'
ref: a452997aabb81f3a9d80b982946bff50f9384d00
ref: fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313
submodules: recursive

- name: Clone PythonRuntime
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Install Dependencies
run: |
conda install -c conda-forge qt=6.9.*
conda install -c conda-forge qt6-main==6.8.3
python -m pip install --upgrade pip
pip install pytest

Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ include(cmake/CloudCompareVariables.cmake)

option(PLUGIN_PYTHON "Install Python Plugin" OFF)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(PLUGIN_PYTHON)
project(PythonRuntime)

Expand Down
19 changes: 15 additions & 4 deletions cmake/Helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,24 @@ function(copy_python_dll)
DEBUG
"Python DLL: = ${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.dll"
)
install(
FILES "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.dll"
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Debug build")
install(
FILES "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}_d.dll"
# install the python3 base dll as well because some libs will try to
# find it (PySide and PyQT for example)
"${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}_d.dll"
DESTINATION ${CLOUDCOMPARE_DEST_FOLDER}
)
else()
install(
FILES "${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.dll"
# install the python3 base dll as well because some libs will try to
# find it (PySide and PyQT for example)
"${Python_RUNTIME_LIBRARY_DIRS}/python${Python_VERSION_MAJOR}.dll"
DESTINATION ${CLOUDCOMPARE_DEST_FOLDER}
)
DESTINATION ${CLOUDCOMPARE_DEST_FOLDER}
)
endif()
endfunction()

function(manage_windows_install)
Expand Down
8 changes: 8 additions & 0 deletions docs/python/pycc/primitives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ __________________
:undoc-members:
:show-inheritance:

ccDisc
________

.. autoclass:: pycc.ccDisc
:members:
:undoc-members:
:show-inheritance:

ccSphere
________

Expand Down
5 changes: 5 additions & 0 deletions docs/stubfiles/pycc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@ class ccShiftedObject(ccHObject):
@overload
def setGlobalShift(*args, **kwargs) -> Any: ...

class ccDisc(ccGenericPrimitive):
def __init__(self, radius: float, transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueId: int = ...) -> None: ...
def getRadius(self) -> float: ...
def setRadius(self, radius: float) -> None: ...

class ccSphere(ccGenericPrimitive):
def __init__(self, radius: float, transMat: ccGLMatrix = ..., name: QString = ..., precision: int = ..., uniqueId: int = ...) -> None: ...
def getRadius(self) -> float: ...
Expand Down
7 changes: 0 additions & 7 deletions tests/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ def test_normal_kdtree(cloudcompare_exe):
cloudcompare_exe, "-SILENT", "-O", f"{abspath}/data/a_cloud.bin", "-PYTHON_SCRIPT",
os.path.join(abspath, "scripts", "kdtree.py"))


def test_normal_kdtree(cloudcompare_exe):
assert_command_runs(
cloudcompare_exe, "-SILENT", "-O", f"{abspath}/data/a_cloud.bin", "-PYTHON_SCRIPT",
os.path.join(abspath, "scripts", "true_kdtree.py"))


def test_cloud_for_each(cloudcompare_exe):
assert_command_runs(
cloudcompare_exe, "-SILENT", "-O", f"{abspath}/data/a_cloud.bin", "-PYTHON_SCRIPT",
Expand Down
2 changes: 1 addition & 1 deletion wrapper/cccorelib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if(CCCORELIB_PYTHON_IS_MASTER_PROJECT)
GIT_REPOSITORY https://github.com/CloudCompare/CCCoreLib
GIT_PROGRESS ON
GIT_SHALLOW OFF
GIT_TAG 0a7b892193575f58241b56c1828eb38ece11e02b
GIT_TAG 52dc573bf8a782d60c95c36f3eed41654debeadc
)

FetchContent_GetProperties(CCCoreLib)
Expand Down
2 changes: 1 addition & 1 deletion wrapper/pycc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(PYCC_IS_MASTER_PROJECT)
GIT_REPOSITORY https://github.com/CloudCompare/CloudCompare
GIT_SUBMODULES "libs/qCC_db/extern/CCCoreLib;libs/CCAppCommon/QDarkStyleSheet"
GIT_PROGRESS ON
GIT_TAG a452997aabb81f3a9d80b982946bff50f9384d00
GIT_TAG fc2fe88a33ca9e406aab43b3bda6a9c6d38a2313
GIT_SHALLOW OFF
GIT_SUBMODULES
)
Expand Down
1 change: 1 addition & 0 deletions wrapper/pycc/src/qcc_db/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(pycc_db_sources
${CMAKE_CURRENT_LIST_DIR}/ccColorScalesManager.cpp
${CMAKE_CURRENT_LIST_DIR}/ccCone.cpp
${CMAKE_CURRENT_LIST_DIR}/ccCylinder.cpp
${CMAKE_CURRENT_LIST_DIR}/ccDisc.cpp
${CMAKE_CURRENT_LIST_DIR}/ccDish.cpp
${CMAKE_CURRENT_LIST_DIR}/ccDrawableObject.cpp
${CMAKE_CURRENT_LIST_DIR}/ccGBLSensor.cpp
Expand Down
64 changes: 64 additions & 0 deletions wrapper/pycc/src/qcc_db/ccDisc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// ##########################################################################
// # #
// # CLOUDCOMPARE PLUGIN: PythonRuntime #
// # #
// # This program is free software; you can redistribute it and/or modify #
// # it under the terms of the GNU General Public License as published by #
// # the Free Software Foundation; version 2 of the License. #
// # #
// # This program is distributed in the hope that it will be useful, #
// # but WITHOUT ANY WARRANTY; without even the implied warranty of #
// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
// # GNU General Public License for more details. #
// # #
// # COPYRIGHT: Thomas Montaigu #
// # #
// ##########################################################################

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>

#include <ccDisc.h>

#include "../casters.h"

namespace py = pybind11;
using namespace pybind11::literals;

void define_ccDisc(py::module &m)
{
py::class_<ccDisc, ccGenericPrimitive>(m, "ccDisc", R"doc(
ccDisc

Parameters
----------
radius : PointCoordinateType
radius of the disc
transMat : , optional
optional 3D transformation (can be set afterwards with ccDrawableObject::setGLTransformation)
name : str, default: Disc
name of the disc object
precision : int, default: 24
drawing precision (angular step = 360/precision)
uniqueID : int, optional
unique ID (handle with care)

Example
-------

.. code:: Python

disc = pycc.ccDisc(3.0)
disc2 = pycc.ccDisc(5.0, name="Disc2")
)doc")
.def(
py::init<PointCoordinateType, const ccGLMatrix *, QString, unsigned, unsigned>(),
"radius"_a,
"transMat"_a = nullptr,
"name"_a = QString("Disc"),
"precision"_a = 24,
"uniqueId"_a = []() { return ccUniqueIDGenerator::InvalidUniqueID; }())
.def("getRadius", &ccDisc::getRadius)
.def("setRadius", &ccDisc::setRadius, "radius"_a);
}
2 changes: 2 additions & 0 deletions wrapper/pycc/src/qcc_db/qcc_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void define_ccIndexedTransformation(py::module &m);
void define_ccPlane(py::module &);
void define_ccTorus(py::module &);
void define_ccBox(py::module &);
void define_ccDisc(py::module &);
void define_ccDish(py::module &);
void define_ccCone(py::module &);
void define_ccCylinder(py::module &);
Expand Down Expand Up @@ -155,6 +156,7 @@ void define_qcc_db(py::module &m)
define_ccPlane(m);
define_ccTorus(m);
define_ccBox(m);
define_ccDisc(m);
define_ccDish(m);
define_ccCone(m);
define_ccCylinder(m);
Expand Down
13 changes: 13 additions & 0 deletions wrapper/pycc/tests/test_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
import cccorelib


def test_cc_disc():
disc = pycc.ccDisc(3.0)
assert disc.getTypeName() == "Disc"
assert disc.getName() == "Disc"
assert disc.getRadius() == 3.0
disc.setRadius(10.0)
assert disc.getRadius() == 10.0

disc2 = pycc.ccDisc(5.0, name="Disc2")
assert disc2.getTypeName() == "Disc"
assert disc2.getName() == "Disc2"


def test_cc_sphere():
sphere = pycc.ccSphere(3.0)
assert sphere.getTypeName() == "Sphere"
Expand Down
Loading