From fc14346828f772a4fd9475bf38f609cb79aeab71 Mon Sep 17 00:00:00 2001 From: AU Date: Fri, 28 Aug 2026 18:19:08 +0200 Subject: [PATCH 1/4] Wrap float fields --- ocp.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocp.toml b/ocp.toml index 55a26e7b5..d1060f136 100644 --- a/ocp.toml +++ b/ocp.toml @@ -1389,7 +1389,7 @@ class OpenGl_ShaderProgram; module_mapping = "lambda x: Path(x).splitpath()[-1].split('.')[0].split('_')[0]" -byref_types = ["Standard_Real","Standard_Integer","Standard_Boolean","int","double","bool"] +byref_types = ["Standard_Real","Standard_Integer","Standard_Boolean","int","double","bool","float"] byref_types_smart_ptr = ["opencascade::handle", "handle", "Handle"] parsing_header = '''#pragma clang diagnostic ignored "-Wmacro-redefined" From e5f799a562c280d2be4859c2988716f46fdaa2ca Mon Sep 17 00:00:00 2001 From: adam-urbanczyk <13981538+adam-urbanczyk@users.noreply.github.com> Date: Sat, 29 Aug 2026 10:29:06 +0200 Subject: [PATCH 2/4] Add a PBR attrs test --- tests/test_ocp.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_ocp.py b/tests/test_ocp.py index 91b93a632..cdde05aa9 100644 --- a/tests/test_ocp.py +++ b/tests/test_ocp.py @@ -186,3 +186,21 @@ def test_bounds(surf): u2 == approx(2.0 * math.pi) v1 == approx(-0.5 * math.pi) v2 == approx(0.5 * math.pi) + + +# %% attributes based on from OCP.XCAFDoc import XCAFDoc_VisMaterialPBR + +from OCP.XCAFDoc import XCAFDoc_VisMaterialPBR +from OCP.Quantity import Quantity_ColorRGBA + + +def test_attributes(): + + pbr = XCAFDoc_VisMaterialPBR() + + assert isinstance(pbr.BaseColor, Quantity_ColorRGBA) + assert isinstance(pbr.Metallic, float) + + assert pbr.Metallic == 1.0 + pbr.Metallic = 0.0 + assert pbr.Metallic == 0.0 From a581fdd070c45cab0bc308bbcc3f82506305b43d Mon Sep 17 00:00:00 2001 From: adam-urbanczyk <13981538+adam-urbanczyk@users.noreply.github.com> Date: Sat, 29 Aug 2026 10:30:14 +0200 Subject: [PATCH 3/4] Update tweak --- conda/meta.yaml | 2 +- ocp.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conda/meta.yaml b/conda/meta.yaml index e9203408c..6514215c4 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,5 +1,5 @@ {% set OCCT_VER = "8.0.0" %} -{% set OCP_TWEAK = "0" %} +{% set OCP_TWEAK = "1" %} package: name: ocp diff --git a/ocp.toml b/ocp.toml index d1060f136..dba47ad2b 100644 --- a/ocp.toml +++ b/ocp.toml @@ -1449,7 +1449,7 @@ class Adaptor3d_Surface; [Attributes] - __version__ = "8.0.0.0" + __version__ = "8.0.0.1" [Modules] From ab55cf63c9bf602dff6c42ee0f8864d069fd0c0d Mon Sep 17 00:00:00 2001 From: adam-urbanczyk <13981538+adam-urbanczyk@users.noreply.github.com> Date: Sat, 29 Aug 2026 18:14:38 +0200 Subject: [PATCH 4/4] Add few tests --- tests/test_ocp.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/tests/test_ocp.py b/tests/test_ocp.py index cdde05aa9..c27eea379 100644 --- a/tests/test_ocp.py +++ b/tests/test_ocp.py @@ -25,11 +25,15 @@ def test_iter(): s3 = TopoDS_Shape() shape_list = List_TopoDS_Shape() + + assert len(shape_list) == 0 + shape_list.Append(s1) shape_list.Append(s2) shape_list.Append(s3) assert shape_list.Size() == 3 + assert len(shape_list) == 3 for s in shape_list: assert isinstance(s, TopoDS_Shape) @@ -188,7 +192,7 @@ def test_bounds(surf): v2 == approx(0.5 * math.pi) -# %% attributes based on from OCP.XCAFDoc import XCAFDoc_VisMaterialPBR +# %% attributes based on XCAFDoc_VisMaterialPBR from OCP.XCAFDoc import XCAFDoc_VisMaterialPBR from OCP.Quantity import Quantity_ColorRGBA @@ -204,3 +208,70 @@ def test_attributes(): assert pbr.Metallic == 1.0 pbr.Metallic = 0.0 assert pbr.Metallic == 0.0 + + +# %% gp + +from OCP.gp import gp_Vec, gp_Dir, gp_Pnt + + +def test_vec(): + + v0 = gp_Vec() + + assert v0.Magnitude() == 0.0 + + v1 = gp_Vec(1, 0, 0) + + assert v1.X() == 1.0 + assert (2 * v1).X() == 2.0 + assert (v1 / 2).X() == 0.5 + assert (v1 + v1).X() == 2.0 + + +def test_dir(): + + d0 = gp_Dir() + + assert d0.X() == 1.0 + assert d0.Y() == 0.0 + assert d0.Z() == 0.0 + + +def test_pnt(): + + p0 = gp_Pnt() + + assert p0.X() == 0.0 + assert p0.Y() == 0.0 + assert p0.Z() == 0.0 + + p1 = gp_Pnt(1, 0, 0) + + assert p1.X() == 1.0 + assert p1.Y() == 0.0 + assert p1.Z() == 0.0 + + +# %% TopLoc_Location + +from OCP.TopLoc import TopLoc_Location +from OCP.gp import gp_Trsf + + +def test_location(): + + T = gp_Trsf() + T.SetTranslation(gp_Vec(1, 0, 0)) + + loc0 = TopLoc_Location(T) + + assert (loc0 / loc0).Transformation().TranslationPart().SquareModulus() == 0.0 + + loc1 = loc0 * loc0 + + trans = loc1.Transformation().TranslationPart() + + assert trans.X() == 2.0 + assert trans.Y() == 0.0 + assert trans.Z() == 0.0