Skip to content
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Generate (Windows on Linux)
if: inputs.platform == 'Windows'
run: |
micromamba create --yes --platform win-64 --no-deps --prefix ./occt occt=8.0.0
micromamba create --yes --platform win-64 --no-deps --prefix ./occt occt=8.0.1
micromamba run -n bindgen cmake -S . -B . -G Ninja \
-DPython_ROOT_DIR=$CONDA_PREFIX \
-DPython3_ROOT_DIR=$CONDA_PREFIX \
Expand All @@ -88,7 +88,7 @@ jobs:
-DPython3_ROOT_DIR=$CONDA_PREFIX \
-DPython_FIND_VIRTUALENV=ONLY \
-DPython3_FIND_VIRTUALENV=ONLY
cmake --build .
cmake --build . -- -v
ls -lRht

- name: Copy pkl output
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
cmake_minimum_required(VERSION 3.29)
project(OCP)

cmake_host_system_information(RESULT N_CORES QUERY NUMBER_OF_LOGICAL_CORES)

set(N_PROC
2
${N_CORES}
CACHE STRING "Number of processes used for generating code")
set(DLL_EXT
dll
Expand Down
1 change: 1 addition & 0 deletions environment.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
- toposort
- py-lief
- msitools # [linux]
- cxxheaderparser
{% else %}
- cxx-compiler
- tbb-devel # [win]
Expand Down
50 changes: 44 additions & 6 deletions tests/test_ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,32 @@

from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCP.TopoDS import TopoDS_Shape
from OCP.collections import List_TopoDS_Shape
from OCP.collections import List_TopoDS_Shape, Array1_TopoDS_Shape

# %% TopoDS_Shape


def test_hash():
@fixture
def boxes():

s1 = BRepPrimAPI_MakeBox(1, 1, 1).Shape()
s2 = BRepPrimAPI_MakeBox(1, 1, 1).Shape()
s3 = BRepPrimAPI_MakeBox(1, 1, 1).Shape()

return s1, s2, s3


def test_hash(boxes):

s1, s2, s3 = boxes

assert len({s1, s2, s3}) == 3
assert len({s1, s1, s3}) == 2


def test_iter():
def test_iter(boxes):

s1 = TopoDS_Shape()
s2 = TopoDS_Shape()
s3 = TopoDS_Shape()
s1, s2, s3 = boxes

shape_list = List_TopoDS_Shape()

Expand All @@ -38,6 +44,38 @@ def test_iter():
for s in shape_list:
assert isinstance(s, TopoDS_Shape)

for s in list(shape_list):
assert isinstance(s, TopoDS_Shape)


def test_shape_list_bool(boxes):

l = List_TopoDS_Shape()

assert not l
assert l.IsEmpty()

for s in boxes:
l.Append(s)

assert l
assert not l.IsEmpty()


def test_shape_array(boxes):

l = Array1_TopoDS_Shape(0, 2)

assert l
assert not l.IsEmpty()
assert len(l) == 3

for i,s in enumerate(boxes):
l.SetValue(i, s)

for i,s in enumerate(boxes):
assert s.IsEqual(l(i))


# %% primitive

Expand Down
Loading