various small bug fixes and newest updates

This commit is contained in:
Mario Voigt 2024-03-31 23:33:36 +02:00
parent 3e57171903
commit 47048e6f01
14 changed files with 60 additions and 62 deletions

View File

@ -2,7 +2,7 @@
<img title="" src="./extensions/fablabchemnitz/000_Mightyscape.svg" alt="" data-align="left"> <img title="" src="./extensions/fablabchemnitz/000_Mightyscape.svg" alt="" data-align="left">
In short: A maintained extension collection for Inkscape 1.2, working on Windows and Linux. There are **237 extension folders** with **432 .inx files** inside. We also take part at https://inkscape.org/gallery/=extension/ (with single extension uploads). In short: A maintained extension collection for Inkscape 1.2, working on Windows and Linux. There are **239 extension folders** with **459 .inx files** inside. We also take part at https://inkscape.org/gallery/=extension/ (with single extension uploads).
# About MightyScape # About MightyScape

View File

@ -141,10 +141,7 @@ class ApplyTransformations(inkex.EffectExtension):
or not isequal(newxy2[0], newxy3[0]) or not isequal(newxy2[0], newxy3[0])
or not isequal(newxy1[1], newxy2[1]) or not isequal(newxy1[1], newxy2[1])
): ):
inkex.utils.errormsg( inkex.utils.errormsg(f"Warning: Shape {node.TAG} ({node.get('id')}) is approximate only, try Object to path first for better results")
"Warning: Shape %s (%s) is approximate only, try Object to path first for better results"
% (element.TAG, element.get("id"))
)
if element.TAG == "ellipse": if element.TAG == "ellipse":
element.set("rx", edgex / 2) element.set("rx", edgex / 2)
@ -204,10 +201,7 @@ class ApplyTransformations(inkex.EffectExtension):
inkex.addNS('text', 'svg'), inkex.addNS('text', 'svg'),
inkex.addNS('image', 'svg')]: inkex.addNS('image', 'svg')]:
element.attrib['transform'] = str(transf) element.attrib['transform'] = str(transf)
inkex.utils.errormsg( inkex.utils.errormsg(f"Shape {node.TAG} ({node.get('id')}) not yet supported. Not all transforms will be applied. Try Object to path first")
"Shape %s (%s) not yet supported. Not all transforms will be applied. Try Object to path first"
% (element.TAG, element.get("id"))
)
else: else:
# e.g. <g style="..."> # e.g. <g style="...">
self.scaleStrokeWidth(element, transf) self.scaleStrokeWidth(element, transf)

View File

@ -1540,7 +1540,8 @@ class BoxFace:
InteriorHeight = self.bottom_right_corner.y_end_joint * Height_percentage / 100.0 InteriorHeight = self.bottom_right_corner.y_end_joint * Height_percentage / 100.0
l_NotchLine = NotchLine((0, 0, 1), (InteriorHeight, 0, 1), math.pi/2, z_joint_size) l_NotchLine = NotchLine((0, 0, 1), (InteriorHeight, 0, 1), math.pi/2, z_joint_size)
StartHole = l_NotchLine.start_line_joint_y + l_NotchLine.JointSize #First hole z computation. Start at notch line but add delta if Height_percentage is not 100%
StartHole = l_NotchLine.start_line_joint_y + l_NotchLine.JointSize + self.bottom_right_corner.y_end_joint - InteriorHeight
Spacing = 2*l_NotchLine.JointSize Spacing = 2*l_NotchLine.JointSize
DebugMsg("drawFaceWithHoles, Hole Start ="+str(StartHole)+" Spacing="+str(Spacing)+" n_holes"+str(l_NotchLine.nb_finger_joint//2) DebugMsg("drawFaceWithHoles, Hole Start ="+str(StartHole)+" Spacing="+str(Spacing)+" n_holes"+str(l_NotchLine.nb_finger_joint//2)
+' n_slot='+str(n_slot)+' slot_size='+str(slot_size)+" Delta_Pos="+str(DeltaHolePosition)+'\n') +' n_slot='+str(n_slot)+' slot_size='+str(slot_size)+" Delta_Pos="+str(DeltaHolePosition)+'\n')
@ -1548,7 +1549,8 @@ class BoxFace:
#For each wall, draw holes corresponding at each notch on zbox #For each wall, draw holes corresponding at each notch on zbox
for j in range(int(l_NotchLine.nb_finger_joint//2)): for j in range(int(l_NotchLine.nb_finger_joint//2)):
drawHole(self.path, i*(slot_size+thickness) - DeltaHolePosition -thickness, StartHole + j*Spacing, thickness, l_NotchLine.JointSize, burn) drawHole(self.path, i*(slot_size+thickness) - DeltaHolePosition -thickness, StartHole + j*Spacing, thickness, l_NotchLine.JointSize, burn)
DebugMsg("drawHole, Slot="+str(i)+", j="+str(j)+", x="+str(i*(slot_size+thickness) - DeltaHolePosition -thickness)+" y="+str(StartHole + j*Spacing)+'\n')
#Close the path if asked #Close the path if asked
if ClosePath: if ClosePath:
self.path.Close() self.path.Close()

View File

@ -10,7 +10,7 @@
"license_url": "https://sourceforge.net/projects/dxf2papercraft/files/dxf2papercraft_v0.2.tgz/download", "license_url": "https://sourceforge.net/projects/dxf2papercraft/files/dxf2papercraft_v0.2.tgz/download",
"comment": "Written by Mario Voigt", "comment": "Written by Mario Voigt",
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/dxf2papercraft", "source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/dxf2papercraft",
"fork_url": "", "fork_url": null,
"documentation_url": "https://stadtfabrikanten.org/display/IFM/DXF+2+Papercraft", "documentation_url": "https://stadtfabrikanten.org/display/IFM/DXF+2+Papercraft",
"inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85dxf2papercraft", "inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85dxf2papercraft",
"contributors": [ "contributors": [

View File

@ -428,7 +428,7 @@ class LabelGuides(inkex.Effect):
# Draw horizontal guides # Draw horizontal guides
for g in guides['h']: for g in guides['h']:
add_SVG_guide(0, self.svg.viewport_height - g, 'horz', colour, nv) add_SVG_guide(0, self.svg.viewbox_height - g, 'horz', colour, nv)
def _draw_centre_guides(self, document, label_opts, colour): def _draw_centre_guides(self, document, label_opts, colour):
""" """
@ -444,7 +444,7 @@ class LabelGuides(inkex.Effect):
for g in range(0, len(guides['h']), 2): for g in range(0, len(guides['h']), 2):
pos = (guides['h'][g] + guides['h'][g + 1]) / 2 pos = (guides['h'][g] + guides['h'][g + 1]) / 2
add_SVG_guide(0, self.svg.viewport_height - pos, 'horz', colour, nv) add_SVG_guide(0, self.svg.viewbox_height - pos, 'horz', colour, nv)
def _draw_shapes(self, document, label_opts, inset): def _draw_shapes(self, document, label_opts, inset):
""" """

View File

@ -22,14 +22,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
''' '''
# The source code is a horrible mess. I apologize for your inconvenience, but hope that it still helps. Feel free to improve :-)
# Keep everything python2 compatible as long as people out there are using Inkscape <= 0.92.4!
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import open from builtins import open
from builtins import map from builtins import map
from builtins import str from builtins import str
@ -57,6 +49,11 @@ import string
DEVNULL = open(os.devnull, 'w') DEVNULL = open(os.devnull, 'w')
atexit.register(DEVNULL.close) atexit.register(DEVNULL.close)
# work around Inkscape 1.3 failing to start when it "calls itself" (Inkscape -> Extension -> Inkscape):
# https://gitlab.com/inkscape/inkscape/-/issues/4163
# https://gitlab.com/inkscape/extensions/-/merge_requests/534
# TODO: Rewrite most parts of this extension using the inkex python module. This removes the need for such workarounds.
os.environ["SELF_CALL"] = "true"
def message(s): def message(s):
sys.stderr.write(s+"\n") sys.stderr.write(s+"\n")
@ -71,9 +68,9 @@ def which(program, raiseError, extraPaths=[], subdir=None):
""" """
pathlist=os.environ["PATH"].split(os.pathsep) pathlist=os.environ["PATH"].split(os.pathsep)
if "nt" in os.name: if "nt" in os.name:
pathlist.append(os.environ.get("ProgramFiles","C:\Program Files\\")) pathlist.append(os.environ.get('ProgramFiles','C:\\Program Files\\'))
pathlist.append(os.environ.get("ProgramFiles(x86)","C:\Program Files (x86)\\")) pathlist.append(os.environ.get('ProgramFiles(x86)','C:\\Program Files (x86)\\'))
pathlist.append("C:\Program Files\\") # needed for 64bit inkscape on 64bit Win7 machines pathlist.append('C:\\Program Files\\') # needed for 64bit inkscape on 64bit Win7 machines
pathlist.append(os.path.dirname(os.path.dirname(os.getcwd()))) # portable application in the current directory pathlist.append(os.path.dirname(os.path.dirname(os.getcwd()))) # portable application in the current directory
pathlist += extraPaths pathlist += extraPaths
if subdir: if subdir:
@ -286,8 +283,8 @@ def EPS2CutstudioEPS(src, dest, mirror=False):
m=m.transpose() m=m.transpose()
#debug("with {}".format(m)) #debug("with {}".format(m))
pnew = numpy.matmul(m, p) pnew = numpy.matmul(m, p)
x=float(pnew[0]) x=float(pnew.item(0))
y=float(pnew[1]) y=float(pnew.item(1))
#debug("to: {} {}".format(x, y)) #debug("to: {} {}".format(x, y))
return [x, y] return [x, y]
def outputMoveto(x, y): def outputMoveto(x, y):
@ -410,7 +407,7 @@ if "--selftest" in sys.argv:
if os.name=="nt": if os.name=="nt":
DETACHED_PROCESS = 8 # start as "daemon" DETACHED_PROCESS = 8 # start as "daemon"
Popen([which("CutStudio\CutStudio.exe", True), "/import", destination], creationflags=DETACHED_PROCESS, close_fds=True) Popen([which("CutStudio\\CutStudio.exe", True), "/import", destination], creationflags=DETACHED_PROCESS, close_fds=True)
else: #check if we have access to "wine" else: #check if we have access to "wine"
CUTSTUDIO_C_DRIVE = str(Path.home()) + "/.wine/drive_c/" CUTSTUDIO_C_DRIVE = str(Path.home()) + "/.wine/drive_c/"
CUTSTUDIO_PATH_LINUX_WINE = CUTSTUDIO_C_DRIVE + "Program Files (x86)/CutStudio/CutStudio.exe" CUTSTUDIO_PATH_LINUX_WINE = CUTSTUDIO_C_DRIVE + "Program Files (x86)/CutStudio/CutStudio.exe"

View File

@ -10,7 +10,7 @@
"license_url": "https://gitlab.com/su-v/inx-pixel2svg/-/blob/master/COPYING", "license_url": "https://gitlab.com/su-v/inx-pixel2svg/-/blob/master/COPYING",
"comment": "ported to Inkscape v1 manually by Mario Voigt", "comment": "ported to Inkscape v1 manually by Mario Voigt",
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/pixel2svg", "source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/pixel2svg",
"fork_url": "ttps://gitlab.com/su-v/inx-pixel2svg", "fork_url": "https://gitlab.com/su-v/inx-pixel2svg",
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Pixel2SVG", "documentation_url": "https://stadtfabrikanten.org/display/IFM/Pixel2SVG",
"inkscape_gallery_url": null, "inkscape_gallery_url": null,
"contributors": [ "contributors": [

View File

@ -80,9 +80,10 @@ class RasterPerspective(inkex.Effect):
if str(envelope_node) == "image" and str(the_image_node) == "path": if str(envelope_node) == "image" and str(the_image_node) == "path":
envelope_node, the_image_node = self.svg.selection #switch envelope_node, the_image_node = self.svg.selection #switch
if str(the_image_node) != "image" and str(envelope_node) != "path": if str(the_image_node) != "image" or str(envelope_node) != "path":
inkex.utils.debug(WARN) inkex.errormsg(WARN)
return exit()
img_width, img_height = the_image_node.width, the_image_node.height img_width, img_height = the_image_node.width, the_image_node.height
try: try:

View File

@ -7,10 +7,10 @@
"original_name": "Shapes for 1.0", "original_name": "Shapes for 1.0",
"original_id": "org.inkscape.effect.shapes1", "original_id": "org.inkscape.effect.shapes1",
"license": "GNU GPL v2", "license": "GNU GPL v2",
"license_url": "https://www.arakne.es/wp-content/uploads/2017/08/arakne_shapes_1.zip", "license_url": "https://www.arakne.es/inkscape-shapes-nueva-version-compatible-con-inkscape-1-2",
"comment": "", "comment": "",
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/shapes", "source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/shapes",
"fork_url": "https://www.arakne.es/en/inkscape-1-0-shapes-extension-new-version/", "fork_url": "https://www.arakne.es/inkscape-shapes-nueva-version-compatible-con-inkscape-1-2",
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Shapes", "documentation_url": "https://stadtfabrikanten.org/display/IFM/Shapes",
"inkscape_gallery_url": null, "inkscape_gallery_url": null,
"contributors": [ "contributors": [

View File

@ -1,20 +1,20 @@
[ [
{ {
"name": "Slic3r STL Input", "name": "Sine And Lace",
"id": "fablabchemnitz.de.slic3r_stl_input", "id": "fablabchemnitz.de.sine_and_lace",
"path": "slic3r_stl_input", "path": "sine_and_lace",
"dependent_extensions": null, "dependent_extensions": null,
"original_name": "STL Input", "original_name": "Sine and Lace",
"original_id": "com.github.jnweiger.inkscape.input.stl", "original_id": "command.experiment.sineandlace",
"license": "GNU GPL v2", "license": "GNU GPL v3",
"license_url": "https://github.com/jnweiger/inkscape-input-stl/blob/master/LICENSE", "license_url": "https://github.com/evil-mad/EggBot/blob/master/LICENSE",
"comment": "", "comment": "",
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/slic3r_stl_input", "source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/sine_and_lace",
"fork_url": "https://github.com/jnweiger/inkscape-input-stl", "fork_url": "https://github.com/evil-mad/EggBot",
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Slic3r+STL+Input", "documentation_url": "https://stadtfabrikanten.org/display/IFM/Sine+And+Lace",
"inkscape_gallery_url": null, "inkscape_gallery_url": null,
"contributors": [ "contributors": [
"github.com/jnweiger", "github.com/evil-mad",
"github.com/eridur-de" "github.com/eridur-de"
] ]
} }

View File

@ -44,6 +44,7 @@
<param name="charSpacing" type="float" min="0" max="100" gui-text="Char Spacing:">1</param> <param name="charSpacing" type="float" min="0" max="100" gui-text="Char Spacing:">1</param>
<param name="wordSpacing" type="float" min="0" max="100" gui-text="Word Spacing:">1</param> <param name="wordSpacing" type="float" min="0" max="100" gui-text="Word Spacing:">1</param>
<param name="lineSpacing" type="float" min="0" max="100" gui-text="Line Spacing:">1.5</param> <param name="lineSpacing" type="float" min="0" max="100" gui-text="Line Spacing:">1.5</param>
<param name="strokeWidthMult" type="float" min = "0" max = "100" _gui-text="Stroke Width:">1</param>
<param name="flowInBox" type="bool" gui-text="Flow Text in Selected Boxes:">true</param> <param name="flowInBox" type="bool" gui-text="Flow Text in Selected Boxes:">true</param>
<param name="margin" type="float" min="-999999" max="999999" gui-text="Margin:">5</param> <param name="margin" type="float" min="-999999" max="999999" gui-text="Margin:">5</param>
<param name="hAlignment" type="optiongroup" appearance="combo" gui-text="Horizontal Alignment:"> <param name="hAlignment" type="optiongroup" appearance="combo" gui-text="Horizontal Alignment:">

View File

@ -150,6 +150,9 @@ class RenderStrokeFontText(Effect):
addFn('--lineSpacing', action = 'store', type = typeFloat, dest = 'lineSpacing', \ addFn('--lineSpacing', action = 'store', type = typeFloat, dest = 'lineSpacing', \
default = '1.5', help = 'Spacing between the lines') default = '1.5', help = 'Spacing between the lines')
addFn('--strokeWidthMult', action = 'store', type = typeFloat, dest = 'strokeWidthMult', \
default = '1', help = 'Stroke Width Proportion')
addFn('--flowInBox', action = 'store', type = typeBool, dest = 'flowInBox', \ addFn('--flowInBox', action = 'store', type = typeBool, dest = 'flowInBox', \
default = False, help = 'Fit the text in the selected rectangle objects') default = False, help = 'Fit the text in the selected rectangle objects')
@ -196,7 +199,7 @@ class RenderStrokeFontText(Effect):
extPath = os.path.dirname(os.path.abspath(__file__)) extPath = os.path.dirname(os.path.abspath(__file__))
strokeWidth = 0.02 * fontSize strokeWidth = 0.02 * fontSize * strokeWidthMult
layer = getCurrentLayer(self) layer = getCurrentLayer(self)
renderer = InkscapeFontRenderer(layer, getViewCenter(self), strokeWidth) renderer = InkscapeFontRenderer(layer, getViewCenter(self), strokeWidth)

View File

@ -1,20 +1,20 @@
[ [
{ {
"name": "Sundial Declining", "name": "Sudoku",
"id": "fablabchemnitz.de.sundial_declining", "id": "fablabchemnitz.de.sudoku",
"path": "sundial_declining", "path": "sudoku",
"dependent_extensions": null, "dependent_extensions": null,
"original_name": "Sundial", "original_name": "Sudoku",
"original_id": "fr.electropol.tableausimple.inkscape", "original_id": "org.inkscape.render.sudoku",
"license": "Public Domain", "license": "GNU GPL v3",
"license_url": "https://inkscape.org/de/~TomasUrban/%E2%98%85sundial-declining", "license_url": "https://github.com/neocogent/inkscape-sudoku/blob/master/LICENCE",
"comment": "ported to Inkscape v1 by Mario Voigt", "comment": "ported to Inkscape v1 by Mario Voigt",
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/sundial_declining", "source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/sudoku",
"fork_url": "https://inkscape.org/de/~TomasUrban/%E2%98%85sundial-declining", "fork_url": "https://github.com/neocogent/inkscape-sudoku",
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Sundial+Declining", "documentation_url": "https://stadtfabrikanten.org/display/IFM/Sudoku",
"inkscape_gallery_url": null, "inkscape_gallery_url": null,
"contributors": [ "contributors": [
"inkscape.org/TomasUrban", "github.com/neocogent",
"github.com/eridur-de" "github.com/eridur-de"
] ]
} }

View File

@ -15,7 +15,7 @@ from copy import deepcopy
from inkex import bezier from inkex import bezier
from inkex.transforms import Transform from inkex.transforms import Transform
from pathlib import Path from pathlib import Path
import re
homePath = str() homePath = str()
homePath = Path.home() homePath = Path.home()
@ -276,8 +276,8 @@ class Svg2ShenzhenExport(inkex.Effect):
def setInkscapeScaling(self): def setInkscapeScaling(self):
root = self.document.getroot() root = self.document.getroot()
height = float(root.get('height').replace("mm", "")) height = float(re.sub(r'[a-zA-Z]+', "", root.get('height')))
width = float(root.get('width').replace("mm", "")) width = float(re.sub(r'[a-zA-Z]+', "", root.get('width')))
self.doc_width = width self.doc_width = width
self.doc_height = height self.doc_height = height
@ -293,8 +293,8 @@ class Svg2ShenzhenExport(inkex.Effect):
def setDocumentSquare(self): def setDocumentSquare(self):
root = self.document.getroot() root = self.document.getroot()
height = float(root.attrib['height'].replace("mm", "")) height = float(re.sub(r'[a-zA-Z]+', "", root.attrib['height']))
width = float(root.attrib['width'].replace("mm", "")) width = float(re.sub(r'[a-zA-Z]+', "", root.attrib['width']))
if (width > height): if (width > height):
root.attrib['height'] = str(width) + "mm" root.attrib['height'] = str(width) + "mm"