From d1c48975ad33ed03b280111ea5bda72cbc7d8a8a Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 14 Jun 2024 20:55:04 -0700 Subject: [PATCH] feat: Add mystery primitive and MoI example --- examples/moi.py | 11 +++++++++++ nhf/primitive.py | 4 ++++ poetry.lock | 2 +- pyproject.toml | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 examples/moi.py create mode 100644 nhf/primitive.py diff --git a/examples/moi.py b/examples/moi.py new file mode 100644 index 0000000..9ce17c1 --- /dev/null +++ b/examples/moi.py @@ -0,0 +1,11 @@ +""" +Computes the moment of inertia for the mystery object +""" +import numpy as N +import cadquery as Cq +import nhf.primitive + +if __name__ == '__main__': + obj = nhf.primitive.mystery() + mat = N.array(Cq.Shape.matrixOfInertia(obj.val())) + print(mat) diff --git a/nhf/primitive.py b/nhf/primitive.py new file mode 100644 index 0000000..ac9209c --- /dev/null +++ b/nhf/primitive.py @@ -0,0 +1,4 @@ +import cadquery + +def mystery(): + return cadquery.Workplane().box(10, 5, 5) diff --git a/poetry.lock b/poetry.lock index db47204..69302dd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -857,4 +857,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "172a6b2578a05dce25e7ea5c38b6f5217a23b3aa7f91e0ce5ea768a3d6090751" +content-hash = "caf46b526858dbf2960b0204782140ad072d96f7b3f161ac7e9db0d9b709b25a" diff --git a/pyproject.toml b/pyproject.toml index 4608771..3431c0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ readme = "README.md" python = "^3.10" cadquery = "^2.4.0" build123d = "^0.5.0" +numpy = "^1.26.4" [build-system] requires = ["poetry-core"]