added unit selector for polyhedra; merged polyhedra inx into one

This commit is contained in:
Mario Voigt 2021-04-24 22:06:25 +02:00
parent 968f5dbe6e
commit 5d87b2cd13
7 changed files with 74 additions and 140 deletions

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Polyhedra</name>
<id>fablabchemnitz.de.polyhedra</id>
<param name="poly" gui-text="Polyhedra to render net for" type="optiongroup" appearance="combo">
<option value="Tetrahedron" >Platonic - Tetrahedron</option>
<option value="Cube" >Platonic - Cube</option>
<option value="Octahedron" >Platonic - Octahedron</option>
<option value="Dodecahedron" >Platonic - Dodecahedron</option>
<option value="Icosahedron" >Platonic - Icosahedron</option>
<option value="TruncatedTetrahedron" >Archimedean - Truncated Tetrahedron</option>
<option value="TruncatedCube" >Archimedean - Truncated Cube</option>
<option value="TruncatedOctahedron" >Archimedean - Truncated Octahedron</option>
<option value="TruncatedDodecahedron" >Archimedean - Truncated Dodecahedron</option>
<option value="TruncatedIcosahedron" >Archimedean - Truncated Icosahedron</option>
<option value="Cuboctahedron" >Archimedean - Cuboctahedron</option>
<option value="Icosidodecahedron" >Archimedean - Icosidodecahedron</option>
<option value="SmallRhombicosidodecahedron">Archimedean - Small Rhombicosidodecahedron</option>
<option value="SmallRhombicuboctahedron" >Archimedean - Small Rhombicuboctahedron</option>
<option value="GreatRhombicosidodecahedron">Archimedean - Great Rhombicosidodecahedron</option>
<option value="GreatRhombicuboctahedron" >Archimedean - Great Rhombicuboctahedron</option>
<option value="SnubCube" >Archimedean - Snub Cube</option>
<option value="SnubDodecahedron" >Archimedean - Snub Dodecahedron</option>
<option value="DeltoidalHexecontahedron" >Archimedean Dual - Deltoidal Hexecontahedron</option>
<option value="DeltoidalIcositetrahedron" >Archimedean Dual - Deltoidal Icositetrahedron</option>
<option value="DisdyakisDodecahedron" >Archimedean Dual - Disdyakis Dodecahedron</option>
<option value="DisdyakisTriacontahedron" >Archimedean Dual - Disdyakis Triacontahedron</option>
<option value="PentagonalIcositetrahedron" >Archimedean Dual - Pentagonal Icositetrahedron</option>
<option value="PentagonalHexecontahedron" >Archimedean Dual - Pentagonal Hexecontahedron</option>
<option value="PentakisDodecahedron" >Archimedean Dual - Pentakis Dodecahedron</option>
<option value="RhombicDodecahedron" >Archimedean Dual - Rhombic Dodecahedron</option>
<option value="RhombicTriacontahedron" >Archimedean Dual - Rhombic Triacontahedron</option>
<option value="SmallTriakisOctahedron" >Archimedean Dual - Small Triakis Octahedron</option>
<option value="TetrakisHexahedron" >Archimedean Dual - Tetrakis Hexahedron</option>
<option value="TriakisIcosahedron" >Archimedean Dual - Triakis Icosahedron</option>
<option value="TriakisTetrahedron" >Archimedean Dual - Triakis Tetrahedron</option>
<option value="ElongatedDodecahedron" >Other - ElongatedDodecahedron</option>
<option value="MathematicaPolyhedron" >Other - MathematicaPolyhedron</option>
</param>
<param name="size" type="float" min="1.0" max="1000.0" gui-text="length of first edge">100.0</param>
<param name="unit" type="optiongroup" appearance="combo" gui-text="Units">
<option value="mm">mm</option>
<option value="cm">cm</option>
<option value="m">m</option>
<option value="in">in</option>
<option value="pt">pt</option>
<option value="px">px</option>
<option value="pc">pc</option>
</param>
<param name="tabs" type="optiongroup" appearance="combo" gui-text="Tab style">
<option value="0">Tab and Slot</option>
<option value="1">Double Tabs</option>
<option value="2">Single Tabs</option>
<option value="3">None</option>
</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Paper/Cardboard Boxes"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">polyhedra.py</command>
</script>
</inkscape-extension>

