Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
DSL for CAD Bodies and Assemblies
The purpose of this tool is to share 3D parts and assemblies like java class binaries.
As of today, the DSL is not complete to define bodies and assemblies will come later.
Building
Install opencascade binary package (Here on Arch)
yay -S opencascade
Check headers are here, at the expected location:
Many Headers
ls /usr/include/opencascade | wc 7598 53186 1138547
Launch Main App
./gradlew cad-dsl:test ./gradlew clean (1)
-
To replay tests, you have to clean the env.
Sample
Get inspiration from CAD Query, but using Groovy DSL.
Sample Code
@Test void "Pillow Block With Counterbored Holes and Prism"() { cd().box(length, height, thickness).topZ().wireFrom() { double rectSX = length - cboreInset double rectSY = height - cboreInset [[-rectSX / 2, -rectSY / 2], [0, rectSY], [rectSX, 0], [0, -rectSY]].each { double cX, double cY -> move(cX, cY) circle(centerHoleDia) } }.toFace().hole(-cboreHoleDiameter).topZ().wireFrom() { circle(centerHoleDia) }.toFace().prism(cboreHoleDiameter).display() }
|
Warning |
DSL is evolving |
Packages
There are 3 main packages in cad-dsl src folder (both for tests and implementation).
-
org.taack.cad.bindingclasses use direct OCCT symbol binding using JExtract. It is considered low-level, and should not be used when composing a new body. -
org.taack.cad.builderusing the builder pattern, quick way to test builder limitation, this step helps to build a good DSL. This package should not be directly used. -
org.taack.cad.dslusing the visitor pattern to build the DSL. This should be used in production.
DSL Tests
DSL Tests are localised cad-dsl/src/test/groovy/org/taack/cad/dsl it could give an overview of cad-dsl constructions.
Cut Version
@Test void "Test mix fuse - common - cut"() { Vec diagonal = new Vec(1, 1, 1) cd().box(2, 2, 1).toCadDsl().cut { position(diagonal * 0.4) { box(1, 1, 1) position(diagonal * 0.3) { cylinder(1 / 2, 3) } } position(diagonal * 0.6) { box(1, 1, 1) } }.display() }
Fuse Version
@Test void "Test mix fuse - common - fuse"() { Vec diagonal = new Vec(1, 1, 1) cd().box(2, 2, 1).toCadDsl().fuse { position(diagonal * 0.4) { box(1, 1, 1) position(diagonal * 0.3) { cylinder(1 / 2, 3) } } position(diagonal * 0.6) { box(1, 1, 1) } }.display() }



