meerk40t 0.9.7910__py2.py3-none-any.whl → 0.9.7940__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meerk40t/balormk/controller.py +46 -13
- meerk40t/balormk/livelightjob.py +34 -7
- meerk40t/core/bindalias.py +12 -4
- meerk40t/core/cutcode/plotcut.py +2 -1
- meerk40t/core/elements/branches.py +35 -14
- meerk40t/core/elements/clipboard.py +10 -12
- meerk40t/core/elements/elements.py +23 -0
- meerk40t/core/elements/files.py +1 -1
- meerk40t/core/elements/geometry.py +48 -14
- meerk40t/core/elements/grid.py +56 -24
- meerk40t/core/elements/offset_clpr.py +2 -4
- meerk40t/core/elements/placements.py +17 -22
- meerk40t/core/elements/render.py +30 -11
- meerk40t/core/elements/shapes.py +206 -126
- meerk40t/core/node/effect_hatch.py +8 -7
- meerk40t/core/node/effect_warp.py +7 -2
- meerk40t/core/node/effect_wobble.py +8 -2
- meerk40t/core/node/op_image.py +79 -25
- meerk40t/core/spoolers.py +1 -1
- meerk40t/core/units.py +4 -0
- meerk40t/grbl/emulator.py +10 -8
- meerk40t/grbl/gcodejob.py +11 -3
- meerk40t/grbl/plugin.py +10 -1
- meerk40t/gui/help_assets/help_assets.py +402 -43
- meerk40t/gui/plugin.py +12 -0
- meerk40t/gui/tips.py +78 -41
- meerk40t/gui/wxmmain.py +99 -4
- meerk40t/lihuiyu/driver.py +46 -9
- meerk40t/main.py +1 -1
- meerk40t/ruida/emulator.py +13 -10
- meerk40t/ruida/plugin.py +5 -0
- meerk40t/ruida/rdjob.py +5 -5
- meerk40t/tools/geomstr.py +15 -0
- {meerk40t-0.9.7910.dist-info → meerk40t-0.9.7940.dist-info}/METADATA +1 -1
- {meerk40t-0.9.7910.dist-info → meerk40t-0.9.7940.dist-info}/RECORD +40 -40
- {meerk40t-0.9.7910.dist-info → meerk40t-0.9.7940.dist-info}/LICENSE +0 -0
- {meerk40t-0.9.7910.dist-info → meerk40t-0.9.7940.dist-info}/WHEEL +0 -0
- {meerk40t-0.9.7910.dist-info → meerk40t-0.9.7940.dist-info}/entry_points.txt +0 -0
- {meerk40t-0.9.7910.dist-info → meerk40t-0.9.7940.dist-info}/top_level.txt +0 -0
- {meerk40t-0.9.7910.dist-info → meerk40t-0.9.7940.dist-info}/zip-safe +0 -0
meerk40t/core/elements/shapes.py
CHANGED
@@ -85,9 +85,9 @@ def init_commands(kernel):
|
|
85
85
|
# ==========
|
86
86
|
# ELEMENT/SHAPE COMMANDS
|
87
87
|
# ==========
|
88
|
-
@self.console_argument("x_pos", type=
|
89
|
-
@self.console_argument("y_pos", type=
|
90
|
-
@self.console_argument("r_pos", type=
|
88
|
+
@self.console_argument("x_pos", type=str, help=_("X-coordinate of center"))
|
89
|
+
@self.console_argument("y_pos", type=str, help=_("Y-coordinate of center"))
|
90
|
+
@self.console_argument("r_pos", type=str, help=_("Radius of the circle"))
|
91
91
|
@self.console_command(
|
92
92
|
"circle",
|
93
93
|
help=_("circle <x> <y> <r>"),
|
@@ -96,11 +96,20 @@ def init_commands(kernel):
|
|
96
96
|
all_arguments_required=True,
|
97
97
|
)
|
98
98
|
def element_circle(channel, _, x_pos, y_pos, r_pos, data=None, post=None, **kwargs):
|
99
|
+
lensett = self.length_settings()
|
100
|
+
try:
|
101
|
+
# fmt:off
|
102
|
+
xp = float(Length(x_pos, relative_length=self.device.view.width, settings=lensett))
|
103
|
+
yp = float(Length(y_pos, relative_length=self.device.view.height, settings=lensett))
|
104
|
+
rp = float(Length(r_pos, settings=lensett))
|
105
|
+
# fmt:on
|
106
|
+
except ValueError:
|
107
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
99
108
|
node = self.elem_branch.add(
|
100
|
-
cx=
|
101
|
-
cy=
|
102
|
-
rx=
|
103
|
-
ry=
|
109
|
+
cx=xp,
|
110
|
+
cy=yp,
|
111
|
+
rx=rp,
|
112
|
+
ry=rp, # Secondary radius equal to primary radius for circle
|
104
113
|
stroke=self.default_stroke,
|
105
114
|
stroke_width=self.default_strokewidth,
|
106
115
|
fill=self.default_fill,
|
@@ -115,39 +124,14 @@ def init_commands(kernel):
|
|
115
124
|
post.append(classify_new(data))
|
116
125
|
return "elements", data
|
117
126
|
|
118
|
-
@self.console_argument("
|
119
|
-
@self.
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
127
|
+
@self.console_argument("x_pos", type=str, help=_("X-coordinate of center"))
|
128
|
+
@self.console_argument("y_pos", type=str, help=_("Y-coordinate of center"))
|
129
|
+
@self.console_argument("rx", type=str, help=_("Primary radius of ellipse"))
|
130
|
+
@self.console_argument(
|
131
|
+
"ry",
|
132
|
+
type=str,
|
133
|
+
help=_("Secondary radius of ellipse (default equal to primary radius=circle)"),
|
125
134
|
)
|
126
|
-
def element_circle_r(channel, _, r_pos, data=None, post=None, **kwargs):
|
127
|
-
node = self.elem_branch.add(
|
128
|
-
cx=0,
|
129
|
-
cy=0,
|
130
|
-
rx=float(r_pos),
|
131
|
-
ry=float(r_pos),
|
132
|
-
stroke=self.default_stroke,
|
133
|
-
stroke_width=self.default_strokewidth,
|
134
|
-
fill=self.default_fill,
|
135
|
-
type="elem ellipse",
|
136
|
-
)
|
137
|
-
node.altered()
|
138
|
-
self.set_emphasis([node])
|
139
|
-
node.focus()
|
140
|
-
if data is None:
|
141
|
-
data = list()
|
142
|
-
data.append(node)
|
143
|
-
# Newly created! Classification needed?
|
144
|
-
post.append(classify_new(data))
|
145
|
-
return "elements", data
|
146
|
-
|
147
|
-
@self.console_argument("x_pos", type=Length)
|
148
|
-
@self.console_argument("y_pos", type=Length)
|
149
|
-
@self.console_argument("rx", type=Length)
|
150
|
-
@self.console_argument("ry", type=Length)
|
151
135
|
@self.console_command(
|
152
136
|
"ellipse",
|
153
137
|
help=_("ellipse <cx> <cy> <rx> <ry>"),
|
@@ -158,11 +142,22 @@ def init_commands(kernel):
|
|
158
142
|
def element_ellipse(
|
159
143
|
channel, _, x_pos, y_pos, rx, ry, data=None, post=None, **kwargs
|
160
144
|
):
|
145
|
+
lensett = self.length_settings()
|
146
|
+
try:
|
147
|
+
# fmt:off
|
148
|
+
xp = float(Length(x_pos, relative_length=self.device.view.width, settings=lensett))
|
149
|
+
yp = float(Length(y_pos, relative_length=self.device.view.height, settings=lensett))
|
150
|
+
rx = float(Length(rx, relative_length=self.device.view.width, settings=lensett))
|
151
|
+
# If ry is not provided, use rx as the secondary radius
|
152
|
+
ry = rx if ry is None else float(Length(ry, relative_length=self.device.view.height, settings=lensett))
|
153
|
+
# fmt:on
|
154
|
+
except ValueError:
|
155
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
161
156
|
node = self.elem_branch.add(
|
162
|
-
cx=
|
163
|
-
cy=
|
164
|
-
rx=
|
165
|
-
ry=
|
157
|
+
cx=xp,
|
158
|
+
cy=yp,
|
159
|
+
rx=rx,
|
160
|
+
ry=ry,
|
166
161
|
stroke=self.default_stroke,
|
167
162
|
stroke_width=self.default_strokewidth,
|
168
163
|
fill=self.default_fill,
|
@@ -178,12 +173,12 @@ def init_commands(kernel):
|
|
178
173
|
post.append(classify_new(data))
|
179
174
|
return "elements", data
|
180
175
|
|
181
|
-
@self.console_argument("x_pos", type=
|
182
|
-
@self.console_argument("y_pos", type=
|
183
|
-
@self.console_argument("rx", type=
|
176
|
+
@self.console_argument("x_pos", type=str, help=_("X-coordinate of center"))
|
177
|
+
@self.console_argument("y_pos", type=str, help=_("Y-coordinate of center"))
|
178
|
+
@self.console_argument("rx", type=str, help=_("Primary radius of ellipse"))
|
184
179
|
@self.console_argument(
|
185
180
|
"ry",
|
186
|
-
type=
|
181
|
+
type=str,
|
187
182
|
help=_("Secondary radius of ellipse (default equal to primary radius=circle)"),
|
188
183
|
)
|
189
184
|
@self.console_argument(
|
@@ -214,26 +209,31 @@ def init_commands(kernel):
|
|
214
209
|
post=None,
|
215
210
|
**kwargs,
|
216
211
|
):
|
212
|
+
lensett = self.length_settings()
|
213
|
+
try:
|
214
|
+
# fmt:off
|
215
|
+
x_pos = float(Length(x_pos, relative_length=self.device.view.width, settings=lensett))
|
216
|
+
y_pos = float(Length(y_pos, relative_length=self.device.view.height, settings=lensett))
|
217
|
+
rx = float(Length(rx, relative_length=self.device.view.width, settings=lensett))
|
218
|
+
# If ry is not provided, use rx as the secondary radius
|
219
|
+
ry = rx if ry is None else float(Length(ry, relative_length=self.device.view.height, settings=lensett))
|
220
|
+
# fmt:on
|
221
|
+
except ValueError:
|
222
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
217
223
|
if start_angle is None:
|
218
224
|
start_angle = Angle("0deg")
|
219
225
|
if end_angle is None:
|
220
226
|
end_angle = Angle("360deg")
|
221
227
|
if rotation is None:
|
222
228
|
rotation = Angle("0deg")
|
223
|
-
if ry is None:
|
224
|
-
ry = rx
|
225
|
-
rx_val = float(rx)
|
226
|
-
ry_val = float(ry)
|
227
|
-
cx = float(x_pos)
|
228
|
-
cy = float(y_pos)
|
229
229
|
geom = Geomstr()
|
230
230
|
geom.arc_as_cubics(
|
231
231
|
start_t=start_angle.radians,
|
232
232
|
end_t=end_angle.radians,
|
233
|
-
rx=
|
234
|
-
ry=
|
235
|
-
cx=
|
236
|
-
cy=
|
233
|
+
rx=rx,
|
234
|
+
ry=ry,
|
235
|
+
cx=x_pos,
|
236
|
+
cy=y_pos,
|
237
237
|
rotation=rotation.radians,
|
238
238
|
)
|
239
239
|
node = self.elem_branch.add(
|
@@ -257,26 +257,18 @@ def init_commands(kernel):
|
|
257
257
|
|
258
258
|
@self.console_argument(
|
259
259
|
"x_pos",
|
260
|
-
type=
|
260
|
+
type=str,
|
261
261
|
help=_("x position for top left corner of rectangle."),
|
262
262
|
)
|
263
263
|
@self.console_argument(
|
264
264
|
"y_pos",
|
265
|
-
type=
|
265
|
+
type=str,
|
266
266
|
help=_("y position for top left corner of rectangle."),
|
267
267
|
)
|
268
|
-
@self.console_argument(
|
269
|
-
|
270
|
-
)
|
271
|
-
@self.
|
272
|
-
"height", type=self.length_y, help=_("height of the rectangle.")
|
273
|
-
)
|
274
|
-
@self.console_option(
|
275
|
-
"rx", "x", type=self.length_x, help=_("rounded rx corner value.")
|
276
|
-
)
|
277
|
-
@self.console_option(
|
278
|
-
"ry", "y", type=self.length_y, help=_("rounded ry corner value.")
|
279
|
-
)
|
268
|
+
@self.console_argument("width", type=str, help=_("width of the rectangle."))
|
269
|
+
@self.console_argument("height", type=str, help=_("height of the rectangle."))
|
270
|
+
@self.console_option("rx", "x", type=str, help=_("rounded rx corner value."))
|
271
|
+
@self.console_option("ry", "y", type=str, help=_("rounded ry corner value."))
|
280
272
|
@self.console_command(
|
281
273
|
"rect",
|
282
274
|
help=_("adds rectangle to scene"),
|
@@ -300,6 +292,18 @@ def init_commands(kernel):
|
|
300
292
|
"""
|
301
293
|
Draws a svg rectangle with optional rounded corners.
|
302
294
|
"""
|
295
|
+
lensett = self.length_settings()
|
296
|
+
try:
|
297
|
+
# fmt:off
|
298
|
+
x_pos = float(Length(x_pos, relative_length=self.device.view.width, settings=lensett))
|
299
|
+
y_pos = float(Length(y_pos, relative_length=self.device.view.height, settings=lensett))
|
300
|
+
width = float(Length(width, relative_length=self.device.view.width, settings=lensett))
|
301
|
+
height = float(Length(height, relative_length=self.device.view.height, settings=lensett))
|
302
|
+
rx = float(Length(rx, relative_length=self.device.view.width, settings=lensett)) if rx else 0
|
303
|
+
ry = float(Length(ry, relative_length=self.device.view.height, settings=lensett)) if ry else rx
|
304
|
+
# fmt:on
|
305
|
+
except ValueError:
|
306
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
303
307
|
node = self.elem_branch.add(
|
304
308
|
x=x_pos,
|
305
309
|
y=y_pos,
|
@@ -321,10 +325,10 @@ def init_commands(kernel):
|
|
321
325
|
post.append(classify_new(data))
|
322
326
|
return "elements", data
|
323
327
|
|
324
|
-
@self.console_argument("x0", type=
|
325
|
-
@self.console_argument("y0", type=
|
326
|
-
@self.console_argument("x1", type=
|
327
|
-
@self.console_argument("y1", type=
|
328
|
+
@self.console_argument("x0", type=str, help=_("start x position"))
|
329
|
+
@self.console_argument("y0", type=str, help=_("start y position"))
|
330
|
+
@self.console_argument("x1", type=str, help=_("end x position"))
|
331
|
+
@self.console_argument("y1", type=str, help=_("end y position"))
|
328
332
|
@self.console_command(
|
329
333
|
"line",
|
330
334
|
help=_("adds line to scene"),
|
@@ -336,11 +340,21 @@ def init_commands(kernel):
|
|
336
340
|
"""
|
337
341
|
Draws a svg line in the scene.
|
338
342
|
"""
|
343
|
+
lensett = self.length_settings()
|
344
|
+
try:
|
345
|
+
# fmt:off
|
346
|
+
ax = float(Length(x0, relative_length=self.device.view.width, settings=lensett))
|
347
|
+
ay = float(Length(y0, relative_length=self.device.view.height, settings=lensett))
|
348
|
+
bx = float(Length(x1, relative_length=self.device.view.width, settings=lensett))
|
349
|
+
by = float(Length(y1, relative_length=self.device.view.height, settings=lensett))
|
350
|
+
# fmt:on
|
351
|
+
except ValueError:
|
352
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
339
353
|
node = self.elem_branch.add(
|
340
|
-
x1=
|
341
|
-
y1=
|
342
|
-
x2=
|
343
|
-
y2=
|
354
|
+
x1=ax,
|
355
|
+
y1=ay,
|
356
|
+
x2=bx,
|
357
|
+
y2=by,
|
344
358
|
stroke=self.default_stroke,
|
345
359
|
stroke_width=self.default_strokewidth,
|
346
360
|
type="elem line",
|
@@ -406,7 +420,7 @@ def init_commands(kernel):
|
|
406
420
|
self.signal("refresh_scene", "Scene")
|
407
421
|
|
408
422
|
@self.console_option("etype", "e", type=str, default="scanline")
|
409
|
-
@self.console_option("distance", "d", type=
|
423
|
+
@self.console_option("distance", "d", type=str, default=None)
|
410
424
|
@self.console_option("angle", "a", type=Angle, default=None)
|
411
425
|
@self.console_option("angle_delta", "b", type=Angle, default=None)
|
412
426
|
@self.console_command(
|
@@ -429,7 +443,12 @@ def init_commands(kernel):
|
|
429
443
|
"""
|
430
444
|
Add an effect hatch object
|
431
445
|
"""
|
432
|
-
|
446
|
+
lensett = self.length_settings()
|
447
|
+
try:
|
448
|
+
distance = Length(distance, settings=lensett) if distance else None
|
449
|
+
except ValueError:
|
450
|
+
channel(_("Invalid length value."))
|
451
|
+
return
|
433
452
|
if data is None:
|
434
453
|
data = list(self.elems(emphasized=True))
|
435
454
|
if len(data) == 0:
|
@@ -477,8 +496,8 @@ def init_commands(kernel):
|
|
477
496
|
node.focus()
|
478
497
|
|
479
498
|
@self.console_option("wtype", "w", type=str, default="circle")
|
480
|
-
@self.console_option("radius", "r", type=
|
481
|
-
@self.console_option("interval", "i", type=
|
499
|
+
@self.console_option("radius", "r", type=str, default=None)
|
500
|
+
@self.console_option("interval", "i", type=str, default=None)
|
482
501
|
@self.console_command(
|
483
502
|
"effect-wobble",
|
484
503
|
help=_("adds wobble-effect to selected elements"),
|
@@ -498,6 +517,7 @@ def init_commands(kernel):
|
|
498
517
|
"""
|
499
518
|
Add an effect hatch object
|
500
519
|
"""
|
520
|
+
lensett = self.length_settings()
|
501
521
|
if data is None:
|
502
522
|
data = list(self.elems(emphasized=True))
|
503
523
|
if len(data) == 0:
|
@@ -521,14 +541,14 @@ def init_commands(kernel):
|
|
521
541
|
channel(f"Invalid wobble type, allowed: {','.join(allowed)}")
|
522
542
|
return
|
523
543
|
try:
|
524
|
-
rlen = Length(radius)
|
544
|
+
rlen = Length(radius, settings=lensett)
|
525
545
|
except ValueError:
|
526
|
-
channel("Invalid value
|
546
|
+
channel(_("Invalid length value."))
|
527
547
|
return
|
528
548
|
try:
|
529
|
-
ilen = Length(interval)
|
549
|
+
ilen = Length(interval, settings=lensett) if interval else None
|
530
550
|
except ValueError:
|
531
|
-
channel("Invalid value
|
551
|
+
channel(_("Invalid length value."))
|
532
552
|
return
|
533
553
|
first_node = data[0]
|
534
554
|
node = first_node.parent.add(
|
@@ -819,7 +839,16 @@ def init_commands(kernel):
|
|
819
839
|
return
|
820
840
|
else:
|
821
841
|
try:
|
822
|
-
|
842
|
+
lensett = self.length_settings()
|
843
|
+
if prop in ("x", "width"):
|
844
|
+
rlen = self.device.view.width
|
845
|
+
elif prop in ("y", "height"):
|
846
|
+
rlen = self.device.view.height
|
847
|
+
else:
|
848
|
+
rlen = None
|
849
|
+
new_value = float(
|
850
|
+
Length(new_value, relative_length=rlen, settings=lensett)
|
851
|
+
)
|
823
852
|
prevalidated = True
|
824
853
|
except ValueError:
|
825
854
|
channel(_("Invalid length: {value}").format(value=new_value))
|
@@ -1285,7 +1314,7 @@ def init_commands(kernel):
|
|
1285
1314
|
post.append(classify_new(data))
|
1286
1315
|
return "elements", data
|
1287
1316
|
|
1288
|
-
@self.console_argument("mlist", type=
|
1317
|
+
@self.console_argument("mlist", type=str, help=_("list of positions"), nargs="*")
|
1289
1318
|
@self.console_command(
|
1290
1319
|
("polygon", "polyline"),
|
1291
1320
|
help=_("poly(gon|line) (Length Length)*"),
|
@@ -1294,8 +1323,9 @@ def init_commands(kernel):
|
|
1294
1323
|
all_arguments_required=True,
|
1295
1324
|
)
|
1296
1325
|
def element_poly(command, channel, _, mlist, data=None, post=None, **kwargs):
|
1326
|
+
lensett = self.length_settings()
|
1297
1327
|
try:
|
1298
|
-
pts = [float(Length(p)) for p in mlist]
|
1328
|
+
pts = [float(Length(p, settings=lensett)) for p in mlist]
|
1299
1329
|
if command == "polygon":
|
1300
1330
|
shape = Polygon(pts)
|
1301
1331
|
else:
|
@@ -1965,15 +1995,11 @@ def init_commands(kernel):
|
|
1965
1995
|
self.signal("refresh_scene", "Scene")
|
1966
1996
|
return "elements", data
|
1967
1997
|
|
1968
|
-
@self.console_argument(
|
1969
|
-
|
1970
|
-
)
|
1971
|
-
@self.console_argument(
|
1972
|
-
"y_offset", type=self.length_y, help=_("y offset"), default="0"
|
1973
|
-
)
|
1998
|
+
@self.console_argument("x_offset", type=str, help=_("x offset."), default="0")
|
1999
|
+
@self.console_argument("y_offset", type=str, help=_("y offset"), default="0")
|
1974
2000
|
@self.console_command(
|
1975
2001
|
"frame",
|
1976
|
-
help=_("Draws a frame the
|
2002
|
+
help=_("Draws a frame around the currently selected elements"),
|
1977
2003
|
input_type=(
|
1978
2004
|
None,
|
1979
2005
|
"elements",
|
@@ -1993,6 +2019,14 @@ def init_commands(kernel):
|
|
1993
2019
|
"""
|
1994
2020
|
Draws an outline of the current shape.
|
1995
2021
|
"""
|
2022
|
+
lensett = self.length_settings()
|
2023
|
+
try:
|
2024
|
+
# fmt:off
|
2025
|
+
x_offset = float(Length(x_offset, relative_length=self.device.view.width, settings=lensett))
|
2026
|
+
y_offset = float(Length(y_offset, relative_length=self.device.view.height, settings=lensett))
|
2027
|
+
# fmt:on
|
2028
|
+
except ValueError:
|
2029
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
1996
2030
|
bounds = self.selected_area()
|
1997
2031
|
if bounds is None:
|
1998
2032
|
channel(_("Nothing Selected"))
|
@@ -2023,8 +2057,8 @@ def init_commands(kernel):
|
|
2023
2057
|
return "elements", data
|
2024
2058
|
|
2025
2059
|
@self.console_argument("angle", type=Angle, help=_("angle to rotate by"))
|
2026
|
-
@self.console_option("cx", "x", type=
|
2027
|
-
@self.console_option("cy", "y", type=
|
2060
|
+
@self.console_option("cx", "x", type=str, help=_("center x"))
|
2061
|
+
@self.console_option("cy", "y", type=str, help=_("center y"))
|
2028
2062
|
@self.console_option(
|
2029
2063
|
"absolute",
|
2030
2064
|
"a",
|
@@ -2080,7 +2114,12 @@ def init_commands(kernel):
|
|
2080
2114
|
if bounds is None:
|
2081
2115
|
channel(_("No selected elements."))
|
2082
2116
|
return
|
2083
|
-
|
2117
|
+
lensett = self.length_settings()
|
2118
|
+
try:
|
2119
|
+
cx = float(Length(cx, settings=lensett)) if cx is not None else None
|
2120
|
+
cy = float(Length(cy, settings=lensett)) if cy is not None else None
|
2121
|
+
except ValueError:
|
2122
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
2084
2123
|
if cx is None:
|
2085
2124
|
cx = (bounds[2] + bounds[0]) / 2.0
|
2086
2125
|
if cy is None:
|
@@ -2116,8 +2155,8 @@ def init_commands(kernel):
|
|
2116
2155
|
|
2117
2156
|
@self.console_argument("scale_x", type=str, help=_("scale_x value"))
|
2118
2157
|
@self.console_argument("scale_y", type=str, help=_("scale_y value"))
|
2119
|
-
@self.console_option("px", "x", type=
|
2120
|
-
@self.console_option("py", "y", type=
|
2158
|
+
@self.console_option("px", "x", type=str, help=_("scale x origin point"))
|
2159
|
+
@self.console_option("py", "y", type=str, help=_("scale y origin point"))
|
2121
2160
|
@self.console_option(
|
2122
2161
|
"absolute",
|
2123
2162
|
"a",
|
@@ -2163,6 +2202,12 @@ def init_commands(kernel):
|
|
2163
2202
|
channel(_("No selected elements."))
|
2164
2203
|
return
|
2165
2204
|
# print (f"Start: {scale_x} ({type(scale_x).__name__}), {scale_y} ({type(scale_y).__name__})")
|
2205
|
+
lensett = self.length_settings()
|
2206
|
+
try:
|
2207
|
+
px = float(Length(px, settings=lensett)) if px is not None else None
|
2208
|
+
py = float(Length(py, settings=lensett)) if py is not None else None
|
2209
|
+
except ValueError:
|
2210
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
2166
2211
|
factor = 1
|
2167
2212
|
if scale_x.endswith("%"):
|
2168
2213
|
factor = 0.01
|
@@ -2308,8 +2353,8 @@ def init_commands(kernel):
|
|
2308
2353
|
return "elements", data
|
2309
2354
|
# Do we have a new value to set? If yes scale by sqrt(of the fraction)
|
2310
2355
|
|
2311
|
-
@self.console_argument("tx", type=
|
2312
|
-
@self.console_argument("ty", type=
|
2356
|
+
@self.console_argument("tx", type=str, help=_("translate x value"))
|
2357
|
+
@self.console_argument("ty", type=str, help=_("translate y value"))
|
2313
2358
|
@self.console_option(
|
2314
2359
|
"absolute",
|
2315
2360
|
"a",
|
@@ -2345,6 +2390,12 @@ def init_commands(kernel):
|
|
2345
2390
|
if len(data) == 0:
|
2346
2391
|
channel(_("No selected elements."))
|
2347
2392
|
return
|
2393
|
+
lensett = self.length_settings()
|
2394
|
+
try:
|
2395
|
+
tx = float(Length(tx, settings=lensett)) if tx is not None else None
|
2396
|
+
ty = float(Length(ty, settings=lensett)) if ty is not None else None
|
2397
|
+
except ValueError:
|
2398
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
2348
2399
|
if tx is None:
|
2349
2400
|
tx = 0
|
2350
2401
|
if ty is None:
|
@@ -2380,8 +2431,8 @@ def init_commands(kernel):
|
|
2380
2431
|
self.signal("modified_by_tool")
|
2381
2432
|
return "elements", data
|
2382
2433
|
|
2383
|
-
@self.console_argument("tx", type=
|
2384
|
-
@self.console_argument("ty", type=
|
2434
|
+
@self.console_argument("tx", type=str, help=_("New x value"))
|
2435
|
+
@self.console_argument("ty", type=str, help=_("New y value"))
|
2385
2436
|
@self.console_command(
|
2386
2437
|
"position",
|
2387
2438
|
help=_("position <tx> <ty>"),
|
@@ -2399,6 +2450,14 @@ def init_commands(kernel):
|
|
2399
2450
|
if tx is None or ty is None:
|
2400
2451
|
channel(_("You need to provide a new position."))
|
2401
2452
|
return
|
2453
|
+
lensett = self.length_settings()
|
2454
|
+
try:
|
2455
|
+
# fmt:off
|
2456
|
+
tx = float(Length(tx, relative_length=self.device.view.width, settings=lensett))
|
2457
|
+
ty = float(Length(ty, relative_length=self.device.view.height, settings=lensett))
|
2458
|
+
# fmt:on
|
2459
|
+
except ValueError:
|
2460
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
2402
2461
|
with self.undoscope("Position"):
|
2403
2462
|
changes = False
|
2404
2463
|
dbounds = Node.union_bounds(data)
|
@@ -2449,16 +2508,10 @@ def init_commands(kernel):
|
|
2449
2508
|
raise CommandSyntaxError
|
2450
2509
|
return "elements", data
|
2451
2510
|
|
2452
|
-
@self.console_argument(
|
2453
|
-
|
2454
|
-
)
|
2455
|
-
@self.console_argument(
|
2456
|
-
"y_pos", type=self.length_y, help=_("y position for top left corner")
|
2457
|
-
)
|
2458
|
-
@self.console_argument("width", type=self.length_x, help=_("new width of selected"))
|
2459
|
-
@self.console_argument(
|
2460
|
-
"height", type=self.length_y, help=_("new height of selected")
|
2461
|
-
)
|
2511
|
+
@self.console_argument("x_pos", type=str, help=_("x position for top left corner"))
|
2512
|
+
@self.console_argument("y_pos", type=str, help=_("y position for top left corner"))
|
2513
|
+
@self.console_argument("width", type=str, help=_("new width of selected"))
|
2514
|
+
@self.console_argument("height", type=str, help=_("new height of selected"))
|
2462
2515
|
@self.console_command(
|
2463
2516
|
"resize",
|
2464
2517
|
help=_("resize <x-pos> <y-pos> <width> <height>"),
|
@@ -2470,6 +2523,16 @@ def init_commands(kernel):
|
|
2470
2523
|
):
|
2471
2524
|
if height is None:
|
2472
2525
|
raise CommandSyntaxError
|
2526
|
+
lensett = self.length_settings()
|
2527
|
+
try:
|
2528
|
+
# fmt:off
|
2529
|
+
x_pos = float(Length(x_pos, relative_length=self.device.view.width, settings=lensett))
|
2530
|
+
y_pos = float(Length(y_pos, relative_length=self.device.view.height, settings=lensett))
|
2531
|
+
width = float(Length(width, relative_length=self.device.view.width, settings=lensett))
|
2532
|
+
height = float(Length(height, relative_length=self.device.view.height, settings=lensett))
|
2533
|
+
# fmt:on
|
2534
|
+
except ValueError:
|
2535
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
2473
2536
|
if data is None:
|
2474
2537
|
data = list(self.elems(emphasized=True))
|
2475
2538
|
if len(data) == 0:
|
@@ -2479,6 +2542,7 @@ def init_commands(kernel):
|
|
2479
2542
|
if area is None:
|
2480
2543
|
channel(_("resize: nothing selected"))
|
2481
2544
|
return
|
2545
|
+
|
2482
2546
|
x, y, x1, y1 = area
|
2483
2547
|
w, h = x1 - x, y1 - y
|
2484
2548
|
if w == 0 or h == 0: # dot
|
@@ -2529,8 +2593,8 @@ def init_commands(kernel):
|
|
2529
2593
|
@self.console_argument("kx", type=float, help=_("skew_x value"))
|
2530
2594
|
@self.console_argument("ky", type=float, help=_("skew_y value"))
|
2531
2595
|
@self.console_argument("sy", type=float, help=_("scale_y value"))
|
2532
|
-
@self.console_argument("tx", type=
|
2533
|
-
@self.console_argument("ty", type=
|
2596
|
+
@self.console_argument("tx", type=str, help=_("translate_x value"))
|
2597
|
+
@self.console_argument("ty", type=str, help=_("translate_y value"))
|
2534
2598
|
@self.console_command(
|
2535
2599
|
"matrix",
|
2536
2600
|
help=_("matrix <sx> <kx> <ky> <sy> <tx> <ty>"),
|
@@ -2557,6 +2621,14 @@ def init_commands(kernel):
|
|
2557
2621
|
if len(data) == 0:
|
2558
2622
|
channel(_("No selected elements."))
|
2559
2623
|
return
|
2624
|
+
lensett = self.length_settings()
|
2625
|
+
try:
|
2626
|
+
# fmt: off
|
2627
|
+
tx = float(Length(tx, relative_length=self.device.view.width, settings=lensett)) if tx is not None else 0.0
|
2628
|
+
ty = float(Length(ty, relative_length=self.device.view.height, settings=lensett)) if ty is not None else 0.0
|
2629
|
+
# fmt: on
|
2630
|
+
except ValueError:
|
2631
|
+
raise CommandSyntaxError(_("Invalid length value."))
|
2560
2632
|
with self.undoscope("Matrix"):
|
2561
2633
|
images = []
|
2562
2634
|
try:
|
@@ -2772,7 +2844,9 @@ def init_commands(kernel):
|
|
2772
2844
|
tolerance_val = 0
|
2773
2845
|
else:
|
2774
2846
|
try:
|
2775
|
-
tolerance_val = float(
|
2847
|
+
tolerance_val = float(
|
2848
|
+
Length(tolerance, settings=self.length_settings())
|
2849
|
+
)
|
2776
2850
|
except ValueError as e:
|
2777
2851
|
channel(f"Invalid tolerance value: {tolerance}")
|
2778
2852
|
return data, tolerance, keep, False
|
@@ -2832,9 +2906,9 @@ def init_commands(kernel):
|
|
2832
2906
|
self.set_emphasis(data_out)
|
2833
2907
|
return "elements", data_out
|
2834
2908
|
|
2835
|
-
@self.console_argument("xpos", type=
|
2836
|
-
@self.console_argument("ypos", type=
|
2837
|
-
@self.console_argument("diameter", type=
|
2909
|
+
@self.console_argument("xpos", type=str, help=_("X-Position of cross center"))
|
2910
|
+
@self.console_argument("ypos", type=str, help=_("Y-Position of cross center"))
|
2911
|
+
@self.console_argument("diameter", type=str, help=_("Diameter of cross"))
|
2838
2912
|
@self.console_option(
|
2839
2913
|
"circle",
|
2840
2914
|
"c",
|
@@ -2874,12 +2948,18 @@ def init_commands(kernel):
|
|
2874
2948
|
channel(_("You need to provide center-point and diameter: cross x y d"))
|
2875
2949
|
return
|
2876
2950
|
try:
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2951
|
+
# fmt:off
|
2952
|
+
lensettings = self.length_settings()
|
2953
|
+
xpos = float(Length(xpos, relative_length=self.device.view.width, settings=lensettings))
|
2954
|
+
ypos = float(Length(ypos, relative_length=self.device.view.height, settings=lensettings))
|
2955
|
+
diameter = float(Length(diameter, settings=lensettings))
|
2956
|
+
# fmt:on
|
2880
2957
|
except ValueError:
|
2881
2958
|
channel(_("Invalid values given"))
|
2882
2959
|
return
|
2960
|
+
xp = float(xpos)
|
2961
|
+
yp = float(ypos)
|
2962
|
+
dia = float(diameter)
|
2883
2963
|
if circle is None:
|
2884
2964
|
circle = False
|
2885
2965
|
if diagonal is None:
|
@@ -2904,7 +2984,7 @@ def init_commands(kernel):
|
|
2904
2984
|
with self.undoscope("Create cross"):
|
2905
2985
|
node = self.elem_branch.add(
|
2906
2986
|
label=_("Cross at ({xp}, {yp})").format(
|
2907
|
-
xp=xpos.length_mm, yp=ypos.length_mm
|
2987
|
+
xp=Length(xpos).length_mm, yp=Length(ypos).length_mm
|
2908
2988
|
),
|
2909
2989
|
geometry=geom,
|
2910
2990
|
stroke=self.default_stroke,
|
@@ -2,8 +2,8 @@ import itertools
|
|
2
2
|
from copy import copy
|
3
3
|
from math import sqrt
|
4
4
|
|
5
|
-
from meerk40t.core.node.node import Node
|
6
5
|
from meerk40t.core.node.mixins import Suppressable
|
6
|
+
from meerk40t.core.node.node import Node
|
7
7
|
from meerk40t.core.units import Angle, Length
|
8
8
|
from meerk40t.svgelements import Color, Point
|
9
9
|
from meerk40t.tools.geomstr import Geomstr # , Scanbeam
|
@@ -179,8 +179,8 @@ class HatchEffectNode(Node, Suppressable):
|
|
179
179
|
factor = sqrt(abs(matrix.determinant))
|
180
180
|
self._distance *= factor
|
181
181
|
# Let's establish the angle
|
182
|
-
p1:Point = matrix.point_in_matrix_space((0, 0))
|
183
|
-
p2:Point = matrix.point_in_matrix_space((1, 0))
|
182
|
+
p1: Point = matrix.point_in_matrix_space((0, 0))
|
183
|
+
p2: Point = matrix.point_in_matrix_space((1, 0))
|
184
184
|
angle = p1.angle_to(p2)
|
185
185
|
self._angle -= angle
|
186
186
|
# from math import tau
|
@@ -240,6 +240,8 @@ class HatchEffectNode(Node, Suppressable):
|
|
240
240
|
subs = right_types(e)
|
241
241
|
res.extend(subs)
|
242
242
|
elif e.type.startswith("elem"):
|
243
|
+
if hasattr(e, "hidden") and e.hidden:
|
244
|
+
continue
|
243
245
|
res.append(e)
|
244
246
|
return res
|
245
247
|
|
@@ -301,7 +303,6 @@ class HatchEffectNode(Node, Suppressable):
|
|
301
303
|
angle=self._angle + p * self._angle_delta,
|
302
304
|
)
|
303
305
|
|
304
|
-
|
305
306
|
def set_interim(self):
|
306
307
|
self.empty_cache()
|
307
308
|
self._interim = True
|
@@ -315,9 +316,9 @@ class HatchEffectNode(Node, Suppressable):
|
|
315
316
|
|
316
317
|
def can_drop(self, drag_node):
|
317
318
|
if (
|
318
|
-
hasattr(drag_node, "as_geometry")
|
319
|
-
drag_node.type in ("effect", "file", "group", "reference")
|
320
|
-
(drag_node.type.startswith("op ") and drag_node.type != "op dots")
|
319
|
+
hasattr(drag_node, "as_geometry")
|
320
|
+
or drag_node.type in ("effect", "file", "group", "reference")
|
321
|
+
or (drag_node.type.startswith("op ") and drag_node.type != "op dots")
|
321
322
|
):
|
322
323
|
return True
|
323
324
|
return False
|