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">
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

View File

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

View File

@ -1540,7 +1540,8 @@ class BoxFace:
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)
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
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')
@ -1548,7 +1549,8 @@ class BoxFace:
#For each wall, draw holes corresponding at each notch on zbox
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)
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
if ClosePath:
self.path.Close()

View File

@ -10,7 +10,7 @@
"license_url": "https://sourceforge.net/projects/dxf2papercraft/files/dxf2papercraft_v0.2.tgz/download",
"comment": "Written by Mario Voigt",
"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",
"inkscape_gallery_url": "https://inkscape.org/~MarioVoigt/%E2%98%85dxf2papercraft",
"contributors": [

View File

@ -428,7 +428,7 @@ class LabelGuides(inkex.Effect):
# Draw horizontal guides
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):
"""
@ -444,7 +444,7 @@ class LabelGuides(inkex.Effect):
for g in range(0, len(guides['h']), 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):
"""

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
'''
# 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 map
from builtins import str
@ -57,6 +49,11 @@ import string
DEVNULL = open(os.devnull, 'w')
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):
sys.stderr.write(s+"\n")
@ -71,9 +68,9 @@ def which(program, raiseError, extraPaths=[], subdir=None):
"""
pathlist=os.environ["PATH"].split(os.pathsep)
if "nt" in os.name:
pathlist.append(os.environ.get("ProgramFiles","C:\Program Files\\"))
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(os.environ.get('ProgramFiles','C:\\Program Files\\'))
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(os.path.dirname(os.path.dirname(os.getcwd()))) # portable application in the current directory
pathlist += extraPaths
if subdir:
@ -286,8 +283,8 @@ def EPS2CutstudioEPS(src, dest, mirror=False):
m=m.transpose()
#debug("with {}".format(m))
pnew = numpy.matmul(m, p)
x=float(pnew[0])
y=float(pnew[1])
x=float(pnew.item(0))
y=float(pnew.item(1))
#debug("to: {} {}".format(x, y))
return [x, y]
def outputMoveto(x, y):
@ -410,7 +407,7 @@ if "--selftest" in sys.argv:
if os.name=="nt":
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"
CUTSTUDIO_C_DRIVE = str(Path.home()) + "/.wine/drive_c/"
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",
"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",
"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",
"inkscape_gallery_url": null,
"contributors": [

View File

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

View File

@ -7,10 +7,10 @@
"original_name": "Shapes for 1.0",
"original_id": "org.inkscape.effect.shapes1",
"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": "",
"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",
"inkscape_gallery_url": null,
"contributors": [

View File

@ -1,20 +1,20 @@
[
{
"name": "Slic3r STL Input",
"id": "fablabchemnitz.de.slic3r_stl_input",
"path": "slic3r_stl_input",
"name": "Sine And Lace",
"id": "fablabchemnitz.de.sine_and_lace",
"path": "sine_and_lace",
"dependent_extensions": null,
"original_name": "STL Input",
"original_id": "com.github.jnweiger.inkscape.input.stl",
"license": "GNU GPL v2",
"license_url": "https://github.com/jnweiger/inkscape-input-stl/blob/master/LICENSE",
"original_name": "Sine and Lace",
"original_id": "command.experiment.sineandlace",
"license": "GNU GPL v3",
"license_url": "https://github.com/evil-mad/EggBot/blob/master/LICENSE",
"comment": "",
"source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.2/src/branch/master/extensions/fablabchemnitz/slic3r_stl_input",
"fork_url": "https://github.com/jnweiger/inkscape-input-stl",
"documentation_url": "https://stadtfabrikanten.org/display/IFM/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/evil-mad/EggBot",
"documentation_url": "https://stadtfabrikanten.org/display/IFM/Sine+And+Lace",
"inkscape_gallery_url": null,
"contributors": [
"github.com/jnweiger",
"github.com/evil-mad",
"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="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="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="margin" type="float" min="-999999" max="999999" gui-text="Margin:">5</param>
<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', \
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', \
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__))
strokeWidth = 0.02 * fontSize
strokeWidth = 0.02 * fontSize * strokeWidthMult
layer = getCurrentLayer(self)
renderer = InkscapeFontRenderer(layer, getViewCenter(self), strokeWidth)

View File

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

View File

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