feat: Add mystery primitive and MoI example

This commit is contained in:
Leni Aniva 2024-06-14 20:55:04 -07:00
parent 6942e1f218
commit d1c48975ad
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
4 changed files with 17 additions and 1 deletions

11
examples/moi.py Normal file
View File

@ -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)

4
nhf/primitive.py Normal file
View File

@ -0,0 +1,4 @@
import cadquery
def mystery():
return cadquery.Workplane().box(10, 5, 5)

2
poetry.lock generated
View File

@ -857,4 +857,4 @@ files = [
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "172a6b2578a05dce25e7ea5c38b6f5217a23b3aa7f91e0ce5ea768a3d6090751" content-hash = "caf46b526858dbf2960b0204782140ad072d96f7b3f161ac7e9db0d9b709b25a"

View File

@ -9,6 +9,7 @@ readme = "README.md"
python = "^3.10" python = "^3.10"
cadquery = "^2.4.0" cadquery = "^2.4.0"
build123d = "^0.5.0" build123d = "^0.5.0"
numpy = "^1.26.4"
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core"]