View File

@ -57,9 +57,10 @@ slotStyle = [{\
class Polyhedra(inkex.EffectExtension):
def add_arguments(self, pars):
pars.add_argument("-p", "--poly", default='Cube', help="polygon net to render")
pars.add_argument("-s", "--size", type=float, default=100.0, help="size of first edge, in px")
pars.add_argument("-t", "--tabs", type=int, default=0, help="tab style")
pars.add_argument("-p", "--poly", default='Cube', help="Polygon net to render")
pars.add_argument("-s", "--size", type=float, default=100.0, help="Size of first edge")
pars.add_argument("-u", "--unit", default= 'mm', help="Units")
pars.add_argument("-t", "--tabs", type=int, default=0, help="Tab style")
def get_tab(self, limitAngle):
return(self.get_connector('tab', limitAngle))
@ -132,14 +133,13 @@ class Polyhedra(inkex.EffectExtension):
def effect(self):
poly = self.options.poly
size = self.options.size
size = self.svg.unittouu(str(self.options.size) + self.options.unit)
eC = polyhedronData[poly]['edgeCoordinates']
iEI = polyhedronData[poly]['insideEdgeIndices']
oEI = polyhedronData[poly]['outsideEdgeIndices']
oED = polyhedronData[poly]['outsideEdgeDegrees']
sidelen = sqrt((eC[oEI[0][0]-1][0] - eC[oEI[0][1]-1][0])**2 + \
(eC[oEI[0][0]-1][1] - eC[oEI[0][1]-1][1])**2)
sidelen = sqrt((eC[oEI[0][0]-1][0] - eC[oEI[0][1]-1][0])**2 + (eC[oEI[0][0]-1][1] - eC[oEI[0][1]-1][1])**2)
scale = size / sidelen
# Translate group, Rotate path.

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Polyhedra - Archimedean</name>
<id>fablabchemnitz.de.polyhedra.archimedean</id>
<param name="poly" gui-text="Polyhedra to render net for" type="optiongroup" appearance="combo">
<option value="TruncatedTetrahedron">TruncatedTetrahedron</option>
<option value="TruncatedCube">TruncatedCube</option>
<option value="TruncatedOctahedron">TruncatedOctahedron</option>
<option value="TruncatedDodecahedron">TruncatedDodecahedron</option>
<option value="TruncatedIcosahedron">TruncatedIcosahedron</option>
<option value="Cuboctahedron">Cuboctahedron</option>
<option value="Icosidodecahedron">Icosidodecahedron</option>
<option value="SmallRhombicosidodecahedron">SmallRhombicosidodecahedron</option>
<option value="SmallRhombicuboctahedron">SmallRhombicuboctahedron</option>
<option value="GreatRhombicosidodecahedron">GreatRhombicosidodecahedron</option>
<option value="GreatRhombicuboctahedron">GreatRhombicuboctahedron</option>
<option value="SnubCube">SnubCube</option>
<option value="SnubDodecahedron">SnubDodecahedron</option>
</param>
<param name="size" type="float" min="1.0" max="1000.0" gui-text="length of first edge, px">100.0</param>
<param name="tabs" type="optiongroup" appearance="combo" gui-text="Tab style">
<option value="0">Tab and Slot</option>
<option value="1">Double Tabs</option>
<option value="2">Single Tabs</option>
<option value="3">None</option>
</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Paper/Cardboard Boxes"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">polyhedra.py</command>
</script>
</inkscape-extension>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Polyhedra - Archimedean Dual</name>
<id>fablabchemnitz.de.polyhedra.archimedeandual</id>
<param name="poly" gui-text="Polyhedra to render net for" type="optiongroup" appearance="combo">
<option value="DeltoidalHexecontahedron">DeltoidalHexecontahedron</option>
<option value="DeltoidalIcositetrahedron">DeltoidalIcositetrahedron</option>
<option value="DisdyakisDodecahedron">DisdyakisDodecahedron</option>
<option value="DisdyakisTriacontahedron">DisdyakisTriacontahedron</option>
<option value="PentagonalIcositetrahedron">PentagonalIcositetrahedron</option>
<option value="PentagonalHexecontahedron">PentagonalHexecontahedron</option>
<option value="PentakisDodecahedron">PentakisDodecahedron</option>
<option value="RhombicDodecahedron">RhombicDodecahedron</option>
<option value="RhombicTriacontahedron">RhombicTriacontahedron</option>
<option value="SmallTriakisOctahedron">SmallTriakisOctahedron</option>
<option value="TetrakisHexahedron">TetrakisHexahedron</option>
<option value="TriakisIcosahedron">TriakisIcosahedron</option>
<option value="TriakisTetrahedron">TriakisTetrahedron</option>
</param>
<param name="size" type="float" min="1.0" max="1000.0" gui-text="length of first edge, px">100.0</param>
<param name="tabs" type="optiongroup" appearance="combo" gui-text="Tab style">
<option value="0">Tab and Slot</option>
<option value="1">Double Tabs</option>
<option value="2">Single Tabs</option>
<option value="3">None</option>
</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Paper/Cardboard Boxes"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">polyhedra.py</command>
</script>
</inkscape-extension>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Polyhedra - Other</name>
<id>fablabchemnitz.de.polyhedra.other</id>
<param name="poly" gui-text="Polyhedra to render net for" type="optiongroup" appearance="combo">
<option value="ElongatedDodecahedron">ElongatedDodecahedron</option>
<option value="MathematicaPolyhedron">MathematicaPolyhedron</option>
</param>
<param name="size" type="float" min="1.0" max="1000.0" gui-text="length of first edge, px">100.0</param>
<param name="tabs" type="optiongroup" appearance="combo" gui-text="Tab style">
<option value="0">Tab and Slot</option>
<option value="1">Double Tabs</option>
<option value="2">Single Tabs</option>
<option value="3">None</option>
</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Paper/Cardboard Boxes"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">polyhedra.py</command>
</script>
</inkscape-extension>

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>Polyhedra - Platonic</name>
<id>fablabchemnitz.de.polyhedra.platonic</id>
<param name="poly" gui-text="Polyhedra to render net for" type="optiongroup" appearance="combo">
<option value="Tetrahedron">Tetrahedron</option>
<option value="Cube">Cube</option>
<option value="Octahedron">Octahedron</option>
<option value="Dodecahedron">Dodecahedron</option>
<option value="Icosahedron">Icosahedron</option>
</param>
<param name="size" type="float" min="1.0" max="1000.0" gui-text="length of first edge, px">100.0</param>
<param name="tabs" type="optiongroup" appearance="combo" gui-text="Tab style">
<option value="0">Tab and Slot</option>
<option value="1">Double Tabs</option>
<option value="2">Single Tabs</option>
<option value="3">None</option>
</param>
<effect>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz">
<submenu name="Paper/Cardboard Boxes"/>
</submenu>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">polyhedra.py</command>
</script>
</inkscape-extension>

View File

@ -16,7 +16,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# net data produced with Mathematica using the notebook at http://jmantonfablab.googlecode.com/svn/trunk/papercuts/polyhedra/autonets/polydatagen.nb
# net data produced with Mathematica using the notebook at https://github.com/vmario89/fablab-polyhedra/tree/master/autonets
# angle overrides manually produced, with help from debugging mode on net generation that also outputs the vertex number of the outer edges of the nets.
angleOverride = {\