parent
de50264c09
commit
0394230c58
7 changed files with 1403 additions and 0 deletions
340
packer/ansible/roles/inkscape/files/tabbed_box_maker/LICENSE
Normal file
340
packer/ansible/roles/inkscape/files/tabbed_box_maker/LICENSE
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
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.
|
||||
|
||||
157
packer/ansible/roles/inkscape/files/tabbed_box_maker/README.md
Executable file
157
packer/ansible/roles/inkscape/files/tabbed_box_maker/README.md
Executable file
|
|
@ -0,0 +1,157 @@
|
|||
# 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.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
|
||||
104
packer/ansible/roles/inkscape/files/tabbed_box_maker/boxmaker.inx
Executable file
104
packer/ansible/roles/inkscape/files/tabbed_box_maker/boxmaker.inx
Executable file
|
|
@ -0,0 +1,104 @@
|
|||
<?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>
|
||||
741
packer/ansible/roles/inkscape/files/tabbed_box_maker/boxmaker.py
Executable file
741
packer/ansible/roles/inkscape/files/tabbed_box_maker/boxmaker.py
Executable file
|
|
@ -0,0 +1,741 @@
|
|||
#! /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()
|
||||
47
packer/ansible/roles/inkscape/files/tabbed_box_maker/schroffmaker.inx
Executable file
47
packer/ansible/roles/inkscape/files/tabbed_box_maker/schroffmaker.inx
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
<?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>
|
||||
|
|
@ -6,5 +6,8 @@
|
|||
- import_tasks: silhouette.yml
|
||||
tags:
|
||||
- inkscape:silhouette
|
||||
- import_tasks: tabbed_box_maker.yml
|
||||
tags:
|
||||
- inkscape:tabbed_box_maker
|
||||
tags:
|
||||
- inkscape
|
||||
|
|
|
|||
11
packer/ansible/roles/inkscape/tasks/tabbed_box_maker.yml
Normal file
11
packer/ansible/roles/inkscape/tasks/tabbed_box_maker.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue