add Jenkinsfile and update prminitives
This commit is contained in:
parent
90c540fb4f
commit
f7bedb8ccb
|
@ -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/'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
from typing import List
|
||||
from typing import List, Iterable
|
||||
|
||||
import solid as scad
|
||||
|
||||
|
@ -10,9 +10,16 @@ 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
|
||||
|
||||
.. image:: img/round_box.png
|
||||
Args:
|
||||
x_dim (float): .
|
||||
|
||||
Important:
|
||||
deprecated
|
||||
|
||||
.. image:: img/round_box.png
|
||||
"""
|
||||
box = scad.cube([x_dim - 2 * radius, y_dim - 2 * radius, z_dim - 2 * radius])
|
||||
wall = scad.sphere(r=radius, segments=segments)
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue