add Jenkinsfile and update prminitives

This commit is contained in:
acereca 2021-02-12 12:35:14 +01:00
parent 90c540fb4f
commit f7bedb8ccb
2 changed files with 60 additions and 3 deletions

24
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,24 @@
pipeline {
agent none
stages {
stage("Setup") {
agent any
steps {
sh 'pip install sphinx'
}
}
stage("Build") {
agent any
steps {
sh 'make -C docs html'
}
}
stage("Deploy") {
agent any
steps {
sh '/bin/rm -rf /var/www/html/docs/solidLib/* || echo ""'
sh 'rsync -a ./docs/_build/html/* /var/www/html/docs/solidLib/'
}
}
}
}

View File

@ -1,4 +1,4 @@
from typing import List
from typing import List, Iterable
import solid as scad
@ -10,7 +10,14 @@ import logging as log
log.basicConfig(level=log.INFO)
def round_box(x_dim: float, y_dim: float, z_dim: float, radius: float, segments: int = 32):
"""creates a round box with radius r
"""
creates a round box with radius r
Args:
x_dim (float): .
Important:
deprecated
.. image:: img/round_box.png
"""
@ -21,6 +28,29 @@ def round_box(x_dim: float, y_dim: float, z_dim: float, radius: float, segments:
scad.minkowski()(box, wall)
)
def rcube(dim: Iterable[float], radius: float, segments: int = 32):
"""
creates a cube with rounded corners
.. image:: img/round_box.png
Args:
dim: cube dimensions to base box on.
radius: box radius.
segments: circular object segments
"""
corners = []
for dx in [radius, dim[0] - radius]:
for dy in [radius, dim[1] - radius]:
for dz in [radius, dim[2] - radius]:
corners.append(
scad.translate([dx, dy, dz])((
scad.sphere(r=radius)
))
)
return scad.hull()(*corners)
def round_flat_box(x: float, y: float, z: float, r: float, segments: int = 32):
"""creates a round box with radius r and flat top/bottom
@ -36,6 +66,9 @@ def round_flat_box(x: float, y: float, z: float, r: float, segments: int = 32):
def pill(ps: List[List[float]], r, segments: int = 36):
"""
create a pill around given points
"""
if len(ps) < 2:
raise Exception("requires 2 or more points")
s = scad.sphere(r=r, segments=segments)