Compare commits

..

1 commit

Author SHA1 Message Date
7bdc0e1e89
Add LICENSE 2020-08-16 16:52:34 +02:00
41 changed files with 1376 additions and 1776 deletions

View file

@ -6,8 +6,8 @@ variables:
PACKER_VERSION: 1.4.3
ANNOUNCE: http://labsync.lab.fablab-nea.de:6969/announce
WEBSEED: http://labsync.lab.fablab-nea.de/labsync/$CI_COMMIT_REF_NAME/$CI_PIPELINE_ID/images
DOCKER_IMAGE_BUILDER: ${CI_REGISTRY_IMAGE}/labsync-builder:main
DOCKER_IMAGE_SECURITY_SCANNER: ${CI_REGISTRY_IMAGE}/security-scanner:main
DOCKER_IMAGE_BUILDER: ${CI_REGISTRY_IMAGE}/labsync-builder:$CI_COMMIT_REF_SLUG
DOCKER_IMAGE_SECURITY_SCANNER: ${CI_REGISTRY_IMAGE}/security-scanner:$CI_COMMIT_REF_SLUG
DOCKER_TLS_CERTDIR: ""
stages:
@ -21,26 +21,17 @@ dockerimage_builder:
- apk add --no-cache make
services:
- docker:dind
variables:
DOCKER_IMAGE_BUILDER: ${CI_REGISTRY_IMAGE}/labsync-builder:$CI_COMMIT_REF_SLUG
script:
- docker pull $DOCKER_IMAGE_BUILDER || true
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- make builderimg
- docker push $DOCKER_IMAGE_BUILDER
- echo "DOCKER_IMAGE_BUILDER=$DOCKER_IMAGE_BUILDER" >> build.env
artifacts:
reports:
dotenv: build.env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
- if:
changes:
paths:
- builder/**/*
compare_to: main
when: on_success
tags:
- fablab
- ssd
except:
refs:
- schedules
dockerimage_security_scanner:
stage: prepare
@ -50,22 +41,15 @@ dockerimage_security_scanner:
- docker:dind
script:
- docker pull $DOCKER_IMAGE_SECURITY_SCANNER || true
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- make secscanimg
- docker push $DOCKER_IMAGE_SECURITY_SCANNER
- echo "DOCKER_IMAGE_SECURITY_SCANNER=${CI_REGISTRY_IMAGE}/security-scanner:$CI_COMMIT_REF_SLUG" >> build.env
artifacts:
reports:
dotenv: build.env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
- if:
changes:
paths:
- security-scanner/**/*
compare_to: main
when: on_success
tags:
- fablab
- ssd
except:
refs:
- schedules
security_scanner:
stage: check
@ -73,7 +57,7 @@ security_scanner:
script:
- set -x
- export GITLAB_URL="$(echo "$CI_PROJECT_URL" | grep -Eo '^https?://[^/]*')"
- /code/venv/bin/python -m security_scanner $target
- python3 -m security_scanner $target
only:
refs:
- schedules
@ -81,17 +65,8 @@ security_scanner:
variables:
- $task == "security-scanner"
- $target
lightburn-download:
stage: prepare
image: alpine
script:
- mkdir -p packer/ansible/roles/lightburn/files
- 'wget -O packer/ansible/roles/lightburn/files/lightburn.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_SERVER_URL}/api/v4/projects/fablab%2Flightburn-patched/jobs/artifacts/main/download?job=patch-Linux64"'
artifacts:
paths:
- packer/ansible/roles/lightburn/files/lightburn.zip
expire_in: 4 hours
tags:
- dedicated
.squashfs_template: &squashfs_template
image: $DOCKER_IMAGE_BUILDER
@ -99,9 +74,7 @@ lightburn-download:
services:
- docker:dind
script:
- echo DOCKER_IMAGE_BUILDER=$DOCKER_IMAGE_BUILDER
- echo DOCKER_IMAGE_SECURITY_SCANNER=$DOCKER_IMAGE_SECURITY_SCANNER
- scripts/packer.sh debian-bookworm
- scripts/packer.sh debian-buster
- aws --endpoint-url "$AWS_ENDPOINT_URL" s3 cp images/ "s3://$AWS_BUCKET/$CI_COMMIT_REF_SLUG/$CI_JOB_ID/" --recursive --no-progress
artifacts:
paths:
@ -111,6 +84,9 @@ lightburn-download:
- images/*.linux
#- images/*.squashfs
- images/*.torrent
tags:
- fablab
- ssd
squashfs_featurebranch:
<<: *squashfs_template
@ -120,15 +96,15 @@ squashfs_featurebranch:
variables:
- $task == "security-scanner"
refs:
- main
- master
squashfs_main:
squashfs_master:
<<: *squashfs_template
variables:
COMPRESSION_LEVEL: 15
only:
refs:
- main
- master
except:
variables:
- $task == "security-scanner"

19
LICENSE Normal file
View file

@ -0,0 +1,19 @@
Copyright 2018-2020 contributors to this repository
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -22,7 +22,7 @@ qemu_network = 10.2.2.0
qemu_netmask = 24
qemu_vm_ip = 10.2.2.10
qemu_disk = tmp/qemu-disk.img
qemu_target ?= debian-bookworm
qemu_target ?= debian-buster
qemu_kernel = $(qemu_target).linux
qemu_torrent = $(qemu_target).torrent
qemu_initramfs = $(shell \
@ -35,7 +35,7 @@ fi \
ci_environment=$(shell env | sed -n 's/^\(CI_.*\)=.*/-e \1/p')
.PHONY: default
default: builderimg images/debian-bookworm.squashfs
default: builderimg images/debian-buster.squashfs
.PHONY: clean
clean:
@ -60,7 +60,7 @@ images:
[ ! -d "$@" ] && mkdir "$@"
touch "$@"
images/debian-bookworm.squashfs: images
images/debian-buster.squashfs: images
docker run \
--rm \
-v /var/run/docker.sock:/var/run/docker.sock \
@ -72,9 +72,9 @@ images/debian-bookworm.squashfs: images
$(ci_environment) \
"$(DOCKER_IMAGE_BUILDER)" \
scripts/packer.sh \
debian-bookworm
debian-buster
images/debian-bookworm.torrent: images
images/debian-buster.torrent: images
docker run \
--rm \
-v "${PWD}:${PWD}" \
@ -82,7 +82,7 @@ images/debian-bookworm.torrent: images
-e "WEBSEED=$(WEBSEED)" \
"$(DOCKER_IMAGE_BUILDER)" \
scripts/torrent.sh \
debian-bookworm
debian-buster
.PHONY: ansible
ansible:
@ -104,24 +104,24 @@ ansible:
# updates the initramfs
# only used for development
images/debian-bookworm.initramfs.dev: tmp/initramfs-extracted/debian-bookworm packer/initramfs/labsync
cp packer/initramfs/labsync tmp/initramfs-extracted/debian-bookworm/scripts/labsync
(cd tmp/initramfs-extracted/debian-bookworm && find . | cpio -H newc -o | gzip > $(CWD)/images/debian-bookworm.initramfs.dev)
images/debian-buster.initramfs.dev: tmp/initramfs-extracted/debian-buster packer/initramfs/labsync
cp packer/initramfs/labsync tmp/initramfs-extracted/debian-buster/scripts/labsync
(cd tmp/initramfs-extracted/debian-buster && find . | cpio -H newc -o | gzip > $(CWD)/images/debian-buster.initramfs.dev)
tmp:
[ ! -d "$@" ] && mkdir "$@" || true
tmp/initramfs-extracted/debian-bookworm: images/debian-bookworm.initramfs
rm -rf tmp/initramfs-extracted/debian-bookworm
mkdir -p tmp/initramfs-extracted/debian-bookworm
(cd tmp/initramfs-extracted/debian-bookworm && zcat "$(CWD)/images/debian-bookworm.initramfs" | cpio -i)
touch tmp/initramfs-extracted/debian-bookworm
tmp/initramfs-extracted/debian-buster: images/debian-buster.initramfs
rm -rf tmp/initramfs-extracted/debian-buster
mkdir -p tmp/initramfs-extracted/debian-buster
(cd tmp/initramfs-extracted/debian-buster && zcat "$(CWD)/images/debian-buster.initramfs" | cpio -i)
touch tmp/initramfs-extracted/debian-buster
$(qemu_disk): tmp
qemu-img create "$@" 20G
tmp/netboot.tar.gz: tmp
wget -c -O "$@" https://cdn-aws.deb.debian.org/debian/dists/bookworm/main/installer-amd64/current/images/netboot/netboot.tar.gz
wget -c -O "$@" https://cdn-aws.deb.debian.org/debian/dists/buster/main/installer-amd64/current/images/netboot/netboot.tar.gz
touch "$@"
tmp/tftproot: tmp/netboot.tar.gz

View file

@ -11,7 +11,7 @@ RUN apk add --no-cache \
openssl \
rsync \
squashfs-tools \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk add --no-cache \
packer

View file

@ -11,8 +11,6 @@
- role: firefox
- role: windowmanager
- role: inkscape
- role: lightburn
- role: prusa-slicer
- role: fablab
- role: hardware
- role: docker
@ -44,20 +42,23 @@
url: "https://github.com/t-oster/VisiCut/releases/download/1.7_310/visicut_1.7-310-gcf8c087-1_all.deb"
cura:
version: 3.3.1
lightburn:
dockerimage: r.jalr.de/fablab/lightburn
metalcut:
socket: laser.lab.fablab-nea.de:9000
dockerimage: r.jalr.de/fablab/metalcut
firefox:
language_packs:
- de
extensions:
- uBlock0@raymondhill.net
- https-everywhere@eff.org
debian_sections:
- main
- contrib
- non-free
debian_mirror: http://ftp.de.debian.org/debian
hardware:
firmware: []
firmware:
- firmware-amd-graphics
greeting:
title: Willkommen im FabLab Bad Windsheim
content: >
@ -66,56 +67,3 @@
Du hast Dich mit einem Gast-Account angemeldet. Alle Daten werden nach
der Anmeldung gelöscht. Wenn Du Deine Daten dauerhaft speichern
möchtest, lege Dir bitte einen Account an!
lightburn:
devices:
- https://raw.githubusercontent.com/fablab-nea/LaserKutter/main/lightburn/LaserKutter.lbdev
prusa_slicer:
settings: |
no_controller = 1
no_defaults = 1
preset_update = 0
show_splash_screen = 0
use_inches = 0
version_check = 0
view_mode = expert
tls_accepted_cert_store_location = /etc/ssl/certs/ca-certificates.crt
tls_cert_store_accepted = yes
[filaments]
AmazonBasics TPU @MINI = 1
Das Filament PLA = 1
Generic PETG = 1
Generic PETG @MINI = 1
Generic PETG @MMU2 = 1
Generic PLA = 1
Generic PLA @MMU2 = 1
Prusament ASA = 1
Prusament ASA @MINI = 1
Prusament ASA @MMU2 = 1
Prusament PC Blend = 1
Prusament PC Blend @MINI = 1
Prusament PC Blend @MMU2 = 1
Prusament PETG = 1
Prusament PETG @MINI = 1
Prusament PETG @MMU2 = 1
Prusament PLA = 1
Prusament PLA @MMU2 = 1
Prusament PVB = 1
Prusament PVB @MMU2 = 1
Verbatim BVOH = 1
Verbatim BVOH @MMU2 = 1
[presets]
filament = Prusament PLA
physical_printer =
print = 0.15mm QUALITY @MK3
printer = Original Prusa i3 MK3
sla_material =
sla_print =
[vendor:PrusaResearch]
model:MK3 = 0.4
model:MK3SMMU2S = 0.4
[vendor:Ultimaker]
model:ULTIMAKER2 = 0.4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

View file

@ -0,0 +1,9 @@
[Desktop Entry]
Name=MetalCut
GenericName=MetalCut
Comment=Laser Cutter Job Control Application
Exec=x-terminal-emulator -e 'sudo /usr/local/bin/metalcut'
Icon=/usr/share/metalcut/metalcut.svg
Terminal=false
Type=Application
Categories=Graphics

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 94 KiB

View file

@ -18,8 +18,14 @@
- import_tasks: visicut.yml
tags:
- fablab:visicut
# - import_tasks: platformio.yml
# tags:
# - fablab:platformio
- import_tasks: metalcut.yml
tags:
- fablab:metalcut
- import_tasks: prusa.yml
tags:
- fablab:prusa
- import_tasks: platformio.yml
tags:
- fablab:platformio
tags:
- fablab

View file

@ -0,0 +1,58 @@
---
- file:
path: /usr/share/metalcut
state: directory
mode: "0755"
owner: root
group: root
- name: copy icon
copy:
src: metalcut/metalcut.svg
dest: /usr/share/metalcut/metalcut.svg
owner: root
group: root
mode: "0644"
- name: add metalcut script
template:
src: metalcut/metalcut.sh.j2
dest: /usr/local/bin/metalcut
owner: root
group: root
mode: "0755"
- name: add metalcut to applications menu
copy:
src: metalcut/metalcut.desktop
dest: /usr/share/applications/metalcut.desktop
owner: root
group: root
mode: "0644"
- name: add group
group:
name: metalcut
system: yes
- name: add sudoers config
copy:
content: "%metalcut ALL=/usr/local/bin/metalcut, NOPASSWD:/usr/local/bin/metalcut\n"
dest: /etc/sudoers.d/metalcut
owner: root
group: root
mode: "0644"
- name: ensure guest-account settings directory exists
file:
path: /etc/guest-account
state: directory
mode: "0755"
owner: root
group: root
- name: add metalcut group to guest account
lineinfile:
path: /etc/guest-account/groups
line: metalcut
create: yes

View file

@ -0,0 +1,25 @@
#!/bin/sh
remote='{{ fablab.metalcut.socket }}'
image='{{ fablab.metalcut.dockerimage }}'
if [ ! -z "$SUDO_COMMAND" ] && [ "$SUDO_COMMAND" = "$0" ]; then
home="$(getent passwd "$SUDO_UID" | cut -d: -f6)"
uid="$SUDO_UID"
gid="$SUDO_GID"
else
home="$HOME"
uid=$(id -u)
gid=$(id -g)
fi
docker run \
--rm \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY \
-e uid="$uid" \
-e gid="$gid" \
-v "$home:/home/metalcut/work" \
-v '/media:/media' \
-e remote="$remote" \
$image

View file

@ -19,7 +19,7 @@
"NoDefaultBookmarks": true,
"OfferToSaveLogins": true,
"Homepage": {
"URL": "https://wiki.fablab-nea.de/"
"URL": "about:blank"
},
"OverrideFirstRunPage": "",
"SearchEngines": {

View file

@ -6,6 +6,6 @@
- name: install google fonts
unarchive:
src: https://github.com/google/fonts/archive/main.zip
src: https://github.com/google/fonts/archive/master.tar.gz
dest: /usr/local/share/fonts/google/
remote_src: yes

View file

@ -3,11 +3,5 @@
- import_tasks: google.yml
tags:
- fonts:google
- name: Install font viewer
apt:
name:
- fontmatrix
tags:
- fonts:fontmatrix
tags:
- fonts

@ -1 +1 @@
Subproject commit 2f40eef85264eb6646ea7e89cbd4659560b88235
Subproject commit 8afe49a2a52bb13bb2a34331e7c9625fb05529bf

View file

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View file

@ -1,157 +0,0 @@
# TabbedBoxMaker: A free Inkscape extension for generating tab-jointed box patterns
_version 1.1 - 9 Aug 2021_
Original box maker by Elliot White (formerly of twot.eu, domain name now squatted)
Heavily modified by [Paul Hutchison](https://github.com/paulh-rnd)
## About
This tool is designed to simplify the process of making practical boxes from sheet material using almost any kind of CNC cutter (laser, plasma, water jet or mill). The box edges are "finger-jointed" or "tab-jointed", and may include press-fit dimples, internal dividers, dogbone corners (for endmill cutting), and more.
The tool works by generating each side of the box with the tab and edge sizes corrected to account for the kerf (width of cut). Each box side is composed of a group of individual lines that make up each edge of the face, as well as any other cutouts for dividers. It is recommended that you join adjacent lines in your CNC software to cut efficiently.
An additional extension which uses the same TabbedBoxMaker generator script is also included: Schroff Box Maker. The Schroff addition was created by [John Slee](https://github.com/jsleeio). If you create further derivative box generators, feel free to send me a pull request!
## Release Notes
This is a major upgrade to support Inkscape v1.0 and CNC mills (with dogbone cuts), plus an updated dialog layout and documentation, and a number of smaller fixes. So far no serious bugs (i.e causing runtime errors) have been found. The program works with Python 3 ONLY. See [issues](https://github.com/paulh-rnd/TabbedBoxMaker/issues) for known issues, or to log issues and enhancement requests.
Note that in this release the extension has *moved from the Laser Tools to the CNC Tools submenu*. This is to better reflect that this tool can be used on a wide variety of CNC machinery, especially with the addition of dogbone corners: laser, water jet, milling, even 3D printing.
## Donate
Any donations will be gratefully received:
[![](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/SparkItUp)
Many thanks to those who have donated.
## To do
* Tidy, modularise and simplify the code - it is rough and unpythonic. Needs some work by a master Python guru.
* Add tests and perhaps get it submitted as a core extension to be installed with Inkscape?
* Improve input checking to restrict values to correct solutions.
* Dogbone only works on tabbed joins, NOT divider keyholes or slots yet
* Would be great to make shapes closed and do path subtraction to get slot cutouts and keyholes from faces, and perhaps offer to add fill colour
* [Schroff] Maybe replace the somewhat obscure collection of Schroff rail input data with a dropdown box listing well-documented rail types (Vector, Z-rails, whatever it is that Elby sells, others?)
* [Schroff] Add support for multiple mounting holes per rail where possible (this would definitely make the previous todo item worthwhile)
* [Schroff] Add support for 6U row height
## Use - regular tabbed boxes
The interface is pretty self explanatory, the extension is 'Tabbed Box Maker' in the 'CNC Tools' group
Parameters in order of appearance:
* Units - unit of measurement used for drawing
* Box Dimensions: Inside/Outside - whether the box dimensions are internal or external measurements
* Length / Width / Height - the box dimensions
* Tab Width: Fixed/Proportional - for fixed the tab width is the value given in the Tab
Width, for proportional the side of a piece is divided
equally into tabs and 'spaces' with the tabs size
greater or equal to the Tab Width setting
* Minimum/Preferred Tab Width - the size of the tabs used to hold the pieces together
* Symmetry - there are two styles of tabs avaiable:
* XY Symmetrix - each piece is symmetric in both the X and Y axes
* Rotate Symmetric ("waffle block") - each piece is symmetric under a 180-degree rotation
(and 90 degrees if that piece is square)
* Tab Dimple Height - the height of the dimple to add to the side of each tab, 0 for no dimple.
Dimples can be added to give tabbed joints a little extra material for a tighter press fit.
* Tab Dimple Length - the length of the tip of the dimple; dimples are trapezoid shaped with
45-degree sides; using a dimple tip length of 0 gives a triangular dimple
* Line Thickness - Leave this as _Default_ unless you need hairline thickness (Use for Epilog lasers)
* Material Thickness - as it says
* Kerf - this is the diameter/width of the cut. Typical laser cutters will be between 0.1 - 0.25mm,
for CNC mills, this will be your end mill diameter. A larger kerf will assume more material is removed,
hence joints will be tighter. Smaller or zero kerf will result in looser joints.
* Layout - controls how the pieces are laid out in the drawing
* Box Type - this allows you to choose how many jointed sides you want. Options are:
* Fully enclosed (6 sides)
* One side open (LxW) - one of the Length x Width panels will be omitted
* Two sides open (LxW and LxH) - two adjacent panels will be omitted
* Three sides open (LxW, LxH, HxW) - one of each panel omitted
* Opposite ends open (LxW) - an open-ended "tube" with the LxW panels omitted
* Two panels only (LxW and LxH) - two panels with a single joint down the Length axis
* Dividers (Length axis) - use this to create additional LxH panels that mount inside the box
along the length axis and have finger joints into the side panels
and slots for Width dividers to slot into
* Dividers (Width axis) - use this to create additional WxH panels that mount inside the box
along the width axis and have finger joints into the side panels
and slots for Length dividers to slot into
* Key the dividers into - this allows you to choose if/how the dividers are keyed into the sides of the box. Options are:
* None - no keying, dividers will be free to slide in and out
* Walls - dividers will only be keyed into the side walls of the box
* Floor/Ceiling - dividers will only be keyed into the top/bottom of the box
* All Sides
* Space Between Parts - how far apart the pieces are in the drawing produced
* Live Preview - you may need to turn this off when changing tab style, box type, or layout
## Use - Schroff enclosures
Much the same as for regular enclosures, except some options are removed, and some others are added. If you're using Elby rails, all you'll need to do is specify:
* Depth
* Number of 3U rows
* Row width in TE/HP units (divide rail length by 5.08mm/0.2")
* If multiple rows, inter-row spacing
## Installation
1. Download the extension from this GitHub page using the *[Clone or download > Download ZIP](archive/master.zip)* link. If you are using an older version of Inkscape, you will need to download the correct version of the extension (see [Version History](#version-history) below)
2. Extract the zip file
3. Copy all files except README.md and LICENSE into the Inkscape extensions directory. The directory location varies depending on your operating system, and may be customised. The easiest way to find the directory is to open Inkscape, go to _Edit > Preferences > System_ (Win/Linux) or _Inkscape > Preferences > System_ (Mac).
4. You can either copy the files to the _User extensions_ directory or the _Inkscape extensions_ directory. The former will install this extension for just the current user, the latter will install it for all users of the machine.
5. Inkscape *must* be restarted after copying the extension files.
6. If it has been installed correctly, you should find the extension under the _Extensions > CNC Tools_ menu. Enjoy!
Default installation directories are given below:
### Windows
* User: `%APPDATA%\inkscape\extensions`
* Machine: `C:\Program Files\Inkscape\share\extensions`
### Mac
* User: `~/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions`
* Machine: `/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions`
### Linux
* User: `~/.config/inkscape/extensions`
* Machine: Depends on installation method
## Version History
version | Date | Notes
--------|------|--------
0.5 | ( 9 Oct 2011) | beta
0.7 | (24 Oct 2011) | first release
0.8 | (26 Oct 2011) | basic input checking implemented
0.86 | (19 Dec 2014) | updates to allow different box types and internal dividers
0.86a | (23 June 2015) | Updated for compatibility with Inkscape 0.91
0.87 | (28 July 2015) | Schroff enclosure add-on
0.93 | (21 Sept 2015) | Updated versioning to match original author's updated v0.91 plus adding my 0.02
0.93a | (21 Sept 2015) | Added hairline line thickness option for Epilog lasers
0.94 | (4 Jan 2017) | Divider keying options
0.95 | (20 Apr 2017) | Added optional dimples on tabs
0.96 | (24 Apr 2017) | Orthogonalized box type, layout, tab style; added rotate-symmetric tabs
0.99 | (4 June 2020) | Upgraded to support Inkscape v1.0, minor fixes and a tidy up of the parameters dialog layout
1.0 | (17 June 2020) | v1.0 final released: fixes and dogbone added - Mills now supported!
1.1 | (9 Aug 2021) | v1.1 with fixes for newer Inkscape versions - sorry for the delays

View file

@ -1,104 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>CNC Tabbed Box Maker</_name>
<id>nz.paulh-rnd.tabbedboxmaker</id>
<hbox>
<vbox>
<label>Dimensions</label>
<separator/>
<param name="unit" _gui-text="    Units" type="optiongroup" appearance="combo">
<option value="mm">mm</option>
<option value="cm">cm</option>
<option value="in">in</option>
</param>
<param name="inside" type="optiongroup" _gui-text="    Box Dimensions" appearance="combo">
<_option value="1">Inside</_option>
<_option value="0">Outside</_option>
</param>
<param name="length" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Length">180</param>
<param name="width" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Width">240</param>
<param name="depth" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Height">50</param>
<spacer/>
<label>Tabs</label>
<separator/>
<param name="equal" type="optiongroup" _gui-text="    Width">
<_option value="0">Fixed</_option>
<_option value="1">Proportional</_option>
</param>
<param name="tab" type="float" precision="2" min="0.0" max="10000.0" _gui-text="    Min/Preferred Width">6.0</param>
<param name="tabtype" type="optiongroup" _gui-text="    Type" appearance="combo">
<_option value="0">Regular (Laser)</_option>
<_option value="1">Dogbone (Mill)</_option>
</param>
<param name="tabsymmetry" type="optiongroup" _gui-text="    Symmetry" appearance="combo">
<_option value="0">XY Symmetric</_option>
<_option value="1">Rotate Symmetric</_option>
<!--_option value="2">Antisymmetric</_option-->
</param>
<param name="dimpleheight" type="float" precision="2" min="0.0" max="10000.0"
_gui-text="    Dimple Height">0.0</param>
<param name="dimplelength" type="float" precision="2" min="0.0" max="10000.0"
_gui-text="    Dimple Length">0.0</param>
</vbox>
<spacer/>
<separator/>
<spacer/>
<vbox>
<label>Line and kerf</label>
<separator/>
<param name="hairline" type="optiongroup" _gui-text="    Line Thickness" appearance="combo">
<_option value="0">Default</_option>
<_option value="1">Hairline (0.002" for Epilog)</_option>
</param>
<param name="thickness" type="float" precision="2" min="0.0" max="10000.0" _gui-text="    Material Thickness">3.0</param>
<param name="kerf" type="float" precision="3" min="0.0" max="10000.0" _gui-text="    Kerf (cut width)">0.1</param>
<spacer/>
<label>Layout</label>
<separator/>
<param name="style" _gui-text="    Layout" type="optiongroup" appearance="combo">
<option value="1">Diagramatic</option>
<option value="2">3 piece</option>
<option value="3">Inline(compact)</option>
</param>
<param name="boxtype" _gui-text="    Box Type" type="optiongroup" appearance="combo">
<option value="1">Fully enclosed</option>
<option value="2">One side open (LxW)</option>
<option value="3">Two sides open (LxW and LxH)</option>
<option value="4">Three sides open (LxW, LxH, HxW)</option>
<option value="5">Opposite ends open (LxW)</option>
<option value="6">Two panels only (LxW and LxH)</option>
</param>
<param name="div_l" type="int" min="0" max="20" _gui-text="    Dividers (Length axis)">2</param>
<param name="div_w" type="int" min="0" max="20" _gui-text="    Dividers (Width axis)">3</param>
<param name="keydiv" _gui-text="    Key the dividers into" type="optiongroup" appearance="combo">
<option value="3">None</option>
<option value="2">Walls</option>
<option value="1">Floor / Ceiling</option>
<option value="0">All sides</option>
</param>
<param name="spacing" type="float" precision="2" min="0.0" max="10000.0" _gui-text="    Space Between Parts">1.0</param>
</vbox>
</hbox>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu _name="CNC Tools" />
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">boxmaker.py</command>
</script>
</inkscape-extension>

View file

@ -1,741 +0,0 @@
#! /usr/bin/env python -t
'''
Generates Inkscape SVG file containing box components needed to
CNC (laser/mill) cut a box with tabbed joints taking kerf and clearance into account
Original Tabbed Box Maker Copyright (C) 2011 elliot white
Changelog:
19/12/2014 Paul Hutchison:
- Ability to generate 6, 5, 4, 3 or 2-panel cutouts
- Ability to also generate evenly spaced dividers within the box
including tabbed joints to box sides and slots to slot into each other
23/06/2015 by Paul Hutchison:
- Updated for Inkscape's 0.91 breaking change (unittouu)
v0.93 - 15/8/2016 by Paul Hutchison:
- Added Hairline option and fixed open box height bug
v0.94 - 05/01/2017 by Paul Hutchison:
- Added option for keying dividers into walls/floor/none
v0.95 - 2017-04-20 by Jim McBeath
- Added optional dimples
v0.96 - 2017-04-24 by Jim McBeath
- Refactored to make box type, tab style, and layout all orthogonal
- Added Tab Style option to allow creating waffle-block-style tabs
- Made open box size correct based on inner or outer dimension choice
- Fixed a few tab bugs
v0.99 - 2020-06-01 by Paul Hutchison
- Preparatory release with Inkscape 1.0 compatibility upgrades (further fixes to come!)
- Removed Antisymmetric option as it's broken, kinda pointless and looks weird
- Fixed divider issues with Rotate Symmetric
- Made individual panels and their keyholes/slots grouped
v1.0 - 2020-06-17 by Paul Hutchison
- Removed clearance parameter, as this was just subtracted from kerf - pointless?
- Corrected kerf adjustments for overall box size and divider keyholes
- Added dogbone cuts: CNC mills now supported!
- Fix for floor/ceiling divider key issue (#17)
- Increased max dividers to 20 (#35)
v1.1 - 2021-08-09 by Paul Hutchison
- Fixed for current Inkscape release version 1.1 - thanks to PR from https://github.com/roastedneutrons
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
__version__ = "1.0" ### please report bugs, suggestions etc at https://github.com/paulh-rnd/TabbedBoxMaker ###
import os,sys,inkex,simplestyle,gettext,math
from copy import deepcopy
_ = gettext.gettext
linethickness = 1 # default unless overridden by settings
def log(text):
if 'SCHROFF_LOG' in os.environ:
f = open(os.environ.get('SCHROFF_LOG'), 'a')
f.write(text + "\n")
def newGroup(canvas):
# Create a new group and add element created from line string
panelId = canvas.svg.get_unique_id('panel')
group = canvas.svg.get_current_layer().add(inkex.Group(id=panelId))
return group
def getLine(XYstring):
line = inkex.PathElement()
line.style = { 'stroke': '#000000', 'stroke-width' : str(linethickness), 'fill': 'none' }
line.path = XYstring
#inkex.etree.SubElement(parent, inkex.addNS('path','svg'), drw)
return line
# jslee - shamelessly adapted from sample code on below Inkscape wiki page 2015-07-28
# http://wiki.inkscape.org/wiki/index.php/Generating_objects_from_extensions
def getCircle(r, c):
(cx, cy) = c
log("putting circle at (%d,%d)" % (cx,cy))
circle = inkex.PathElement.arc((cx, cy), r)
circle.style = { 'stroke': '#000000', 'stroke-width': str(linethickness), 'fill': 'none' }
# ell_attribs = {'style':simplestyle.formatStyle(style),
# inkex.addNS('cx','sodipodi') :str(cx),
# inkex.addNS('cy','sodipodi') :str(cy),
# inkex.addNS('rx','sodipodi') :str(r),
# inkex.addNS('ry','sodipodi') :str(r),
# inkex.addNS('start','sodipodi') :str(0),
# inkex.addNS('end','sodipodi') :str(2*math.pi),
# inkex.addNS('open','sodipodi') :'true', #all ellipse sectors we will draw are open
# inkex.addNS('type','sodipodi') :'arc',
# 'transform' :'' }
#inkex.etree.SubElement(parent, inkex.addNS('path','svg'), ell_attribs )
return circle
def dimpleStr(tabVector,vectorX,vectorY,dirX,dirY,dirxN,diryN,ddir,isTab):
ds=''
if not isTab:
ddir = -ddir
if dimpleHeight>0 and tabVector!=0:
if tabVector>0:
dimpleStart=(tabVector-dimpleLength)/2-dimpleHeight
tabSgn=1
else:
dimpleStart=(tabVector+dimpleLength)/2+dimpleHeight
tabSgn=-1
Vxd=vectorX+dirxN*dimpleStart
Vyd=vectorY+diryN*dimpleStart
ds+='L '+str(Vxd)+','+str(Vyd)+' '
Vxd=Vxd+(tabSgn*dirxN-ddir*dirX)*dimpleHeight
Vyd=Vyd+(tabSgn*diryN-ddir*dirY)*dimpleHeight
ds+='L '+str(Vxd)+','+str(Vyd)+' '
Vxd=Vxd+tabSgn*dirxN*dimpleLength
Vyd=Vyd+tabSgn*diryN*dimpleLength
ds+='L '+str(Vxd)+','+str(Vyd)+' '
Vxd=Vxd+(tabSgn*dirxN+ddir*dirX)*dimpleHeight
Vyd=Vyd+(tabSgn*diryN+ddir*dirY)*dimpleHeight
ds+='L '+str(Vxd)+','+str(Vyd)+' '
return ds
def side(group,root,startOffset,endOffset,tabVec,length,direction,isTab,isDivider,numDividers,dividerSpacing):
rootX, rootY = root
startOffsetX, startOffsetY = startOffset
endOffsetX, endOffsetY = endOffset
dirX, dirY = direction
notTab=0 if isTab else 1
if (tabSymmetry==1): # waffle-block style rotationally symmetric tabs
divisions=int((length-2*thickness)/nomTab)
if divisions%2: divisions+=1 # make divs even
divisions=float(divisions)
tabs=divisions/2 # tabs for side
else:
divisions=int(length/nomTab)
if not divisions%2: divisions-=1 # make divs odd
divisions=float(divisions)
tabs=(divisions-1)/2 # tabs for side
if (tabSymmetry==1): # waffle-block style rotationally symmetric tabs
gapWidth=tabWidth=(length-2*thickness)/divisions
elif equalTabs:
gapWidth=tabWidth=length/divisions
else:
tabWidth=nomTab
gapWidth=(length-tabs*nomTab)/(divisions-tabs)
if isTab: # kerf correction
gapWidth-=kerf
tabWidth+=kerf
first=halfkerf
else:
gapWidth+=kerf
tabWidth-=kerf
first=-halfkerf
firstholelenX=0
firstholelenY=0
s=[]
h=[]
firstVec=0; secondVec=tabVec
dividerEdgeOffsetX = dividerEdgeOffsetY = thickness
notDirX=0 if dirX else 1 # used to select operation on x or y
notDirY=0 if dirY else 1
if (tabSymmetry==1):
dividerEdgeOffsetX = dirX*thickness;
#dividerEdgeOffsetY = ;
vectorX = rootX + (startOffsetX*thickness if notDirX else 0)
vectorY = rootY + (startOffsetY*thickness if notDirY else 0)
s='M '+str(vectorX)+','+str(vectorY)+' '
vectorX = rootX+(startOffsetX if startOffsetX else dirX)*thickness
vectorY = rootY+(startOffsetY if startOffsetY else dirY)*thickness
if notDirX: endOffsetX=0
if notDirY: endOffsetY=0
else:
(vectorX,vectorY)=(rootX+startOffsetX*thickness,rootY+startOffsetY*thickness)
dividerEdgeOffsetX=dirY*thickness
dividerEdgeOffsetY=dirX*thickness
s='M '+str(vectorX)+','+str(vectorY)+' '
if notDirX: vectorY=rootY # set correct line start for tab generation
if notDirY: vectorX=rootX
# generate line as tab or hole using:
# last co-ord:Vx,Vy ; tab dir:tabVec ; direction:dirx,diry ; thickness:thickness
# divisions:divs ; gap width:gapWidth ; tab width:tabWidth
for tabDivision in range(1,int(divisions)):
if ((tabDivision%2) ^ (not isTab)) and numDividers>0 and not isDivider: # draw holes for divider tabs to key into side walls
w=gapWidth if isTab else tabWidth
if tabDivision==1 and tabSymmetry==0:
w-=startOffsetX*thickness
holeLenX=dirX*w+notDirX*firstVec+first*dirX
holeLenY=dirY*w+notDirY*firstVec+first*dirY
if first:
firstholelenX=holeLenX
firstholelenY=holeLenY
for dividerNumber in range(1,int(numDividers)+1):
Dx=vectorX+-dirY*dividerSpacing*dividerNumber+notDirX*halfkerf+dirX*dogbone*halfkerf-dogbone*first*dirX
Dy=vectorY+dirX*dividerSpacing*dividerNumber-notDirY*halfkerf+dirY*dogbone*halfkerf-dogbone*first*dirY
if tabDivision==1 and tabSymmetry==0:
Dx+=startOffsetX*thickness
h='M '+str(Dx)+','+str(Dy)+' '
Dx=Dx+holeLenX
Dy=Dy+holeLenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx+notDirX*(secondVec-kerf)
Dy=Dy+notDirY*(secondVec+kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-holeLenX
Dy=Dy-holeLenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-notDirX*(secondVec-kerf)
Dy=Dy-notDirY*(secondVec+kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
group.add(getLine(h))
if tabDivision%2:
if tabDivision==1 and numDividers>0 and isDivider: # draw slots for dividers to slot into each other
for dividerNumber in range(1,int(numDividers)+1):
Dx=vectorX+-dirY*dividerSpacing*dividerNumber-dividerEdgeOffsetX+notDirX*halfkerf
Dy=vectorY+dirX*dividerSpacing*dividerNumber-dividerEdgeOffsetY+notDirY*halfkerf
h='M '+str(Dx)+','+str(Dy)+' '
Dx=Dx+dirX*(first+length/2)
Dy=Dy+dirY*(first+length/2)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx+notDirX*(thickness-kerf)
Dy=Dy+notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-dirX*(first+length/2)
Dy=Dy-dirY*(first+length/2)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-notDirX*(thickness-kerf)
Dy=Dy-notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
group.add(getLine(h))
# draw the gap
vectorX+=dirX*(gapWidth+(isTab&dogbone&1 ^ 0x1)*first+dogbone*kerf*isTab)+notDirX*firstVec
vectorY+=dirY*(gapWidth+(isTab&dogbone&1 ^ 0x1)*first+dogbone*kerf*isTab)+notDirY*firstVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and isTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
# draw the starting edge of the tab
s+=dimpleStr(secondVec,vectorX,vectorY,dirX,dirY,notDirX,notDirY,1,isTab)
vectorX+=notDirX*secondVec
vectorY+=notDirY*secondVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and notTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
else:
# draw the tab
vectorX+=dirX*(tabWidth+dogbone*kerf*notTab)+notDirX*firstVec
vectorY+=dirY*(tabWidth+dogbone*kerf*notTab)+notDirY*firstVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and notTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
# draw the ending edge of the tab
s+=dimpleStr(secondVec,vectorX,vectorY,dirX,dirY,notDirX,notDirY,-1,isTab)
vectorX+=notDirX*secondVec
vectorY+=notDirY*secondVec
s+='L '+str(vectorX)+','+str(vectorY)+' '
if dogbone and isTab:
vectorX-=dirX*halfkerf
vectorY-=dirY*halfkerf
s+='L '+str(vectorX)+','+str(vectorY)+' '
(secondVec,firstVec)=(-secondVec,-firstVec) # swap tab direction
first=0
#finish the line off
s+='L '+str(rootX+endOffsetX*thickness+dirX*length)+','+str(rootY+endOffsetY*thickness+dirY*length)+' '
if isTab and numDividers>0 and tabSymmetry==0 and not isDivider: # draw last for divider joints in side walls
for dividerNumber in range(1,int(numDividers)+1):
Dx=vectorX+-dirY*dividerSpacing*dividerNumber+notDirX*halfkerf+dirX*dogbone*halfkerf-dogbone*first*dirX
# Dy=vectorY+dirX*dividerSpacing*dividerNumber-notDirY*halfkerf+dirY*dogbone*halfkerf-dogbone*first*dirY
# Dx=vectorX+-dirY*dividerSpacing*dividerNumber-dividerEdgeOffsetX+notDirX*halfkerf
Dy=vectorY+dirX*dividerSpacing*dividerNumber-dividerEdgeOffsetY+notDirY*halfkerf
h='M '+str(Dx)+','+str(Dy)+' '
Dx=Dx+firstholelenX
Dy=Dy+firstholelenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx+notDirX*(thickness-kerf)
Dy=Dy+notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-firstholelenX
Dy=Dy-firstholelenY
h+='L '+str(Dx)+','+str(Dy)+' '
Dx=Dx-notDirX*(thickness-kerf)
Dy=Dy-notDirY*(thickness-kerf)
h+='L '+str(Dx)+','+str(Dy)+' '
group.add(getLine(h))
# for dividerNumber in range(1,int(numDividers)+1):
# Dx=vectorX+-dirY*dividerSpacing*dividerNumber+notDirX*halfkerf+dirX*dogbone*halfkerf
# Dy=vectorY+dirX*dividerSpacing*dividerNumber-notDirY*halfkerf+dirY*dogbone*halfkerf
# # Dx=vectorX+dirX*dogbone*halfkerf
# # Dy=vectorY+dirX*dividerSpacing*dividerNumber-dirX*halfkerf+dirY*dogbone*halfkerf
# h='M '+str(Dx)+','+str(Dy)+' '
# Dx=rootX+endOffsetX*thickness+dirX*length
# Dy+=dirY*tabWidth+notDirY*firstVec+first*dirY
# h+='L '+str(Dx)+','+str(Dy)+' '
# Dx+=notDirX*(secondVec-kerf)
# Dy+=notDirY*(secondVec+kerf)
# h+='L '+str(Dx)+','+str(Dy)+' '
# Dx-=vectorX
# Dy-=(dirY*tabWidth+notDirY*firstVec+first*dirY)
# h+='L '+str(Dx)+','+str(Dy)+' '
# Dx-=notDirX*(secondVec-kerf)
# Dy-=notDirY*(secondVec+kerf)
# h+='L '+str(Dx)+','+str(Dy)+' '
# group.add(getLine(h))
group.add(getLine(s))
return s
class BoxMaker(inkex.Effect):
def __init__(self):
# Call the base class constructor.
inkex.Effect.__init__(self)
# Define options
self.arg_parser.add_argument('--schroff',action='store',type=int,
dest='schroff',default=0,help='Enable Schroff mode')
self.arg_parser.add_argument('--rail_height',action='store',type=float,
dest='rail_height',default=10.0,help='Height of rail')
self.arg_parser.add_argument('--rail_mount_depth',action='store',type=float,
dest='rail_mount_depth',default=17.4,help='Depth at which to place hole for rail mount bolt')
self.arg_parser.add_argument('--rail_mount_centre_offset',action='store',type=float,
dest='rail_mount_centre_offset',default=0.0,help='How far toward row centreline to offset rail mount bolt (from rail centreline)')
self.arg_parser.add_argument('--rows',action='store',type=int,
dest='rows',default=0,help='Number of Schroff rows')
self.arg_parser.add_argument('--hp',action='store',type=int,
dest='hp',default=0,help='Width (TE/HP units) of Schroff rows')
self.arg_parser.add_argument('--row_spacing',action='store',type=float,
dest='row_spacing',default=10.0,help='Height of rail')
self.arg_parser.add_argument('--unit',action='store',type=str,
dest='unit',default='mm',help='Measure Units')
self.arg_parser.add_argument('--inside',action='store',type=int,
dest='inside',default=0,help='Int/Ext Dimension')
self.arg_parser.add_argument('--length',action='store',type=float,
dest='length',default=100,help='Length of Box')
self.arg_parser.add_argument('--width',action='store',type=float,
dest='width',default=100,help='Width of Box')
self.arg_parser.add_argument('--depth',action='store',type=float,
dest='height',default=100,help='Height of Box')
self.arg_parser.add_argument('--tab',action='store',type=float,
dest='tab',default=25,help='Nominal Tab Width')
self.arg_parser.add_argument('--equal',action='store',type=int,
dest='equal',default=0,help='Equal/Prop Tabs')
self.arg_parser.add_argument('--tabsymmetry',action='store',type=int,
dest='tabsymmetry',default=0,help='Tab style')
self.arg_parser.add_argument('--tabtype',action='store',type=int,
dest='tabtype',default=0,help='Tab type: regular or dogbone')
self.arg_parser.add_argument('--dimpleheight',action='store',type=float,
dest='dimpleheight',default=0,help='Tab Dimple Height')
self.arg_parser.add_argument('--dimplelength',action='store',type=float,
dest='dimplelength',default=0,help='Tab Dimple Tip Length')
self.arg_parser.add_argument('--hairline',action='store',type=int,
dest='hairline',default=0,help='Line Thickness')
self.arg_parser.add_argument('--thickness',action='store',type=float,
dest='thickness',default=10,help='Thickness of Material')
self.arg_parser.add_argument('--kerf',action='store',type=float,
dest='kerf',default=0.5,help='Kerf (width of cut)')
self.arg_parser.add_argument('--style',action='store',type=int,
dest='style',default=25,help='Layout/Style')
self.arg_parser.add_argument('--spacing',action='store',type=float,
dest='spacing',default=25,help='Part Spacing')
self.arg_parser.add_argument('--boxtype',action='store',type=int,
dest='boxtype',default=25,help='Box type')
self.arg_parser.add_argument('--div_l',action='store',type=int,
dest='div_l',default=25,help='Dividers (Length axis)')
self.arg_parser.add_argument('--div_w',action='store',type=int,
dest='div_w',default=25,help='Dividers (Width axis)')
self.arg_parser.add_argument('--keydiv',action='store',type=int,
dest='keydiv',default=3,help='Key dividers into walls/floor')
def effect(self):
global group,nomTab,equalTabs,tabSymmetry,dimpleHeight,dimpleLength,thickness,kerf,halfkerf,dogbone,divx,divy,hairline,linethickness,keydivwalls,keydivfloor
# Get access to main SVG document element and get its dimensions.
svg = self.document.getroot()
# Get the attributes:
widthDoc = self.svg.unittouu(svg.get('width'))
heightDoc = self.svg.unittouu(svg.get('height'))
# Get script's option values.
hairline=self.options.hairline
unit=self.options.unit
inside=self.options.inside
schroff=self.options.schroff
kerf = self.svg.unittouu( str(self.options.kerf) + unit )
halfkerf=kerf/2
# Set the line thickness
if hairline:
linethickness=self.svg.unittouu('0.002in')
else:
linethickness=1
if schroff:
rows=self.options.rows
rail_height=self.svg.unittouu(str(self.options.rail_height)+unit)
row_centre_spacing=self.svg.unittouu(str(122.5)+unit)
row_spacing=self.svg.unittouu(str(self.options.row_spacing)+unit)
rail_mount_depth=self.svg.unittouu(str(self.options.rail_mount_depth)+unit)
rail_mount_centre_offset=self.svg.unittouu(str(self.options.rail_mount_centre_offset)+unit)
rail_mount_radius=self.svg.unittouu(str(2.5)+unit)
## minimally different behaviour for schroffmaker.inx vs. boxmaker.inx
## essentially schroffmaker.inx is just an alternate interface with different
## default settings, some options removed, and a tiny amount of extra logic
if schroff:
## schroffmaker.inx
X = self.svg.unittouu(str(self.options.hp * 5.08) + unit)
# 122.5mm vertical distance between mounting hole centres of 3U Schroff panels
row_height = rows * (row_centre_spacing + rail_height)
# rail spacing in between rows but never between rows and case panels
row_spacing_total = (rows - 1) * row_spacing
Y = row_height + row_spacing_total
else:
## boxmaker.inx
X = self.svg.unittouu( str(self.options.length + kerf) + unit )
Y = self.svg.unittouu( str(self.options.width + kerf) + unit )
Z = self.svg.unittouu( str(self.options.height + kerf) + unit )
thickness = self.svg.unittouu( str(self.options.thickness) + unit )
nomTab = self.svg.unittouu( str(self.options.tab) + unit )
equalTabs=self.options.equal
tabSymmetry=self.options.tabsymmetry
dimpleHeight=self.options.dimpleheight
dimpleLength=self.options.dimplelength
dogbone = 1 if self.options.tabtype == 1 else 0
layout=self.options.style
spacing = self.svg.unittouu( str(self.options.spacing) + unit )
boxtype = self.options.boxtype
divx = self.options.div_l
divy = self.options.div_w
keydivwalls = 0 if self.options.keydiv == 3 or self.options.keydiv == 1 else 1
keydivfloor = 0 if self.options.keydiv == 3 or self.options.keydiv == 2 else 1
initOffsetX=0
initOffsetY=0
if inside: # if inside dimension selected correct values to outside dimension
X+=thickness*2
Y+=thickness*2
Z+=thickness*2
# check input values mainly to avoid python errors
# TODO restrict values to *correct* solutions
# TODO restrict divisions to logical values
error=0
if min(X,Y,Z)==0:
inkex.errormsg(_('Error: Dimensions must be non zero'))
error=1
if max(X,Y,Z)>max(widthDoc,heightDoc)*10: # crude test
inkex.errormsg(_('Error: Dimensions Too Large'))
error=1
if min(X,Y,Z)<3*nomTab:
inkex.errormsg(_('Error: Tab size too large'))
error=1
if nomTab<thickness:
inkex.errormsg(_('Error: Tab size too small'))
error=1
if thickness==0:
inkex.errormsg(_('Error: Thickness is zero'))
error=1
if thickness>min(X,Y,Z)/3: # crude test
inkex.errormsg(_('Error: Material too thick'))
error=1
if kerf>min(X,Y,Z)/3: # crude test
inkex.errormsg(_('Error: Kerf too large'))
error=1
if spacing>max(X,Y,Z)*10: # crude test
inkex.errormsg(_('Error: Spacing too large'))
error=1
if spacing<kerf:
inkex.errormsg(_('Error: Spacing too small'))
error=1
if error: exit()
# For code spacing consistency, we use two-character abbreviations for the six box faces,
# where each abbreviation is the first and last letter of the face name:
# tp=top, bm=bottom, ft=front, bk=back, lt=left, rt=right
# Determine which faces the box has based on the box type
hasTp=hasBm=hasFt=hasBk=hasLt=hasRt = True
if boxtype==2: hasTp=False
elif boxtype==3: hasTp=hasFt=False
elif boxtype==4: hasTp=hasFt=hasRt=False
elif boxtype==5: hasTp=hasBm=False
elif boxtype==6: hasTp=hasFt=hasBk=hasRt=False
# else boxtype==1, full box, has all sides
# Determine where the tabs go based on the tab style
if tabSymmetry==2: # Antisymmetric (deprecated)
tpTabInfo=0b0110
bmTabInfo=0b1100
ltTabInfo=0b1100
rtTabInfo=0b0110
ftTabInfo=0b1100
bkTabInfo=0b1001
elif tabSymmetry==1: # Rotationally symmetric (Waffle-blocks)
tpTabInfo=0b1111
bmTabInfo=0b1111
ltTabInfo=0b1111
rtTabInfo=0b1111
ftTabInfo=0b1111
bkTabInfo=0b1111
else: # XY symmetric
tpTabInfo=0b0000
bmTabInfo=0b0000
ltTabInfo=0b1111
rtTabInfo=0b1111
ftTabInfo=0b1010
bkTabInfo=0b1010
def fixTabBits(tabbed, tabInfo, bit):
newTabbed = tabbed & ~bit
if inside:
newTabInfo = tabInfo | bit # set bit to 1 to use tab base line
else:
newTabInfo = tabInfo & ~bit # set bit to 0 to use tab tip line
return newTabbed, newTabInfo
# Update the tab bits based on which sides of the box don't exist
tpTabbed=bmTabbed=ltTabbed=rtTabbed=ftTabbed=bkTabbed=0b1111
if not hasTp:
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b0010)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b1000)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b0001)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b0100)
tpTabbed=0
if not hasBm:
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b1000)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b0010)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b0100)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b0001)
bmTabbed=0
if not hasFt:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b1000)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b1000)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b1000)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b1000)
ftTabbed=0
if not hasBk:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b0010)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b0010)
ltTabbed, ltTabInfo = fixTabBits(ltTabbed, ltTabInfo, 0b0010)
rtTabbed, rtTabInfo = fixTabBits(rtTabbed, rtTabInfo, 0b0010)
bkTabbed=0
if not hasLt:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b0100)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b0001)
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b0001)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b0001)
ltTabbed=0
if not hasRt:
tpTabbed, tpTabInfo = fixTabBits(tpTabbed, tpTabInfo, 0b0001)
bmTabbed, bmTabInfo = fixTabBits(bmTabbed, bmTabInfo, 0b0100)
bkTabbed, bkTabInfo = fixTabBits(bkTabbed, bkTabInfo, 0b0100)
ftTabbed, ftTabInfo = fixTabBits(ftTabbed, ftTabInfo, 0b0100)
rtTabbed=0
# Layout positions are specified in a grid of rows and columns
row0=(1,0,0,0) # top row
row1y=(2,0,1,0) # second row, offset by Y
row1z=(2,0,0,1) # second row, offset by Z
row2=(3,0,1,1) # third row, always offset by Y+Z
col0=(1,0,0,0) # left column
col1x=(2,1,0,0) # second column, offset by X
col1z=(2,0,0,1) # second column, offset by Z
col2xx=(3,2,0,0) # third column, offset by 2*X
col2xz=(3,1,0,1) # third column, offset by X+Z
col3xzz=(4,1,0,2) # fourth column, offset by X+2*Z
col3xxz=(4,2,0,1) # fourth column, offset by 2*X+Z
col4=(5,2,0,2) # fifth column, always offset by 2*X+2*Z
col5=(6,3,0,2) # sixth column, always offset by 3*X+2*Z
# layout format:(rootx),(rooty),Xlength,Ylength,tabInfo,tabbed,pieceType
# root= (spacing,X,Y,Z) * values in tuple
# tabInfo= <abcd> 0=holes 1=tabs
# tabbed= <abcd> 0=no tabs 1=tabs on this side
# (sides: a=top, b=right, c=bottom, d=left)
# pieceType: 1=XY, 2=XZ, 3=ZY
tpFace=1
bmFace=1
ftFace=2
bkFace=2
ltFace=3
rtFace=3
def reduceOffsets(aa, start, dx, dy, dz):
for ix in range(start+1,len(aa)):
(s,x,y,z) = aa[ix]
aa[ix] = (s-1, x-dx, y-dy, z-dz)
# note first two pieces in each set are the X-divider template and Y-divider template respectively
pieces=[]
if layout==1: # Diagramatic Layout
rr = deepcopy([row0, row1z, row2])
cc = deepcopy([col0, col1z, col2xz, col3xzz])
if not hasFt: reduceOffsets(rr, 0, 0, 0, 1) # remove row0, shift others up by Z
if not hasLt: reduceOffsets(cc, 0, 0, 0, 1)
if not hasRt: reduceOffsets(cc, 2, 0, 0, 1)
if hasBk: pieces.append([cc[1], rr[2], X,Z, bkTabInfo, bkTabbed, bkFace])
if hasLt: pieces.append([cc[0], rr[1], Z,Y, ltTabInfo, ltTabbed, ltFace])
if hasBm: pieces.append([cc[1], rr[1], X,Y, bmTabInfo, bmTabbed, bmFace])
if hasRt: pieces.append([cc[2], rr[1], Z,Y, rtTabInfo, rtTabbed, rtFace])
if hasTp: pieces.append([cc[3], rr[1], X,Y, tpTabInfo, tpTabbed, tpFace])
if hasFt: pieces.append([cc[1], rr[0], X,Z, ftTabInfo, ftTabbed, ftFace])
elif layout==2: # 3 Piece Layout
rr = deepcopy([row0, row1y])
cc = deepcopy([col0, col1z])
if hasBk: pieces.append([cc[1], rr[1], X,Z, bkTabInfo, bkTabbed, bkFace])
if hasLt: pieces.append([cc[0], rr[0], Z,Y, ltTabInfo, ltTabbed, ltFace])
if hasBm: pieces.append([cc[1], rr[0], X,Y, bmTabInfo, bmTabbed, bmFace])
elif layout==3: # Inline(compact) Layout
rr = deepcopy([row0])
cc = deepcopy([col0, col1x, col2xx, col3xxz, col4, col5])
if not hasTp: reduceOffsets(cc, 0, 1, 0, 0) # remove col0, shift others left by X
if not hasBm: reduceOffsets(cc, 1, 1, 0, 0)
if not hasLt: reduceOffsets(cc, 2, 0, 0, 1)
if not hasRt: reduceOffsets(cc, 3, 0, 0, 1)
if not hasBk: reduceOffsets(cc, 4, 1, 0, 0)
if hasBk: pieces.append([cc[4], rr[0], X,Z, bkTabInfo, bkTabbed, bkFace])
if hasLt: pieces.append([cc[2], rr[0], Z,Y, ltTabInfo, ltTabbed, ltFace])
if hasTp: pieces.append([cc[0], rr[0], X,Y, tpTabInfo, tpTabbed, tpFace])
if hasBm: pieces.append([cc[1], rr[0], X,Y, bmTabInfo, bmTabbed, bmFace])
if hasRt: pieces.append([cc[3], rr[0], Z,Y, rtTabInfo, rtTabbed, rtFace])
if hasFt: pieces.append([cc[5], rr[0], X,Z, ftTabInfo, ftTabbed, ftFace])
for idx, piece in enumerate(pieces): # generate and draw each piece of the box
(xs,xx,xy,xz)=piece[0]
(ys,yx,yy,yz)=piece[1]
x=xs*spacing+xx*X+xy*Y+xz*Z+initOffsetX # root x co-ord for piece
y=ys*spacing+yx*X+yy*Y+yz*Z+initOffsetY # root y co-ord for piece
dx=piece[2]
dy=piece[3]
tabs=piece[4]
a=tabs>>3&1; b=tabs>>2&1; c=tabs>>1&1; d=tabs&1 # extract tab status for each side
tabbed=piece[5]
atabs=tabbed>>3&1; btabs=tabbed>>2&1; ctabs=tabbed>>1&1; dtabs=tabbed&1 # extract tabbed flag for each side
xspacing=(X-thickness)/(divy+1)
yspacing=(Y-thickness)/(divx+1)
xholes = 1 if piece[6]<3 else 0
yholes = 1 if piece[6]!=2 else 0
wall = 1 if piece[6]>1 else 0
floor = 1 if piece[6]==1 else 0
railholes = 1 if piece[6]==3 else 0
group = newGroup(self)
if schroff and railholes:
log("rail holes enabled on piece %d at (%d, %d)" % (idx, x+thickness,y+thickness))
log("abcd = (%d,%d,%d,%d)" % (a,b,c,d))
log("dxdy = (%d,%d)" % (dx,dy))
rhxoffset = rail_mount_depth + thickness
if idx == 1:
rhx=x+rhxoffset
elif idx == 3:
rhx=x-rhxoffset+dx
else:
rhx=0
log("rhxoffset = %d, rhx= %d" % (rhxoffset, rhx))
rystart=y+(rail_height/2)+thickness
if rows == 1:
log("just one row this time, rystart = %d" % rystart)
rh1y=rystart+rail_mount_centre_offset
rh2y=rh1y+(row_centre_spacing-rail_mount_centre_offset)
group.add(getCircle(rail_mount_radius,(rhx,rh1y)))
group.add(getCircle(rail_mount_radius,(rhx,rh2y)))
else:
for n in range(0,rows):
log("drawing row %d, rystart = %d" % (n+1, rystart))
# if holes are offset (eg. Vector T-strut rails), they should be offset
# toward each other, ie. toward the centreline of the Schroff row
rh1y=rystart+rail_mount_centre_offset
rh2y=rh1y+row_centre_spacing-rail_mount_centre_offset
group.add(getCircle(rail_mount_radius,(rhx,rh1y)))
group.add(getCircle(rail_mount_radius,(rhx,rh2y)))
rystart+=row_centre_spacing+row_spacing+rail_height
# generate and draw the sides of each piece
side(group,(x,y),(d,a),(-b,a),atabs * (-thickness if a else thickness),dx,(1,0),a,0,(keydivfloor|wall) * (keydivwalls|floor) * divx*yholes*atabs,yspacing) # side a
side(group,(x+dx,y),(-b,a),(-b,-c),btabs * (thickness if b else -thickness),dy,(0,1),b,0,(keydivfloor|wall) * (keydivwalls|floor) * divy*xholes*btabs,xspacing) # side b
if atabs:
side(group,(x+dx,y+dy),(-b,-c),(d,-c),ctabs * (thickness if c else -thickness),dx,(-1,0),c,0,0,0) # side c
else:
side(group,(x+dx,y+dy),(-b,-c),(d,-c),ctabs * (thickness if c else -thickness),dx,(-1,0),c,0,(keydivfloor|wall) * (keydivwalls|floor) * divx*yholes*ctabs,yspacing) # side c
if btabs:
side(group,(x,y+dy),(d,-c),(d,a),dtabs * (-thickness if d else thickness),dy,(0,-1),d,0,0,0) # side d
else:
side(group,(x,y+dy),(d,-c),(d,a),dtabs * (-thickness if d else thickness),dy,(0,-1),d,0,(keydivfloor|wall) * (keydivwalls|floor) * divy*xholes*dtabs,xspacing) # side d
if idx==0:
# remove tabs from dividers if not required
if not keydivfloor:
a=c=1
atabs=ctabs=0
if not keydivwalls:
b=d=1
btabs=dtabs=0
y=4*spacing+1*Y+2*Z # root y co-ord for piece
for n in range(0,divx): # generate X dividers
group = newGroup(self)
x=n*(spacing+X) # root x co-ord for piece
side(group,(x,y),(d,a),(-b,a),keydivfloor*atabs*(-thickness if a else thickness),dx,(1,0),a,1,0,0) # side a
side(group,(x+dx,y),(-b,a),(-b,-c),keydivwalls*btabs*(thickness if b else -thickness),dy,(0,1),b,1,divy*xholes,xspacing) # side b
side(group,(x+dx,y+dy),(-b,-c),(d,-c),keydivfloor*ctabs*(thickness if c else -thickness),dx,(-1,0),c,1,0,0) # side c
side(group,(x,y+dy),(d,-c),(d,a),keydivwalls*dtabs*(-thickness if d else thickness),dy,(0,-1),d,1,0,0) # side d
elif idx==1:
y=5*spacing+1*Y+3*Z # root y co-ord for piece
for n in range(0,divy): # generate Y dividers
group = newGroup(self)
x=n*(spacing+Z) # root x co-ord for piece
side(group,(x,y),(d,a),(-b,a),keydivwalls*atabs*(-thickness if a else thickness),dx,(1,0),a,1,divx*yholes,yspacing) # side a
side(group,(x+dx,y),(-b,a),(-b,-c),keydivfloor*btabs*(thickness if b else -thickness),dy,(0,1),b,1,0,0) # side b
side(group,(x+dx,y+dy),(-b,-c),(d,-c),keydivwalls*ctabs*(thickness if c else -thickness),dx,(-1,0),c,1,0,0) # side c
side(group,(x,y+dy),(d,-c),(d,a),keydivfloor*dtabs*(-thickness if d else thickness),dy,(0,-1),d,1,0,0) # side d
# Create effect instance and apply it.
effect = BoxMaker()
effect.run()

View file

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>Schroff Box Maker</_name>
<id>eu.twot.render.schroffboxmaker</id>
<param name="unit" type="string" gui-hidden="true">mm</param>
<param name="inside" type="string" gui-hidden="true">1</param>
<param name="schroff" type="int" gui-hidden="true">1</param>
<param name="rows" type="int" min="1" max="6" _gui-text="Number of 3U rows:">1</param>
<param name="hp" type="int" min="4" max="168" _gui-text="Width (TE/HP units):">84</param>
<param name="length" type="float" precision="3" gui-hidden="true">0.0</param>
<param name="width" type="float" precision="3" gui-hidden="true">0.0</param>
<param name="depth" type="float" precision="3" min="30" max="300" _gui-text="Depth:">65</param>
<!-- these defaults are suitable for the rails sold by Elby Designs -->
<param name="rail_height" type="float" precision="3" min="7.0" max="10.0" _gui-text="Rail height:">10.0</param>
<param name="rail_mount_depth" type="float" precision="3" min="5" max="30" _gui-text="Rail mounting hole depth:">17.4</param>
<param name="rail_mount_centre_offset" type="float" precision="3" min="0.0" max="5.0" _gui-text="Rail mount hole centre-offset:">0.0</param>
<param name="row_spacing" type="float" precision="3" min="0.0" max="50.0" _gui-text="Spacing between rows:">0.0</param>
<param name="tab" type="float" precision="2" min="0.0" max="10000.0" _gui-text="Minimum/Prefered Tab Width">6.0</param>
<param name="equal" type="optiongroup" _gui-text="Tab Width">
<_option value="0">Fixed</_option>
<_option value="1">Proportional</_option>
</param>
<param name="thickness" type="float" precision="2" min="0.0" max="10000.0" _gui-text="Material Thickness">3.0</param>
<param name="kerf" type="float" precision="3" min="0.0" max="10000.0" _gui-text="Kerf (cut width)">0.1</param>
<param name="clearance" type="float" precision="3" min="0.0" max="10000.0" _gui-text="Joint clearance">0.01</param>
<param name="div_l" type="int" gui-hidden="true">0</param>
<param name="div_w" type="int" gui-hidden="true">0</param>
<param name="style" type="string" gui-hidden="true">1</param>
<param name="boxtype" type="int" gui-hidden="true">2</param>
<param name="spacing" type="float" precision="2" min="0.0" max="10000.0" _gui-text="Space Between Parts">1.0</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu _name="CNC Tools" />
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">boxmaker.py</command>
</script>
</inkscape-extension>

View file

@ -6,8 +6,5 @@
- import_tasks: silhouette.yml
tags:
- inkscape:silhouette
- import_tasks: tabbed_box_maker.yml
tags:
- inkscape:tabbed_box_maker
tags:
- inkscape

View file

@ -1,8 +1,8 @@
---
- name: install python3-usb and usbip
- name: install python-usb and usbip
apt:
name:
- python3-usb
- python-usb
- usbip
state: present

View file

@ -1,11 +0,0 @@
---
- name: copy files
copy:
src: tabbed_box_maker/{{ item }}
dest: /usr/share/inkscape/extensions
owner: root
group: root
loop:
- boxmaker.inx
- boxmaker.py
- schroffmaker.inx

View file

@ -1 +0,0 @@
*.zip

View file

@ -1,6 +0,0 @@
[Desktop Entry]
Name=LightBurn
Exec=/opt/LightBurn/LightBurn
Icon=/opt/LightBurn/LightBurn.png
Type=Application
Categories=Graphics;VectorGraphics;Engineering;

View file

@ -1,34 +0,0 @@
- name: Download devices files
uri:
url: "{{ device_url }}"
return_content: true
loop: "{{ lightburn.devices }}"
loop_control:
loop_var: device_url
register: lightburn_downloaded_devices
- name: Create lightburn settings
set_fact:
lightburn_devices: "{{ lightburn_devices | default([]) + [device_settings] }}"
vars:
device_settings: "{{ (device.content | from_json)['DeviceList'][0] }}"
loop: "{{ lightburn_downloaded_devices.results }}"
loop_control:
loop_var: device
label: "{{ device_settings.DisplayName }}"
- name: Create settings directory
file:
path: "{{ item }}"
state: directory
loop:
- /etc/skel/.config
- /etc/skel/.config/LightBurn
- name: Create settings file
copy:
dest: /etc/skel/.config/LightBurn/prefs.ini
content: "{{ lightburn_settings | to_nice_json() }}"
vars:
lightburn_settings:
DeviceList: "{{ lightburn_devices }}"

View file

@ -1,13 +0,0 @@
---
- name: Extract zip file
unarchive:
src: lightburn.zip
dest: /opt
- name: Create applications directory
file:
path: /usr/local/share/applications/
state: directory
- name: Copy desktop file
copy:
src: lightburn.desktop
dest: /usr/local/share/applications/lightburn.desktop

View file

@ -1,10 +0,0 @@
---
- block:
- import_tasks: install.yml
tags:
- lightburn:install
- import_tasks: devices.yml
tags:
- lightburn:devices
tags:
- lightburn

View file

@ -1,7 +1,7 @@
---
- name: install python3-apt
- name: install python-apt
apt:
name: "python3-apt"
name: "python-apt"
state: present
- name: clear sources.list
@ -26,5 +26,5 @@
- name: configure security updates repo
apt_repository:
filename: "{{ ansible_lsb.codename }}-security"
repo: "deb {{ debian_mirror_security }}/debian-security/ {{ ansible_lsb.codename }}-security {{ debian_sections | join(' ') }}"
repo: "deb {{ debian_mirror_security }} {{ ansible_lsb.codename }}/updates {{ debian_sections | join(' ') }}"
state: present

View file

@ -1,2 +0,0 @@
---
prusa_slicer_use_package: false

View file

@ -1,9 +0,0 @@
[Desktop Entry]
Name=Prusa GCode viewer
Exec=/opt/PrusaSlicer/bin/prusa-slicer --gcodeviewer %F
Icon=/opt/PrusaSlicer/resources/icons/PrusaSlicer-gcodeviewer.svg
Terminal=false
Type=Application
MimeType=text/x.gcode;
Categories=Graphics;3DGraphics;
Keywords=3D;Printing;Slicer;

View file

@ -1,12 +0,0 @@
[Desktop Entry]
Name=PrusaSlicer
GenericName=3D Printing Software
Terminal=false
Exec=/opt/PrusaSlicer/bin/prusa-slicer %F
Icon=/opt/PrusaSlicer/resources/icons/PrusaSlicer.png
Type=Application
MimeType=model/stl;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;application/x-amf;
Categories=Graphics;3DGraphics;Engineering;
Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA
StartupNotify=false
StartupWMClass=prusa-slicer

View file

@ -1,46 +0,0 @@
---
- set_fact:
prusa_slicer_profiles_directory: /usr/share/PrusaSlicer/profiles
when: prusa_slicer_use_package | bool
- set_fact:
prusa_slicer_profiles_directory: /opt/PrusaSlicer/resources/profiles
when: not prusa_slicer_use_package | bool
- name: create skel directories
file:
path: "/etc/skel/{{ item }}"
state: directory
loop:
- .config
- .config/PrusaSlicer
- .config/PrusaSlicer/vendor
- name: create symlink to vendor profiles
file:
src: "{{ prusa_slicer_profiles_directory }}/{{ item }}.ini"
dest: /etc/skel/.config/PrusaSlicer/vendor/{{ item }}.ini
state: link
loop:
- PrusaResearch
- Ultimaker
- name: Stat /opt/PrusaSlicer
stat:
path: /opt/PrusaSlicer
register: prusa_slicer_stat
- name: Set version
set_fact:
prusa_slicer_version: "{{ prusa_slicer_stat.stat.lnk_target | regex_replace('^/opt/PrusaSlicer-(.*)-[0-9]{12}$', '\\1') }}"
when: prusa_slicer_stat.stat.exists and prusa_slicer_stat.stat.islnk
- debug:
var: prusa_slicer_version
- name: Copy Prusa slicer settings
copy:
content: |
version_system_info_sent = {{ prusa_slicer_version | default('') }}
{{ prusa_slicer.settings }}
dest: /etc/skel/.config/PrusaSlicer/PrusaSlicer.ini

View file

@ -1,60 +0,0 @@
---
- name: Get latest release
uri:
url: https://api.github.com/repos/prusa3d/PrusaSlicer/releases/latest
return_content: true
register: prusa_slicer_release
- name: Create tarball tempfile
tempfile:
state: file
suffix: .tar.gz
register: prusa_slicer_tarball
- name: Select asset
set_fact:
prusa_slicer_asset: "{{ asset }}"
when: "asset.name | regex_search('PrusaSlicer-.*linux-x64-GTK3.*\\.tar\\.bz2$')"
loop: "{{ prusa_slicer_release.json.assets }}"
loop_control:
loop_var: asset
label: "{{ asset.name }}"
- name: Download release file
get_url:
url: "{{ prusa_slicer_asset.browser_download_url }}"
dest: "{{ prusa_slicer_tarball.path }}"
force: true
- name: Extract tarball
unarchive:
src: "{{ prusa_slicer_tarball.path }}"
dest: /opt
remote_src: true
- name: Remove tarball
ansible.builtin.file:
path: "{{ prusa_slicer_tarball.path }}"
state: absent
when: prusa_slicer_tarball.path is defined
- name: Create symlink
file:
src: "/opt/{{ prusa_slicer_directory }}"
dest: "/opt/PrusaSlicer"
state: link
vars:
prusa_slicer_directory: "{{ prusa_slicer_asset.name | regex_replace('\\.tar\\.bz2$', '') }}"
- name: Create applications directory
file:
path: /usr/local/share/applications/
state: directory
- name: Copy desktop files
copy:
src: "{{ item }}.desktop"
dest: /usr/local/share/applications/{{ item }}.desktop
loop:
- PrusaSlicer
- PrusaGcodeviewer

View file

@ -1,18 +0,0 @@
---
- block:
- import_tasks: package.yml
when: prusa_slicer_use_package | bool
tags:
- prusa-slicer:install
- import_tasks: install_from_github.yml
when: not prusa_slicer_use_package | bool
tags:
- prusa-slicer:install
- import_tasks: configure.yml
tags:
- prusa-slicer:configure
tags:
- prusa-slicer

View file

@ -20,7 +20,7 @@ variables:
builders:
- discard: true
image: debian:bookworm
image: debian:buster
type: docker
volumes:
'{{user `images`}}': /tmp/images
@ -40,14 +40,12 @@ provisioners:
- echo "LABSYNC_COMMIT_REF_SLUG='{{user `ci_commit_ref_slug`}}'" >> /etc/environment
- echo "LABSYNC_PROJECT_URL='{{user `ci_project_url`}}'" >> /etc/environment
- sed -i 's#@@PROJECT_URL@@#{{user `ci_project_url`}}#' /etc/initramfs-tools/scripts/labsync
- chmod +x /etc/initramfs-tools/scripts/labsync
type: shell
- destination: /etc/initramfs-tools/scripts/local-premount/
source: initramfs/labsync-prereqs
type: file
- inline:
- set -x
- chmod +x /etc/initramfs-tools/scripts/local-premount/labsync-prereqs
- apt-get update
- apt-get -y dist-upgrade
- rmdir /boot && ln -s /usr/local/boot /boot
@ -56,23 +54,17 @@ provisioners:
- echo overlay >> /etc/initramfs-tools/modules
- echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume
- mkdir /usr/local/boot
- apt-get -f -y install aria2 linux-image-amd64 lvm2 haveged fdisk
- apt-get -f -y install aria2 linux-image-amd64 lvm2 haveged
- mkdir -p /tmp/images
- cp $(find /boot/ -name 'initrd.img-*' | sort -V | tail -n 1) '/tmp/images/{{user `initramfs_file`}}'
- cp $(find /boot/ -name 'vmlinuz-*' | sort -V | tail -n 1) '/tmp/images/{{user `linux_file`}}'
type: shell
- inline:
- apt-get -y install openssh-server python3 lsb-release
- apt-get -y install openssh-server python lsb-release
type: shell
- playbook_file: ansible/playbook.yml
type: ansible
user: root
ansible_env_vars:
- "ANSIBLE_SSH_ARGS='-o HostkeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa'"
- "ANSIBLE_PYTHON_INTERPRETER=/usr/bin/python3"
extra_arguments:
- "--scp-extra-args"
- "'-O'"
- inline:
- rm /boot && mkdir /boot
type: shell

View file

@ -112,7 +112,7 @@ labsync_mount_root() {
labsync_info "Updating partitions"
size_disk=$(blockdev --getsz /dev/${labsync_disk})
size_part_1=$((labsync_partsize_boot * 1024 * 1024 / 512))
size_part_2=$((size_disk - size_part_1 - 2048))
size_part_2=$(((size_disk - labsync_partsize_boot) * 1024 * 1024 / 512))
start_part_2=$((size_part_1 + 2048))
dmsetup ls --tree

View file

@ -1,4 +1,4 @@
FROM debian:bookworm-slim
FROM debian:buster-slim
RUN apt-get update \
&& apt-get -y install \
@ -7,17 +7,14 @@ RUN apt-get update \
python3 \
python3-apt \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
COPY setup.py /code/setup.py
WORKDIR /code
RUN python3 -m venv --system-site-packages venv
RUN venv/bin/pip install -e .
RUN pip3 install -e .
ADD . /code
RUN venv/bin/python setup.py install
RUN python3 setup.py install

View file

@ -33,7 +33,7 @@ if __name__ == '__main__':
api_token = os.environ.get('PRIVATE_TOKEN')
gitlab = GitLab(gitlab_url, project_id, api_token)
for distro in sys.argv[1:]:
job = gitlab.getLastSuccessfulJob('main', 'squashfs_main')
job = gitlab.getLastSuccessfulJob('master', 'squashfs_master')
if job is not None:
gitlab.downloadArtifact(job, 'images/debian-' + distro + '.dpkg-list', 'debian-' + distro + '.dpkg-list')
if checkDebianDistro(distro) > 0:

View file

@ -1,7 +1,7 @@
label labsync
menu label ^labsync
kernel images/debian-bookworm.linux
append initrd=images/debian-bookworm.initramfs.dev boot=labsync labsync_disk=sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/debian-bookworm.torrent quiet vga=792 ip=10.2.2.10:::255.255.255.0:qemu-host:ens3:off labsync_wait=pause
kernel images/debian-buster.linux
append initrd=images/debian-buster.initramfs.dev boot=labsync labsync_disk=sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/debian-buster.torrent quiet vga=792 ip=10.2.2.10:::255.255.255.0:qemu-host:ens3:off labsync_wait=pause
label install
menu label ^Install