meerk40t 0.9.3001__py2.py3-none-any.whl → 0.9.7020__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/__init__.py +1 -1
- meerk40t/balormk/balor_params.py +167 -167
- meerk40t/balormk/clone_loader.py +457 -457
- meerk40t/balormk/controller.py +1566 -1512
- meerk40t/balormk/cylindermod.py +64 -0
- meerk40t/balormk/device.py +966 -1959
- meerk40t/balormk/driver.py +778 -591
- meerk40t/balormk/galvo_commands.py +1194 -0
- meerk40t/balormk/gui/balorconfig.py +237 -111
- meerk40t/balormk/gui/balorcontroller.py +191 -184
- meerk40t/balormk/gui/baloroperationproperties.py +116 -115
- meerk40t/balormk/gui/corscene.py +845 -0
- meerk40t/balormk/gui/gui.py +179 -147
- meerk40t/balormk/livelightjob.py +466 -382
- meerk40t/balormk/mock_connection.py +131 -109
- meerk40t/balormk/plugin.py +133 -135
- meerk40t/balormk/usb_connection.py +306 -301
- meerk40t/camera/__init__.py +1 -1
- meerk40t/camera/camera.py +514 -397
- meerk40t/camera/gui/camerapanel.py +1241 -1095
- meerk40t/camera/gui/gui.py +58 -58
- meerk40t/camera/plugin.py +441 -399
- meerk40t/ch341/__init__.py +27 -27
- meerk40t/ch341/ch341device.py +628 -628
- meerk40t/ch341/libusb.py +595 -589
- meerk40t/ch341/mock.py +171 -171
- meerk40t/ch341/windriver.py +157 -157
- meerk40t/constants.py +13 -0
- meerk40t/core/__init__.py +1 -1
- meerk40t/core/bindalias.py +550 -539
- meerk40t/core/core.py +47 -47
- meerk40t/core/cutcode/cubiccut.py +73 -73
- meerk40t/core/cutcode/cutcode.py +315 -312
- meerk40t/core/cutcode/cutgroup.py +141 -137
- meerk40t/core/cutcode/cutobject.py +192 -185
- meerk40t/core/cutcode/dwellcut.py +37 -37
- meerk40t/core/cutcode/gotocut.py +29 -29
- meerk40t/core/cutcode/homecut.py +29 -29
- meerk40t/core/cutcode/inputcut.py +34 -34
- meerk40t/core/cutcode/linecut.py +33 -33
- meerk40t/core/cutcode/outputcut.py +34 -34
- meerk40t/core/cutcode/plotcut.py +335 -335
- meerk40t/core/cutcode/quadcut.py +61 -61
- meerk40t/core/cutcode/rastercut.py +168 -148
- meerk40t/core/cutcode/waitcut.py +34 -34
- meerk40t/core/cutplan.py +1843 -1316
- meerk40t/core/drivers.py +330 -329
- meerk40t/core/elements/align.py +801 -669
- meerk40t/core/elements/branches.py +1858 -1507
- meerk40t/core/elements/clipboard.py +229 -219
- meerk40t/core/elements/element_treeops.py +4595 -2837
- meerk40t/core/elements/element_types.py +125 -105
- meerk40t/core/elements/elements.py +4315 -3617
- meerk40t/core/elements/files.py +117 -64
- meerk40t/core/elements/geometry.py +473 -224
- meerk40t/core/elements/grid.py +467 -316
- meerk40t/core/elements/materials.py +158 -94
- meerk40t/core/elements/notes.py +50 -38
- meerk40t/core/elements/offset_clpr.py +934 -912
- meerk40t/core/elements/offset_mk.py +963 -955
- meerk40t/core/elements/penbox.py +339 -267
- meerk40t/core/elements/placements.py +300 -83
- meerk40t/core/elements/render.py +785 -687
- meerk40t/core/elements/shapes.py +2618 -2092
- meerk40t/core/elements/testcases.py +105 -0
- meerk40t/core/elements/trace.py +651 -563
- meerk40t/core/elements/tree_commands.py +415 -409
- meerk40t/core/elements/undo_redo.py +116 -58
- meerk40t/core/elements/wordlist.py +319 -200
- meerk40t/core/exceptions.py +9 -9
- meerk40t/core/laserjob.py +220 -220
- meerk40t/core/logging.py +63 -63
- meerk40t/core/node/blobnode.py +83 -86
- meerk40t/core/node/bootstrap.py +105 -103
- meerk40t/core/node/branch_elems.py +40 -31
- meerk40t/core/node/branch_ops.py +45 -38
- meerk40t/core/node/branch_regmark.py +48 -41
- meerk40t/core/node/cutnode.py +29 -32
- meerk40t/core/node/effect_hatch.py +375 -257
- meerk40t/core/node/effect_warp.py +398 -0
- meerk40t/core/node/effect_wobble.py +441 -309
- meerk40t/core/node/elem_ellipse.py +404 -309
- meerk40t/core/node/elem_image.py +1082 -801
- meerk40t/core/node/elem_line.py +358 -292
- meerk40t/core/node/elem_path.py +259 -201
- meerk40t/core/node/elem_point.py +129 -102
- meerk40t/core/node/elem_polyline.py +310 -246
- meerk40t/core/node/elem_rect.py +376 -286
- meerk40t/core/node/elem_text.py +445 -418
- meerk40t/core/node/filenode.py +59 -40
- meerk40t/core/node/groupnode.py +138 -74
- meerk40t/core/node/image_processed.py +777 -766
- meerk40t/core/node/image_raster.py +156 -113
- meerk40t/core/node/layernode.py +31 -31
- meerk40t/core/node/mixins.py +135 -107
- meerk40t/core/node/node.py +1427 -1304
- meerk40t/core/node/nutils.py +117 -114
- meerk40t/core/node/op_cut.py +463 -335
- meerk40t/core/node/op_dots.py +296 -251
- meerk40t/core/node/op_engrave.py +414 -311
- meerk40t/core/node/op_image.py +755 -369
- meerk40t/core/node/op_raster.py +787 -522
- meerk40t/core/node/place_current.py +37 -40
- meerk40t/core/node/place_point.py +329 -126
- meerk40t/core/node/refnode.py +58 -47
- meerk40t/core/node/rootnode.py +225 -219
- meerk40t/core/node/util_console.py +48 -48
- meerk40t/core/node/util_goto.py +84 -65
- meerk40t/core/node/util_home.py +61 -61
- meerk40t/core/node/util_input.py +102 -102
- meerk40t/core/node/util_output.py +102 -102
- meerk40t/core/node/util_wait.py +65 -65
- meerk40t/core/parameters.py +709 -707
- meerk40t/core/planner.py +875 -785
- meerk40t/core/plotplanner.py +656 -652
- meerk40t/core/space.py +120 -113
- meerk40t/core/spoolers.py +706 -705
- meerk40t/core/svg_io.py +1836 -1549
- meerk40t/core/treeop.py +534 -445
- meerk40t/core/undos.py +278 -124
- meerk40t/core/units.py +784 -680
- meerk40t/core/view.py +393 -322
- meerk40t/core/webhelp.py +62 -62
- meerk40t/core/wordlist.py +513 -504
- meerk40t/cylinder/cylinder.py +247 -0
- meerk40t/cylinder/gui/cylindersettings.py +41 -0
- meerk40t/cylinder/gui/gui.py +24 -0
- meerk40t/device/__init__.py +1 -1
- meerk40t/device/basedevice.py +322 -123
- meerk40t/device/devicechoices.py +50 -0
- meerk40t/device/dummydevice.py +163 -128
- meerk40t/device/gui/defaultactions.py +618 -602
- meerk40t/device/gui/effectspanel.py +114 -0
- meerk40t/device/gui/formatterpanel.py +253 -290
- meerk40t/device/gui/warningpanel.py +337 -260
- meerk40t/device/mixins.py +13 -13
- meerk40t/dxf/__init__.py +1 -1
- meerk40t/dxf/dxf_io.py +766 -554
- meerk40t/dxf/plugin.py +47 -35
- meerk40t/external_plugins.py +79 -79
- meerk40t/external_plugins_build.py +28 -28
- meerk40t/extra/cag.py +112 -116
- meerk40t/extra/coolant.py +403 -0
- meerk40t/extra/encode_detect.py +204 -0
- meerk40t/extra/ezd.py +1165 -1165
- meerk40t/extra/hershey.py +834 -340
- meerk40t/extra/imageactions.py +322 -316
- meerk40t/extra/inkscape.py +628 -622
- meerk40t/extra/lbrn.py +424 -424
- meerk40t/extra/outerworld.py +283 -0
- meerk40t/extra/param_functions.py +1542 -1556
- meerk40t/extra/potrace.py +257 -253
- meerk40t/extra/serial_exchange.py +118 -0
- meerk40t/extra/updater.py +602 -453
- meerk40t/extra/vectrace.py +147 -146
- meerk40t/extra/winsleep.py +83 -83
- meerk40t/extra/xcs_reader.py +597 -0
- meerk40t/fill/fills.py +781 -335
- meerk40t/fill/patternfill.py +1061 -1061
- meerk40t/fill/patterns.py +614 -567
- meerk40t/grbl/control.py +87 -87
- meerk40t/grbl/controller.py +990 -903
- meerk40t/grbl/device.py +1084 -768
- meerk40t/grbl/driver.py +989 -771
- meerk40t/grbl/emulator.py +532 -497
- meerk40t/grbl/gcodejob.py +783 -767
- meerk40t/grbl/gui/grblconfiguration.py +373 -298
- meerk40t/grbl/gui/grblcontroller.py +485 -271
- meerk40t/grbl/gui/grblhardwareconfig.py +269 -153
- meerk40t/grbl/gui/grbloperationconfig.py +105 -0
- meerk40t/grbl/gui/gui.py +147 -116
- meerk40t/grbl/interpreter.py +44 -44
- meerk40t/grbl/loader.py +22 -22
- meerk40t/grbl/mock_connection.py +56 -56
- meerk40t/grbl/plugin.py +294 -264
- meerk40t/grbl/serial_connection.py +93 -88
- meerk40t/grbl/tcp_connection.py +81 -79
- meerk40t/grbl/ws_connection.py +112 -0
- meerk40t/gui/__init__.py +1 -1
- meerk40t/gui/about.py +2042 -296
- meerk40t/gui/alignment.py +1644 -1608
- meerk40t/gui/autoexec.py +199 -0
- meerk40t/gui/basicops.py +791 -670
- meerk40t/gui/bufferview.py +77 -71
- meerk40t/gui/busy.py +232 -133
- meerk40t/gui/choicepropertypanel.py +1662 -1469
- meerk40t/gui/consolepanel.py +706 -542
- meerk40t/gui/devicepanel.py +687 -581
- meerk40t/gui/dialogoptions.py +110 -107
- meerk40t/gui/executejob.py +316 -306
- meerk40t/gui/fonts.py +90 -90
- meerk40t/gui/functionwrapper.py +252 -0
- meerk40t/gui/gui_mixins.py +729 -0
- meerk40t/gui/guicolors.py +205 -182
- meerk40t/gui/help_assets/help_assets.py +218 -201
- meerk40t/gui/helper.py +154 -0
- meerk40t/gui/hersheymanager.py +1440 -846
- meerk40t/gui/icons.py +3422 -2747
- meerk40t/gui/imagesplitter.py +555 -508
- meerk40t/gui/keymap.py +354 -344
- meerk40t/gui/laserpanel.py +897 -806
- meerk40t/gui/laserrender.py +1470 -1232
- meerk40t/gui/lasertoolpanel.py +805 -793
- meerk40t/gui/magnetoptions.py +436 -0
- meerk40t/gui/materialmanager.py +2944 -0
- meerk40t/gui/materialtest.py +1722 -1694
- meerk40t/gui/mkdebug.py +646 -359
- meerk40t/gui/mwindow.py +163 -140
- meerk40t/gui/navigationpanels.py +2605 -2467
- meerk40t/gui/notes.py +143 -142
- meerk40t/gui/opassignment.py +414 -410
- meerk40t/gui/operation_info.py +310 -299
- meerk40t/gui/plugin.py +500 -328
- meerk40t/gui/position.py +714 -669
- meerk40t/gui/preferences.py +901 -650
- meerk40t/gui/propertypanels/attributes.py +1461 -1131
- meerk40t/gui/propertypanels/blobproperty.py +117 -114
- meerk40t/gui/propertypanels/consoleproperty.py +83 -80
- meerk40t/gui/propertypanels/gotoproperty.py +77 -0
- meerk40t/gui/propertypanels/groupproperties.py +223 -217
- meerk40t/gui/propertypanels/hatchproperty.py +489 -469
- meerk40t/gui/propertypanels/imageproperty.py +2244 -1384
- meerk40t/gui/propertypanels/inputproperty.py +59 -58
- meerk40t/gui/propertypanels/opbranchproperties.py +82 -80
- meerk40t/gui/propertypanels/operationpropertymain.py +1890 -1638
- meerk40t/gui/propertypanels/outputproperty.py +59 -58
- meerk40t/gui/propertypanels/pathproperty.py +389 -380
- meerk40t/gui/propertypanels/placementproperty.py +1214 -383
- meerk40t/gui/propertypanels/pointproperty.py +140 -136
- meerk40t/gui/propertypanels/propertywindow.py +313 -181
- meerk40t/gui/propertypanels/rasterwizardpanels.py +996 -912
- meerk40t/gui/propertypanels/regbranchproperties.py +76 -0
- meerk40t/gui/propertypanels/textproperty.py +770 -755
- meerk40t/gui/propertypanels/waitproperty.py +56 -55
- meerk40t/gui/propertypanels/warpproperty.py +121 -0
- meerk40t/gui/propertypanels/wobbleproperty.py +255 -204
- meerk40t/gui/ribbon.py +2471 -2210
- meerk40t/gui/scene/scene.py +1100 -1051
- meerk40t/gui/scene/sceneconst.py +22 -22
- meerk40t/gui/scene/scenepanel.py +439 -349
- meerk40t/gui/scene/scenespacewidget.py +365 -365
- meerk40t/gui/scene/widget.py +518 -505
- meerk40t/gui/scenewidgets/affinemover.py +215 -215
- meerk40t/gui/scenewidgets/attractionwidget.py +315 -309
- meerk40t/gui/scenewidgets/bedwidget.py +120 -97
- meerk40t/gui/scenewidgets/elementswidget.py +137 -107
- meerk40t/gui/scenewidgets/gridwidget.py +785 -745
- meerk40t/gui/scenewidgets/guidewidget.py +765 -765
- meerk40t/gui/scenewidgets/laserpathwidget.py +66 -66
- meerk40t/gui/scenewidgets/machineoriginwidget.py +86 -86
- meerk40t/gui/scenewidgets/nodeselector.py +28 -28
- meerk40t/gui/scenewidgets/rectselectwidget.py +592 -346
- meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
- meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
- meerk40t/gui/scenewidgets/selectionwidget.py +2958 -2756
- meerk40t/gui/simpleui.py +362 -333
- meerk40t/gui/simulation.py +2451 -2094
- meerk40t/gui/snapoptions.py +208 -203
- meerk40t/gui/spoolerpanel.py +1227 -1180
- meerk40t/gui/statusbarwidgets/defaultoperations.py +480 -353
- meerk40t/gui/statusbarwidgets/infowidget.py +520 -483
- meerk40t/gui/statusbarwidgets/opassignwidget.py +356 -355
- meerk40t/gui/statusbarwidgets/selectionwidget.py +172 -171
- meerk40t/gui/statusbarwidgets/shapepropwidget.py +754 -236
- meerk40t/gui/statusbarwidgets/statusbar.py +272 -260
- meerk40t/gui/statusbarwidgets/statusbarwidget.py +268 -270
- meerk40t/gui/statusbarwidgets/strokewidget.py +267 -251
- meerk40t/gui/themes.py +200 -78
- meerk40t/gui/tips.py +590 -0
- meerk40t/gui/toolwidgets/circlebrush.py +35 -35
- meerk40t/gui/toolwidgets/toolcircle.py +248 -242
- meerk40t/gui/toolwidgets/toolcontainer.py +82 -77
- meerk40t/gui/toolwidgets/tooldraw.py +97 -90
- meerk40t/gui/toolwidgets/toolellipse.py +219 -212
- meerk40t/gui/toolwidgets/toolimagecut.py +25 -132
- meerk40t/gui/toolwidgets/toolline.py +39 -144
- meerk40t/gui/toolwidgets/toollinetext.py +79 -236
- meerk40t/gui/toolwidgets/toollinetext_inline.py +296 -0
- meerk40t/gui/toolwidgets/toolmeasure.py +163 -216
- meerk40t/gui/toolwidgets/toolnodeedit.py +2088 -2074
- meerk40t/gui/toolwidgets/toolnodemove.py +92 -94
- meerk40t/gui/toolwidgets/toolparameter.py +754 -668
- meerk40t/gui/toolwidgets/toolplacement.py +108 -108
- meerk40t/gui/toolwidgets/toolpoint.py +68 -59
- meerk40t/gui/toolwidgets/toolpointlistbuilder.py +294 -0
- meerk40t/gui/toolwidgets/toolpointmove.py +183 -0
- meerk40t/gui/toolwidgets/toolpolygon.py +288 -403
- meerk40t/gui/toolwidgets/toolpolyline.py +38 -196
- meerk40t/gui/toolwidgets/toolrect.py +211 -207
- meerk40t/gui/toolwidgets/toolrelocate.py +72 -72
- meerk40t/gui/toolwidgets/toolribbon.py +598 -113
- meerk40t/gui/toolwidgets/tooltabedit.py +546 -0
- meerk40t/gui/toolwidgets/tooltext.py +98 -89
- meerk40t/gui/toolwidgets/toolvector.py +213 -204
- meerk40t/gui/toolwidgets/toolwidget.py +39 -39
- meerk40t/gui/usbconnect.py +98 -91
- meerk40t/gui/utilitywidgets/buttonwidget.py +18 -18
- meerk40t/gui/utilitywidgets/checkboxwidget.py +90 -90
- meerk40t/gui/utilitywidgets/controlwidget.py +14 -14
- meerk40t/gui/utilitywidgets/cyclocycloidwidget.py +343 -340
- meerk40t/gui/utilitywidgets/debugwidgets.py +148 -0
- meerk40t/gui/utilitywidgets/handlewidget.py +27 -27
- meerk40t/gui/utilitywidgets/harmonograph.py +450 -447
- meerk40t/gui/utilitywidgets/openclosewidget.py +40 -40
- meerk40t/gui/utilitywidgets/rotationwidget.py +54 -54
- meerk40t/gui/utilitywidgets/scalewidget.py +75 -75
- meerk40t/gui/utilitywidgets/seekbarwidget.py +183 -183
- meerk40t/gui/utilitywidgets/togglewidget.py +142 -142
- meerk40t/gui/utilitywidgets/toolbarwidget.py +8 -8
- meerk40t/gui/wordlisteditor.py +985 -931
- meerk40t/gui/wxmeerk40t.py +1447 -1169
- meerk40t/gui/wxmmain.py +5644 -4112
- meerk40t/gui/wxmribbon.py +1591 -1076
- meerk40t/gui/wxmscene.py +1631 -1453
- meerk40t/gui/wxmtree.py +2416 -2089
- meerk40t/gui/wxutils.py +1769 -1099
- meerk40t/gui/zmatrix.py +102 -102
- meerk40t/image/__init__.py +1 -1
- meerk40t/image/dither.py +429 -0
- meerk40t/image/imagetools.py +2793 -2269
- meerk40t/internal_plugins.py +150 -130
- meerk40t/kernel/__init__.py +63 -12
- meerk40t/kernel/channel.py +259 -212
- meerk40t/kernel/context.py +538 -538
- meerk40t/kernel/exceptions.py +41 -41
- meerk40t/kernel/functions.py +463 -414
- meerk40t/kernel/jobs.py +100 -100
- meerk40t/kernel/kernel.py +3828 -3571
- meerk40t/kernel/lifecycles.py +71 -71
- meerk40t/kernel/module.py +49 -49
- meerk40t/kernel/service.py +147 -147
- meerk40t/kernel/settings.py +383 -343
- meerk40t/lihuiyu/controller.py +883 -876
- meerk40t/lihuiyu/device.py +1181 -1069
- meerk40t/lihuiyu/driver.py +1466 -1372
- meerk40t/lihuiyu/gui/gui.py +127 -106
- meerk40t/lihuiyu/gui/lhyaccelgui.py +377 -363
- meerk40t/lihuiyu/gui/lhycontrollergui.py +741 -651
- meerk40t/lihuiyu/gui/lhydrivergui.py +470 -446
- meerk40t/lihuiyu/gui/lhyoperationproperties.py +238 -237
- meerk40t/lihuiyu/gui/tcpcontroller.py +226 -190
- meerk40t/lihuiyu/interpreter.py +53 -53
- meerk40t/lihuiyu/laserspeed.py +450 -450
- meerk40t/lihuiyu/loader.py +90 -90
- meerk40t/lihuiyu/parser.py +404 -404
- meerk40t/lihuiyu/plugin.py +101 -102
- meerk40t/lihuiyu/tcp_connection.py +111 -109
- meerk40t/main.py +231 -165
- meerk40t/moshi/builder.py +788 -781
- meerk40t/moshi/controller.py +505 -499
- meerk40t/moshi/device.py +495 -442
- meerk40t/moshi/driver.py +862 -696
- meerk40t/moshi/gui/gui.py +78 -76
- meerk40t/moshi/gui/moshicontrollergui.py +538 -522
- meerk40t/moshi/gui/moshidrivergui.py +87 -75
- meerk40t/moshi/plugin.py +43 -43
- meerk40t/network/console_server.py +140 -57
- meerk40t/network/kernelserver.py +10 -9
- meerk40t/network/tcp_server.py +142 -140
- meerk40t/network/udp_server.py +103 -77
- meerk40t/network/web_server.py +404 -0
- meerk40t/newly/controller.py +1158 -1144
- meerk40t/newly/device.py +874 -732
- meerk40t/newly/driver.py +540 -412
- meerk40t/newly/gui/gui.py +219 -188
- meerk40t/newly/gui/newlyconfig.py +116 -101
- meerk40t/newly/gui/newlycontroller.py +193 -186
- meerk40t/newly/gui/operationproperties.py +51 -51
- meerk40t/newly/mock_connection.py +82 -82
- meerk40t/newly/newly_params.py +56 -56
- meerk40t/newly/plugin.py +1214 -1246
- meerk40t/newly/usb_connection.py +322 -322
- meerk40t/rotary/gui/gui.py +52 -46
- meerk40t/rotary/gui/rotarysettings.py +240 -232
- meerk40t/rotary/rotary.py +202 -98
- meerk40t/ruida/control.py +291 -91
- meerk40t/ruida/controller.py +138 -1088
- meerk40t/ruida/device.py +676 -231
- meerk40t/ruida/driver.py +534 -472
- meerk40t/ruida/emulator.py +1494 -1491
- meerk40t/ruida/exceptions.py +4 -4
- meerk40t/ruida/gui/gui.py +71 -76
- meerk40t/ruida/gui/ruidaconfig.py +239 -72
- meerk40t/ruida/gui/ruidacontroller.py +187 -184
- meerk40t/ruida/gui/ruidaoperationproperties.py +48 -47
- meerk40t/ruida/loader.py +54 -52
- meerk40t/ruida/mock_connection.py +57 -109
- meerk40t/ruida/plugin.py +124 -87
- meerk40t/ruida/rdjob.py +2084 -945
- meerk40t/ruida/serial_connection.py +116 -0
- meerk40t/ruida/tcp_connection.py +146 -0
- meerk40t/ruida/udp_connection.py +73 -0
- meerk40t/svgelements.py +9671 -9669
- meerk40t/tools/driver_to_path.py +584 -579
- meerk40t/tools/geomstr.py +5583 -4680
- meerk40t/tools/jhfparser.py +357 -292
- meerk40t/tools/kerftest.py +904 -890
- meerk40t/tools/livinghinges.py +1168 -1033
- meerk40t/tools/pathtools.py +987 -949
- meerk40t/tools/pmatrix.py +234 -0
- meerk40t/tools/pointfinder.py +942 -942
- meerk40t/tools/polybool.py +941 -940
- meerk40t/tools/rasterplotter.py +1660 -547
- meerk40t/tools/shxparser.py +1047 -901
- meerk40t/tools/ttfparser.py +726 -446
- meerk40t/tools/zinglplotter.py +595 -593
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/LICENSE +21 -21
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/METADATA +150 -139
- meerk40t-0.9.7020.dist-info/RECORD +446 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/WHEEL +1 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/top_level.txt +0 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/zip-safe +1 -1
- meerk40t/balormk/elementlightjob.py +0 -159
- meerk40t-0.9.3001.dist-info/RECORD +0 -437
- test/bootstrap.py +0 -63
- test/test_cli.py +0 -12
- test/test_core_cutcode.py +0 -418
- test/test_core_elements.py +0 -144
- test/test_core_plotplanner.py +0 -397
- test/test_core_viewports.py +0 -312
- test/test_drivers_grbl.py +0 -108
- test/test_drivers_lihuiyu.py +0 -443
- test/test_drivers_newly.py +0 -113
- test/test_element_degenerate_points.py +0 -43
- test/test_elements_classify.py +0 -97
- test/test_elements_penbox.py +0 -22
- test/test_file_svg.py +0 -176
- test/test_fill.py +0 -155
- test/test_geomstr.py +0 -1523
- test/test_geomstr_nodes.py +0 -18
- test/test_imagetools_actualize.py +0 -306
- test/test_imagetools_wizard.py +0 -258
- test/test_kernel.py +0 -200
- test/test_laser_speeds.py +0 -3303
- test/test_length.py +0 -57
- test/test_lifecycle.py +0 -66
- test/test_operations.py +0 -251
- test/test_operations_hatch.py +0 -57
- test/test_ruida.py +0 -19
- test/test_spooler.py +0 -22
- test/test_tools_rasterplotter.py +0 -29
- test/test_wobble.py +0 -133
- test/test_zingl.py +0 -124
- {test → meerk40t/cylinder}/__init__.py +0 -0
- /meerk40t/{core/element_commands.py → cylinder/gui/__init__.py} +0 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/entry_points.txt +0 -0
meerk40t/gui/lasertoolpanel.py
CHANGED
@@ -1,793 +1,805 @@
|
|
1
|
-
from math import atan, sqrt, tau
|
2
|
-
|
3
|
-
import wx
|
4
|
-
|
5
|
-
from meerk40t.core.units import Length
|
6
|
-
from meerk40t.gui.icons import (
|
7
|
-
icon_instruct_circle,
|
8
|
-
icon_instruct_rect,
|
9
|
-
icon_instruct_square,
|
10
|
-
)
|
11
|
-
from meerk40t.gui.mwindow import MWindow
|
12
|
-
from meerk40t.gui.wxutils import
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
self.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
self.
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
self.
|
57
|
-
|
58
|
-
|
59
|
-
)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
self.
|
113
|
-
)
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
self.
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
self.
|
127
|
-
|
128
|
-
|
129
|
-
sizer_4
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
)
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
sizer_5a.Add(
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
self.
|
166
|
-
self.
|
167
|
-
|
168
|
-
)
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
sizer_6a.Add(
|
173
|
-
|
174
|
-
self.
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
)
|
179
|
-
|
180
|
-
|
181
|
-
)
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
self.
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
self.
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
)
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
sizer_5.Add(
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
sizer_6.Add(
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
)
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
sizer_7.Add(
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
self.
|
268
|
-
self.
|
269
|
-
|
270
|
-
size_width
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
)
|
277
|
-
|
278
|
-
|
279
|
-
)
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
self.
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
self.sizer_square.Add(
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
)
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
self.
|
303
|
-
|
304
|
-
self.
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
self.
|
310
|
-
|
311
|
-
self.
|
312
|
-
|
313
|
-
self.
|
314
|
-
|
315
|
-
|
316
|
-
self.
|
317
|
-
self.
|
318
|
-
self.
|
319
|
-
|
320
|
-
self.
|
321
|
-
self.
|
322
|
-
self.
|
323
|
-
self.
|
324
|
-
self.
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
#
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
#
|
348
|
-
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
|
360
|
-
# if self.scenario
|
361
|
-
#
|
362
|
-
#
|
363
|
-
# c3 = (
|
364
|
-
# self.
|
365
|
-
#
|
366
|
-
# self.
|
367
|
-
#
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
if
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
self.
|
391
|
-
self.
|
392
|
-
|
393
|
-
self.
|
394
|
-
self.
|
395
|
-
|
396
|
-
self.
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
self.
|
407
|
-
self.
|
408
|
-
self.
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
value =
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
self.
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
def
|
425
|
-
# Current Laserposition
|
426
|
-
self.set_coord(idx=
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
)
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
if
|
526
|
-
result = False
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
if self.coord_c[
|
570
|
-
segment =
|
571
|
-
else:
|
572
|
-
segment =
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
signx =
|
586
|
-
signy =
|
587
|
-
elif segment ==
|
588
|
-
signx =
|
589
|
-
signy =
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
if self.
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
)
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
if self.
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
f"
|
760
|
-
f"
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
self.
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
1
|
+
from math import atan, sqrt, tau
|
2
|
+
|
3
|
+
import wx
|
4
|
+
|
5
|
+
from meerk40t.core.units import Length
|
6
|
+
from meerk40t.gui.icons import (
|
7
|
+
icon_instruct_circle,
|
8
|
+
icon_instruct_rect,
|
9
|
+
icon_instruct_square,
|
10
|
+
)
|
11
|
+
from meerk40t.gui.mwindow import MWindow
|
12
|
+
from meerk40t.gui.wxutils import (
|
13
|
+
TextCtrl,
|
14
|
+
dip_size,
|
15
|
+
wxButton,
|
16
|
+
wxCheckBox,
|
17
|
+
wxStaticBitmap,
|
18
|
+
wxStaticText,
|
19
|
+
)
|
20
|
+
from meerk40t.kernel import signal_listener
|
21
|
+
|
22
|
+
_ = wx.GetTranslation
|
23
|
+
|
24
|
+
|
25
|
+
DEFAULT_LEN = "5cm"
|
26
|
+
|
27
|
+
|
28
|
+
class LaserToolPanel(wx.Panel):
|
29
|
+
def __init__(self, *args, context=None, **kwds):
|
30
|
+
# begin wxGlade: clsLasertools.__init__
|
31
|
+
kwds["style"] = kwds.get("style", 0) | wx.TAB_TRAVERSAL
|
32
|
+
wx.Panel.__init__(self, *args, **kwds)
|
33
|
+
self.context = context
|
34
|
+
self.context.themes.set_window_colors(self)
|
35
|
+
self.SetHelpText("templates")
|
36
|
+
self.coord_a = None
|
37
|
+
self.coord_b = None
|
38
|
+
self.coord_c = None
|
39
|
+
self.laserposition = None
|
40
|
+
|
41
|
+
sizer_main = wx.BoxSizer(wx.VERTICAL)
|
42
|
+
|
43
|
+
self.nbook_lasertools = wx.Notebook(self, wx.ID_ANY)
|
44
|
+
self.context.themes.set_window_colors(self.nbook_lasertools)
|
45
|
+
|
46
|
+
sizer_main.Add(self.nbook_lasertools, 1, wx.EXPAND, 0)
|
47
|
+
|
48
|
+
# ------------------------ Circle with 3 points
|
49
|
+
|
50
|
+
self.nb_circle = wx.Panel(self.nbook_lasertools, wx.ID_ANY)
|
51
|
+
self.nbook_lasertools.AddPage(self.nb_circle, _("Find center"))
|
52
|
+
|
53
|
+
self.sizer_circle = wx.BoxSizer(wx.VERTICAL)
|
54
|
+
|
55
|
+
sizer_9 = wx.BoxSizer(wx.HORIZONTAL)
|
56
|
+
self.sizer_circle.Add(sizer_9, 0, wx.EXPAND, 0)
|
57
|
+
|
58
|
+
sizer_10 = wx.BoxSizer(wx.VERTICAL)
|
59
|
+
sizer_9.Add(sizer_10, 0, wx.EXPAND, 0)
|
60
|
+
|
61
|
+
sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
|
62
|
+
sizer_10.Add(sizer_1, 1, wx.EXPAND, 0)
|
63
|
+
|
64
|
+
label_1 = wxStaticText(self.nb_circle, wx.ID_ANY, _("A"))
|
65
|
+
sizer_1.Add(label_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
66
|
+
|
67
|
+
self.btn_set_circle_1 = wxButton(self.nb_circle, wx.ID_ANY, _("Use position"))
|
68
|
+
self.btn_set_circle_1.SetToolTip(
|
69
|
+
_("Place the laser over the desired point and click...")
|
70
|
+
)
|
71
|
+
sizer_1.Add(self.btn_set_circle_1, 0, wx.EXPAND, 0)
|
72
|
+
|
73
|
+
# How big should graphics become?
|
74
|
+
desired_height = 6 * self.btn_set_circle_1.Size[1]
|
75
|
+
|
76
|
+
self.lbl_pos_1 = wxStaticText(self.nb_circle, wx.ID_ANY, _("<empty>"))
|
77
|
+
sizer_1.Add(self.lbl_pos_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
78
|
+
|
79
|
+
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
|
80
|
+
sizer_10.Add(sizer_2, 1, wx.EXPAND, 0)
|
81
|
+
|
82
|
+
label_2 = wxStaticText(self.nb_circle, wx.ID_ANY, _("B"))
|
83
|
+
sizer_2.Add(label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
84
|
+
|
85
|
+
self.btn_set_circle_2 = wxButton(self.nb_circle, wx.ID_ANY, _("Use position"))
|
86
|
+
self.btn_set_circle_2.SetToolTip(
|
87
|
+
_("Place the laser over the desired point and click...")
|
88
|
+
)
|
89
|
+
sizer_2.Add(self.btn_set_circle_2, 0, wx.EXPAND, 0)
|
90
|
+
|
91
|
+
self.lbl_pos_2 = wxStaticText(self.nb_circle, wx.ID_ANY, _("<empty>"))
|
92
|
+
sizer_2.Add(self.lbl_pos_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
93
|
+
|
94
|
+
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
|
95
|
+
sizer_10.Add(sizer_3, 1, wx.EXPAND, 0)
|
96
|
+
|
97
|
+
label_3 = wxStaticText(self.nb_circle, wx.ID_ANY, _("C"))
|
98
|
+
sizer_3.Add(label_3, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
99
|
+
|
100
|
+
self.btn_set_circle_3 = wxButton(self.nb_circle, wx.ID_ANY, _("Use position"))
|
101
|
+
self.btn_set_circle_3.SetToolTip(
|
102
|
+
_("Place the laser over the desired point and click...")
|
103
|
+
)
|
104
|
+
sizer_3.Add(self.btn_set_circle_3, 0, wx.EXPAND, 0)
|
105
|
+
|
106
|
+
self.lbl_pos_3 = wxStaticText(self.nb_circle, wx.ID_ANY, _("<empty>"))
|
107
|
+
sizer_3.Add(self.lbl_pos_3, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
108
|
+
|
109
|
+
img_instruction_1 = wxStaticBitmap(
|
110
|
+
self.nb_circle,
|
111
|
+
wx.ID_ANY,
|
112
|
+
self.fitted_bitmap(icon_instruct_circle, desired_height),
|
113
|
+
)
|
114
|
+
instructions = _(
|
115
|
+
"Instruction: place the laser on three points on the circumference of the circle on the bed and confirm the position by clicking on the buttons below.\nMK will find the center for you and place the laser above it or will recreate the circle for further processing."
|
116
|
+
)
|
117
|
+
img_instruction_1.SetToolTip(instructions)
|
118
|
+
sizer_9.Add(img_instruction_1, 1, 0, 0)
|
119
|
+
|
120
|
+
sizer_chk = wx.BoxSizer(wx.HORIZONTAL)
|
121
|
+
self.sizer_circle.Add(sizer_chk, 0, wx.EXPAND, 0)
|
122
|
+
self.check_ref_circle = wxCheckBox(
|
123
|
+
self.nb_circle, wx.ID_ANY, _("Make reference")
|
124
|
+
)
|
125
|
+
sizer_chk.Add(self.check_ref_circle, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
126
|
+
self.check_circle = wxCheckBox(self.nb_circle, wx.ID_ANY, _("Mark Center"))
|
127
|
+
sizer_chk.Add(self.check_circle, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
128
|
+
|
129
|
+
sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
|
130
|
+
self.sizer_circle.Add(sizer_4, 0, wx.EXPAND, 0)
|
131
|
+
|
132
|
+
self.btn_move_to_center = wxButton(
|
133
|
+
self.nb_circle, wx.ID_ANY, _("Move to center")
|
134
|
+
)
|
135
|
+
sizer_4.Add(self.btn_move_to_center, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
136
|
+
|
137
|
+
self.btn_create_circle = wxButton(self.nb_circle, wx.ID_ANY, _("Create circle"))
|
138
|
+
sizer_4.Add(self.btn_create_circle, 0, wx.EXPAND, 0)
|
139
|
+
|
140
|
+
# ------------------------ Rectangle with 2 points
|
141
|
+
|
142
|
+
self.nb_rectangle = wx.Panel(self.nbook_lasertools, wx.ID_ANY)
|
143
|
+
self.nbook_lasertools.AddPage(self.nb_rectangle, _("Place frame"))
|
144
|
+
|
145
|
+
self.sizer_rectangle = wx.BoxSizer(wx.VERTICAL)
|
146
|
+
|
147
|
+
sizer_rect_hor = wx.BoxSizer(wx.HORIZONTAL)
|
148
|
+
self.sizer_rectangle.Add(sizer_rect_hor, 0, wx.EXPAND, 0)
|
149
|
+
|
150
|
+
sizer_rect_vert = wx.BoxSizer(wx.VERTICAL)
|
151
|
+
sizer_rect_hor.Add(sizer_rect_vert, 0, wx.EXPAND, 0)
|
152
|
+
|
153
|
+
sizer_5a = wx.BoxSizer(wx.HORIZONTAL)
|
154
|
+
sizer_rect_vert.Add(sizer_5a, 1, wx.EXPAND, 0)
|
155
|
+
|
156
|
+
label_corner_1 = wxStaticText(self.nb_rectangle, wx.ID_ANY, _("Corner 1"))
|
157
|
+
sizer_5a.Add(label_corner_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
158
|
+
|
159
|
+
self.btn_set_rect_1 = wxButton(self.nb_rectangle, wx.ID_ANY, _("Use position"))
|
160
|
+
self.btn_set_rect_1.SetToolTip(
|
161
|
+
_("Place the laser over the desired point and click...")
|
162
|
+
)
|
163
|
+
sizer_5a.Add(self.btn_set_rect_1, 0, wx.EXPAND, 0)
|
164
|
+
|
165
|
+
self.lbl_pos_7 = wxStaticText(self.nb_rectangle, wx.ID_ANY, _("<empty>"))
|
166
|
+
sizer_5a.Add(self.lbl_pos_7, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
167
|
+
|
168
|
+
sizer_6a = wx.BoxSizer(wx.HORIZONTAL)
|
169
|
+
sizer_rect_vert.Add(sizer_6a, 1, wx.EXPAND, 0)
|
170
|
+
|
171
|
+
label_corner_2 = wxStaticText(self.nb_rectangle, wx.ID_ANY, _("Corner 2"))
|
172
|
+
sizer_6a.Add(label_corner_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
173
|
+
|
174
|
+
self.btn_set_rect_2 = wxButton(self.nb_rectangle, wx.ID_ANY, _("Use position"))
|
175
|
+
self.btn_set_rect_2.SetToolTip(
|
176
|
+
_("Place the laser over the desired point and click...")
|
177
|
+
)
|
178
|
+
sizer_6a.Add(self.btn_set_rect_2, 0, wx.EXPAND, 0)
|
179
|
+
|
180
|
+
self.lbl_pos_8 = wxStaticText(self.nb_rectangle, wx.ID_ANY, _("<empty>"))
|
181
|
+
sizer_6a.Add(self.lbl_pos_8, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
182
|
+
|
183
|
+
self.img_instruction_2 = wxStaticBitmap(
|
184
|
+
self.nb_rectangle,
|
185
|
+
wx.ID_ANY,
|
186
|
+
self.fitted_bitmap(icon_instruct_rect, desired_height),
|
187
|
+
)
|
188
|
+
instructions = _(
|
189
|
+
"Instruction: place the laser on one corner of the encompassing rectangle and confirm the position by clicking on the buttons below. Then choose the opposing corner.\nMK will create a rectangle for you for further processing."
|
190
|
+
)
|
191
|
+
self.img_instruction_2.SetToolTip(instructions)
|
192
|
+
sizer_rect_hor.Add(self.img_instruction_2, 1, 0, 0)
|
193
|
+
|
194
|
+
sizer_chk_rect = wx.BoxSizer(wx.HORIZONTAL)
|
195
|
+
self.sizer_rectangle.Add(sizer_chk_rect, 0, wx.EXPAND, 0)
|
196
|
+
self.check_ref_frame = wxCheckBox(
|
197
|
+
self.nb_rectangle, wx.ID_ANY, _("Make reference")
|
198
|
+
)
|
199
|
+
sizer_chk_rect.Add(self.check_ref_frame, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
200
|
+
|
201
|
+
sizer_8a = wx.BoxSizer(wx.HORIZONTAL)
|
202
|
+
self.sizer_rectangle.Add(sizer_8a, 0, wx.EXPAND, 0)
|
203
|
+
|
204
|
+
self.btn_create_frame = wxButton(
|
205
|
+
self.nb_rectangle, wx.ID_ANY, _("Create frame")
|
206
|
+
)
|
207
|
+
sizer_8a.Add(self.btn_create_frame, 0, wx.EXPAND, 0)
|
208
|
+
|
209
|
+
# ------------------------ Square with 3 points
|
210
|
+
|
211
|
+
self.nb_square = wx.Panel(self.nbook_lasertools, wx.ID_ANY)
|
212
|
+
self.nbook_lasertools.AddPage(self.nb_square, _("Place square"))
|
213
|
+
|
214
|
+
self.sizer_square = wx.BoxSizer(wx.VERTICAL)
|
215
|
+
|
216
|
+
sizer_sqare_hor = wx.BoxSizer(wx.HORIZONTAL)
|
217
|
+
self.sizer_square.Add(sizer_sqare_hor, 0, wx.EXPAND, 0)
|
218
|
+
|
219
|
+
sizer_sqare_vert = wx.BoxSizer(wx.VERTICAL)
|
220
|
+
sizer_sqare_hor.Add(sizer_sqare_vert, 0, wx.EXPAND, 0)
|
221
|
+
|
222
|
+
sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
|
223
|
+
sizer_sqare_vert.Add(sizer_5, 1, wx.EXPAND, 0)
|
224
|
+
|
225
|
+
label_4 = wxStaticText(self.nb_square, wx.ID_ANY, _("Side A 1"))
|
226
|
+
label_4.SetMinSize(dip_size(self.nb_square, 45, -1))
|
227
|
+
sizer_5.Add(label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
228
|
+
|
229
|
+
self.btn_set_square_1 = wxButton(self.nb_square, wx.ID_ANY, _("Use position"))
|
230
|
+
self.btn_set_square_1.SetToolTip(
|
231
|
+
_("Place the laser over the desired point and click...")
|
232
|
+
)
|
233
|
+
sizer_5.Add(self.btn_set_square_1, 0, wx.EXPAND, 0)
|
234
|
+
|
235
|
+
self.lbl_pos_4 = wxStaticText(self.nb_square, wx.ID_ANY, _("<empty>"))
|
236
|
+
sizer_5.Add(self.lbl_pos_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
237
|
+
|
238
|
+
sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
|
239
|
+
sizer_sqare_vert.Add(sizer_6, 1, wx.EXPAND, 0)
|
240
|
+
|
241
|
+
label_5 = wxStaticText(self.nb_square, wx.ID_ANY, _("Side A 2"))
|
242
|
+
label_5.SetMinSize(dip_size(self.nb_square, 45, -1))
|
243
|
+
sizer_6.Add(label_5, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
244
|
+
|
245
|
+
self.btn_set_square_2 = wxButton(self.nb_square, wx.ID_ANY, _("Use position"))
|
246
|
+
self.btn_set_square_2.SetToolTip(
|
247
|
+
_("Place the laser over the desired point and click...")
|
248
|
+
)
|
249
|
+
sizer_6.Add(self.btn_set_square_2, 0, wx.EXPAND, 0)
|
250
|
+
|
251
|
+
self.lbl_pos_5 = wxStaticText(self.nb_square, wx.ID_ANY, _("<empty>"))
|
252
|
+
sizer_6.Add(self.lbl_pos_5, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
253
|
+
|
254
|
+
sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
|
255
|
+
sizer_sqare_vert.Add(sizer_7, 1, wx.EXPAND, 0)
|
256
|
+
|
257
|
+
label_6 = wxStaticText(self.nb_square, wx.ID_ANY, _("Side B"))
|
258
|
+
label_6.SetMinSize(dip_size(self.nb_square, 45, -1))
|
259
|
+
sizer_7.Add(label_6, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
260
|
+
|
261
|
+
self.btn_set_square_3 = wxButton(self.nb_square, wx.ID_ANY, _("Use position"))
|
262
|
+
self.btn_set_square_3.SetToolTip(
|
263
|
+
_("Place the laser over the desired point and click...")
|
264
|
+
)
|
265
|
+
sizer_7.Add(self.btn_set_square_3, 0, wx.EXPAND, 0)
|
266
|
+
|
267
|
+
self.lbl_pos_6 = wxStaticText(self.nb_square, wx.ID_ANY, _("<empty>"))
|
268
|
+
sizer_7.Add(self.lbl_pos_6, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
269
|
+
|
270
|
+
size_width = wx.BoxSizer(wx.HORIZONTAL)
|
271
|
+
sizer_sqare_vert.Add(size_width, 1, wx.EXPAND, 0)
|
272
|
+
|
273
|
+
label_wd = wxStaticText(self.nb_square, wx.ID_ANY, _("Dimension"))
|
274
|
+
size_width.Add(label_wd, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
275
|
+
|
276
|
+
self.txt_width = TextCtrl(self.nb_square, wx.ID_ANY, DEFAULT_LEN)
|
277
|
+
self.txt_width.SetToolTip(_("Extension of the square to create"))
|
278
|
+
self.txt_width.SetMinSize(dip_size(self.nb_square, 60, -1))
|
279
|
+
size_width.Add(self.txt_width, 0, wx.EXPAND, 0)
|
280
|
+
|
281
|
+
self.img_instruction_3 = wxStaticBitmap(
|
282
|
+
self.nb_square,
|
283
|
+
wx.ID_ANY,
|
284
|
+
self.fitted_bitmap(icon_instruct_square, desired_height),
|
285
|
+
)
|
286
|
+
instructions = _(
|
287
|
+
"Instruction: place the laser on two points of one side of a square on the bed and confirm the position by clicking on the buttons below. Then choose one point on the other side of the corner.\nMK will create a square for you for further processing."
|
288
|
+
)
|
289
|
+
self.img_instruction_3.SetToolTip(instructions)
|
290
|
+
sizer_sqare_hor.Add(self.img_instruction_3, 1, 0, 0)
|
291
|
+
|
292
|
+
sizer_chk_square = wx.BoxSizer(wx.HORIZONTAL)
|
293
|
+
self.sizer_square.Add(sizer_chk_square, 0, wx.EXPAND, 0)
|
294
|
+
self.check_ref_square = wxCheckBox(
|
295
|
+
self.nb_square, wx.ID_ANY, _("Make reference")
|
296
|
+
)
|
297
|
+
sizer_chk_square.Add(self.check_ref_square, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
298
|
+
self.check_square = wxCheckBox(self.nb_square, wx.ID_ANY, _("Mark Corner"))
|
299
|
+
sizer_chk_square.Add(self.check_square, 0, wx.ALIGN_CENTER_VERTICAL, 0)
|
300
|
+
|
301
|
+
sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
|
302
|
+
self.sizer_square.Add(sizer_8, 0, wx.EXPAND, 0)
|
303
|
+
|
304
|
+
self.btn_create_square = wxButton(self.nb_square, wx.ID_ANY, _("Create square"))
|
305
|
+
sizer_8.Add(self.btn_create_square, 0, wx.EXPAND, 0)
|
306
|
+
|
307
|
+
self.nb_square.SetSizer(self.sizer_square)
|
308
|
+
|
309
|
+
self.nb_circle.SetSizer(self.sizer_circle)
|
310
|
+
|
311
|
+
self.nb_rectangle.SetSizer(self.sizer_rectangle)
|
312
|
+
|
313
|
+
self.SetSizer(sizer_main)
|
314
|
+
sizer_main.Fit(self)
|
315
|
+
|
316
|
+
self.Layout()
|
317
|
+
self.check_input()
|
318
|
+
self.btn_set_circle_1.Bind(wx.EVT_BUTTON, self.on_click_get1)
|
319
|
+
self.btn_set_circle_2.Bind(wx.EVT_BUTTON, self.on_click_get2)
|
320
|
+
self.btn_set_circle_3.Bind(wx.EVT_BUTTON, self.on_click_get3)
|
321
|
+
self.btn_move_to_center.Bind(wx.EVT_BUTTON, self.on_btn_move_center)
|
322
|
+
self.btn_create_circle.Bind(wx.EVT_BUTTON, self.on_btn_create_circle)
|
323
|
+
self.btn_set_rect_1.Bind(wx.EVT_BUTTON, self.on_click_get1)
|
324
|
+
self.btn_set_rect_2.Bind(wx.EVT_BUTTON, self.on_click_get2)
|
325
|
+
self.btn_create_frame.Bind(wx.EVT_BUTTON, self.on_btn_create_frame)
|
326
|
+
|
327
|
+
self.btn_set_square_1.Bind(wx.EVT_BUTTON, self.on_click_get1)
|
328
|
+
self.btn_set_square_2.Bind(wx.EVT_BUTTON, self.on_click_get2)
|
329
|
+
self.btn_set_square_3.Bind(wx.EVT_BUTTON, self.on_click_get3)
|
330
|
+
self.txt_width.Bind(wx.EVT_KILL_FOCUS, self.on_text_change)
|
331
|
+
self.btn_create_square.Bind(wx.EVT_BUTTON, self.on_btn_create_square)
|
332
|
+
# self.img_instruction_3.Bind(wx.EVT_LEFT_DCLICK, self.create_scenario)
|
333
|
+
# end wxGlade
|
334
|
+
|
335
|
+
def fitted_bitmap(self, picture, available_height):
|
336
|
+
bmp = picture.GetBitmap()
|
337
|
+
bmp_width, bmp_height = bmp.Size
|
338
|
+
factor = int(4 * available_height / bmp_height) / 4
|
339
|
+
# print(f"Img: {factor}, Available:{available_height} vs ht={bmp_height}")
|
340
|
+
if factor > 1:
|
341
|
+
bmp_width *= factor
|
342
|
+
bmp_height *= factor
|
343
|
+
bmp_width *= self.context.root.bitmap_correction_scale
|
344
|
+
bmp_height *= self.context.root.bitmap_correction_scale
|
345
|
+
return picture.GetBitmap(resize=(bmp_width, bmp_height))
|
346
|
+
|
347
|
+
# scenario = 8
|
348
|
+
#
|
349
|
+
# def create_scenario(self, event):
|
350
|
+
# event.Skip()
|
351
|
+
# self.scenario += 1
|
352
|
+
# l1 ="10cm"
|
353
|
+
# self.txt_width.SetValue(l1)
|
354
|
+
# if self.scenario in (1, 2, 3, 4):
|
355
|
+
# c1 = (20 * UNITS_PER_MM, 20 * UNITS_PER_MM)
|
356
|
+
# c2 = (50 * UNITS_PER_MM, 20 * UNITS_PER_MM)
|
357
|
+
# else:
|
358
|
+
# c1 = (20 * UNITS_PER_MM, 20 * UNITS_PER_MM)
|
359
|
+
# c2 = (20 * UNITS_PER_MM, 50 * UNITS_PER_MM)
|
360
|
+
# if self.scenario in (1, 5):
|
361
|
+
# c3 = (10 * UNITS_PER_MM, 70 * UNITS_PER_MM)
|
362
|
+
# elif self.scenario in (2, 6):
|
363
|
+
# c3 = (10 * UNITS_PER_MM, 0 * UNITS_PER_MM)
|
364
|
+
# elif self.scenario in (3, 7):
|
365
|
+
# c3 = (70 * UNITS_PER_MM, 70 * UNITS_PER_MM)
|
366
|
+
# elif self.scenario in (4, 8):
|
367
|
+
# c3 = (70 * UNITS_PER_MM, 0 * UNITS_PER_MM)
|
368
|
+
|
369
|
+
# if self.scenario == 9:
|
370
|
+
# c1 = (20 * UNITS_PER_MM, 20 * UNITS_PER_MM)
|
371
|
+
# c2 = (30 * UNITS_PER_MM, 50 * UNITS_PER_MM)
|
372
|
+
# c3 = (70 * UNITS_PER_MM, 10 * UNITS_PER_MM)
|
373
|
+
# self.set_coord(idx=0, position=c1)
|
374
|
+
# self.set_coord(idx=1, position=c2)
|
375
|
+
# self.set_coord(idx=2, position=c3)
|
376
|
+
# if self.scenario>=9:
|
377
|
+
# self.scenario = 0
|
378
|
+
|
379
|
+
def set_coord(self, idx=0, position=None):
|
380
|
+
if position is None:
|
381
|
+
label_string = _("<empty>")
|
382
|
+
else:
|
383
|
+
p = self.context
|
384
|
+
units = p.units_name
|
385
|
+
label_string = (
|
386
|
+
f"({str(Length(amount=position[0], digits=1, preferred_units=units))}, "
|
387
|
+
f"{str(Length(amount=position[1], digits=1, preferred_units=units))})"
|
388
|
+
)
|
389
|
+
if idx == 0:
|
390
|
+
self.lbl_pos_1.Label = label_string
|
391
|
+
self.lbl_pos_4.Label = label_string
|
392
|
+
self.lbl_pos_7.Label = label_string
|
393
|
+
self.coord_a = position
|
394
|
+
self.check_input()
|
395
|
+
elif idx == 1:
|
396
|
+
self.lbl_pos_2.Label = label_string
|
397
|
+
self.lbl_pos_5.Label = label_string
|
398
|
+
self.lbl_pos_8.Label = label_string
|
399
|
+
self.coord_b = position
|
400
|
+
self.check_input()
|
401
|
+
elif idx == 2:
|
402
|
+
self.lbl_pos_3.Label = label_string
|
403
|
+
self.lbl_pos_6.Label = label_string
|
404
|
+
self.coord_c = position
|
405
|
+
self.check_input()
|
406
|
+
self.sizer_circle.Layout()
|
407
|
+
self.sizer_square.Layout()
|
408
|
+
self.sizer_rectangle.Layout()
|
409
|
+
|
410
|
+
def check_input(self):
|
411
|
+
if self.coord_a is None or self.coord_b is None or self.coord_c is None:
|
412
|
+
value = False
|
413
|
+
else:
|
414
|
+
value = True
|
415
|
+
self.btn_create_circle.Enable(value)
|
416
|
+
self.btn_move_to_center.Enable(value)
|
417
|
+
self.btn_create_square.Enable(value)
|
418
|
+
if self.coord_a is None or self.coord_b is None:
|
419
|
+
value = False
|
420
|
+
else:
|
421
|
+
value = True
|
422
|
+
self.btn_create_frame.Enable(value)
|
423
|
+
|
424
|
+
def on_click_get1(self, event):
|
425
|
+
# Current Laserposition
|
426
|
+
self.set_coord(idx=0, position=self.laserposition)
|
427
|
+
|
428
|
+
def on_click_get2(self, event):
|
429
|
+
# Current Laserposition
|
430
|
+
self.set_coord(idx=1, position=self.laserposition)
|
431
|
+
event.Skip()
|
432
|
+
|
433
|
+
def on_click_get3(self, event):
|
434
|
+
# Current Laserposition
|
435
|
+
self.set_coord(idx=2, position=self.laserposition)
|
436
|
+
event.Skip()
|
437
|
+
|
438
|
+
def on_text_change(self, event):
|
439
|
+
event.Skip()
|
440
|
+
try:
|
441
|
+
l = Length(self.txt_width.GetValue())
|
442
|
+
except (ValueError, AttributeError):
|
443
|
+
self.txt_width.SetValue(DEFAULT_LEN)
|
444
|
+
|
445
|
+
def calculate_center(self):
|
446
|
+
"""
|
447
|
+
Let's recall how the equation of a circle looks like in general form:
|
448
|
+
x^2+y^2+2ax+2by+c=0
|
449
|
+
|
450
|
+
Since all three points should belong to one circle, we can write a system of equations.
|
451
|
+
|
452
|
+
x_1^2+y_1^2+2ax_1+2by_1+c=0\\x_2^2+y_2^2+2ax_2+2by_2+c=0\\x_3^2+y_3^2+2ax_3+2by_3+c=0
|
453
|
+
|
454
|
+
The values (x_1, y_1), (x_2, y_2) and (x_3, y_3) are known. Let's rearrange with respect to unknowns a, b and c.
|
455
|
+
|
456
|
+
2x_1a+2y_1b+c + x_1^2+y_1^2+=0\\2x_2a+2y_2b+c+x_2^2+y_2^2=0\\2x_3a+2y_3b+c+x_3^2+y_3^2=0
|
457
|
+
"""
|
458
|
+
result = True
|
459
|
+
radius = None
|
460
|
+
x12 = self.coord_a[0] - self.coord_b[0]
|
461
|
+
x13 = self.coord_a[0] - self.coord_c[0]
|
462
|
+
|
463
|
+
y12 = self.coord_a[1] - self.coord_b[1]
|
464
|
+
y13 = self.coord_a[1] - self.coord_c[1]
|
465
|
+
|
466
|
+
y31 = self.coord_c[1] - self.coord_a[1]
|
467
|
+
y21 = self.coord_b[1] - self.coord_a[1]
|
468
|
+
|
469
|
+
x31 = self.coord_c[0] - self.coord_a[0]
|
470
|
+
x21 = self.coord_b[0] - self.coord_a[0]
|
471
|
+
|
472
|
+
# coord_a[0]^2 - coord_c[0]^2
|
473
|
+
sx13 = pow(self.coord_a[0], 2) - pow(self.coord_c[0], 2)
|
474
|
+
|
475
|
+
# self.coord_a[1]^2 - self.coord_c[1]^2
|
476
|
+
sy13 = pow(self.coord_a[1], 2) - pow(self.coord_c[1], 2)
|
477
|
+
|
478
|
+
sx21 = pow(self.coord_b[0], 2) - pow(self.coord_a[0], 2)
|
479
|
+
sy21 = pow(self.coord_b[1], 2) - pow(self.coord_a[1], 2)
|
480
|
+
try:
|
481
|
+
f = (sx13 * x12 + sy13 * x12 + sx21 * x13 + sy21 * x13) // (
|
482
|
+
2 * (y31 * x12 - y21 * x13)
|
483
|
+
)
|
484
|
+
|
485
|
+
g = (sx13 * y12 + sy13 * y12 + sx21 * y13 + sy21 * y13) // (
|
486
|
+
2 * (x31 * y12 - x21 * y13)
|
487
|
+
)
|
488
|
+
except (ZeroDivisionError, ArithmeticError):
|
489
|
+
return False, None, None
|
490
|
+
|
491
|
+
c = (
|
492
|
+
-pow(self.coord_a[0], 2)
|
493
|
+
- pow(self.coord_a[1], 2)
|
494
|
+
- 2 * g * self.coord_a[0]
|
495
|
+
- 2 * f * self.coord_a[1]
|
496
|
+
)
|
497
|
+
|
498
|
+
# eqn of circle be x^2 + y^2 + 2*g*x + 2*f*y + c = 0
|
499
|
+
# where centre is (h = -g, k = -f) and
|
500
|
+
# radius r as r^2 = h^2 + k^2 - c
|
501
|
+
h = -g
|
502
|
+
k = -f
|
503
|
+
sqr_of_r = h * h + k * k - c
|
504
|
+
|
505
|
+
# r is the radius
|
506
|
+
if sqr_of_r < 0:
|
507
|
+
result = False
|
508
|
+
else:
|
509
|
+
radius = round(sqrt(sqr_of_r), 5)
|
510
|
+
|
511
|
+
# print("Centre = (", h, ", ", k, ")")
|
512
|
+
# print("Radius = ", r)
|
513
|
+
center = (h, k)
|
514
|
+
return result, center, radius
|
515
|
+
|
516
|
+
def calculate_square(self):
|
517
|
+
result = True
|
518
|
+
angle = 0
|
519
|
+
signx = 1
|
520
|
+
signy = 1
|
521
|
+
# equation for the first line through (x1, y1)-(x2, y2)
|
522
|
+
# y = a1 * x + b1
|
523
|
+
dx1 = self.coord_a[0] - self.coord_b[0]
|
524
|
+
dy1 = self.coord_a[1] - self.coord_b[1]
|
525
|
+
if dx1 == 0 and dy1 == 0:
|
526
|
+
result = False
|
527
|
+
if self.coord_a == self.coord_b:
|
528
|
+
result = False
|
529
|
+
if self.coord_a == self.coord_c:
|
530
|
+
result = False
|
531
|
+
if self.coord_b == self.coord_c:
|
532
|
+
result = False
|
533
|
+
|
534
|
+
if dx1 == 0:
|
535
|
+
a1 = float("inf")
|
536
|
+
b1 = 0
|
537
|
+
else:
|
538
|
+
a1 = dy1 / dx1
|
539
|
+
b1 = self.coord_a[1] - self.coord_a[0] * a1
|
540
|
+
|
541
|
+
if dx1 == 0:
|
542
|
+
center = (self.coord_a[0], self.coord_c[1])
|
543
|
+
elif dy1 == 0:
|
544
|
+
center = (self.coord_c[0], self.coord_a[1])
|
545
|
+
else:
|
546
|
+
# regular line
|
547
|
+
# line 1
|
548
|
+
# y = a1 * x + b1
|
549
|
+
# orthogonal line
|
550
|
+
a2 = -1 / a1
|
551
|
+
b2 = self.coord_c[1] - self.coord_c[0] * a2
|
552
|
+
|
553
|
+
x0 = (b2 - b1) / (a1 - a2)
|
554
|
+
y0 = a1 * x0 + b1
|
555
|
+
center = (x0, y0)
|
556
|
+
dx1 = 0
|
557
|
+
dy1 = 0
|
558
|
+
angle = atan(a1)
|
559
|
+
|
560
|
+
mid_a_x = (self.coord_a[0] + self.coord_b[0]) / 2
|
561
|
+
mid_a_y = (self.coord_a[1] + self.coord_b[1]) / 2
|
562
|
+
if abs(dx1) < abs(dy1): # A is a 'vertical' line
|
563
|
+
if mid_a_y < center[1]:
|
564
|
+
if self.coord_c[0] >= center[0]:
|
565
|
+
segment = 4
|
566
|
+
else:
|
567
|
+
segment = 3
|
568
|
+
else:
|
569
|
+
if self.coord_c[0] >= center[0]:
|
570
|
+
segment = 1
|
571
|
+
else:
|
572
|
+
segment = 2
|
573
|
+
else: # Horizontal line
|
574
|
+
if mid_a_x < center[0]:
|
575
|
+
if self.coord_c[1] >= center[1]:
|
576
|
+
segment = 2
|
577
|
+
else:
|
578
|
+
segment = 3
|
579
|
+
else:
|
580
|
+
if self.coord_c[1] >= center[1]:
|
581
|
+
segment = 1
|
582
|
+
else:
|
583
|
+
segment = 4
|
584
|
+
if segment == 1:
|
585
|
+
signx = +1
|
586
|
+
signy = +1
|
587
|
+
elif segment == 2:
|
588
|
+
signx = -1
|
589
|
+
signy = +1
|
590
|
+
elif segment == 3:
|
591
|
+
signx = -1
|
592
|
+
signy = -1
|
593
|
+
elif segment == 4:
|
594
|
+
signx = +1
|
595
|
+
signy = -1
|
596
|
+
|
597
|
+
# print (center, angle / tau * 360)
|
598
|
+
return result, center, angle, signx, signy
|
599
|
+
|
600
|
+
def calculate_frame(self):
|
601
|
+
result = False
|
602
|
+
left_top = (0, 0)
|
603
|
+
width = 0
|
604
|
+
height = 0
|
605
|
+
if self.coord_a is not None and self.coord_b is not None:
|
606
|
+
x0 = self.coord_a[0]
|
607
|
+
x1 = self.coord_b[0]
|
608
|
+
y0 = self.coord_a[1]
|
609
|
+
y1 = self.coord_b[1]
|
610
|
+
width = abs(x0 - x1)
|
611
|
+
height = abs(y0 - y1)
|
612
|
+
xx = min(x0, x1)
|
613
|
+
yy = min(y0, y1)
|
614
|
+
if width != 0 and height != 0:
|
615
|
+
left_top = (xx, yy)
|
616
|
+
result = True
|
617
|
+
return result, left_top, width, height
|
618
|
+
|
619
|
+
def on_btn_move_center(self, event): # wxGlade: clsLasertools.<event_handler>
|
620
|
+
result, center, radius = self.calculate_center()
|
621
|
+
if result:
|
622
|
+
p = self.context
|
623
|
+
units = p.units_name
|
624
|
+
cx = float(Length(amount=center[0], digits=5, preferred_units=units))
|
625
|
+
cy = float(Length(amount=center[1], digits=5, preferred_units=units))
|
626
|
+
if self.context.elements.classify_new:
|
627
|
+
option = " classify"
|
628
|
+
postsignal = "tree_changed"
|
629
|
+
else:
|
630
|
+
option = ""
|
631
|
+
postsignal = ""
|
632
|
+
if self.check_circle.GetValue():
|
633
|
+
self.context(
|
634
|
+
f"circle "
|
635
|
+
f"{str(Length(amount=center[0], digits=5, preferred_units=units))} "
|
636
|
+
f"{str(Length(amount=center[1], digits=5, preferred_units=units))} "
|
637
|
+
f"1mm stroke blue{option}\n"
|
638
|
+
)
|
639
|
+
if postsignal != "":
|
640
|
+
self.context.signal(postsignal)
|
641
|
+
if (
|
642
|
+
cx < 0
|
643
|
+
or cy < 0
|
644
|
+
or cx > self.context.device.view.unit_width
|
645
|
+
or cy > self.context.device.view.unit_height
|
646
|
+
):
|
647
|
+
message = (
|
648
|
+
_("The circles center seems to lie outside the bed-dimensions!")
|
649
|
+
+ "\n"
|
650
|
+
)
|
651
|
+
message += (
|
652
|
+
_("If you continue to move to the center, then the laserhead might")
|
653
|
+
+ "\n"
|
654
|
+
)
|
655
|
+
message += _(
|
656
|
+
"slam into the walls and get damaged! Do you really want to proceed?"
|
657
|
+
)
|
658
|
+
caption = _("Dangerous coordinates")
|
659
|
+
dlg = wx.MessageDialog(
|
660
|
+
self,
|
661
|
+
message,
|
662
|
+
caption,
|
663
|
+
wx.YES_NO | wx.ICON_WARNING,
|
664
|
+
)
|
665
|
+
dlgresult = dlg.ShowModal()
|
666
|
+
dlg.Destroy()
|
667
|
+
if dlgresult != wx.ID_YES:
|
668
|
+
return
|
669
|
+
self.context(
|
670
|
+
f"move_absolute "
|
671
|
+
f"{str(Length(amount=center[0], digits=5, preferred_units=units))} "
|
672
|
+
f"{str(Length(amount=center[1], digits=5, preferred_units=units))}\n"
|
673
|
+
)
|
674
|
+
|
675
|
+
def on_btn_create_circle(self, event): # wxGlade: clsLasertools.<event_handler>
|
676
|
+
result, center, radius = self.calculate_center()
|
677
|
+
if result:
|
678
|
+
p = self.context
|
679
|
+
units = p.units_name
|
680
|
+
if self.context.elements.classify_new:
|
681
|
+
option = " classify"
|
682
|
+
postsignal = "tree_changed"
|
683
|
+
else:
|
684
|
+
option = ""
|
685
|
+
postsignal = ""
|
686
|
+
if self.check_circle.GetValue():
|
687
|
+
self.context(
|
688
|
+
f"circle "
|
689
|
+
f"{str(Length(amount=center[0], digits=5, preferred_units=units))} "
|
690
|
+
f"{str(Length(amount=center[1], digits=5, preferred_units=units))} "
|
691
|
+
f"1mm stroke blue{option}\n"
|
692
|
+
)
|
693
|
+
self.context(
|
694
|
+
f"circle "
|
695
|
+
f"{str(Length(amount=center[0], digits=5, preferred_units=units))} "
|
696
|
+
f"{str(Length(amount=center[1], digits=5, preferred_units=units))} "
|
697
|
+
f"{str(Length(amount=radius, digits=5, preferred_units=units))}{option}\n"
|
698
|
+
)
|
699
|
+
if self.check_ref_circle.GetValue():
|
700
|
+
self.context("reference\n")
|
701
|
+
if postsignal != "":
|
702
|
+
self.context.signal(postsignal)
|
703
|
+
event.Skip()
|
704
|
+
|
705
|
+
def on_btn_create_frame(self, event): # wxGlade: clsLasertools.<event_handler>
|
706
|
+
result, left_top, width, height = self.calculate_frame()
|
707
|
+
|
708
|
+
if result:
|
709
|
+
p = self.context
|
710
|
+
units = p.units_name
|
711
|
+
if self.context.elements.classify_new:
|
712
|
+
option = " classify"
|
713
|
+
postsignal = "tree_changed"
|
714
|
+
else:
|
715
|
+
option = ""
|
716
|
+
postsignal = ""
|
717
|
+
|
718
|
+
self.context(
|
719
|
+
f"rect "
|
720
|
+
f"{str(Length(amount=left_top[0], digits=5, preferred_units=units))} "
|
721
|
+
f"{str(Length(amount=left_top[1], digits=5, preferred_units=units))} "
|
722
|
+
f"{str(Length(amount=width, digits=5, preferred_units=units))} "
|
723
|
+
f"{str(Length(amount=height, digits=5, preferred_units=units))}"
|
724
|
+
f"{option}\n"
|
725
|
+
)
|
726
|
+
if self.check_ref_frame.GetValue():
|
727
|
+
self.context("reference\n")
|
728
|
+
if postsignal != "":
|
729
|
+
self.context.signal(postsignal)
|
730
|
+
event.Skip()
|
731
|
+
|
732
|
+
def on_btn_create_square(self, event): # wxGlade: clsLasertools.<event_handler>
|
733
|
+
try:
|
734
|
+
dim_x = Length(self.txt_width.GetValue())
|
735
|
+
dim_y = Length(self.txt_width.GetValue())
|
736
|
+
except ValueError:
|
737
|
+
dim_x = Length(DEFAULT_LEN)
|
738
|
+
dim_y = Length(DEFAULT_LEN)
|
739
|
+
result, center, angle, signx, signy = self.calculate_square()
|
740
|
+
dim_x *= signx
|
741
|
+
dim_y *= signy
|
742
|
+
angle = angle * 360 / tau
|
743
|
+
if result:
|
744
|
+
p = self.context
|
745
|
+
units = p.units_name
|
746
|
+
|
747
|
+
# self.context("circle {x}mm {y}mm 2mm stroke green".format(x=round(self.coord_a[0]/UNITS_PER_MM,2),y=round(self.coord_a[1]/UNITS_PER_MM,2)) )
|
748
|
+
# self.context("circle {x}mm {y}mm 2mm stroke green".format(x=round(self.coord_b[0]/UNITS_PER_MM,2),y=round(self.coord_b[1]/UNITS_PER_MM,2)) )
|
749
|
+
# self.context("circle {x}mm {y}mm 2mm stroke red".format(x=round(self.coord_c[0]/UNITS_PER_MM,2),y=round(self.coord_c[1]/UNITS_PER_MM,2)) )
|
750
|
+
|
751
|
+
if self.check_square.GetValue():
|
752
|
+
self.context(
|
753
|
+
f"circle "
|
754
|
+
f"{str(Length(amount=center[0], digits=5, preferred_units=units))} "
|
755
|
+
f"{str(Length(amount=center[1], digits=5, preferred_units=units))} "
|
756
|
+
f"1mm stroke black\n"
|
757
|
+
)
|
758
|
+
self.context(
|
759
|
+
f"rect "
|
760
|
+
f"{str(Length(amount=center[0], digits=5, preferred_units=units))} "
|
761
|
+
f"{str(Length(amount=center[1], digits=5, preferred_units=units))} "
|
762
|
+
f"{str(dim_x.length_mm)} "
|
763
|
+
f"{str(dim_y.length_mm)} "
|
764
|
+
f"rotate {angle}deg "
|
765
|
+
f"-x {str(Length(amount=center[0], digits=5, preferred_units=units))} "
|
766
|
+
f"-y {str(Length(amount=center[1], digits=5, preferred_units=units))}\n"
|
767
|
+
)
|
768
|
+
if self.check_ref_square.GetValue():
|
769
|
+
self.context("reference\n")
|
770
|
+
event.Skip()
|
771
|
+
|
772
|
+
@signal_listener("driver;position")
|
773
|
+
@signal_listener("emulator;position")
|
774
|
+
@signal_listener("status;position")
|
775
|
+
def on_update_laser(self, origin, pos):
|
776
|
+
self.laserposition = (pos[2], pos[3])
|
777
|
+
|
778
|
+
|
779
|
+
class LaserTool(MWindow):
|
780
|
+
def __init__(self, *args, **kwds):
|
781
|
+
super().__init__(551, 234, submenu="Operations", *args, **kwds)
|
782
|
+
self.panel = LaserToolPanel(self, wx.ID_ANY, context=self.context)
|
783
|
+
self.sizer.Add(self.panel, 1, wx.EXPAND, 0)
|
784
|
+
_icon = wx.NullIcon
|
785
|
+
# _icon.CopyFromBitmap(icons8_computer_support.GetBitmap())
|
786
|
+
self.SetIcon(_icon)
|
787
|
+
self.SetTitle(_("Place Template"))
|
788
|
+
self.restore_aspect()
|
789
|
+
|
790
|
+
def window_open(self):
|
791
|
+
pass
|
792
|
+
|
793
|
+
def window_close(self):
|
794
|
+
pass
|
795
|
+
|
796
|
+
def delegates(self):
|
797
|
+
yield self.panel
|
798
|
+
|
799
|
+
@staticmethod
|
800
|
+
def submenu():
|
801
|
+
return "Laser-Tools", "Place Template"
|
802
|
+
|
803
|
+
@staticmethod
|
804
|
+
def helptext():
|
805
|
+
return _("Define and use some templates for repetitive laser jobs")
|