Add Black formatting check to CI (#255)

* Add Black formatting check to CI
* Add some documentation for code contributors
* Use uncompromised code formatting
This commit is contained in:
Miguel Sánchez de León Peque
2020-01-20 20:52:12 +01:00
committed by Adam Urbańczyk
parent 74573fc3bb
commit 102c16c14e
43 changed files with 2968 additions and 1892 deletions

View File

@ -4,37 +4,80 @@ import cadquery as cq
path = cq.Workplane("XZ").moveTo(-10, 0).lineTo(10, 0)
# Sweep a circle from diameter 2.0 to diameter 1.0 to diameter 2.0 along X axis length 10.0 + 10.0
defaultSweep = (cq.Workplane("YZ").workplane(offset=-10.0).circle(2.0).
workplane(offset=10.0).circle(1.0).
workplane(offset=10.0).circle(2.0).sweep(path, multisection=True))
defaultSweep = (
cq.Workplane("YZ")
.workplane(offset=-10.0)
.circle(2.0)
.workplane(offset=10.0)
.circle(1.0)
.workplane(offset=10.0)
.circle(2.0)
.sweep(path, multisection=True)
)
# We can sweep thrue different shapes
recttocircleSweep = (cq.Workplane("YZ").workplane(offset=-10.0).rect(2.0, 2.0).
workplane(offset=8.0).circle(1.0).workplane(offset=4.0).circle(1.0).
workplane(offset=8.0).rect(2.0, 2.0).sweep(path, multisection=True))
recttocircleSweep = (
cq.Workplane("YZ")
.workplane(offset=-10.0)
.rect(2.0, 2.0)
.workplane(offset=8.0)
.circle(1.0)
.workplane(offset=4.0)
.circle(1.0)
.workplane(offset=8.0)
.rect(2.0, 2.0)
.sweep(path, multisection=True)
)
circletorectSweep = (cq.Workplane("YZ").workplane(offset=-10.0).circle(1.0).
workplane(offset=7.0).rect(2.0, 2.0).workplane(offset=6.0).rect(2.0, 2.0).
workplane(offset=7.0).circle(1.0).sweep(path, multisection=True))
circletorectSweep = (
cq.Workplane("YZ")
.workplane(offset=-10.0)
.circle(1.0)
.workplane(offset=7.0)
.rect(2.0, 2.0)
.workplane(offset=6.0)
.rect(2.0, 2.0)
.workplane(offset=7.0)
.circle(1.0)
.sweep(path, multisection=True)
)
# Placement of the Shape is important otherwise could produce unexpected shape
specialSweep = (cq.Workplane("YZ").circle(1.0).workplane(offset=10.0).rect(2.0, 2.0).
sweep(path, multisection=True))
specialSweep = (
cq.Workplane("YZ")
.circle(1.0)
.workplane(offset=10.0)
.rect(2.0, 2.0)
.sweep(path, multisection=True)
)
# Switch to an arc for the path : line l=5.0 then half circle r=4.0 then line l=5.0
path = (cq.Workplane("XZ").moveTo(-5, 4).lineTo(0, 4).
threePointArc((4, 0), (0, -4)).lineTo(-5, -4))
path = (
cq.Workplane("XZ")
.moveTo(-5, 4)
.lineTo(0, 4)
.threePointArc((4, 0), (0, -4))
.lineTo(-5, -4)
)
# Placement of different shapes should follow the path
# cylinder r=1.5 along first line
# then sweep allong arc from r=1.5 to r=1.0
# then cylinder r=1.0 along last line
arcSweep = (cq.Workplane("YZ").workplane(offset=-5).moveTo(0, 4).circle(1.5).
workplane(offset=5).circle(1.5).
moveTo(0, -8).circle(1.0).
workplane(offset=-5).circle(1.0).
sweep(path, multisection=True))
arcSweep = (
cq.Workplane("YZ")
.workplane(offset=-5)
.moveTo(0, 4)
.circle(1.5)
.workplane(offset=5)
.circle(1.5)
.moveTo(0, -8)
.circle(1.0)
.workplane(offset=-5)
.circle(1.0)
.sweep(path, multisection=True)
)
# Translate the resulting solids so that they do not overlap and display them left to right
@ -43,5 +86,3 @@ show_object(circletorectSweep.translate((0, 5, 0)))
show_object(recttocircleSweep.translate((0, 10, 0)))
show_object(specialSweep.translate((0, 15, 0)))
show_object(arcSweep.translate((0, -5, 0)))