Software renders implicit surface function f(x,y,z) into aprintable STL.
Project description
Update - 22nd June 2024
-
Triangle Lookup Table implemented - no defective surfaces anymore
-
nearly all functions compiled with Numba - faster operation
Update - 27th November 2022
A new, much faster version is available. It uses more numba jit compiled python code and more parallelization.
The first run may be slower due to compilation time.
xyzCad - functional cad software
xyzCad is an ease to use marching cubes based cad software generating 3d printable stl files from a function f(x, y, z) = {True : False}.
x, y and z are the coordinates in 3d space in mm. The function f(x, y, z) returns True or False depending on the arguments x, y and z. True means, there should be solid. False means, there is nothing.
Theory of operation
It looks like the software iterates over alle points in the 3d raster space. But this would be very slow. So the algorithm is a bit more optimized.
-
At first it searches for two points, one inside the solid (=True), one outside (=False).
-
Now the surface is searched on a line between the two points.
-
Rasterization is done over the surface only.
That means only one solid can be created. If two solids without contact to each other are created, only the one found at first will be rendered.
Usage example
Let us create a sphere:
#!/usr/bin/env python3
from numba import njit
from xyzcad import render
@njit
def f(x,y,z):
r = 10
return r**2 > x**2 + y**2 + z**2
render.renderAndSave(f, 'sphere.stl', 0.3)
numba just in time compiler makes it a bit faster. render is the xyzcad renderer/compiler. We want a resolution of 0.3
mm. The output file should be sphere.stl
. Our sphere will have a radius of r = 10
mm.
Want to Support the project?
Buy your 3d printer filament or parts using my affiliate link:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file xyzcad-0.4.0.post9.tar.gz
.
File metadata
- Download URL: xyzcad-0.4.0.post9.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7a69f622899dd3705974b3490b9eeff3f0756119fc1cff72e3dc4adf458a87c |
|
MD5 | 8d23f3ab2b75ff053780a921960a3b89 |
|
BLAKE2b-256 | 53875e9f921641576f971c3e21b76d700221c34108c205c9d47c6ce34ac18484 |
File details
Details for the file xyzcad-0.4.0.post9-py3-none-any.whl
.
File metadata
- Download URL: xyzcad-0.4.0.post9-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e34a974a7f66879368bc43058b317d96e08c24ebc16492d4f5f90011f5ef4ae |
|
MD5 | a5e86fcb2db50d4fab82382b54a3e3a5 |
|
BLAKE2b-256 | f8261a114d28007d2f71efa98b035be541732a0de11e4acba535e52e6878f65c |