https://github.com/miho/jcsg-meshextensions
JCSG extension library for producing high-quality meshes from JCSG mesh objects.
https://github.com/miho/jcsg-meshextensions
cad constructive-solid-geometries java javafx jcsg vrl vrl-studio
Last synced: about 1 month ago
JSON representation
JCSG extension library for producing high-quality meshes from JCSG mesh objects.
- Host: GitHub
- URL: https://github.com/miho/jcsg-meshextensions
- Owner: miho
- License: other
- Created: 2016-12-25T13:17:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-20T08:44:14.000Z (almost 8 years ago)
- Last Synced: 2025-03-22T04:51:18.536Z (about 2 months ago)
- Topics: cad, constructive-solid-geometries, java, javafx, jcsg, vrl, vrl-studio
- Language: Java
- Homepage:
- Size: 338 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JCSG-MeshExtensions
[  ](https://bintray.com/miho/JCSG/JCSG-MeshExtensions/_latestVersion)[JCSG](https://github.com/miho/JCSG) extension library for producing high-quality meshes from [JCSG](https://github.com/miho/JCSG) mesh objects. The mesh optimization is performed with the cross-platform meshing software [ProMesh](http://promesh3d.com/) which is available as [ug4](https://github.com/UG4/ugcore) plugin.
## Sample Code
```java
// we use cube and sphere as base geometries
CSG cube = new Cube(2).toCSG();
CSG sphere = new Sphere(1.25).toCSG();// compute difference between cube and sphere
CSG cubeMinusSphere = cube.difference(sphere);// create a copy of cube-sphere that shall be optimized
CSG optimized = cubeMinusSphere.
transformed(Transform.unity().translateX(3));// perform the optimization
CSG all = MeshTools.optimize(
optimized, // csg object to optimize
1e-6, // tolerance
1e-4, // max tolerance
0.25, // min edge length
1.5 // max edge length
);// save optimized mesh as "all.stl"
Files.write(Paths.get("all.stl"), all.toStlString().getBytes());
```## How to Build JCSG-MeshExtensions
### Requirements
- Java >= 1.8
- Internet connection (dependencies are downloaded automatically)
- IDE: [Gradle](http://www.gradle.org/) Plugin (not necessary for command line usage)### IDE
Open the `JCSG-MeshExtensions` [Gradle](http://www.gradle.org/) project in your favourite IDE (tested with NetBeans 8.2) and build it
by calling the `assemble` task.### Command Line
Navigate to the [Gradle](http://www.gradle.org/) project (e.g., `path/to/JCSG-MeshExtensions`) and enter the following command
#### Bash (Linux/OS X/Cygwin/other Unix-like shell)
bash gradlew assemble
#### Windows (CMD)gradlew assemble