Fixes for packaging boxes

This commit is contained in:
leyghisbb 2020-07-31 00:14:03 +02:00
parent 6241edb17a
commit d93cdc434e
13 changed files with 290 additions and 345 deletions

View File

@ -12,9 +12,6 @@
<param name="glue_tab" type="float" min="0.1" max="300.0" gui-text="P - Width glue tab">5.0</param>
<param name="close_tab" type="float" min="0.1" max="300.0" gui-text="C - Top side sealing flange:">5.0</param>
<param name="side_tabs" type="float" min="0.1" max="300.0" gui-text="T - Top side closure tabs:">5.0</param>
<param name="use_material_compensation" type="bool" gui-text="Apply material compensation (only in mm)">false</param>
<label>This option only works with mm, make sure it is unchecked if you do not use this unit.</label>
<param name="material_compensation" type="float" min="0.2" max="50.0" gui-text="Thickness of the material:">0.250</param>
<effect>
<object-type>all</object-type>
<effects-menu>

View File

@ -42,8 +42,6 @@ class GenerarEstuche(inkex.EffectExtension):
pars.add_argument("--glue_tab", type=float, default=5.0, help="Ancho pestaña de engomado")
pars.add_argument("--close_tab", type=float, default=5.0, help="Alto pestaña de cierre")
pars.add_argument("--side_tabs", type=float, default=5.0, help="Alto pestañas laterales de cierre")
pars.add_argument("--use_material_compensation", type=inkex.Boolean, default=False, help="Aplicar compensación de material")
pars.add_argument("--material_compensation", type=float, default=0.2, help="Grueso del material.")
pars.add_argument("--unit", default="mm", help="Tipo de unidades")
@ -62,11 +60,7 @@ class GenerarEstuche(inkex.EffectExtension):
ancho_pestana_cola = self.svg.unittouu(str(self.options.glue_tab) + self.options.unit)
alto_pestana_cierre = self.svg.unittouu(str(self.options.close_tab) + self.options.unit)
alto_pestana = self.svg.unittouu(str(self.options.side_tabs) + self.options.unit)
compensacion=0.0
if self.options.use_material_compensation==True:
compensacion=self.svg.unittouu(str(self.options.material_compensation) + self.options.unit)
if self.options.unit=="cm":
medida_pestana1=0.5
medida_pestana2=0.1
@ -100,59 +94,59 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-exterior'))
line.path = [
['M', [0, 0]],
['l', [0, 0-largo_caja-compensacion]],
['l', [compensacion, 0]],
['l', [0, 0-largo_caja]],
['l', [0, 0]],
['q', [0,0-alto_pestana_cierre,alto_pestana_cierre, 0-alto_pestana_cierre]],
['l', [ancho_caja-(alto_pestana_cierre*2)-(compensacion*2), 0]],
['l', [ancho_caja-(alto_pestana_cierre*2), 0]],
['q', [alto_pestana_cierre,0,alto_pestana_cierre,alto_pestana_cierre]],
['l', [compensacion, 0]],
['l', [0, (largo_caja-compensacion)]],
['l', [0, 0]],
['l', [0, (largo_caja)]],
['l', [medida4_pestanas_laterales, 0-medida4_pestanas_laterales]],
['l', [0,0-(alto_pestana-medida4_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales-compensacion), 0]],
['l', [(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [medida3_pestanas_laterales, (alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [medida2_pestanas_laterales, medida2_pestanas_laterales]],
['l', [0, medida1_pestanas_laterales]],
['l', [0,compensacion]],
['l', [0,0]],
['l', [ancho_caja, 0]],
['l', [0,compensacion]],
['l', [compensacion, 0]],
['l', [0,0]],
['l', [0, 0]],
['l', [0, 0-medida1_pestanas_laterales]],
['l', [medida2_pestanas_laterales, 0-medida2_pestanas_laterales]],
['l', [medida3_pestanas_laterales, 0-(alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0,alto_pestana-medida4_pestanas_laterales]],
['l', [medida4_pestanas_laterales, medida4_pestanas_laterales]],
['l', [0, alto_caja]],
['l', [0-medida4_pestanas_laterales, medida4_pestanas_laterales]],
['l', [0,(alto_pestana-medida4_pestanas_laterales)]],
['l', [0-(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales-compensacion), 0]],
['l', [0-(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0-(medida3_pestanas_laterales), 0-(alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [0-(medida2_pestanas_laterales), 0-(medida2_pestanas_laterales)]],
['l', [0, 0-medida1_pestanas_laterales]],
['l', [0-compensacion, 0]],
['l', [0,0-compensacion]],
['l', [0, 0]],
['l', [0,0]],
['l', [0-ancho_caja, 0]],
['l', [0,compensacion]],
['l', [0-compensacion, 0]],
['l', [0,0]],
['l', [0, 0]],
['l', [0, medida1_pestanas_laterales]],
['l', [0-medida2_pestanas_laterales, medida2_pestanas_laterales]],
['l', [0-medida3_pestanas_laterales, (alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [0-(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0-(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0,0-(alto_pestana-medida4_pestanas_laterales)]],
['l', [0-medida4_pestanas_laterales, 0-medida4_pestanas_laterales]],
['l', [0,compensacion]],
['l', [0, largo_caja-compensacion]],
['l', [0-compensacion, 0]],
['l', [0,0]],
['l', [0, largo_caja]],
['l', [0, 0]],
['q', [0,alto_pestana_cierre,0-alto_pestana_cierre, alto_pestana_cierre]],#
['l', [0-(ancho_caja-(alto_pestana_cierre*2)-(compensacion*2)), 0]],
['l', [0-(ancho_caja-(alto_pestana_cierre*2)), 0]],
['q', [0-alto_pestana_cierre,0,0-alto_pestana_cierre,0-alto_pestana_cierre]],
['l', [0-compensacion, 0]],
['l', [0, 0-largo_caja-compensacion]],
['l', [0, 0]],
['l', [0, 0-largo_caja]],
['l', [0, 0-medida2_pestanas_laterales]],
['l', [0-ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0, 0-(alto_caja-ancho_pestana_cola-(medida2_pestanas_laterales*2)-(compensacion*2))]],
['l', [ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0-ancho_pestana_cola, 0-(ancho_pestana_cola/2)]],
['l', [0, 0-(alto_caja-ancho_pestana_cola-(medida2_pestanas_laterales*2))]],
['l', [ancho_pestana_cola, 0-(ancho_pestana_cola/2)]],
['Z', []]
]
line.style = estilo_linea_cortes
@ -192,8 +186,8 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-5'))
line.path = [
['M', [ancho_caja,compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [ancho_caja,0]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
@ -208,8 +202,8 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-7'))
line.path = [
['M', [(ancho_caja*2)+largo_caja,compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [(ancho_caja*2)+largo_caja,0]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
@ -224,32 +218,32 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-9'))
line.path = [
['M', [ancho_caja,alto_caja-compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [ancho_caja,alto_caja]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-10'))
line.path = [
['M', [(ancho_caja*2)+largo_caja,alto_caja-compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [(ancho_caja*2)+largo_caja,alto_caja]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-11'))
line.path = [
['M', [compensacion,0-(largo_caja-compensacion)]],
['l', [ancho_caja-(compensacion*2),0]],
['M', [0,0-(largo_caja)]],
['l', [ancho_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-12'))
line.path = [
['M', [compensacion,alto_caja+largo_caja-compensacion]],
['l', [ancho_caja-(compensacion*2),0]],
['M', [0,alto_caja+largo_caja]],
['l', [ancho_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos

View File

@ -12,9 +12,6 @@
<param name="glue_tab" type="float" min="0.1" max="300.0" gui-text="P - Width glue tab">5.0</param>
<param name="close_tab" type="float" min="0.1" max="300.0" gui-text="C - Top side sealing flange:">5.0</param>
<param name="side_tabs" type="float" min="0.1" max="300.0" gui-text="T - Top side closure tabs:">5.0</param>
<param name="use_material_compensation" type="bool" gui-text="Apply material compensation (only in mm)">false</param>
<label>This option only works with mm, make sure it is unchecked if you do not use this unit.</label>
<param name="material_compensation" type="float" min="0.2" max="50.0" gui-text="Thickness of the material:">0.250</param>
<effect>
<object-type>all</object-type>
<effects-menu>

View File

@ -1,18 +1,17 @@
#! /usr/bin/env python
# coding=utf-8
#! /usr/bin/env python3
#
#
# Este script dibuja el perfil exterior de corte la caja en un solo
# path cerrado y añade despues los otros flejes necesarios con colores
# diferentes para identificarlos.
# rojo > para cortes y perfil exterior
# azul > para hendidos
# verde > para taladros
# amarillo > medios cortes
# This script draws the outer profile of the box cut in a single
# closed path and then add the other necessary strips with colours
# different to identify them.
# red > for cuts and outer profile
# blue > for crevices
# green > for drills
# yellow > half-cut
#
# TODO:
# agregar opción de dibujo en cm/in
# mover dibujo al centro del documento
# EVERYTHING:
# add cm/in drawing option
# move drawing to the center of the document
#
# 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
@ -33,219 +32,213 @@ __version__ = "0.2"
import inkex
class GenerarEstuche(inkex.EffectExtension):
class AutomaticBottomCase(inkex.EffectExtension):
def add_arguments(self, pars):
pars.add_argument("--width", type=float, default=25.0, help="Ancho de la caja")
pars.add_argument("--height", type=float, default=25.0, help="Alto de la caja")
pars.add_argument("--depth", type=float, default=25.0, help="Largo de la caja")
pars.add_argument("--glue_tab", type=float, default=5.0, help="Ancho pestaña de engomado")
pars.add_argument("--close_tab", type=float, default=5.0, help="Alto pestaña de cierre")
pars.add_argument("--side_tabs", type=float, default=5.0, help="Alto pestañas laterales de cierre")
pars.add_argument("--use_material_compensation", type=inkex.Boolean, default=False, help="Aplicar compensación de material")
pars.add_argument("--material_compensation", type=float, default=0.2, help="Grueso del material.")
pars.add_argument("--unit", default="mm", help="Tipo de unidades")
pars.add_argument("--width", type=float, default=25.0, help="Width of the box")
pars.add_argument("--height", type=float, default=25.0, help="Height of the box")
pars.add_argument("--depth", type=float, default=25.0, help="Length of the box")
pars.add_argument("--glue_tab", type=float, default=5.0, help="Tab width")
pars.add_argument("--close_tab", type=float, default=5.0, help="Height sealing flange")
pars.add_argument("--side_tabs", type=float, default=5.0, help="Height side sealing flanges")
pars.add_argument("--unit", default="mm", help="Type of units")
def effect(self):
centro_ancho_documento = self.svg.unittouu(self.document.getroot().get('width'))/2
centro_alto_documento = self.svg.unittouu(self.document.getroot().get('height'))/2
width_center_document = self.svg.unittouu(self.document.getroot().get('width'))/2
height_center_document = self.svg.unittouu(self.document.getroot().get('height'))/2
medida_pestana1=5
medida_pestana2=1
medida_pestana3=4
medida_pestana4=3
eyelash_measure1=5
eyelash_measure2=1
eyelash_measure3=4
eyelash_measure4=3
box_width = self.svg.unittouu(str(self.options.width) + self.options.unit)
box_height = self.svg.unittouu(str(self.options.height) + self.options.unit)
box_length = self.svg.unittouu(str(self.options.depth) + self.options.unit)
glue_width = self.svg.unittouu(str(self.options.glue_tab) + self.options.unit)
top_flap_closure = self.svg.unittouu(str(self.options.close_tab) + self.options.unit)
top_flap = self.svg.unittouu(str(self.options.side_tabs) + self.options.unit)
ancho_caja = self.svg.unittouu(str(self.options.width) + self.options.unit)
alto_caja = self.svg.unittouu(str(self.options.height) + self.options.unit)
largo_caja = self.svg.unittouu(str(self.options.depth) + self.options.unit)
ancho_pestana_cola = self.svg.unittouu(str(self.options.glue_tab) + self.options.unit)
alto_pestana_cierre = self.svg.unittouu(str(self.options.close_tab) + self.options.unit)
alto_pestana = self.svg.unittouu(str(self.options.side_tabs) + self.options.unit)
compensacion=0.0
if self.options.use_material_compensation==True:
compensacion=self.svg.unittouu(str(self.options.material_compensation) + self.options.unit)
if self.options.unit=="cm":
medida_pestana1=0.5
medida_pestana2=0.1
medida_pestana3=0.4
medida_pestana3=0.3
eyelash_measure1=0.5
eyelash_measure2=0.1
eyelash_measure3=0.4
eyelash_measure3=0.3
if self.options.unit=='in':
medida_pestana1=0.196
medida_pestana2=0.039
medida_pestana3=0.157
medida_pestana3=0.118
eyelash_measure1=0.196
eyelash_measure2=0.039
eyelash_measure3=0.157
eyelash_measure3=0.118
medida1_pestanas_laterales=self.svg.unittouu(str(medida_pestana1) + self.options.unit)
medida2_pestanas_laterales=self.svg.unittouu(str(medida_pestana2) + self.options.unit)
medida3_pestanas_laterales=self.svg.unittouu(str(medida_pestana3) + self.options.unit)
medida4_pestanas_laterales=self.svg.unittouu(str(medida_pestana4) + self.options.unit)
measure1_side_blind=self.svg.unittouu(str(eyelash_measure1) + self.options.unit)
measure2_side_blind=self.svg.unittouu(str(eyelash_measure2) + self.options.unit)
measure3_side_blind=self.svg.unittouu(str(eyelash_measure3) + self.options.unit)
measure4_side_blind=self.svg.unittouu(str(eyelash_measure4) + self.options.unit)
id_caja = self.svg.get_unique_id('estuche-fondoautomatico')
group = self.svg.get_current_layer().add(inkex.Group(id=id_caja))
estilo_linea_cortes = {'stroke': '#FF0000', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
estilo_linea_hendidos = {'stroke': '#0000FF', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
estilo_linea_taladros = {'stroke': '#00FF00', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
estilo_linea_medioscortes = {'stroke': '#00FFFF', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
box_id = self.svg.get_unique_id('automaticbottomcase')
group = self.svg.get_current_layer().add(inkex.Group(id=box_id))
line_style_cuts = {'stroke': '#FF0000', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
cleft_line_style = {'stroke': '#0000FF', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
line_style_drills = {'stroke': '#00FF00', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
media_line_style = {'stroke': '#00FFFF', 'fill': 'none', 'stroke-width': str(self.svg.unittouu('1px'))}
# line.path --> M = coordenadas absolutas
# line.path --> l = dibuja una linea desde el punto actual a las coordenadas especificadas
# line.path --> c = dibuja una curva beizer desde el punto actual a las coordenadas especificadas
# line.path --> q = dibuja un arco desde el punto actual a las coordenadas especificadas usando un punto como referencia
# line.path --> Z = cierra path
# line.path --> M = absolute coordinates
# line.path --> l = draws a line from the current point to the specified coordinates
# line.path --> c = draws a beizer curve from the current point to the specified coordinates
# line.path --> q = draws an arc from the current point to the specified coordinates using a point as reference
# line.path --> Z = close path
#Perfil Exterior de la caja
line = group.add(inkex.PathElement(id=id_caja + '-perfil-exterior'))
#Outside profile of the box
line = group.add(inkex.PathElement(id=box_id + '-profile-outside'))
line.path = [
['M', [0, 0]],
['l', [0, 0-largo_caja-compensacion]],
['l', [compensacion, 0]],
['q', [0,0-alto_pestana_cierre,alto_pestana_cierre, 0-alto_pestana_cierre]],
['l', [ancho_caja-(alto_pestana_cierre*2)-(compensacion*2), 0]],
['q', [alto_pestana_cierre,0,alto_pestana_cierre,alto_pestana_cierre]],
['l', [compensacion, 0]],
['l', [0, (largo_caja-compensacion)]],
['l', [medida4_pestanas_laterales, 0-medida4_pestanas_laterales]],
['l', [0,0-(alto_pestana-medida4_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales-compensacion), 0]],
['l', [medida3_pestanas_laterales, (alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [medida2_pestanas_laterales, medida2_pestanas_laterales]],
['l', [0, medida1_pestanas_laterales]],
['l', [0,compensacion]],
['l', [ancho_caja, 0]],
['l', [0,compensacion]],
['l', [compensacion, 0]],
['l', [0, 0-medida1_pestanas_laterales]],
['l', [medida2_pestanas_laterales, 0-medida2_pestanas_laterales]],
['l', [medida3_pestanas_laterales, 0-(alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0,alto_pestana-medida4_pestanas_laterales]],
['l', [medida4_pestanas_laterales, medida4_pestanas_laterales]],
['l', [0, alto_caja]],
['l', [0-((largo_caja/2)-compensacion),largo_caja/2]],
['l', [0-((largo_caja/2)-compensacion-(medida2_pestanas_laterales)*2),0]],
['l', [0-(medida2_pestanas_laterales),0-((largo_caja/2)-medida2_pestanas_laterales)]],
['l', [0-medida2_pestanas_laterales,0-medida2_pestanas_laterales]],
['l', [0-medida2_pestanas_laterales,medida2_pestanas_laterales]],
['l', [0,largo_caja*0.7]],
['l', [0-(((largo_caja*0.5)-medida2_pestanas_laterales)/2),0]],
['l', [0-(((largo_caja*0.5)-medida2_pestanas_laterales)/2),0-((largo_caja*0.7)-(largo_caja*0.5))]],
['l', [0-((ancho_caja/2)-((largo_caja*0.5)-medida2_pestanas_laterales)),0]],
['l', [medida3_pestanas_laterales,medida3_pestanas_laterales]],
['l', [0-((largo_caja*0.7)-(largo_caja*0.5))-medida3_pestanas_laterales,((largo_caja*0.7)-(largo_caja*0.5))-medida3_pestanas_laterales]],
['l', [0-(((ancho_caja/2)-((largo_caja*0.5)))+((largo_caja*0.7)-(largo_caja*0.5))),0]],
['l', [0-medida3_pestanas_laterales,0-((largo_caja*0.7)+(compensacion*2))]],
['l', [0-((largo_caja/2)),largo_caja/2]],
['l', [0-((largo_caja/2)-(medida2_pestanas_laterales)*2),0]],
['l', [0-(medida2_pestanas_laterales),0-((largo_caja/2)-medida2_pestanas_laterales)]],
['l', [0-medida2_pestanas_laterales,0-medida2_pestanas_laterales]],
['l', [0-medida2_pestanas_laterales,medida2_pestanas_laterales]],
['l', [0,largo_caja*0.7]],
['l', [0-(((largo_caja*0.5)-medida2_pestanas_laterales)/2),0]],
['l', [0-(((largo_caja*0.5)-medida2_pestanas_laterales)/2),0-((largo_caja*0.7)-(largo_caja*0.5))]],
['l', [0-((ancho_caja/2)-((largo_caja*0.5)-medida2_pestanas_laterales)),0]],
['l', [medida3_pestanas_laterales,medida3_pestanas_laterales]],
['l', [0-((largo_caja*0.7)-(largo_caja*0.5))-medida3_pestanas_laterales,((largo_caja*0.7)-(largo_caja*0.5))-medida3_pestanas_laterales]],
['l', [0-(((ancho_caja/2)-((largo_caja*0.5)))+((largo_caja*0.7)-(largo_caja*0.5))),0]],
['l', [0-medida3_pestanas_laterales,0-((largo_caja*0.7)+compensacion)]],
['l', [0, 0-medida2_pestanas_laterales]],
['l', [0-ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0, 0-(alto_caja-ancho_pestana_cola-(medida2_pestanas_laterales*2)-(compensacion*2))]],
['l', [ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0, 0-box_length]],
['l', [0, 0]],
['q', [0,0-top_flap_closure,top_flap_closure, 0-top_flap_closure]],
['l', [box_width-(top_flap_closure*2), 0]],
['q', [top_flap_closure,0,top_flap_closure,top_flap_closure]],
['l', [0, 0]],
['l', [0, (box_length)]],
['l', [measure4_side_blind, 0-measure4_side_blind]],
['l', [0,0-(top_flap-measure4_side_blind)]],
['l', [(box_length-measure2_side_blind-measure3_side_blind-measure4_side_blind), 0]],
['l', [measure3_side_blind, (top_flap-measure2_side_blind-measure1_side_blind)]],
['l', [measure2_side_blind, measure2_side_blind]],
['l', [0, measure1_side_blind]],
['l', [0,0]],
['l', [box_width, 0]],
['l', [0,0]],
['l', [0, 0]],
['l', [0, 0-measure1_side_blind]],
['l', [measure2_side_blind, 0-measure2_side_blind]],
['l', [measure3_side_blind, 0-(top_flap-measure2_side_blind-measure1_side_blind)]],
['l', [(box_length-measure2_side_blind-measure3_side_blind-measure4_side_blind), 0]],
['l', [0,top_flap-measure4_side_blind]],
['l', [measure4_side_blind, measure4_side_blind]],
['l', [0, box_height]],
['l', [0-((box_length/2)),box_length/2]],
['l', [0-((box_length/2)-(measure2_side_blind)*2),0]],
['l', [0-(measure2_side_blind),0-((box_length/2)-measure2_side_blind)]],
['l', [0-measure2_side_blind,0-measure2_side_blind]],
['l', [0-measure2_side_blind,measure2_side_blind]],
['l', [0,box_length*0.7]],
['l', [0-(((box_length*0.5)-measure2_side_blind)/2),0]],
['l', [0-(((box_length*0.5)-measure2_side_blind)/2),0-((box_length*0.7)-(box_length*0.5))]],
['l', [0-((box_width/2)-((box_length*0.5)-measure2_side_blind)),0]],
['l', [measure3_side_blind,measure3_side_blind]],
['l', [0-((box_length*0.7)-(box_length*0.5))-measure3_side_blind,((box_length*0.7)-(box_length*0.5))-measure3_side_blind]],
['l', [0-(((box_width/2)-((box_length*0.5)))+((box_length*0.7)-(box_length*0.5))),0]],
['l', [0-measure4_side_blind/2,0-((box_length*0.7))-measure2_side_blind]],
['l', [0-(box_length/2),box_length/2]],
['l', [0-((box_length/2)-(measure2_side_blind)*2),0]],
['l', [0-measure2_side_blind,0-((box_length/2)-measure2_side_blind)]],
['l', [0-measure2_side_blind,0-measure2_side_blind]],
['l', [0-measure2_side_blind,measure2_side_blind]],
['l', [0,box_length*0.7]],
['l', [0-(((box_length*0.5)-measure2_side_blind)/2),0]],
['l', [0-(((box_length*0.5)-measure2_side_blind)/2),0-((box_length*0.7)-(box_length*0.5))]],
['l', [0-((box_width/2)-((box_length*0.5)-measure2_side_blind)),0]],
['l', [measure3_side_blind,measure3_side_blind]],
['l', [0-((box_length*0.7)-(box_length*0.5))-measure3_side_blind,((box_length*0.7)-(box_length*0.5))-measure3_side_blind]],
['l', [0-(((box_width/2)-((box_length*0.5)))+((box_length*0.7)-(box_length*0.5))),0]],
['l', [0-measure4_side_blind/2,0-((box_length*0.7))-measure2_side_blind]],
['l', [0, 0-measure2_side_blind]],
['l', [0-glue_width, 0-(glue_width/2)]],
['l', [0, 0-(box_height-glue_width-(measure2_side_blind*2))]],
['l', [glue_width, 0-(glue_width/2)]],
['Z', []]
]
line.style = estilo_linea_cortes
line.style = line_style_cuts
#Hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-1'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-1'))
line.path = [
['M', [0,0]],
['l', [0,alto_caja]],
['l', [0,box_height]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-2'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-2'))
line.path = [
['M', [ancho_caja,0]],
['l', [0,alto_caja]],
['M', [box_width,0]],
['l', [0,box_height]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-3'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-3'))
line.path = [
['M', [ancho_caja+largo_caja,0]],
['l', [0,alto_caja]],
['M', [box_width+box_length,0]],
['l', [0,box_height]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-4'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-4'))
line.path = [
['M', [ancho_caja+ancho_caja+largo_caja,0]],
['l', [0,alto_caja]],
['M', [box_width+box_width+box_length,0]],
['l', [0,box_height]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-5'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-5'))
line.path = [
['M', [0,0]],
['l', [ancho_caja,0]],
['l', [box_width,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-6'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-6'))
line.path = [
['M', [0,alto_caja+compensacion]],
['l', [((largo_caja+ancho_caja)*2)-(compensacion*2),0]],
['M', [0,box_height]],
['l', [((box_length+box_width)*2),0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-7'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-7'))
line.path = [
['M', [ancho_caja+compensacion,compensacion]],
['l', [(largo_caja-compensacion*2),0]],
['M', [box_width,0]],
['l', [box_length,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-8'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-8'))
line.path = [
['M', [(ancho_caja*2)+largo_caja+(compensacion*2),compensacion]],
['l', [(largo_caja-compensacion*2),0]],
['M', [box_length+box_width*2,0]],
['l', [box_length,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-9'))
line = group.add(inkex.PathElement(id=box_id + '-profile-splits-9'))
line.path = [
['M', [compensacion,0-(largo_caja+compensacion)]],
['l', [ancho_caja-(compensacion*2),0]],
['M', [0,0-(box_length)]],
['l', [box_width,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_caja + '-perfil-taladro-1'))
line = group.add(inkex.PathElement(id=box_id + '-profile-drill-1'))
line.path = [
['M', [ancho_caja-medida2_pestanas_laterales+compensacion,alto_caja+medida2_pestanas_laterales+compensacion]],
['l', [0-((largo_caja*0.5)-compensacion),(largo_caja*0.5)-compensacion]],
['M', [box_width-measure2_side_blind,box_height+measure2_side_blind]],
['l', [0-((box_length*0.5)),(box_length*0.5)]],
['Z', []]
]
line.style = estilo_linea_taladros
line.style = line_style_drills
line = group.add(inkex.PathElement(id=id_caja + '-perfil-taladro-2'))
line = group.add(inkex.PathElement(id=box_id + '-profile-drill-2'))
line.path = [
['M', [((ancho_caja*2)+largo_caja)-medida2_pestanas_laterales+(compensacion*2),alto_caja+medida2_pestanas_laterales+compensacion]],
['l', [0-((largo_caja*0.5)-compensacion),(largo_caja*0.5)-compensacion]],
['M', [((box_width*2)+box_length)-measure2_side_blind,box_height+measure2_side_blind]],
['l', [0-((box_length*0.5)),(box_length*0.5)]],
['Z', []]
]
line.style = estilo_linea_taladros
line.style = line_style_drills
if __name__ == '__main__':
GenerarEstuche().run()
AutomaticBottomCase().run()

View File

@ -9,9 +9,6 @@
<param name="width" type="float" min="0.1" max="300.0" gui-text="A - width:">25.0</param>
<param name="depth" type="float" min="0.1" max="300.0" gui-text="L - length:">25.0</param>
<param name="height" type="float" min="0.1" max="300.0" gui-text="H - height:">25.0</param>
<param name="use_material_compensation" type="bool" gui-text="Apply material compensation (only in mm)">false</param>
<label>This option only works with mm, make sure it is unchecked if you do not use this unit.</label>
<param name="material_compensation" type="float" min="0.2" max="50.0" gui-text="Thickness of the material:">0.250</param>
<effect>
<object-type>all</object-type>
<effects-menu>

View File

@ -38,8 +38,6 @@ class GenerarEstuche(inkex.EffectExtension):
pars.add_argument("--width", type=float, default=25.0, help="Ancho de la caja")
pars.add_argument("--height", type=float, default=25.0, help="Alto de la caja")
pars.add_argument("--depth", type=float, default=25.0, help="Largo de la caja")
pars.add_argument("--use_material_compensation", type=inkex.Boolean, default=False, help="Aplicar compensación de material")
pars.add_argument("--material_compensation", type=float, default=0.2, help="Grueso del material.")
pars.add_argument("--unit", default="mm", help="Tipo de unidades")
def effect(self):
@ -51,11 +49,7 @@ class GenerarEstuche(inkex.EffectExtension):
ancho_caja = self.svg.unittouu(str(self.options.width) + self.options.unit)
alto_caja = self.svg.unittouu(str(self.options.height) + self.options.unit)
largo_caja = self.svg.unittouu(str(self.options.depth) + self.options.unit)
compensacion=0.0
if self.options.use_material_compensation==True:
compensacion=self.svg.unittouu(str(self.options.material_compensation) + self.options.unit)
if self.options.unit=="cm":
medida_pestana1=0.2
@ -81,9 +75,9 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-exterior'))
line.path = [
['M', [0, 0]],
['l', [alto_caja+compensacion,0]],
['l', [alto_caja,0]],
['l', [ancho_caja,0]],
['l', [alto_caja+compensacion,0]],
['l', [alto_caja,0]],
['l', [0,alto_caja-medida1_pestanas_laterales]],
['l', [0-(alto_caja-medida1_pestanas_laterales),0]],
['l', [0-medida1_pestanas_laterales,medida1_pestanas_laterales]],
@ -93,15 +87,15 @@ class GenerarEstuche(inkex.EffectExtension):
['l', [medida1_pestanas_laterales,medida1_pestanas_laterales]],
['l', [alto_caja-medida1_pestanas_laterales,0]],
['l', [0,alto_caja-medida1_pestanas_laterales]],
['l', [0-(alto_caja+compensacion),0]],
['l', [0-(alto_caja),0]],
['l', [0-(ancho_caja),0]],
['l', [0-(alto_caja+compensacion),0]],
['l', [0-(alto_caja),0]],
['l', [0,0-(alto_caja-medida1_pestanas_laterales)]],
['l', [alto_caja-medida1_pestanas_laterales,0]],
['l', [medida1_pestanas_laterales,0-medida1_pestanas_laterales]],
['l', [0-(alto_caja+compensacion),0]],
['l', [0-(alto_caja),0]],
['l', [0,0-largo_caja]],
['l', [alto_caja++compensacion,0]],
['l', [alto_caja,0]],
['l', [0-medida1_pestanas_laterales,0-medida1_pestanas_laterales]],
['l', [0-(alto_caja-medida1_pestanas_laterales),0]],
['Z', []]

View File

@ -1,5 +1,4 @@
#! /usr/bin/env python
# coding=utf-8
#! /usr/bin/env python3
#
#
# This script draws the outer profile of the box cut in a single
@ -77,7 +76,7 @@ class GenerateBox(inkex.EffectExtension):
['l', [0,0]],
['l', [0,eyelash_width]],
['l', [eyelash_width,0]],
['l', [0-(eyelash_width-eyelash_measure1),box_height-eyelash_measure1]],
['l', [0-(eyelash_width-eyelash_measure1),box_height-eyelash_measure4]],
['l', [0-eyelash_measure1,eyelash_measure2]],
['l', [0,eyelash_measure1]],
['l', [box_height-eyelash_measure3,eyelash_measure3]],
@ -115,7 +114,7 @@ class GenerateBox(inkex.EffectExtension):
['l', [eyelash_measure1,0]],
['l', [eyelash_measure3,0-(box_height-eyelash_measure3)]],
['l', [(box_height-eyelash_measure3),0-eyelash_measure3]],
['l', [0,0-eyelash_measure4]],
['l', [0,0-eyelash_measure1]],
['l', [0-eyelash_measure1,0-eyelash_measure2]],
['l', [0-(eyelash_width-eyelash_measure1),0-(box_height-eyelash_measure4)]],
['l', [eyelash_width,0]],
@ -142,7 +141,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-3'))
line.path = [
['M', [0-box_height,((box_height*2)+eyelash_width)+eyelash_measure2]],
['M', [0-box_height,((box_height*2)+eyelash_width)]],
['l', [box_width+(box_height*2),0]],
['Z', []]
]
@ -150,7 +149,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-4'))
line.path = [
['M', [0-box_height,(((box_height*2)+eyelash_width)+box_length)+eyelash_measure2]],
['M', [0-box_height,(((box_height*2)+eyelash_width)+box_length)]],
['l', [box_width+(box_height*2),0]],
['Z', []]
]
@ -158,7 +157,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-5'))
line.path = [
['M', [0,(box_height*3)+box_length+eyelash_width+eyelash_measure2]],
['M', [0,(box_height*3)+box_length+eyelash_width]],
['l', [box_width,0]],
['Z', []]
]
@ -166,7 +165,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-6'))
line.path = [
['M', [0,(box_height*4)+box_length+eyelash_width+eyelash_measure2]],
['M', [0,(box_height*4)+box_length+eyelash_width]],
['l', [box_width,0]],
['Z', []]
]
@ -175,7 +174,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-7'))
line.path = [
['M', [0,eyelash_width]],
['l', [0,box_length+(box_height*4)+eyelash_measure2]],
['l', [0,box_length+(box_height*4)]],
['Z', []]
]
line.style = cleft_line_style
@ -183,14 +182,14 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-8'))
line.path = [
['M', [box_width,eyelash_width]],
['l', [0,box_length+(box_height*4)+eyelash_measure2]],
['l', [0,box_length+(box_height*4)]],
['Z', []]
]
line.style = cleft_line_style
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-9'))
line.path = [
['M', [0-box_height,eyelash_width+(box_height*2)+eyelash_measure2]],
['M', [0-box_height,eyelash_width+(box_height*2)]],
['l', [0,box_length]],
['Z', []]
]
@ -198,7 +197,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-10'))
line.path = [
['M', [box_width+box_height,eyelash_width+(box_height*2)+eyelash_measure2]],
['M', [box_width+box_height,eyelash_width+(box_height*2)]],
['l', [0,box_length]],
['Z', []]
]
@ -206,7 +205,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-11'))
line.path = [
['M', [0,eyelash_width+(box_height*2)+eyelash_measure2]],
['M', [0,eyelash_width+(box_height*2)]],
['l', [0-(box_height-eyelash_measure3),0-(box_height-eyelash_measure3)]],
['Z', []]
]
@ -214,7 +213,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-12'))
line.path = [
['M', [box_width,eyelash_width+(box_height*2)+eyelash_measure2]],
['M', [box_width,eyelash_width+(box_height*2)]],
['l', [box_height-eyelash_measure3,0-(box_height-eyelash_measure3)]],
['Z', []]
]
@ -222,7 +221,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-13'))
line.path = [
['M', [box_width,eyelash_width+(box_height*2)+box_length+eyelash_measure2]],
['M', [box_width,eyelash_width+(box_height*2)+box_length]],
['l', [box_height-eyelash_measure3,box_height-eyelash_measure3]],
['Z', []]
]
@ -230,7 +229,7 @@ class GenerateBox(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_box + '-profile-splits-14'))
line.path = [
['M', [0,eyelash_width+(box_height*2)+box_length+eyelash_measure2]],
['M', [0,eyelash_width+(box_height*2)+box_length]],
['l', [0-(box_height-eyelash_measure3),box_height-eyelash_measure3]],
['Z', []]
]

View File

@ -10,9 +10,6 @@
<param name="depth" type="float" min="0.1" max="300.0" gui-text="L - length:">25.0</param>
<param name="height" type="float" min="0.1" max="300.0" gui-text="H - height:">25.0</param>
<param name="glue_tab" type="float" min="0.1" max="300.0" gui-text="P - Width glue tab">5.0</param>
<param name="use_material_compensation" type="bool" gui-text="Apply material compensation (only in mm)">false</param>
<label>This option only works with mm, make sure it is unchecked if you do not use this unit.</label>
<param name="material_compensation" type="float" min="0.2" max="50.0" gui-text="Thickness of the material:">0.250</param>
<effect>
<object-type>all</object-type>
<effects-menu>

View File

@ -39,8 +39,6 @@ class GenerarEstuche(inkex.EffectExtension):
pars.add_argument("--height", type=float, default=25.0, help="Alto de la caja")
pars.add_argument("--depth", type=float, default=25.0, help="Largo de la caja")
pars.add_argument("--glue_tab", type=float, default=5.0, help="Ancho pestaña de engomado")
pars.add_argument("--use_material_compensation", type=inkex.Boolean, default=False, help="Aplicar compensación de material")
pars.add_argument("--material_compensation", type=float, default=0.2, help="Grueso del material.")
pars.add_argument("--unit", default="mm", help="Tipo de unidades")
def effect(self):
@ -56,11 +54,7 @@ class GenerarEstuche(inkex.EffectExtension):
alto_caja = self.svg.unittouu(str(self.options.height) + self.options.unit)
largo_caja = self.svg.unittouu(str(self.options.depth) + self.options.unit)
ancho_pestana_cola = self.svg.unittouu(str(self.options.glue_tab) + self.options.unit)
compensacion=0.0
if self.options.use_material_compensation==True:
compensacion=self.svg.unittouu(str(self.options.material_compensation) + self.options.unit)
if self.options.unit=="cm":
medida_pestana1=0.5
medida_pestana2=0.1
@ -97,11 +91,11 @@ class GenerarEstuche(inkex.EffectExtension):
['M', [0, 0]],
['l', [ancho_caja,0]],
['l', [largo_caja,0]],
['l', [ancho_caja-compensacion,0]],
['l', [largo_caja-compensacion,0]],
['l', [ancho_caja,0]],
['l', [largo_caja,0]],
['l', [0,alto_caja]],
['l', [0-(largo_caja-compensacion),0]],
['l', [0-(ancho_caja-compensacion),0]],
['l', [0-(largo_caja),0]],
['l', [0-(ancho_caja),0]],
['l', [0-largo_caja,0]],
['l', [0-ancho_caja,0]],
['l', [0-ancho_pestana_cola,0-ancho_pestana_cola]],
@ -129,7 +123,7 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-3'))
line.path = [
['M', [ancho_caja+largo_caja-compensacion,0]],
['M', [ancho_caja+largo_caja,0]],
['l', [0,alto_caja]],
['Z', []]
]
@ -137,7 +131,7 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-4'))
line.path = [
['M', [ancho_caja+ancho_caja+largo_caja-(compensacion*2),0]],
['M', [ancho_caja+ancho_caja+largo_caja,0]],
['l', [0,alto_caja]],
['Z', []]
]
@ -145,4 +139,4 @@ class GenerarEstuche(inkex.EffectExtension):
if __name__ == '__main__':
GenerarEstuche().run()
GenerarEstuche().run()

View File

@ -12,9 +12,6 @@
<param name="glue_tab" type="float" min="0.1" max="300.0" gui-text="P - Width glue tab">5.0</param>
<param name="close_tab" type="float" min="0.1" max="300.0" gui-text="C - Top side sealing flange:">5.0</param>
<param name="side_tabs" type="float" min="0.1" max="300.0" gui-text="T - Top side closure tabs:">5.0</param>
<param name="use_material_compensation" type="bool" gui-text="Apply material compensation (only in mm)">false</param>
<label>This option only works with mm, make sure it is unchecked if you do not use this unit.</label>
<param name="material_compensation" type="float" min="0.2" max="50.0" gui-text="Thickness of the material:">0.250</param>
<effect>
<object-type>all</object-type>
<effects-menu>

View File

@ -42,8 +42,6 @@ class GenerarEstuche(inkex.EffectExtension):
pars.add_argument("--glue_tab", type=float, default=5.0, help="Ancho pestaña de engomado")
pars.add_argument("--close_tab", type=float, default=5.0, help="Alto pestaña de cierre")
pars.add_argument("--side_tabs", type=float, default=5.0, help="Alto pestañas laterales de cierre")
pars.add_argument("--use_material_compensation", type=inkex.Boolean, default=False, help="Aplicar compensación de material")
pars.add_argument("--material_compensation", type=float, default=0.2, help="Grueso del material.")
pars.add_argument("--unit", default="mm", help="Tipo de unidades")
def effect(self):
@ -56,10 +54,7 @@ class GenerarEstuche(inkex.EffectExtension):
ancho_pestana_cola = self.svg.unittouu(str(self.options.glue_tab) + self.options.unit)
alto_pestana_cierre = self.svg.unittouu(str(self.options.close_tab) + self.options.unit)
alto_pestana = self.svg.unittouu(str(self.options.side_tabs) + self.options.unit)
compensacion=0.0
if self.options.use_material_compensation==True:
compensacion=self.svg.unittouu(str(self.options.material_compensation) + self.options.unit)
if self.options.unit=="mm":
medida_pestana1=5
medida_pestana2=1
@ -100,58 +95,58 @@ class GenerarEstuche(inkex.EffectExtension):
line.path = [
['M', [0, 0]],
['l', [ancho_caja, 0]],
['l', [0,compensacion]],
['l', [compensacion, 0]],
['l', [0,0]],
['l', [0, 0]],
['l', [0, 0-medida1_pestanas_laterales]],
['l', [medida2_pestanas_laterales, 0-medida2_pestanas_laterales]],
['l', [medida3_pestanas_laterales, 0-(alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0,alto_pestana-medida4_pestanas_laterales]],
['l', [medida4_pestanas_laterales, medida4_pestanas_laterales]],
['l', [0, 0-largo_caja-compensacion]],
['l', [compensacion, 0]],
['l', [0, 0-largo_caja]],
['l', [0, 0]],
['q', [0,0-alto_pestana_cierre,alto_pestana_cierre, 0-alto_pestana_cierre]],
['l', [ancho_caja-(alto_pestana_cierre*2)-(compensacion*2), 0]],
['l', [ancho_caja-(alto_pestana_cierre*2), 0]],
['q', [alto_pestana_cierre,0,alto_pestana_cierre,alto_pestana_cierre]],
['l', [compensacion, 0]],
['l', [0, (largo_caja-compensacion)]],
['l', [0, 0]],
['l', [0, (largo_caja)]],
['l', [medida4_pestanas_laterales, 0-medida4_pestanas_laterales]],
['l', [0,0-(alto_pestana-medida4_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales-compensacion), 0]],
['l', [(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [medida3_pestanas_laterales, (alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [medida2_pestanas_laterales, medida2_pestanas_laterales]],
['l', [0, medida1_pestanas_laterales]],
['l', [0,compensacion]],
['l', [0,0]],
['l', [0, alto_caja]],
['l', [0-medida4_pestanas_laterales, medida4_pestanas_laterales]],
['l', [0,(alto_pestana-medida4_pestanas_laterales)]],
['l', [0-(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales-compensacion), 0]],
['l', [0-(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0-(medida3_pestanas_laterales), 0-(alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [0-(medida2_pestanas_laterales), 0-(medida2_pestanas_laterales)]],
['l', [0, 0-medida1_pestanas_laterales]],
['l', [0-compensacion, 0]],
['l', [0,0-compensacion]],
['l', [0, 0]],
['l', [0,0]],
['l', [0-ancho_caja, 0]],
['l', [0,compensacion]],
['l', [0-compensacion, 0]],
['l', [0,0]],
['l', [0, 0]],
['l', [0, medida1_pestanas_laterales]],
['l', [0-medida2_pestanas_laterales, medida2_pestanas_laterales]],
['l', [0-medida3_pestanas_laterales, (alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [0-(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0-(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0,0-(alto_pestana-medida4_pestanas_laterales)]],
['l', [0-medida4_pestanas_laterales, 0-medida4_pestanas_laterales]],
['l', [0,compensacion]],
['l', [0, largo_caja-compensacion]],
['l', [0-compensacion, 0]],
['l', [0,0]],
['l', [0, largo_caja]],
['l', [0, 0]],
['q', [0,alto_pestana_cierre,0-alto_pestana_cierre, alto_pestana_cierre]],#
['l', [0-(ancho_caja-(alto_pestana_cierre*2)-(compensacion*2)), 0]],
['l', [0-(ancho_caja-(alto_pestana_cierre*2)), 0]],
['q', [0-alto_pestana_cierre,0,0-alto_pestana_cierre,0-alto_pestana_cierre]],
['l', [0-compensacion, 0]],
['l', [0, 0-largo_caja-compensacion]],
['l', [0, 0]],
['l', [0, 0-largo_caja]],
['l', [0, 0-medida2_pestanas_laterales]],
['l', [0-ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0, 0-(alto_caja-ancho_pestana_cola-(medida2_pestanas_laterales*2)-(compensacion*2))]],
['l', [ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0-ancho_pestana_cola, 0-(ancho_pestana_cola/2)]],
['l', [0, 0-(alto_caja-ancho_pestana_cola-(medida2_pestanas_laterales*2))]],
['l', [ancho_pestana_cola, 0-(ancho_pestana_cola/2)]],
['Z', []]
]
line.style = estilo_linea_cortes
@ -191,8 +186,8 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-5'))
line.path = [
['M', [ancho_caja,compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [ancho_caja,0]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
@ -207,8 +202,8 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-7'))
line.path = [
['M', [(ancho_caja*2)+largo_caja,compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [(ancho_caja*2)+largo_caja,0]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
@ -223,32 +218,32 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-9'))
line.path = [
['M', [ancho_caja,alto_caja-compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [ancho_caja,alto_caja]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-10'))
line.path = [
['M', [(ancho_caja*2)+largo_caja,alto_caja-compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [(ancho_caja*2)+largo_caja,alto_caja]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-11'))
line.path = [
['M', [ancho_caja+largo_caja+compensacion,0-(largo_caja-compensacion)]],
['l', [ancho_caja-(compensacion*2),0]],
['M', [ancho_caja+largo_caja,0-(largo_caja)]],
['l', [ancho_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-12'))
line.path = [
['M', [compensacion,alto_caja+largo_caja-compensacion]],
['l', [ancho_caja-(compensacion*2),0]],
['M', [0,alto_caja+largo_caja]],
['l', [ancho_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos

View File

@ -12,9 +12,6 @@
<param name="glue_tab" type="float" min="0.1" max="300.0" gui-text="P - Width glue tab">5.0</param>
<param name="close_tab" type="float" min="0.1" max="300.0" gui-text="C - Top side sealing flange:">5.0</param>
<param name="side_tabs" type="float" min="0.1" max="300.0" gui-text="T - Top side closure tabs:">5.0</param>
<param name="use_material_compensation" type="bool" gui-text="Apply material compensation (only in mm)">false</param>
<label>This option only works with mm, make sure it is unchecked if you do not use this unit.</label>
<param name="material_compensation" type="float" min="0.2" max="50.0" gui-text="Thickness of the material:">0.250</param>
<effect>
<object-type>all</object-type>
<effects-menu>

View File

@ -41,8 +41,6 @@ class GenerarEstuche(inkex.EffectExtension):
pars.add_argument("--glue_tab", type=float, default=5.0, help="Ancho pestaña de engomado")
pars.add_argument("--close_tab", type=float, default=5.0, help="Alto pestaña de cierre")
pars.add_argument("--side_tabs", type=float, default=5.0, help="Alto pestañas laterales de cierre")
pars.add_argument("--use_material_compensation", type=inkex.Boolean, default=False, help="Aplicar compensación de material")
pars.add_argument("--material_compensation", type=float, default=0.2, help="Grueso del material.")
pars.add_argument("--unit", default="mm", help="Tipo de unidades")
def effect(self):
@ -61,11 +59,7 @@ class GenerarEstuche(inkex.EffectExtension):
ancho_pestana_cola = self.svg.unittouu(str(self.options.glue_tab) + self.options.unit)
alto_pestana_cierre = self.svg.unittouu(str(self.options.close_tab) + self.options.unit)
alto_pestana = self.svg.unittouu(str(self.options.side_tabs) + self.options.unit)
compensacion=0.0
if self.options.use_material_compensation==True:
compensacion=self.svg.unittouu(str(self.options.material_compensation) + self.options.unit)
if self.options.unit=="cm":
medida_pestana1=0.5
medida_pestana2=0.1
@ -104,55 +98,55 @@ class GenerarEstuche(inkex.EffectExtension):
line.path = [
['M', [0, 0]],
['l', [ancho_caja, 0]],
['l', [0,compensacion]],
['l', [compensacion, 0]],
['l', [0,0]],
['l', [0, 0]],
['l', [0, 0-medida1_pestanas_laterales]],
['l', [medida2_pestanas_laterales, 0-medida2_pestanas_laterales]],
['l', [medida3_pestanas_laterales, 0-(alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [0,alto_pestana-medida4_pestanas_laterales]],
['l', [medida4_pestanas_laterales, medida4_pestanas_laterales]],
['l', [0, 0-largo_caja-compensacion]],
['l', [compensacion, 0]],
['l', [0, 0-largo_caja]],
['l', [0, 0]],
['q', [0,0-alto_pestana_cierre,alto_pestana_cierre, 0-alto_pestana_cierre]],
['l', [ancho_caja-(alto_pestana_cierre*2)-(compensacion*2), 0]],
['l', [ancho_caja-(alto_pestana_cierre*2), 0]],
['q', [alto_pestana_cierre,0,alto_pestana_cierre,alto_pestana_cierre]],
['l', [compensacion, 0]],
['l', [0, (largo_caja-compensacion)]],
['l', [0, 0]],
['l', [0, (largo_caja)]],
['l', [medida4_pestanas_laterales, 0-medida4_pestanas_laterales]],
['l', [0,0-(alto_pestana-medida4_pestanas_laterales)]],
['l', [(largo_caja-compensacion-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales-compensacion), 0]],
['l', [(largo_caja-medida2_pestanas_laterales-medida3_pestanas_laterales-medida4_pestanas_laterales), 0]],
['l', [medida3_pestanas_laterales, (alto_pestana-medida2_pestanas_laterales-medida1_pestanas_laterales)]],
['l', [medida2_pestanas_laterales, medida2_pestanas_laterales]],
['l', [0, medida1_pestanas_laterales]],
['l', [0,compensacion]],
['l', [0,0]],
['l', [0, alto_caja]],
['l', [0,(largo_caja*0.5)+medida1_pestanas_cierre]],
['l', [0-(largo_caja-compensacion)*0.5,0]],
['l', [0-(largo_caja)*0.5,0]],
['l', [0,0-medida1_pestanas_cierre]],
['l', [0-(largo_caja-compensacion)*0.5,0-((largo_caja)*0.5)]],
['l', [0-(largo_caja)*0.5,0-((largo_caja)*0.5)]],
['l', [0,(largo_caja*0.5)+medida1_pestanas_cierre]],
['l', [0-(ancho_caja-compensacion)*0.25,0]],
['l', [0-(ancho_caja)*0.25,0]],
['l', [0, 0-medida1_pestanas_cierre]],
['l', [0-(ancho_caja-compensacion)*0.5,0]],
['l', [0-(ancho_caja)*0.5,0]],
['l', [0, medida1_pestanas_cierre]],
['l', [0-(ancho_caja-compensacion)*0.25,0]],
['l', [0-(ancho_caja)*0.25,0]],
['l', [0,0-((largo_caja*0.5)+medida1_pestanas_cierre)]],
['l', [0-(largo_caja-compensacion)*0.5,((largo_caja*0.5))]],
['l', [0-(largo_caja)*0.5,((largo_caja*0.5))]],
['l', [0,medida1_pestanas_cierre]],
['l', [0-(largo_caja-compensacion)*0.5,0]],
['l', [0-(largo_caja)*0.5,0]],
['l', [0,0-((largo_caja*0.5)+medida1_pestanas_cierre)]],
['l', [0-ancho_caja*0.25,(largo_caja*0.5)]],
['l', [0,medida1_pestanas_cierre]],
['l', [0-ancho_caja*0.5,0]],
['l', [0,0-medida1_pestanas_cierre]],
['l', [0-ancho_caja*0.25,0-(largo_caja*0.5)]],
['l', [0-compensacion, 0]],
['l', [0, 0-compensacion]],
['l', [0, 0]],
['l', [0, 0]],
['l', [0, 0-medida2_pestanas_laterales]],
['l', [0-ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0, 0-(alto_caja-ancho_pestana_cola-(medida2_pestanas_laterales*2)-(compensacion*2))]],
['l', [ancho_pestana_cola, 0-(ancho_pestana_cola/2)-compensacion]],
['l', [0-ancho_pestana_cola, 0-(ancho_pestana_cola/2)]],
['l', [0, 0-(alto_caja-ancho_pestana_cola-(medida2_pestanas_laterales*2))]],
['l', [ancho_pestana_cola, 0-(ancho_pestana_cola/2)]],
['Z', []]
]
line.style = estilo_linea_cortes
@ -169,7 +163,7 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-2'))
line.path = [
['M', [ancho_caja,0]],
['l', [0,alto_caja-compensacion]],
['l', [0,alto_caja]],
['Z', []]
]
line.style = estilo_linea_hendidos
@ -192,8 +186,8 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-5'))
line.path = [
['M', [ancho_caja,compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [ancho_caja,0]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
@ -201,22 +195,22 @@ class GenerarEstuche(inkex.EffectExtension):
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-6'))
line.path = [
['M', [largo_caja+ancho_caja,0]],
['l', [ancho_caja-(compensacion)*2,0]],
['l', [ancho_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-7'))
line.path = [
['M', [(ancho_caja*2)+largo_caja-(compensacion*3),compensacion]],
['l', [largo_caja-compensacion,0]],
['M', [(ancho_caja*2)+largo_caja,0]],
['l', [largo_caja,0]],
['Z', []]
]
line.style = estilo_linea_hendidos
line = group.add(inkex.PathElement(id=id_caja + '-perfil-hendidos-8'))
line.path = [
['M', [ancho_caja+largo_caja-(compensacion*2),0-largo_caja-compensacion]],
['M', [ancho_caja+largo_caja,0-largo_caja]],
['l', [ancho_caja,0]],
['Z', []]
]