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.
Files changed (446) hide show
  1. meerk40t/__init__.py +1 -1
  2. meerk40t/balormk/balor_params.py +167 -167
  3. meerk40t/balormk/clone_loader.py +457 -457
  4. meerk40t/balormk/controller.py +1566 -1512
  5. meerk40t/balormk/cylindermod.py +64 -0
  6. meerk40t/balormk/device.py +966 -1959
  7. meerk40t/balormk/driver.py +778 -591
  8. meerk40t/balormk/galvo_commands.py +1194 -0
  9. meerk40t/balormk/gui/balorconfig.py +237 -111
  10. meerk40t/balormk/gui/balorcontroller.py +191 -184
  11. meerk40t/balormk/gui/baloroperationproperties.py +116 -115
  12. meerk40t/balormk/gui/corscene.py +845 -0
  13. meerk40t/balormk/gui/gui.py +179 -147
  14. meerk40t/balormk/livelightjob.py +466 -382
  15. meerk40t/balormk/mock_connection.py +131 -109
  16. meerk40t/balormk/plugin.py +133 -135
  17. meerk40t/balormk/usb_connection.py +306 -301
  18. meerk40t/camera/__init__.py +1 -1
  19. meerk40t/camera/camera.py +514 -397
  20. meerk40t/camera/gui/camerapanel.py +1241 -1095
  21. meerk40t/camera/gui/gui.py +58 -58
  22. meerk40t/camera/plugin.py +441 -399
  23. meerk40t/ch341/__init__.py +27 -27
  24. meerk40t/ch341/ch341device.py +628 -628
  25. meerk40t/ch341/libusb.py +595 -589
  26. meerk40t/ch341/mock.py +171 -171
  27. meerk40t/ch341/windriver.py +157 -157
  28. meerk40t/constants.py +13 -0
  29. meerk40t/core/__init__.py +1 -1
  30. meerk40t/core/bindalias.py +550 -539
  31. meerk40t/core/core.py +47 -47
  32. meerk40t/core/cutcode/cubiccut.py +73 -73
  33. meerk40t/core/cutcode/cutcode.py +315 -312
  34. meerk40t/core/cutcode/cutgroup.py +141 -137
  35. meerk40t/core/cutcode/cutobject.py +192 -185
  36. meerk40t/core/cutcode/dwellcut.py +37 -37
  37. meerk40t/core/cutcode/gotocut.py +29 -29
  38. meerk40t/core/cutcode/homecut.py +29 -29
  39. meerk40t/core/cutcode/inputcut.py +34 -34
  40. meerk40t/core/cutcode/linecut.py +33 -33
  41. meerk40t/core/cutcode/outputcut.py +34 -34
  42. meerk40t/core/cutcode/plotcut.py +335 -335
  43. meerk40t/core/cutcode/quadcut.py +61 -61
  44. meerk40t/core/cutcode/rastercut.py +168 -148
  45. meerk40t/core/cutcode/waitcut.py +34 -34
  46. meerk40t/core/cutplan.py +1843 -1316
  47. meerk40t/core/drivers.py +330 -329
  48. meerk40t/core/elements/align.py +801 -669
  49. meerk40t/core/elements/branches.py +1858 -1507
  50. meerk40t/core/elements/clipboard.py +229 -219
  51. meerk40t/core/elements/element_treeops.py +4595 -2837
  52. meerk40t/core/elements/element_types.py +125 -105
  53. meerk40t/core/elements/elements.py +4315 -3617
  54. meerk40t/core/elements/files.py +117 -64
  55. meerk40t/core/elements/geometry.py +473 -224
  56. meerk40t/core/elements/grid.py +467 -316
  57. meerk40t/core/elements/materials.py +158 -94
  58. meerk40t/core/elements/notes.py +50 -38
  59. meerk40t/core/elements/offset_clpr.py +934 -912
  60. meerk40t/core/elements/offset_mk.py +963 -955
  61. meerk40t/core/elements/penbox.py +339 -267
  62. meerk40t/core/elements/placements.py +300 -83
  63. meerk40t/core/elements/render.py +785 -687
  64. meerk40t/core/elements/shapes.py +2618 -2092
  65. meerk40t/core/elements/testcases.py +105 -0
  66. meerk40t/core/elements/trace.py +651 -563
  67. meerk40t/core/elements/tree_commands.py +415 -409
  68. meerk40t/core/elements/undo_redo.py +116 -58
  69. meerk40t/core/elements/wordlist.py +319 -200
  70. meerk40t/core/exceptions.py +9 -9
  71. meerk40t/core/laserjob.py +220 -220
  72. meerk40t/core/logging.py +63 -63
  73. meerk40t/core/node/blobnode.py +83 -86
  74. meerk40t/core/node/bootstrap.py +105 -103
  75. meerk40t/core/node/branch_elems.py +40 -31
  76. meerk40t/core/node/branch_ops.py +45 -38
  77. meerk40t/core/node/branch_regmark.py +48 -41
  78. meerk40t/core/node/cutnode.py +29 -32
  79. meerk40t/core/node/effect_hatch.py +375 -257
  80. meerk40t/core/node/effect_warp.py +398 -0
  81. meerk40t/core/node/effect_wobble.py +441 -309
  82. meerk40t/core/node/elem_ellipse.py +404 -309
  83. meerk40t/core/node/elem_image.py +1082 -801
  84. meerk40t/core/node/elem_line.py +358 -292
  85. meerk40t/core/node/elem_path.py +259 -201
  86. meerk40t/core/node/elem_point.py +129 -102
  87. meerk40t/core/node/elem_polyline.py +310 -246
  88. meerk40t/core/node/elem_rect.py +376 -286
  89. meerk40t/core/node/elem_text.py +445 -418
  90. meerk40t/core/node/filenode.py +59 -40
  91. meerk40t/core/node/groupnode.py +138 -74
  92. meerk40t/core/node/image_processed.py +777 -766
  93. meerk40t/core/node/image_raster.py +156 -113
  94. meerk40t/core/node/layernode.py +31 -31
  95. meerk40t/core/node/mixins.py +135 -107
  96. meerk40t/core/node/node.py +1427 -1304
  97. meerk40t/core/node/nutils.py +117 -114
  98. meerk40t/core/node/op_cut.py +463 -335
  99. meerk40t/core/node/op_dots.py +296 -251
  100. meerk40t/core/node/op_engrave.py +414 -311
  101. meerk40t/core/node/op_image.py +755 -369
  102. meerk40t/core/node/op_raster.py +787 -522
  103. meerk40t/core/node/place_current.py +37 -40
  104. meerk40t/core/node/place_point.py +329 -126
  105. meerk40t/core/node/refnode.py +58 -47
  106. meerk40t/core/node/rootnode.py +225 -219
  107. meerk40t/core/node/util_console.py +48 -48
  108. meerk40t/core/node/util_goto.py +84 -65
  109. meerk40t/core/node/util_home.py +61 -61
  110. meerk40t/core/node/util_input.py +102 -102
  111. meerk40t/core/node/util_output.py +102 -102
  112. meerk40t/core/node/util_wait.py +65 -65
  113. meerk40t/core/parameters.py +709 -707
  114. meerk40t/core/planner.py +875 -785
  115. meerk40t/core/plotplanner.py +656 -652
  116. meerk40t/core/space.py +120 -113
  117. meerk40t/core/spoolers.py +706 -705
  118. meerk40t/core/svg_io.py +1836 -1549
  119. meerk40t/core/treeop.py +534 -445
  120. meerk40t/core/undos.py +278 -124
  121. meerk40t/core/units.py +784 -680
  122. meerk40t/core/view.py +393 -322
  123. meerk40t/core/webhelp.py +62 -62
  124. meerk40t/core/wordlist.py +513 -504
  125. meerk40t/cylinder/cylinder.py +247 -0
  126. meerk40t/cylinder/gui/cylindersettings.py +41 -0
  127. meerk40t/cylinder/gui/gui.py +24 -0
  128. meerk40t/device/__init__.py +1 -1
  129. meerk40t/device/basedevice.py +322 -123
  130. meerk40t/device/devicechoices.py +50 -0
  131. meerk40t/device/dummydevice.py +163 -128
  132. meerk40t/device/gui/defaultactions.py +618 -602
  133. meerk40t/device/gui/effectspanel.py +114 -0
  134. meerk40t/device/gui/formatterpanel.py +253 -290
  135. meerk40t/device/gui/warningpanel.py +337 -260
  136. meerk40t/device/mixins.py +13 -13
  137. meerk40t/dxf/__init__.py +1 -1
  138. meerk40t/dxf/dxf_io.py +766 -554
  139. meerk40t/dxf/plugin.py +47 -35
  140. meerk40t/external_plugins.py +79 -79
  141. meerk40t/external_plugins_build.py +28 -28
  142. meerk40t/extra/cag.py +112 -116
  143. meerk40t/extra/coolant.py +403 -0
  144. meerk40t/extra/encode_detect.py +204 -0
  145. meerk40t/extra/ezd.py +1165 -1165
  146. meerk40t/extra/hershey.py +834 -340
  147. meerk40t/extra/imageactions.py +322 -316
  148. meerk40t/extra/inkscape.py +628 -622
  149. meerk40t/extra/lbrn.py +424 -424
  150. meerk40t/extra/outerworld.py +283 -0
  151. meerk40t/extra/param_functions.py +1542 -1556
  152. meerk40t/extra/potrace.py +257 -253
  153. meerk40t/extra/serial_exchange.py +118 -0
  154. meerk40t/extra/updater.py +602 -453
  155. meerk40t/extra/vectrace.py +147 -146
  156. meerk40t/extra/winsleep.py +83 -83
  157. meerk40t/extra/xcs_reader.py +597 -0
  158. meerk40t/fill/fills.py +781 -335
  159. meerk40t/fill/patternfill.py +1061 -1061
  160. meerk40t/fill/patterns.py +614 -567
  161. meerk40t/grbl/control.py +87 -87
  162. meerk40t/grbl/controller.py +990 -903
  163. meerk40t/grbl/device.py +1084 -768
  164. meerk40t/grbl/driver.py +989 -771
  165. meerk40t/grbl/emulator.py +532 -497
  166. meerk40t/grbl/gcodejob.py +783 -767
  167. meerk40t/grbl/gui/grblconfiguration.py +373 -298
  168. meerk40t/grbl/gui/grblcontroller.py +485 -271
  169. meerk40t/grbl/gui/grblhardwareconfig.py +269 -153
  170. meerk40t/grbl/gui/grbloperationconfig.py +105 -0
  171. meerk40t/grbl/gui/gui.py +147 -116
  172. meerk40t/grbl/interpreter.py +44 -44
  173. meerk40t/grbl/loader.py +22 -22
  174. meerk40t/grbl/mock_connection.py +56 -56
  175. meerk40t/grbl/plugin.py +294 -264
  176. meerk40t/grbl/serial_connection.py +93 -88
  177. meerk40t/grbl/tcp_connection.py +81 -79
  178. meerk40t/grbl/ws_connection.py +112 -0
  179. meerk40t/gui/__init__.py +1 -1
  180. meerk40t/gui/about.py +2042 -296
  181. meerk40t/gui/alignment.py +1644 -1608
  182. meerk40t/gui/autoexec.py +199 -0
  183. meerk40t/gui/basicops.py +791 -670
  184. meerk40t/gui/bufferview.py +77 -71
  185. meerk40t/gui/busy.py +232 -133
  186. meerk40t/gui/choicepropertypanel.py +1662 -1469
  187. meerk40t/gui/consolepanel.py +706 -542
  188. meerk40t/gui/devicepanel.py +687 -581
  189. meerk40t/gui/dialogoptions.py +110 -107
  190. meerk40t/gui/executejob.py +316 -306
  191. meerk40t/gui/fonts.py +90 -90
  192. meerk40t/gui/functionwrapper.py +252 -0
  193. meerk40t/gui/gui_mixins.py +729 -0
  194. meerk40t/gui/guicolors.py +205 -182
  195. meerk40t/gui/help_assets/help_assets.py +218 -201
  196. meerk40t/gui/helper.py +154 -0
  197. meerk40t/gui/hersheymanager.py +1440 -846
  198. meerk40t/gui/icons.py +3422 -2747
  199. meerk40t/gui/imagesplitter.py +555 -508
  200. meerk40t/gui/keymap.py +354 -344
  201. meerk40t/gui/laserpanel.py +897 -806
  202. meerk40t/gui/laserrender.py +1470 -1232
  203. meerk40t/gui/lasertoolpanel.py +805 -793
  204. meerk40t/gui/magnetoptions.py +436 -0
  205. meerk40t/gui/materialmanager.py +2944 -0
  206. meerk40t/gui/materialtest.py +1722 -1694
  207. meerk40t/gui/mkdebug.py +646 -359
  208. meerk40t/gui/mwindow.py +163 -140
  209. meerk40t/gui/navigationpanels.py +2605 -2467
  210. meerk40t/gui/notes.py +143 -142
  211. meerk40t/gui/opassignment.py +414 -410
  212. meerk40t/gui/operation_info.py +310 -299
  213. meerk40t/gui/plugin.py +500 -328
  214. meerk40t/gui/position.py +714 -669
  215. meerk40t/gui/preferences.py +901 -650
  216. meerk40t/gui/propertypanels/attributes.py +1461 -1131
  217. meerk40t/gui/propertypanels/blobproperty.py +117 -114
  218. meerk40t/gui/propertypanels/consoleproperty.py +83 -80
  219. meerk40t/gui/propertypanels/gotoproperty.py +77 -0
  220. meerk40t/gui/propertypanels/groupproperties.py +223 -217
  221. meerk40t/gui/propertypanels/hatchproperty.py +489 -469
  222. meerk40t/gui/propertypanels/imageproperty.py +2244 -1384
  223. meerk40t/gui/propertypanels/inputproperty.py +59 -58
  224. meerk40t/gui/propertypanels/opbranchproperties.py +82 -80
  225. meerk40t/gui/propertypanels/operationpropertymain.py +1890 -1638
  226. meerk40t/gui/propertypanels/outputproperty.py +59 -58
  227. meerk40t/gui/propertypanels/pathproperty.py +389 -380
  228. meerk40t/gui/propertypanels/placementproperty.py +1214 -383
  229. meerk40t/gui/propertypanels/pointproperty.py +140 -136
  230. meerk40t/gui/propertypanels/propertywindow.py +313 -181
  231. meerk40t/gui/propertypanels/rasterwizardpanels.py +996 -912
  232. meerk40t/gui/propertypanels/regbranchproperties.py +76 -0
  233. meerk40t/gui/propertypanels/textproperty.py +770 -755
  234. meerk40t/gui/propertypanels/waitproperty.py +56 -55
  235. meerk40t/gui/propertypanels/warpproperty.py +121 -0
  236. meerk40t/gui/propertypanels/wobbleproperty.py +255 -204
  237. meerk40t/gui/ribbon.py +2471 -2210
  238. meerk40t/gui/scene/scene.py +1100 -1051
  239. meerk40t/gui/scene/sceneconst.py +22 -22
  240. meerk40t/gui/scene/scenepanel.py +439 -349
  241. meerk40t/gui/scene/scenespacewidget.py +365 -365
  242. meerk40t/gui/scene/widget.py +518 -505
  243. meerk40t/gui/scenewidgets/affinemover.py +215 -215
  244. meerk40t/gui/scenewidgets/attractionwidget.py +315 -309
  245. meerk40t/gui/scenewidgets/bedwidget.py +120 -97
  246. meerk40t/gui/scenewidgets/elementswidget.py +137 -107
  247. meerk40t/gui/scenewidgets/gridwidget.py +785 -745
  248. meerk40t/gui/scenewidgets/guidewidget.py +765 -765
  249. meerk40t/gui/scenewidgets/laserpathwidget.py +66 -66
  250. meerk40t/gui/scenewidgets/machineoriginwidget.py +86 -86
  251. meerk40t/gui/scenewidgets/nodeselector.py +28 -28
  252. meerk40t/gui/scenewidgets/rectselectwidget.py +592 -346
  253. meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
  254. meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
  255. meerk40t/gui/scenewidgets/selectionwidget.py +2958 -2756
  256. meerk40t/gui/simpleui.py +362 -333
  257. meerk40t/gui/simulation.py +2451 -2094
  258. meerk40t/gui/snapoptions.py +208 -203
  259. meerk40t/gui/spoolerpanel.py +1227 -1180
  260. meerk40t/gui/statusbarwidgets/defaultoperations.py +480 -353
  261. meerk40t/gui/statusbarwidgets/infowidget.py +520 -483
  262. meerk40t/gui/statusbarwidgets/opassignwidget.py +356 -355
  263. meerk40t/gui/statusbarwidgets/selectionwidget.py +172 -171
  264. meerk40t/gui/statusbarwidgets/shapepropwidget.py +754 -236
  265. meerk40t/gui/statusbarwidgets/statusbar.py +272 -260
  266. meerk40t/gui/statusbarwidgets/statusbarwidget.py +268 -270
  267. meerk40t/gui/statusbarwidgets/strokewidget.py +267 -251
  268. meerk40t/gui/themes.py +200 -78
  269. meerk40t/gui/tips.py +590 -0
  270. meerk40t/gui/toolwidgets/circlebrush.py +35 -35
  271. meerk40t/gui/toolwidgets/toolcircle.py +248 -242
  272. meerk40t/gui/toolwidgets/toolcontainer.py +82 -77
  273. meerk40t/gui/toolwidgets/tooldraw.py +97 -90
  274. meerk40t/gui/toolwidgets/toolellipse.py +219 -212
  275. meerk40t/gui/toolwidgets/toolimagecut.py +25 -132
  276. meerk40t/gui/toolwidgets/toolline.py +39 -144
  277. meerk40t/gui/toolwidgets/toollinetext.py +79 -236
  278. meerk40t/gui/toolwidgets/toollinetext_inline.py +296 -0
  279. meerk40t/gui/toolwidgets/toolmeasure.py +163 -216
  280. meerk40t/gui/toolwidgets/toolnodeedit.py +2088 -2074
  281. meerk40t/gui/toolwidgets/toolnodemove.py +92 -94
  282. meerk40t/gui/toolwidgets/toolparameter.py +754 -668
  283. meerk40t/gui/toolwidgets/toolplacement.py +108 -108
  284. meerk40t/gui/toolwidgets/toolpoint.py +68 -59
  285. meerk40t/gui/toolwidgets/toolpointlistbuilder.py +294 -0
  286. meerk40t/gui/toolwidgets/toolpointmove.py +183 -0
  287. meerk40t/gui/toolwidgets/toolpolygon.py +288 -403
  288. meerk40t/gui/toolwidgets/toolpolyline.py +38 -196
  289. meerk40t/gui/toolwidgets/toolrect.py +211 -207
  290. meerk40t/gui/toolwidgets/toolrelocate.py +72 -72
  291. meerk40t/gui/toolwidgets/toolribbon.py +598 -113
  292. meerk40t/gui/toolwidgets/tooltabedit.py +546 -0
  293. meerk40t/gui/toolwidgets/tooltext.py +98 -89
  294. meerk40t/gui/toolwidgets/toolvector.py +213 -204
  295. meerk40t/gui/toolwidgets/toolwidget.py +39 -39
  296. meerk40t/gui/usbconnect.py +98 -91
  297. meerk40t/gui/utilitywidgets/buttonwidget.py +18 -18
  298. meerk40t/gui/utilitywidgets/checkboxwidget.py +90 -90
  299. meerk40t/gui/utilitywidgets/controlwidget.py +14 -14
  300. meerk40t/gui/utilitywidgets/cyclocycloidwidget.py +343 -340
  301. meerk40t/gui/utilitywidgets/debugwidgets.py +148 -0
  302. meerk40t/gui/utilitywidgets/handlewidget.py +27 -27
  303. meerk40t/gui/utilitywidgets/harmonograph.py +450 -447
  304. meerk40t/gui/utilitywidgets/openclosewidget.py +40 -40
  305. meerk40t/gui/utilitywidgets/rotationwidget.py +54 -54
  306. meerk40t/gui/utilitywidgets/scalewidget.py +75 -75
  307. meerk40t/gui/utilitywidgets/seekbarwidget.py +183 -183
  308. meerk40t/gui/utilitywidgets/togglewidget.py +142 -142
  309. meerk40t/gui/utilitywidgets/toolbarwidget.py +8 -8
  310. meerk40t/gui/wordlisteditor.py +985 -931
  311. meerk40t/gui/wxmeerk40t.py +1447 -1169
  312. meerk40t/gui/wxmmain.py +5644 -4112
  313. meerk40t/gui/wxmribbon.py +1591 -1076
  314. meerk40t/gui/wxmscene.py +1631 -1453
  315. meerk40t/gui/wxmtree.py +2416 -2089
  316. meerk40t/gui/wxutils.py +1769 -1099
  317. meerk40t/gui/zmatrix.py +102 -102
  318. meerk40t/image/__init__.py +1 -1
  319. meerk40t/image/dither.py +429 -0
  320. meerk40t/image/imagetools.py +2793 -2269
  321. meerk40t/internal_plugins.py +150 -130
  322. meerk40t/kernel/__init__.py +63 -12
  323. meerk40t/kernel/channel.py +259 -212
  324. meerk40t/kernel/context.py +538 -538
  325. meerk40t/kernel/exceptions.py +41 -41
  326. meerk40t/kernel/functions.py +463 -414
  327. meerk40t/kernel/jobs.py +100 -100
  328. meerk40t/kernel/kernel.py +3828 -3571
  329. meerk40t/kernel/lifecycles.py +71 -71
  330. meerk40t/kernel/module.py +49 -49
  331. meerk40t/kernel/service.py +147 -147
  332. meerk40t/kernel/settings.py +383 -343
  333. meerk40t/lihuiyu/controller.py +883 -876
  334. meerk40t/lihuiyu/device.py +1181 -1069
  335. meerk40t/lihuiyu/driver.py +1466 -1372
  336. meerk40t/lihuiyu/gui/gui.py +127 -106
  337. meerk40t/lihuiyu/gui/lhyaccelgui.py +377 -363
  338. meerk40t/lihuiyu/gui/lhycontrollergui.py +741 -651
  339. meerk40t/lihuiyu/gui/lhydrivergui.py +470 -446
  340. meerk40t/lihuiyu/gui/lhyoperationproperties.py +238 -237
  341. meerk40t/lihuiyu/gui/tcpcontroller.py +226 -190
  342. meerk40t/lihuiyu/interpreter.py +53 -53
  343. meerk40t/lihuiyu/laserspeed.py +450 -450
  344. meerk40t/lihuiyu/loader.py +90 -90
  345. meerk40t/lihuiyu/parser.py +404 -404
  346. meerk40t/lihuiyu/plugin.py +101 -102
  347. meerk40t/lihuiyu/tcp_connection.py +111 -109
  348. meerk40t/main.py +231 -165
  349. meerk40t/moshi/builder.py +788 -781
  350. meerk40t/moshi/controller.py +505 -499
  351. meerk40t/moshi/device.py +495 -442
  352. meerk40t/moshi/driver.py +862 -696
  353. meerk40t/moshi/gui/gui.py +78 -76
  354. meerk40t/moshi/gui/moshicontrollergui.py +538 -522
  355. meerk40t/moshi/gui/moshidrivergui.py +87 -75
  356. meerk40t/moshi/plugin.py +43 -43
  357. meerk40t/network/console_server.py +140 -57
  358. meerk40t/network/kernelserver.py +10 -9
  359. meerk40t/network/tcp_server.py +142 -140
  360. meerk40t/network/udp_server.py +103 -77
  361. meerk40t/network/web_server.py +404 -0
  362. meerk40t/newly/controller.py +1158 -1144
  363. meerk40t/newly/device.py +874 -732
  364. meerk40t/newly/driver.py +540 -412
  365. meerk40t/newly/gui/gui.py +219 -188
  366. meerk40t/newly/gui/newlyconfig.py +116 -101
  367. meerk40t/newly/gui/newlycontroller.py +193 -186
  368. meerk40t/newly/gui/operationproperties.py +51 -51
  369. meerk40t/newly/mock_connection.py +82 -82
  370. meerk40t/newly/newly_params.py +56 -56
  371. meerk40t/newly/plugin.py +1214 -1246
  372. meerk40t/newly/usb_connection.py +322 -322
  373. meerk40t/rotary/gui/gui.py +52 -46
  374. meerk40t/rotary/gui/rotarysettings.py +240 -232
  375. meerk40t/rotary/rotary.py +202 -98
  376. meerk40t/ruida/control.py +291 -91
  377. meerk40t/ruida/controller.py +138 -1088
  378. meerk40t/ruida/device.py +676 -231
  379. meerk40t/ruida/driver.py +534 -472
  380. meerk40t/ruida/emulator.py +1494 -1491
  381. meerk40t/ruida/exceptions.py +4 -4
  382. meerk40t/ruida/gui/gui.py +71 -76
  383. meerk40t/ruida/gui/ruidaconfig.py +239 -72
  384. meerk40t/ruida/gui/ruidacontroller.py +187 -184
  385. meerk40t/ruida/gui/ruidaoperationproperties.py +48 -47
  386. meerk40t/ruida/loader.py +54 -52
  387. meerk40t/ruida/mock_connection.py +57 -109
  388. meerk40t/ruida/plugin.py +124 -87
  389. meerk40t/ruida/rdjob.py +2084 -945
  390. meerk40t/ruida/serial_connection.py +116 -0
  391. meerk40t/ruida/tcp_connection.py +146 -0
  392. meerk40t/ruida/udp_connection.py +73 -0
  393. meerk40t/svgelements.py +9671 -9669
  394. meerk40t/tools/driver_to_path.py +584 -579
  395. meerk40t/tools/geomstr.py +5583 -4680
  396. meerk40t/tools/jhfparser.py +357 -292
  397. meerk40t/tools/kerftest.py +904 -890
  398. meerk40t/tools/livinghinges.py +1168 -1033
  399. meerk40t/tools/pathtools.py +987 -949
  400. meerk40t/tools/pmatrix.py +234 -0
  401. meerk40t/tools/pointfinder.py +942 -942
  402. meerk40t/tools/polybool.py +941 -940
  403. meerk40t/tools/rasterplotter.py +1660 -547
  404. meerk40t/tools/shxparser.py +1047 -901
  405. meerk40t/tools/ttfparser.py +726 -446
  406. meerk40t/tools/zinglplotter.py +595 -593
  407. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/LICENSE +21 -21
  408. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/METADATA +150 -139
  409. meerk40t-0.9.7020.dist-info/RECORD +446 -0
  410. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/WHEEL +1 -1
  411. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/top_level.txt +0 -1
  412. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/zip-safe +1 -1
  413. meerk40t/balormk/elementlightjob.py +0 -159
  414. meerk40t-0.9.3001.dist-info/RECORD +0 -437
  415. test/bootstrap.py +0 -63
  416. test/test_cli.py +0 -12
  417. test/test_core_cutcode.py +0 -418
  418. test/test_core_elements.py +0 -144
  419. test/test_core_plotplanner.py +0 -397
  420. test/test_core_viewports.py +0 -312
  421. test/test_drivers_grbl.py +0 -108
  422. test/test_drivers_lihuiyu.py +0 -443
  423. test/test_drivers_newly.py +0 -113
  424. test/test_element_degenerate_points.py +0 -43
  425. test/test_elements_classify.py +0 -97
  426. test/test_elements_penbox.py +0 -22
  427. test/test_file_svg.py +0 -176
  428. test/test_fill.py +0 -155
  429. test/test_geomstr.py +0 -1523
  430. test/test_geomstr_nodes.py +0 -18
  431. test/test_imagetools_actualize.py +0 -306
  432. test/test_imagetools_wizard.py +0 -258
  433. test/test_kernel.py +0 -200
  434. test/test_laser_speeds.py +0 -3303
  435. test/test_length.py +0 -57
  436. test/test_lifecycle.py +0 -66
  437. test/test_operations.py +0 -251
  438. test/test_operations_hatch.py +0 -57
  439. test/test_ruida.py +0 -19
  440. test/test_spooler.py +0 -22
  441. test/test_tools_rasterplotter.py +0 -29
  442. test/test_wobble.py +0 -133
  443. test/test_zingl.py +0 -124
  444. {test → meerk40t/cylinder}/__init__.py +0 -0
  445. /meerk40t/{core/element_commands.py → cylinder/gui/__init__.py} +0 -0
  446. {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/entry_points.txt +0 -0
@@ -1,1959 +1,966 @@
1
- """
2
- Galvo Device
3
-
4
- Defines how the balor device interacts with the scene, and accepts data via the spooler.
5
- """
6
- import os
7
- import re
8
- import struct
9
- import time
10
-
11
- from meerk40t.balormk.driver import BalorDriver
12
- from meerk40t.balormk.elementlightjob import ElementLightJob
13
- from meerk40t.balormk.livelightjob import LiveLightJob
14
- from meerk40t.core.laserjob import LaserJob
15
- from meerk40t.core.spoolers import Spooler
16
- from meerk40t.core.units import Angle, Length
17
- from meerk40t.core.view import View
18
- from meerk40t.device.mixins import Status
19
- from meerk40t.kernel import CommandSyntaxError, Service, signal_listener
20
- from meerk40t.svgelements import Path, Point
21
- from meerk40t.tools.geomstr import Geomstr
22
-
23
-
24
- class BalorDevice(Service, Status):
25
- """
26
- The BalorDevice is a MeerK40t service for the device type. It should be the main method of interacting with
27
- the rest of meerk40t. It defines how the scene should look and contains a spooler which meerk40t will give jobs
28
- to. This class additionally defines commands which exist as console commands while this service is activated.
29
- """
30
-
31
- def __init__(self, kernel, path, *args, choices=None, **kwargs):
32
- Service.__init__(self, kernel, path)
33
- Status.__init__(self)
34
- self.name = "balor"
35
- self.extension = "lmc"
36
- self.job = None
37
- if choices is not None:
38
- for c in choices:
39
- attr = c.get("attr")
40
- default = c.get("default")
41
- if attr is not None and default is not None:
42
- setattr(self, attr, default)
43
-
44
- _ = kernel.translation
45
- self.register("frequency", (0, 1000))
46
- self.register(
47
- "format/op cut",
48
- "{danger}{defop}{enabled}{pass}{element_type} {speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
49
- )
50
- self.register(
51
- "format/op engrave",
52
- "{danger}{defop}{enabled}{pass}{element_type} {speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
53
- )
54
- self.register(
55
- "format/op hatch",
56
- "{danger}{defop}{enabled}{penpass}{pass}{element_type} {speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
57
- )
58
- self.register(
59
- "format/op raster",
60
- "{danger}{defop}{enabled}{pass}{element_type}{direction}{speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
61
- )
62
- self.register(
63
- "format/op image",
64
- "{danger}{defop}{enabled}{penvalue}{pass}{element_type}{direction}{speed}mm/s @{power} {frequency}kHz {colcode}",
65
- )
66
- self.register(
67
- "format/op dots",
68
- "{danger}{defop}{enabled}{pass}{element_type} {dwell_time}ms dwell {frequency}kHz {colcode} {opstop}",
69
- )
70
- self.register("format/util console", "{enabled}{command}")
71
- # This device prefers to display power level in percent
72
- self.setting(bool, "use_percent_for_power_display", True)
73
- # Tuple contains 4 value pairs: Speed Low, Speed High, Power Low, Power High, each with enabled, value
74
- self.setting(
75
- list, "dangerlevel_op_cut", (False, 0, False, 0, False, 0, False, 0)
76
- )
77
- self.setting(
78
- list, "dangerlevel_op_engrave", (False, 0, False, 0, False, 0, False, 0)
79
- )
80
- self.setting(
81
- list, "dangerlevel_op_hatch", (False, 0, False, 0, False, 0, False, 0)
82
- )
83
- self.setting(
84
- list, "dangerlevel_op_raster", (False, 0, False, 0, False, 0, False, 0)
85
- )
86
- self.setting(
87
- list, "dangerlevel_op_image", (False, 0, False, 0, False, 0, False, 0)
88
- )
89
- self.setting(
90
- list, "dangerlevel_op_dots", (False, 0, False, 0, False, 0, False, 0)
91
- )
92
- choices = [
93
- {
94
- "attr": "label",
95
- "object": self,
96
- "default": "balor-device",
97
- "type": str,
98
- "label": _("Label"),
99
- "tip": _("What is this device called."),
100
- "section": "_00_General",
101
- "priority": "10",
102
- "signals": "device;renamed",
103
- },
104
- {
105
- "attr": "source",
106
- "object": self,
107
- "default": "fiber",
108
- "type": str,
109
- "style": "combo",
110
- "choices": ["fiber", "co2", "uv"],
111
- "label": _("Laser Source"),
112
- "tip": _("What type of laser is this?"),
113
- },
114
- {
115
- "attr": "corfile_enabled",
116
- "object": self,
117
- "default": False,
118
- "type": bool,
119
- "label": _("Enable"),
120
- "tip": _("Use correction file?"),
121
- "section": "_00_General",
122
- "subsection": "Correction File",
123
- },
124
- {
125
- "attr": "corfile",
126
- "object": self,
127
- "default": None,
128
- "type": str,
129
- "style": "file",
130
- "wildcard": "*.cor",
131
- "conditional": (self, "corfile_enabled"),
132
- "label": _("File"),
133
- "tip": _("Provide a correction file for the machine"),
134
- "weight": 3,
135
- "section": "_00_General",
136
- "subsection": "Correction File",
137
- },
138
- {
139
- "attr": "lens_size",
140
- "object": self,
141
- "default": "110mm",
142
- "type": Length,
143
- "label": _("Width"),
144
- "tip": _("Lens Size"),
145
- "section": "_00_General",
146
- "priority": "20",
147
- "signals": "bedsize",
148
- "nonzero": True,
149
- # intentionally not bed_size
150
- },
151
- {
152
- "attr": "offset_x",
153
- "object": self,
154
- "default": "0mm",
155
- "type": Length,
156
- "label": _("X-Axis"),
157
- "tip": _("Offset in the X axis"),
158
- "section": "_10_Parameters",
159
- "subsection": "_25_Offset",
160
- },
161
- {
162
- "attr": "offset_y",
163
- "object": self,
164
- "default": "0mm",
165
- "type": Length,
166
- "label": _("Y-Axis"),
167
- "tip": _("Offset in the Y axis"),
168
- "section": "_10_Parameters",
169
- "subsection": "_25_Offset",
170
- },
171
- {
172
- "attr": "flip_x",
173
- "object": self,
174
- "default": False,
175
- "type": bool,
176
- "label": _("Flip X"),
177
- "tip": _("Flip the X axis for the Balor device"),
178
- "section": "_10_Parameters",
179
- "subsection": "_10_Axis corrections",
180
- "signals": "bedsize",
181
- },
182
- {
183
- "attr": "flip_y",
184
- "object": self,
185
- "default": True,
186
- "type": bool,
187
- "label": _("Flip Y"),
188
- "tip": _("Flip the Y axis for the Balor device"),
189
- "section": "_10_Parameters",
190
- "subsection": "_10_Axis corrections",
191
- "signals": "bedsize",
192
- },
193
- {
194
- "attr": "swap_xy",
195
- "object": self,
196
- "default": True,
197
- "type": bool,
198
- "label": _("Swap XY"),
199
- "tip": _("Swap the X and Y axis for the device"),
200
- "section": "_10_Parameters",
201
- "subsection": "_10_Axis corrections",
202
- },
203
- {
204
- "attr": "interpolate",
205
- "object": self,
206
- "default": 50,
207
- "type": int,
208
- "label": _("Curve Interpolation"),
209
- "section": "_10_Parameters",
210
- "tip": _("Number of curve interpolation points"),
211
- },
212
- {
213
- "attr": "mock",
214
- "object": self,
215
- "default": False,
216
- "type": bool,
217
- "label": _("Run mock-usb backend"),
218
- "tip": _(
219
- "This starts connects to fake software laser rather than real one for debugging."
220
- ),
221
- "section": "_00_General",
222
- "priority": "30",
223
- },
224
- {
225
- "attr": "machine_index",
226
- "object": self,
227
- "default": 0,
228
- "type": int,
229
- "label": _("Machine index to select"),
230
- "tip": _(
231
- "Which machine should we connect to? -- Leave at 0 if you have 1 machine."
232
- ),
233
- "section": "_00_General",
234
- },
235
- {
236
- "attr": "footpedal_pin",
237
- "object": self,
238
- "default": 15,
239
- "type": int,
240
- "label": _("Footpedal"),
241
- "tip": _("What pin is your foot pedal hooked to on the GPIO"),
242
- "section": "_10_Parameters",
243
- "subsection": "_30_Pin-Index",
244
- },
245
- {
246
- "attr": "light_pin",
247
- "object": self,
248
- "default": 8,
249
- "type": int,
250
- "label": _("Redlight laser"),
251
- "tip": _("What pin is your redlight hooked to on the GPIO"),
252
- "section": "_10_Parameters",
253
- "subsection": "_30_Pin-Index",
254
- },
255
- ]
256
- self.register_choices("balor", choices)
257
-
258
- choices = [
259
- {
260
- "attr": "redlight_speed",
261
- "object": self,
262
- "default": "3000",
263
- "type": int,
264
- "label": _("Redlight travel speed"),
265
- "tip": _("Speed of the galvo when using the red laser."),
266
- },
267
- {
268
- "attr": "redlight_offset_x",
269
- "object": self,
270
- "default": "0mm",
271
- "type": Length,
272
- "label": _("X-Offset"),
273
- "tip": _("Offset the redlight positions by this amount in x"),
274
- "subsection": "Redlight-Offset",
275
- },
276
- {
277
- "attr": "redlight_offset_y",
278
- "object": self,
279
- "default": "0mm",
280
- "type": Length,
281
- "label": _("Y-Offset"),
282
- "tip": _("Offset the redlight positions by this amount in y"),
283
- "subsection": "Redlight-Offset",
284
- },
285
- {
286
- "attr": "redlight_angle",
287
- "object": self,
288
- "default": "0deg",
289
- "type": Angle,
290
- "label": _("Angle Offset"),
291
- "tip": _(
292
- "Offset the redlight positions by this angle, curving around center"
293
- ),
294
- "subsection": "Redlight-Offset",
295
- },
296
- {
297
- "attr": "redlight_preferred",
298
- "object": self,
299
- "default": False,
300
- "type": bool,
301
- "label": _("Prefer redlight on"),
302
- "tip": _(
303
- "Redlight preference will turn toggleable redlights on after a job completes."
304
- ),
305
- "priority": "0",
306
- },
307
- ]
308
- self.register_choices("balor-redlight", choices)
309
-
310
- choices = [
311
- {
312
- "attr": "default_power",
313
- "object": self,
314
- "default": 50.0,
315
- "type": float,
316
- "label": _("Laser Power"),
317
- "trailer": "%",
318
- "tip": _("What power level do we cut at?"),
319
- },
320
- {
321
- "attr": "default_speed",
322
- "object": self,
323
- "default": 100.0,
324
- "type": float,
325
- "trailer": "mm/s",
326
- "label": _("Cut Speed"),
327
- "tip": _("How fast do we cut?"),
328
- },
329
- {
330
- "attr": "default_frequency",
331
- "object": self,
332
- "default": 30.0,
333
- "type": float,
334
- "trailer": "kHz",
335
- "label": _("Q Switch Frequency"),
336
- "tip": _("QSwitch Frequency value"),
337
- },
338
- {
339
- "attr": "default_fpk",
340
- "object": self,
341
- "default": 10.0,
342
- "type": float,
343
- "trailer": "%",
344
- "label": _("First Pulse Killer"),
345
- "conditional": (self, "source", "co2"),
346
- "tip": _("Percent of First Pulse Killer for co2 source"),
347
- },
348
- {
349
- "attr": "default_rapid_speed",
350
- "object": self,
351
- "default": 2000.0,
352
- "type": float,
353
- "label": _("Travel Speed"),
354
- "trailer": "mm/s",
355
- "tip": _("How fast do we travel when not cutting?"),
356
- },
357
- {
358
- "attr": "pulse_width_enabled",
359
- "object": self,
360
- "default": False,
361
- "type": bool,
362
- "label": _("Enable"),
363
- "tip": _("Enable using Pulse Width (MOPA)"),
364
- # "conditional": (self, "source", "fiber"),
365
- "subsection": "Pulse Width",
366
- },
367
- {
368
- "attr": "default_pulse_width",
369
- "object": self,
370
- "default": 4,
371
- "type": int,
372
- "style": "combo",
373
- "choices": [
374
- 1,
375
- 2,
376
- 4,
377
- 6,
378
- 9,
379
- 13,
380
- 20,
381
- 30,
382
- 45,
383
- 55,
384
- 60,
385
- 80,
386
- 100,
387
- 150,
388
- 200,
389
- 250,
390
- ],
391
- "conditional": (self, "pulse_width_enabled"),
392
- "label": _("Set Pulse Width (ns)"),
393
- "trailer": "ns",
394
- "tip": _("Set the MOPA pulse width setting"),
395
- "subsection": "Pulse Width",
396
- },
397
- ]
398
- self.register_choices("balor-global", choices)
399
-
400
- choices = [
401
- {
402
- "attr": "delay_laser_on",
403
- "object": self,
404
- "default": 100.0,
405
- "type": float,
406
- "label": _("Laser On"),
407
- "trailer": "µs",
408
- "tip": _(
409
- "Start delay (Start TC) at the beginning of each mark command"
410
- ),
411
- "section": "_10_General",
412
- "subsection": "Delays",
413
- "priority": "00",
414
- },
415
- {
416
- "attr": "delay_laser_off",
417
- "object": self,
418
- "default": 100.0,
419
- "type": float,
420
- "label": _("Laser Off"),
421
- "trailer": "µs",
422
- "tip": _(
423
- "The delay time of the laser shutting down after marking finished"
424
- ),
425
- "section": "_10_General",
426
- "subsection": "Delays",
427
- "priority": "10",
428
- },
429
- {
430
- "attr": "delay_polygon",
431
- "object": self,
432
- "default": 100.0,
433
- "type": float,
434
- "label": _("Polygon Delay"),
435
- "trailer": "µs",
436
- "tip": _("Delay amount between different points in the path travel."),
437
- "section": "_10_General",
438
- "subsection": "Delays",
439
- "priority": "30",
440
- },
441
- {
442
- "attr": "delay_end",
443
- "object": self,
444
- "default": 300.0,
445
- "type": float,
446
- "label": _("End Delay"),
447
- "trailer": "µs",
448
- "tip": _("Delay amount for the end TC"),
449
- "section": "_10_General",
450
- "subsection": "Delays",
451
- "priority": "20",
452
- },
453
- {
454
- "attr": "delay_jump_long",
455
- "object": self,
456
- "default": 200.0,
457
- "type": float,
458
- "label": _("Long jump delay"),
459
- "trailer": "µs",
460
- "tip": _("Delay for a long jump distance"),
461
- "section": "_10_General",
462
- "subsection": "Jump-Settings",
463
- },
464
- {
465
- "attr": "delay_jump_short",
466
- "object": self,
467
- "default": 8,
468
- "type": float,
469
- "label": _("Short jump delay"),
470
- "trailer": "µs",
471
- "tip": _("Delay for a short jump distance"),
472
- "section": "_10_General",
473
- "subsection": "Jump-Settings",
474
- },
475
- {
476
- "attr": "delay_distance_long",
477
- "object": self,
478
- "default": "10mm",
479
- "type": Length,
480
- "label": _("Long jump distance"),
481
- "tip": _("Distance divide between long and short jump distances"),
482
- "section": "_10_General",
483
- "subsection": "Jump-Settings",
484
- },
485
- {
486
- "attr": "delay_openmo",
487
- "object": self,
488
- "default": 8.0,
489
- "type": float,
490
- "label": _("Open MO delay"),
491
- "trailer": "ms",
492
- "tip": _("OpenMO delay in ms"),
493
- "section": "_90_Other",
494
- },
495
- ]
496
- self.register_choices("balor-global-timing", choices)
497
-
498
- choices = [
499
- {
500
- "attr": "first_pulse_killer",
501
- "object": self,
502
- "default": 200,
503
- "type": int,
504
- "label": _("First Pulse Killer"),
505
- "trailer": "µs",
506
- "tip": _(
507
- "First Pulse Killer (F.P.K): the lasting time for the first pulse suppress"
508
- ),
509
- "section": "First Pulse Killer",
510
- },
511
- {
512
- "attr": "pwm_half_period",
513
- "object": self,
514
- "default": 125,
515
- "type": int,
516
- "label": _("PWM Half Period"),
517
- "tip": _("Pulse Period: the frequency of the preionization signal"),
518
- "subsection": "Pulse-Width-Modulation",
519
- },
520
- {
521
- "attr": "pwm_pulse_width",
522
- "object": self,
523
- "default": 125,
524
- "type": int,
525
- "label": _("PWM Pulse Width"),
526
- "tip": _("Pulse Width: the pulse width of the preionization signal"),
527
- "subsection": "Pulse-Width-Modulation",
528
- },
529
- {
530
- "attr": "standby_param_1",
531
- "object": self,
532
- "default": 2000,
533
- "type": int,
534
- "label": _("Parameter 1"),
535
- # "tip": _(""),
536
- "subsection": "Standby-Parameter",
537
- },
538
- {
539
- "attr": "standby_param_2",
540
- "object": self,
541
- "default": 20,
542
- "type": int,
543
- "label": _("Parameter 2"),
544
- # "tip": _(""),
545
- "subsection": "Standby-Parameter",
546
- },
547
- {
548
- "attr": "timing_mode",
549
- "object": self,
550
- "default": 1,
551
- "type": int,
552
- "label": _("Timing Mode"),
553
- # "tip": _(""),
554
- "subsection": "Modes",
555
- },
556
- {
557
- "attr": "delay_mode",
558
- "object": self,
559
- "default": 1,
560
- "type": int,
561
- "label": _("Delay Mode"),
562
- # "tip": _(""),
563
- "subsection": "Modes",
564
- },
565
- {
566
- "attr": "laser_mode",
567
- "object": self,
568
- "default": 1,
569
- "type": int,
570
- "label": _("Laser Mode"),
571
- # "tip": _(""),
572
- "subsection": "Modes",
573
- },
574
- {
575
- "attr": "control_mode",
576
- "object": self,
577
- "default": 0,
578
- "type": int,
579
- "label": _("Control Mode"),
580
- # "tip": _(""),
581
- "subsection": "Modes",
582
- },
583
- {
584
- "attr": "fpk2_p1",
585
- "object": self,
586
- "default": 0xFFB,
587
- "type": int,
588
- "label": _("Max Voltage"),
589
- # "tip": _(""),
590
- "trailer": "V",
591
- "section": "First Pulse Killer",
592
- "subsection": "Parameters",
593
- },
594
- {
595
- "attr": "fpk2_p2",
596
- "object": self,
597
- "default": 1,
598
- "type": int,
599
- "label": _("Min Voltage"),
600
- "trailer": "V",
601
- # "tip": _(""),
602
- "section": "First Pulse Killer",
603
- "subsection": "Parameters",
604
- },
605
- {
606
- "attr": "fpk2_p3",
607
- "object": self,
608
- "default": 409,
609
- "type": int,
610
- "label": _("T1"),
611
- "trailer": "µs",
612
- # "tip": _(""),
613
- "section": "First Pulse Killer",
614
- "subsection": "Parameters",
615
- },
616
- {
617
- "attr": "fpk2_p4",
618
- "object": self,
619
- "default": 100,
620
- "type": int,
621
- "label": _("T2"),
622
- "trailer": "µs",
623
- # "tip": _(""),
624
- "section": "First Pulse Killer",
625
- "subsection": "Parameters",
626
- },
627
- {
628
- "attr": "fly_res_p1",
629
- "object": self,
630
- "default": 0,
631
- "type": int,
632
- "label": _("Param 1"),
633
- # "tip": _(""),
634
- "subsection": "Fly Resolution",
635
- },
636
- {
637
- "attr": "fly_res_p2",
638
- "object": self,
639
- "default": 99,
640
- "type": int,
641
- "label": _("Param 2"),
642
- # "tip": _(""),
643
- "subsection": "Fly Resolution",
644
- },
645
- {
646
- "attr": "fly_res_p3",
647
- "object": self,
648
- "default": 1000,
649
- "type": int,
650
- "label": _("Param 3"),
651
- # "tip": _(""),
652
- "subsection": "Fly Resolution",
653
- },
654
- {
655
- "attr": "fly_res_p4",
656
- "object": self,
657
- "default": 25,
658
- "type": int,
659
- "label": _("Param 4"),
660
- # "tip": _(""),
661
- "subsection": "Fly Resolution",
662
- },
663
- {
664
- "attr": "input_passes_required",
665
- "object": self,
666
- "default": 3,
667
- "type": int,
668
- "label": _("Input Signal Hold"),
669
- "tip": _(
670
- "How long does the input operation need to hold for to count as a pass"
671
- ),
672
- },
673
- {
674
- "attr": "input_operation_hardware",
675
- "object": self,
676
- "default": False,
677
- "type": bool,
678
- "label": _("Input Operation Hardware"),
679
- "tip": _("Use hardware based input operation command"),
680
- },
681
- ]
682
- self.register_choices("balor-extra", choices)
683
- choices = [
684
- {
685
- "attr": "rotary_active",
686
- "object": self,
687
- "default": False,
688
- "type": bool,
689
- "label": _("Rotary-Mode active"),
690
- "tip": _("Is the rotary mode active for this device"),
691
- },
692
- {
693
- "attr": "rotary_scale_x",
694
- "object": self,
695
- "default": 1.0,
696
- "type": float,
697
- "label": _("X-Scale"),
698
- "tip": _("Scale that needs to be applied to the X-Axis"),
699
- "conditional": (self, "rotary_active"),
700
- "subsection": _("Scale"),
701
- },
702
- {
703
- "attr": "rotary_scale_y",
704
- "object": self,
705
- "default": 1.0,
706
- "type": float,
707
- "label": _("Y-Scale"),
708
- "tip": _("Scale that needs to be applied to the Y-Axis"),
709
- "conditional": (self, "rotary_active"),
710
- "subsection": _("Scale"),
711
- },
712
- {
713
- "attr": "rotary_supress_home",
714
- "object": self,
715
- "default": False,
716
- "type": bool,
717
- "label": _("Ignore Home"),
718
- "tip": _("Ignore Home-Command"),
719
- "conditional": (self, "rotary_active"),
720
- },
721
- {
722
- "attr": "rotary_mirror_x",
723
- "object": self,
724
- "default": False,
725
- "type": bool,
726
- "label": _("Mirror X"),
727
- "tip": _("Mirror the elements on the X-Axis"),
728
- "conditional": (self, "rotary_active"),
729
- "subsection": _("Mirror Output"),
730
- },
731
- {
732
- "attr": "rotary_mirror_y",
733
- "object": self,
734
- "default": False,
735
- "type": bool,
736
- "label": _("Mirror Y"),
737
- "tip": _("Mirror the elements on the Y-Axis"),
738
- "conditional": (self, "rotary_active"),
739
- "subsection": _("Mirror Output"),
740
- },
741
- ]
742
- self.register_choices("rotary", choices)
743
-
744
- self.state = 0
745
-
746
- unit_size = float(Length(self.lens_size))
747
- galvo_range = 0xFFFF
748
- units_per_galvo = unit_size / galvo_range
749
- self.view = View(
750
- self.lens_size,
751
- self.lens_size,
752
- native_scale_x=units_per_galvo,
753
- native_scale_y=units_per_galvo,
754
- )
755
- self.view.transform(
756
- flip_x=self.flip_x,
757
- flip_y=self.flip_y,
758
- swap_xy=self.swap_xy,
759
- )
760
- self.spooler = Spooler(self)
761
- self.driver = BalorDriver(self)
762
- self.spooler.driver = self.driver
763
-
764
- self.add_service_delegate(self.spooler)
765
-
766
- self.viewbuffer = ""
767
-
768
- @self.console_option(
769
- "travel_speed", "t", type=float, help="Set the travel speed."
770
- )
771
- @self.console_option(
772
- "jump_delay",
773
- "d",
774
- type=float,
775
- default=200.0,
776
- help="Sets the jump delay for light travel moves",
777
- )
778
- @self.console_option(
779
- "simulation_speed",
780
- "m",
781
- type=float,
782
- help="sets the simulation speed for this operation",
783
- )
784
- @self.console_option(
785
- "quantization",
786
- "Q",
787
- type=int,
788
- default=500,
789
- help="Number of line segments to break this path into",
790
- )
791
- @self.console_command(
792
- ("light", "light-simulate"),
793
- input_type="geometry",
794
- help=_("runs light on events."),
795
- )
796
- def light(
797
- command,
798
- channel,
799
- _,
800
- travel_speed=None,
801
- jump_delay=200,
802
- simulation_speed=None,
803
- quantization=500,
804
- data=None,
805
- **kwgs,
806
- ):
807
- """
808
- Creates a shape based light job for use with the Galvo driver
809
- """
810
- if data is None:
811
- channel("Nothing sent")
812
- return
813
- self.job = ElementLightJob(
814
- self,
815
- data,
816
- travel_speed=travel_speed,
817
- jump_delay=jump_delay,
818
- simulation_speed=simulation_speed,
819
- quantization=quantization,
820
- simulate=bool(command != "light"),
821
- )
822
- self.spooler.send(self.job)
823
-
824
- @self.console_command(
825
- "select-light", help=_("Execute selection light idle job")
826
- )
827
- def select_light(**kwargs):
828
- """
829
- Start a live bounds job.
830
- """
831
- # Live Bounds Job.
832
- if self.job is not None:
833
- self.job.stop()
834
- self.job = LiveLightJob(self, mode="bounds")
835
- self.spooler.send(self.job)
836
-
837
- @self.console_command("full-light", help=_("Execute full light idle job"))
838
- def full_light(**kwargs):
839
- if self.job is not None:
840
- self.job.stop()
841
- self.job = LiveLightJob(self)
842
- self.spooler.send(self.job)
843
-
844
- @self.console_command(
845
- "regmark-light", help=_("Execute regmark live light idle job")
846
- )
847
- def reg_light(**kwargs):
848
- if self.job is not None:
849
- self.job.stop()
850
- self.job = LiveLightJob(self, mode="regmarks")
851
- self.spooler.send(self.job)
852
-
853
- @self.console_command(
854
- "hull-light", help=_("Execute convex hull light idle job")
855
- )
856
- def hull_light(**kwargs):
857
- if self.job is not None:
858
- self.job.stop()
859
- self.job = LiveLightJob(self, mode="hull")
860
- self.spooler.send(self.job)
861
-
862
- @self.console_command(
863
- "stop",
864
- help=_("stops the idle running job"),
865
- )
866
- def stoplight(command, channel, _, data=None, remainder=None, **kwgs):
867
- if self.job is None:
868
- channel("No job is currently set")
869
- return
870
- channel("Stopping idle job")
871
- self.job.stop()
872
-
873
- @self.console_command(
874
- "estop",
875
- help=_("stops the current job, deletes the spooler"),
876
- input_type=None,
877
- )
878
- def estop(command, channel, _, data=None, remainder=None, **kwgs):
879
- channel("Stopping Job")
880
- if self.job is not None:
881
- self.job.stop()
882
- self.spooler.clear_queue()
883
- self.driver.set_abort()
884
- try:
885
- channel("Resetting controller.")
886
- self.driver.reset()
887
- self.signal("pause")
888
- except ConnectionRefusedError:
889
- pass
890
-
891
- @self.console_command(
892
- "pause",
893
- help=_("Pauses the currently running job"),
894
- )
895
- def pause(command, channel, _, data=None, remainder=None, **kwgs):
896
- if self.driver.paused:
897
- channel("Resuming current job")
898
- else:
899
- channel("Pausing current job")
900
- try:
901
- self.driver.pause()
902
- except ConnectionRefusedError:
903
- channel(_("Could not contact Galvo laser."))
904
- self.signal("pause")
905
-
906
- @self.console_command(
907
- "resume",
908
- help=_("Resume the currently running job"),
909
- )
910
- def resume(command, channel, _, data=None, remainder=None, **kwgs):
911
- channel("Resume the current job")
912
- try:
913
- self.driver.resume()
914
- except ConnectionRefusedError:
915
- channel(_("Could not contact Galvo laser."))
916
- self.signal("pause")
917
-
918
- @self.console_option(
919
- "idonotlovemyhouse",
920
- type=bool,
921
- action="store_true",
922
- help=_("override one second laser fire pulse duration"),
923
- )
924
- @self.console_argument("time", type=float, help=_("laser fire pulse duration"))
925
- @self.console_command(
926
- "pulse",
927
- help=_("pulse <time>: Pulse the laser in place."),
928
- )
929
- def pulse(command, channel, _, time=None, idonotlovemyhouse=False, **kwargs):
930
- if time is None:
931
- channel(_("Must specify a pulse time in milliseconds."))
932
- return
933
- if time > 1000.0:
934
- channel(
935
- _(
936
- '"{time}ms" exceeds 1 second limit to fire a standing laser.'
937
- ).format(time=time)
938
- )
939
- try:
940
- if not idonotlovemyhouse:
941
- return
942
- except IndexError:
943
- return
944
- if self.spooler.is_idle:
945
- self.spooler.command("pulse", time)
946
- channel(_("Pulse laser for {time} milliseconds").format(time=time))
947
- else:
948
- channel(_("Pulse laser failed: Busy"))
949
- return
950
-
951
- @self.console_command(
952
- "usb_connect",
953
- help=_("connect usb"),
954
- )
955
- def usb_connect(command, channel, _, data=None, remainder=None, **kwgs):
956
- self.spooler.command("connect", priority=1)
957
-
958
- @self.console_command(
959
- "usb_disconnect",
960
- help=_("connect usb"),
961
- )
962
- def usb_disconnect(command, channel, _, data=None, remainder=None, **kwgs):
963
- self.spooler.command("disconnect", priority=1)
964
-
965
- @self.console_command("usb_abort", help=_("Stops USB retries"))
966
- def usb_abort(command, channel, _, **kwargs):
967
- self.spooler.command("abort_retry", priority=1)
968
-
969
- @self.console_argument("filename", type=str)
970
- @self.console_command("save_job", help=_("save job export"), input_type="plan")
971
- def galvo_save(channel, _, filename, data=None, **kwargs):
972
- if filename is None:
973
- raise CommandSyntaxError
974
- try:
975
- with open(filename, "w") as f:
976
- driver = BalorDriver(self, force_mock=True)
977
- job = LaserJob(filename, list(data.plan), driver=driver)
978
- from meerk40t.balormk.controller import list_command_lookup
979
-
980
- def write(index, cmd):
981
- cmds = [
982
- struct.unpack("<6H", cmd[i : i + 12])
983
- for i in range(0, len(cmd), 12)
984
- ]
985
- for v in cmds:
986
- if v[0] >= 0x8000:
987
- f.write(
988
- f"{list_command_lookup.get(v[0], f'{v[0]:04x}').ljust(20)} "
989
- f"{v[1]:04x} {v[2]:04x} {v[3]:04x} {v[4]:04x} {v[5]:04x}\n"
990
- )
991
- if v[0] == 0x8002:
992
- break
993
-
994
- driver.connection.connect_if_needed()
995
- driver.connection.connection.write = write
996
- job.execute()
997
-
998
- except (PermissionError, OSError):
999
- channel(_("Could not save: {filename}").format(filename=filename))
1000
-
1001
- @self.console_option(
1002
- "default",
1003
- "d",
1004
- help=_("Allow default list commands to persist within the raw command"),
1005
- type=bool,
1006
- action="store_true",
1007
- )
1008
- @self.console_option(
1009
- "raw",
1010
- "r",
1011
- help=_("Data is explicitly little-ended hex from a data capture"),
1012
- type=bool,
1013
- action="store_true",
1014
- )
1015
- @self.console_option(
1016
- "binary_in",
1017
- "b",
1018
- help=_("Read data is explicitly in binary"),
1019
- type=bool,
1020
- action="store_true",
1021
- )
1022
- @self.console_option(
1023
- "binary_out",
1024
- "B",
1025
- help=_("Write data should be explicitly in binary"),
1026
- type=bool,
1027
- action="store_true",
1028
- )
1029
- @self.console_option(
1030
- "short",
1031
- "s",
1032
- help=_("Export data is assumed short command only"),
1033
- type=bool,
1034
- action="store_true",
1035
- )
1036
- @self.console_option(
1037
- "hard",
1038
- "h",
1039
- help=_("Do not send regular list protocol commands"),
1040
- type=bool,
1041
- action="store_true",
1042
- )
1043
- @self.console_option(
1044
- "trim",
1045
- "t",
1046
- help=_("Trim the first number of characters"),
1047
- type=int,
1048
- )
1049
- @self.console_option(
1050
- "input", "i", type=str, default=None, help="input data for given file"
1051
- )
1052
- @self.console_option(
1053
- "output", "o", type=str, default=None, help="output data to given file"
1054
- )
1055
- @self.console_command(
1056
- "raw",
1057
- help=_("sends raw galvo list command exactly as composed"),
1058
- )
1059
- def galvo_raw(
1060
- channel,
1061
- _,
1062
- default=False,
1063
- raw=False,
1064
- binary_in=False,
1065
- binary_out=False,
1066
- short=False,
1067
- hard=False,
1068
- trim=0,
1069
- input=None,
1070
- output=None,
1071
- remainder=None,
1072
- **kwgs,
1073
- ):
1074
- """
1075
- Raw for galvo performs raw actions and sends these commands directly to the laser.
1076
- There are methods for reading and writing raw info from files in order to send that
1077
- data. You can also use shorthand commands.
1078
- """
1079
- from meerk40t.balormk.controller import (
1080
- list_command_lookup,
1081
- single_command_lookup,
1082
- )
1083
-
1084
- # Establish reverse lookup for string commands to binary command.
1085
- reverse_lookup = {}
1086
- for k in list_command_lookup:
1087
- command_string = list_command_lookup[k]
1088
- reverse_lookup[command_string] = k
1089
- reverse_lookup[command_string.lower()[4:]] = k
1090
-
1091
- for k in single_command_lookup:
1092
- command_string = single_command_lookup[k]
1093
- reverse_lookup[command_string] = k
1094
- reverse_lookup[command_string.lower()] = k
1095
-
1096
- if remainder is None and input is None:
1097
- # "raw" was typed without any data or input file, so we list the permitted commands
1098
- channel("Permitted List Commands:")
1099
- for k in list_command_lookup:
1100
- command_string = list_command_lookup[k]
1101
- channel(f"{command_string.lower()[4:]} aka {k:04x}")
1102
- channel("----------------------------")
1103
-
1104
- channel("Permitted Short Commands:")
1105
- for k in single_command_lookup:
1106
- command_string = single_command_lookup[k]
1107
- channel(f"{command_string.lower()} aka {k:04x}")
1108
- return
1109
-
1110
- if input is not None:
1111
- # We were given an input file. We load that data, in either binary plain text.
1112
- from os.path import exists
1113
-
1114
- if exists(input):
1115
- channel(f"Loading data from: {input}")
1116
- try:
1117
- if binary_in:
1118
- with open(input, "br") as f:
1119
- remainder = f.read().hex()
1120
- else:
1121
- with open(input) as f:
1122
- remainder = f.read()
1123
- except OSError:
1124
- channel("File could not be read.")
1125
- else:
1126
- channel(f"The file at {os.path.realpath(input)} does not exist.")
1127
- return
1128
-
1129
- cmds = None
1130
- if raw or binary_in:
1131
- # Our data is 6 values int16le
1132
- if trim:
1133
- # Used to cut off raw header data
1134
- remainder = remainder[trim:]
1135
- try:
1136
- cmds = [
1137
- struct.unpack("<6H", bytearray.fromhex(remainder[i : i + 24]))
1138
- for i in range(0, len(remainder), 24)
1139
- ]
1140
- cmds = [
1141
- f"{v[0]:04x} {v[1]:04x} {v[2]:04x} {v[3]:04x} {v[4]:04x} {v[5]:04x}"
1142
- for v in cmds
1143
- ]
1144
- except (struct.error, ValueError) as e:
1145
- channel(f"Data was declared raw but could not parse because '{e}'")
1146
-
1147
- if cmds is None:
1148
- cmds = list(re.split(r"[,\n\r]", remainder))
1149
-
1150
- raw_commands = list()
1151
-
1152
- # Compile commands.
1153
- for cmd_i, cmd in enumerate(cmds):
1154
- cmd = cmd.strip()
1155
- if not cmd:
1156
- continue
1157
-
1158
- values = [0] * 6
1159
- byte_i = 0
1160
- split_bytes = [b for b in cmd.split(" ") if b.strip()]
1161
- if len(split_bytes) > 6:
1162
- channel(
1163
- f"Invalid command line {cmd_i}: {split_bytes} has more than six entries."
1164
- )
1165
- return
1166
- for b in split_bytes:
1167
- v = None
1168
- convert = reverse_lookup.get(b)
1169
- if convert is not None:
1170
- v = int(convert)
1171
- else:
1172
- try:
1173
- p = struct.unpack(">H", bytearray.fromhex(b))
1174
- v = p[0]
1175
- except (ValueError, struct.error):
1176
- pass
1177
- if not isinstance(v, int):
1178
- channel(f'Compile error. Line #{cmd_i+1} value "{b}"')
1179
- return
1180
- values[byte_i] = v
1181
- byte_i += 1
1182
- raw_commands.append(values)
1183
-
1184
- if output is not None:
1185
- # Output to file
1186
- channel(f"Writing data to: {output}")
1187
- try:
1188
- if binary_out:
1189
- with open(output, "wb") as f:
1190
- for v in raw_commands:
1191
- b_data = struct.pack("<6H", *v)
1192
- f.write(b_data)
1193
- else:
1194
- lines = []
1195
- for v in raw_commands:
1196
- lines.append(
1197
- f"{list_command_lookup.get(v[0], f'{v[0]:04x}').ljust(20)} "
1198
- f"{v[1]:04x} {v[2]:04x} {v[3]:04x} {v[4]:04x} {v[5]:04x}\n"
1199
- )
1200
- with open(output, "w") as f:
1201
- f.writelines(lines)
1202
- except OSError:
1203
- channel("File could not be written.")
1204
- return # If we output to file, we do not output to device.
1205
-
1206
- # OUTPUT TO DEVICE
1207
- if hard:
1208
- # Hard raw mode, disable any control values being sent.
1209
- self.driver.connection.raw_mode()
1210
- if not default:
1211
- self.driver.connection.raw_clear()
1212
- for v in raw_commands:
1213
- command = v[0]
1214
- if command >= 0x8000:
1215
- self.driver.connection._list_write(*v)
1216
- else:
1217
- self.driver.connection._list_end()
1218
- self.driver.connection._command(*v)
1219
- return
1220
-
1221
- if short:
1222
- # Short mode only sending pure shorts.
1223
- for v in raw_commands:
1224
- self.driver.connection.raw_write(*v)
1225
- return
1226
-
1227
- # Hybrid mode. Sending list and short commands using the right mode changes.
1228
- self.driver.connection.rapid_mode()
1229
- self.driver.connection.program_mode()
1230
- if not default:
1231
- self.driver.connection.raw_clear()
1232
- for v in raw_commands:
1233
- command = v[0]
1234
- if command >= 0x8000:
1235
- self.driver.connection.program_mode()
1236
- self.driver.connection._list_write(*v)
1237
- else:
1238
- self.driver.connection.rapid_mode()
1239
- self.driver.connection._command(*v)
1240
- self.driver.connection.rapid_mode()
1241
-
1242
- @self.console_argument("x", type=float, default=0.0)
1243
- @self.console_argument("y", type=float, default=0.0)
1244
- @self.console_command(
1245
- "goto",
1246
- help=_("send laser a goto command"),
1247
- )
1248
- def galvo_goto(command, channel, _, x=None, y=None, remainder=None, **kwgs):
1249
- if x is not None and y is not None:
1250
- rx = int(0x8000 + x) & 0xFFFF
1251
- ry = int(0x8000 + y) & 0xFFFF
1252
- self.driver.connection.set_xy(rx, ry)
1253
-
1254
- @self.console_option("minspeed", "n", type=int, default=100)
1255
- @self.console_option("maxspeed", "x", type=int, default=5000)
1256
- @self.console_option("acc_time", "a", type=int, default=100)
1257
- @self.console_argument("position", type=int, default=0)
1258
- @self.console_command(
1259
- "rotary_to",
1260
- help=_("Send laser rotary command info."),
1261
- all_arguments_required=True,
1262
- )
1263
- def galvo_rotary(
1264
- command, channel, _, position, minspeed, maxspeed, acc_time, **kwgs
1265
- ):
1266
- self.driver.connection.set_axis_motion_param(
1267
- minspeed & 0xFFFF, maxspeed & 0xFFFF
1268
- )
1269
- self.driver.connection.set_axis_origin_param(acc_time) # Unsure why 100.
1270
- pos = position if position >= 0 else -position + 0x80000000
1271
- p1 = (pos >> 16) & 0xFFFF
1272
- p0 = pos & 0xFFFF
1273
- self.driver.connection.move_axis_to(p0, p1)
1274
- self.driver.connection.wait_axis()
1275
-
1276
- @self.console_option("minspeed", "n", type=int, default=100)
1277
- @self.console_option("maxspeed", "x", type=int, default=5000)
1278
- @self.console_option("acc_time", "a", type=int, default=100)
1279
- @self.console_argument(
1280
- "delta_rotary", type=int, default=0, help="relative amount"
1281
- )
1282
- @self.console_command(
1283
- "rotary_relative",
1284
- help=_("Advance the rotary by the given amount"),
1285
- all_arguments_required=True,
1286
- )
1287
- def galvo_rotary_advance(
1288
- command, channel, _, delta_rotary, minspeed, maxspeed, acc_time, **kwgs
1289
- ):
1290
- pos_args = self.driver.connection.get_axis_pos()
1291
- current = pos_args[1] | pos_args[2] << 16
1292
- if current > 0x80000000:
1293
- current = -current + 0x80000000
1294
- position = current + delta_rotary
1295
-
1296
- self.driver.connection.set_axis_motion_param(
1297
- minspeed & 0xFFFF, maxspeed & 0xFFFF
1298
- )
1299
- self.driver.connection.set_axis_origin_param(acc_time) # Unsure why 100.
1300
- pos = position if position >= 0 else -position + 0x80000000
1301
- p1 = (pos >> 16) & 0xFFFF
1302
- p0 = pos & 0xFFFF
1303
- self.driver.connection.move_axis_to(p0, p1)
1304
- self.driver.connection.wait_axis()
1305
-
1306
- @self.console_option("axis_index", "i", type=int, default=0)
1307
- @self.console_command(
1308
- "rotary_pos",
1309
- help=_("Check the rotary position"),
1310
- )
1311
- def galvo_rotary_pos(command, channel, _, axis_index=0, **kwgs):
1312
- pos_args = self.driver.connection.get_axis_pos(axis_index)
1313
- if pos_args is None:
1314
- channel("Not connected, cannot get axis pos.")
1315
- return
1316
- current = pos_args[1] | pos_args[2] << 16
1317
- if current > 0x80000000:
1318
- current = -current + 0x80000000
1319
- channel(f"Rotary Position: {current}")
1320
-
1321
- @self.console_argument("off", type=str)
1322
- @self.console_command(
1323
- "red",
1324
- help=_("Turns redlight on/off"),
1325
- )
1326
- def galvo_on(command, channel, _, off=None, remainder=None, **kwgs):
1327
- try:
1328
- if off == "off":
1329
- reply = self.driver.connection.light_off()
1330
- self.driver.connection.write_port()
1331
- self.redlight_preferred = False
1332
- channel("Turning off redlight.")
1333
- else:
1334
- reply = self.driver.connection.light_on()
1335
- self.driver.connection.write_port()
1336
- channel("Turning on redlight.")
1337
- self.redlight_preferred = True
1338
- except ConnectionRefusedError:
1339
- self.signal(
1340
- "warning",
1341
- _("Connection was aborted. Manual connection required."),
1342
- _("Not Connected"),
1343
- )
1344
- channel("Could not alter redlight. Connection is aborted.")
1345
-
1346
- @self.console_argument(
1347
- "filename", type=str, default=None, help="filename or none"
1348
- )
1349
- @self.console_option(
1350
- "default", "d", type=bool, action="store_true", help="restore to default"
1351
- )
1352
- @self.console_command(
1353
- "force_correction",
1354
- help=_("Resets the galvo laser"),
1355
- )
1356
- def force_correction(
1357
- command, channel, _, filename=None, default=False, remainder=None, **kwgs
1358
- ):
1359
- if default:
1360
- filename = self.corfile
1361
- channel(f"Using default corfile: {filename}")
1362
- if filename is None:
1363
- self.driver.connection.write_correction_file(None)
1364
- channel(f"Force set corrections to blank.")
1365
- else:
1366
- from os.path import exists
1367
-
1368
- if exists(filename):
1369
- channel(f"Force set corrections: {filename}")
1370
- self.driver.connection.write_correction_file(filename)
1371
- else:
1372
- channel(f"The file at {os.path.realpath(filename)} does not exist.")
1373
-
1374
- @self.console_command(
1375
- "softreboot",
1376
- help=_("Resets the galvo laser"),
1377
- )
1378
- def galvo_reset(command, channel, _, remainder=None, **kwgs):
1379
- self.driver.connection.init_laser()
1380
- channel(f"Soft reboot: {self.label}")
1381
-
1382
- @self.console_option(
1383
- "duration", "d", type=float, help=_("time to set/unset the port")
1384
- )
1385
- @self.console_argument("off", type=str)
1386
- @self.console_argument("bit", type=int)
1387
- @self.console_command(
1388
- "port",
1389
- help=_("Turns port on or off, eg. port off 8"),
1390
- all_arguments_required=True,
1391
- )
1392
- def galvo_port(command, channel, _, off, bit=None, duration=None, **kwgs):
1393
- off = off == "off"
1394
- if off:
1395
- self.driver.connection.port_off(bit)
1396
- self.driver.connection.write_port()
1397
- channel(f"Turning off bit {bit}")
1398
- else:
1399
- self.driver.connection.port_on(bit)
1400
- self.driver.connection.write_port()
1401
- channel(f"Turning on bit {bit}")
1402
- if duration is not None:
1403
- if off:
1404
- self(f".timer 1 {duration} port on {bit}")
1405
- else:
1406
- self(f".timer 1 {duration} port off {bit}")
1407
-
1408
- @self.console_command(
1409
- "status",
1410
- help=_("Sends status check"),
1411
- )
1412
- def galvo_status(command, channel, _, remainder=None, **kwgs):
1413
- reply = self.driver.connection.get_version()
1414
- if reply is None:
1415
- channel("Not connected, cannot get serial number.")
1416
- return
1417
- channel(f"Command replied: {reply}")
1418
- for index, b in enumerate(reply):
1419
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1420
-
1421
- @self.console_command(
1422
- "lstatus",
1423
- help=_("Checks the list status."),
1424
- )
1425
- def galvo_liststatus(command, channel, _, remainder=None, **kwgs):
1426
- reply = self.driver.connection.get_list_status()
1427
- if reply is None:
1428
- channel("Not connected, cannot get serial number.")
1429
- return
1430
- channel(f"Command replied: {reply}")
1431
- for index, b in enumerate(reply):
1432
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1433
-
1434
- @self.console_command(
1435
- "mark_time",
1436
- help=_("Checks the Mark Time."),
1437
- )
1438
- def galvo_mark_time(command, channel, _, remainder=None, **kwgs):
1439
- reply = self.driver.connection.get_mark_time()
1440
- if reply is None:
1441
- channel("Not connected, cannot get mark time.")
1442
- return
1443
- channel(f"Command replied: {reply}")
1444
- for index, b in enumerate(reply):
1445
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1446
-
1447
- @self.console_command(
1448
- "mark_count",
1449
- help=_("Checks the Mark Count."),
1450
- )
1451
- def galvo_mark_count(command, channel, _, remainder=None, **kwgs):
1452
- reply = self.driver.connection.get_mark_count()
1453
- if reply is None:
1454
- channel("Not connected, cannot get mark count.")
1455
- return
1456
- channel(f"Command replied: {reply}")
1457
- for index, b in enumerate(reply):
1458
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1459
-
1460
- @self.console_command(
1461
- "axis_pos",
1462
- help=_("Checks the Axis Position."),
1463
- )
1464
- def galvo_axis_pos(command, channel, _, remainder=None, **kwgs):
1465
- reply = self.driver.connection.get_axis_pos()
1466
- if reply is None:
1467
- channel("Not connected, cannot get axis position.")
1468
- return
1469
- channel(f"Command replied: {reply}")
1470
- for index, b in enumerate(reply):
1471
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1472
-
1473
- @self.console_command(
1474
- "user_data",
1475
- help=_("Checks the User Data."),
1476
- )
1477
- def galvo_user_data(command, channel, _, remainder=None, **kwgs):
1478
- reply = self.driver.connection.get_user_data()
1479
- if reply is None:
1480
- channel("Not connected, cannot get user data.")
1481
- return
1482
- channel(f"Command replied: {reply}")
1483
- for index, b in enumerate(reply):
1484
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1485
-
1486
- @self.console_command(
1487
- "position_xy",
1488
- help=_("Checks the Position XY"),
1489
- )
1490
- def galvo_position_xy(command, channel, _, remainder=None, **kwgs):
1491
- reply = self.driver.connection.get_position_xy()
1492
- if reply is None:
1493
- channel("Not connected, cannot get position xy.")
1494
- return
1495
- channel(f"Command replied: {reply}")
1496
- for index, b in enumerate(reply):
1497
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1498
-
1499
- @self.console_command(
1500
- "fly_speed",
1501
- help=_("Checks the Fly Speed."),
1502
- )
1503
- def galvo_fly_speed(command, channel, _, remainder=None, **kwgs):
1504
- reply = self.driver.connection.get_fly_speed()
1505
- if reply is None:
1506
- channel("Not connected, cannot get fly speed.")
1507
- return
1508
- channel(f"Command replied: {reply}")
1509
- for index, b in enumerate(reply):
1510
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1511
-
1512
- @self.console_command(
1513
- "fly_wait_count",
1514
- help=_("Checks the fiber config extend"),
1515
- )
1516
- def galvo_fly_wait_count(command, channel, _, remainder=None, **kwgs):
1517
- reply = self.driver.connection.get_fly_wait_count()
1518
- if reply is None:
1519
- channel("Not connected, cannot get fly weight count.")
1520
- return
1521
- channel(f"Command replied: {reply}")
1522
- for index, b in enumerate(reply):
1523
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1524
-
1525
- @self.console_command(
1526
- "fiber_st_mo_ap",
1527
- help=_("Checks the fiber st mo ap"),
1528
- )
1529
- def galvo_fiber_st_mo_ap(command, channel, _, remainder=None, **kwgs):
1530
- reply = self.driver.connection.get_fiber_st_mo_ap()
1531
- if reply is None:
1532
- channel("Not connected, cannot get fiber_st_mo_ap.")
1533
- return
1534
- channel(f"Command replied: {reply}")
1535
- for index, b in enumerate(reply):
1536
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1537
-
1538
- def from_binary(p: str):
1539
- if p.startswith("0b"):
1540
- p = p[2:]
1541
- for c in p:
1542
- if c not in ("0", "1", "x", "X"):
1543
- raise ValueError("Not valid binary")
1544
- return p.lower()
1545
-
1546
- @self.console_argument(
1547
- "input",
1548
- help=_("input binary to wait for. Use 'x' for any bit."),
1549
- type=from_binary,
1550
- nargs="*",
1551
- )
1552
- @self.console_option(
1553
- "debug", "d", action="store_true", type=bool, help="debug output"
1554
- )
1555
- @self.console_command(
1556
- "wait_for_input", all_arguments_required=True, hidden=True
1557
- )
1558
- def wait_for_input(channel, input, debug=False, **kwargs):
1559
- """
1560
- Wait for input is intended as a spooler command. It will halt the calling thread (spooler thread) until the
1561
- matching input is matched. Unimportant bits or bytes can be denoted with `x` for example:
1562
- `wait_for_input x x x 1xxxx` would wait for a 1 on the 5th bit of the 4th word.
1563
-
1564
- Omitted values are assumed to be unimportant.
1565
- """
1566
- input_unmatched = True
1567
- while input_unmatched:
1568
- reply = self.driver.connection.read_port()
1569
- input_unmatched = False
1570
- word = 0
1571
- for a, b in zip(reply, input):
1572
- a = bin(a)
1573
- if debug:
1574
- channel(f"input check: {a} match {b} in word #{word}")
1575
- word += 1
1576
- for i in range(-1, -len(a), -1):
1577
- try:
1578
- ac = a[i]
1579
- bc = b[i]
1580
- except IndexError:
1581
- # Assume remaining bits are no-care.
1582
- break
1583
- if bc in "x":
1584
- # This is a no-care bit.
1585
- continue
1586
- if ac != bc:
1587
- if debug:
1588
- channel(f"Fail at {~i} because {ac} != {bc}")
1589
- # We care, and they weren't equal
1590
- time.sleep(0.1)
1591
- input_unmatched = True
1592
- break
1593
- if not input_unmatched:
1594
- if debug:
1595
- channel("Input matched.")
1596
- return # We exited
1597
-
1598
- @self.console_command(
1599
- "read_port",
1600
- help=_("Checks the read_port"),
1601
- )
1602
- def galvo_read_port(command, channel, _, remainder=None, **kwgs):
1603
- reply = self.driver.connection.read_port()
1604
- if reply is None:
1605
- channel("Not connected, cannot get read port.")
1606
- return
1607
- channel(f"Command replied: {reply}")
1608
- for index, b in enumerate(reply):
1609
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1610
-
1611
- @self.console_command(
1612
- "input_port",
1613
- help=_("Checks the input_port"),
1614
- )
1615
- def galvo_input_port(command, channel, _, remainder=None, **kwgs):
1616
- reply = self.driver.connection.get_input_port()
1617
- if reply is None:
1618
- channel("Not connected, cannot get input port.")
1619
- return
1620
- channel(f"Command replied: {reply}")
1621
- for index, b in enumerate(reply):
1622
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1623
-
1624
- @self.console_command(
1625
- "clear_lock_input_port",
1626
- help=_("clear the input_port"),
1627
- )
1628
- def galvo_clear_input_port(command, channel, _, remainder=None, **kwgs):
1629
- reply = self.driver.connection.clear_lock_input_port()
1630
- if reply is None:
1631
- channel("Not connected, cannot get input port.")
1632
- return
1633
- channel(f"Command replied: {reply}")
1634
- for index, b in enumerate(reply):
1635
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1636
-
1637
- @self.console_command(
1638
- "enable_lock_input_port",
1639
- help=_("clear the input_port"),
1640
- )
1641
- def galvo_enable_lock_input_port(command, channel, _, remainder=None, **kwgs):
1642
- reply = self.driver.connection.enable_lock_input_port()
1643
- if reply is None:
1644
- channel("Not connected, cannot get input port.")
1645
- return
1646
- channel(f"Command replied: {reply}")
1647
- for index, b in enumerate(reply):
1648
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1649
-
1650
- @self.console_command(
1651
- "disable_lock_input_port",
1652
- help=_("clear the input_port"),
1653
- )
1654
- def galvo_disable_lock_input_port(command, channel, _, remainder=None, **kwgs):
1655
- reply = self.driver.connection.disable_lock_input_port()
1656
- if reply is None:
1657
- channel("Not connected, cannot get input port.")
1658
- return
1659
- channel(f"Command replied: {reply}")
1660
- for index, b in enumerate(reply):
1661
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1662
-
1663
- @self.console_command(
1664
- "fiber_config_extend",
1665
- help=_("Checks the fiber config extend"),
1666
- )
1667
- def galvo_fiber_config_extend(command, channel, _, remainder=None, **kwgs):
1668
- reply = self.driver.connection.get_fiber_config_extend()
1669
- if reply is None:
1670
- channel("Not connected, cannot get fiber config extend.")
1671
- return
1672
- channel(f"Command replied: {reply}")
1673
- for index, b in enumerate(reply):
1674
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1675
-
1676
- @self.console_command(
1677
- "serial_number",
1678
- help=_("Checks the serial number."),
1679
- )
1680
- def galvo_serial(command, channel, _, remainder=None, **kwgs):
1681
- reply = self.driver.connection.get_serial_number()
1682
- if reply is None:
1683
- channel("Not connected, cannot get serial number.")
1684
- return
1685
-
1686
- channel(f"Command replied: {reply}")
1687
- for index, b in enumerate(reply):
1688
- channel(f"Bit {index}: 0x{b:04x} 0b{b:016b}")
1689
-
1690
- @self.console_argument("filename", type=str, default=None)
1691
- @self.console_command(
1692
- "correction",
1693
- help=_("set the correction file"),
1694
- )
1695
- def set_corfile(command, channel, _, filename=None, remainder=None, **kwgs):
1696
- if filename is None:
1697
- file = self.corfile
1698
- if file is None:
1699
- channel("No correction file set.")
1700
- else:
1701
- channel(f"Correction file is set to: {self.corfile}")
1702
- from os.path import exists
1703
-
1704
- if exists(file):
1705
- channel("Correction file exists!")
1706
- else:
1707
- channel("WARNING: Correction file does not exist.")
1708
- else:
1709
- from os.path import exists
1710
-
1711
- if exists(filename):
1712
- self.corfile = filename
1713
- self.signal("corfile", filename)
1714
- else:
1715
- channel(f"The file at {os.path.realpath(filename)} does not exist.")
1716
- channel("Correction file was not set.")
1717
-
1718
- @self.console_command(
1719
- "position",
1720
- help=_("give the position of the selection box in galvos"),
1721
- )
1722
- def galvo_pos(command, channel, _, data=None, args=tuple(), **kwargs):
1723
- """
1724
- Draws an outline of the current shape.
1725
- """
1726
- bounds = self.elements.selected_area()
1727
- if bounds is None:
1728
- channel(_("Nothing Selected"))
1729
- return
1730
- x0, y0 = self.view.position(bounds[0], bounds[1])
1731
- x1, y1 = self.view.position(bounds[2], bounds[3])
1732
- channel(
1733
- f"Top,Right: ({x0:.02f}, {y0:.02f}). Lower, Left: ({x1:.02f},{y1:.02f})"
1734
- )
1735
-
1736
- @self.console_argument("lens_size", type=str, default=None)
1737
- @self.console_command(
1738
- "lens",
1739
- help=_("set the lens size"),
1740
- )
1741
- def galvo_lens(
1742
- command, channel, _, data=None, lens_size=None, args=tuple(), **kwargs
1743
- ):
1744
- """
1745
- Sets lens size.
1746
- """
1747
- if lens_size is None:
1748
- raise SyntaxError
1749
- self.lens_size = lens_size
1750
- self.width = lens_size
1751
- self.height = lens_size
1752
- self.signal("bedsize", (self.lens_size, self.lens_size))
1753
- channel(f"Set Bed Size : ({self.lens_size}, {self.lens_size}).")
1754
-
1755
- @self.console_option(
1756
- "count",
1757
- "c",
1758
- default=256,
1759
- type=int,
1760
- help="Number of instances of boxes to draw.",
1761
- )
1762
- @self.console_command(
1763
- "box",
1764
- help=_("outline the current selected elements"),
1765
- output_type="geometry",
1766
- )
1767
- def shapes_selected(
1768
- command, channel, _, count=256, data=None, args=tuple(), **kwargs
1769
- ):
1770
- """
1771
- Draws an outline of the current shape.
1772
- """
1773
- bounds = self.elements.selected_area()
1774
- if bounds is None:
1775
- channel(_("Nothing Selected"))
1776
- return
1777
- xmin, ymin, xmax, ymax = bounds
1778
- channel(_("Element bounds: {bounds}").format(bounds=str(bounds)))
1779
- geometry = Geomstr.rect(xmin, ymin, xmax - xmin, ymin - ymax)
1780
- if count > 1:
1781
- geometry.copies(count)
1782
- return "geometry", geometry
1783
-
1784
- @self.console_command(
1785
- "hull",
1786
- help=_("convex hull of the current selected elements"),
1787
- input_type=(None, "elements"),
1788
- output_type="geometry",
1789
- )
1790
- def shapes_hull(channel, _, data=None, **kwargs):
1791
- """
1792
- Draws an outline of the current shape.
1793
- """
1794
- if data is None:
1795
- data = list(self.elements.elems(emphasized=True))
1796
- g = Geomstr()
1797
- for e in data:
1798
- if hasattr(e, "as_image"):
1799
- bounds = e.bounds
1800
- g.append(
1801
- Geomstr.rect(
1802
- bounds[0],
1803
- bounds[1],
1804
- bounds[2] - bounds[0],
1805
- bounds[3] - bounds[1],
1806
- )
1807
- )
1808
- elif e.type == "elem text":
1809
- continue # We can't outline text.
1810
- else:
1811
- g.append(e.as_geometry())
1812
- hull = Geomstr.hull(g)
1813
- if len(hull) == 0:
1814
- channel(_("No elements bounds to trace."))
1815
- return
1816
- return "geometry", hull
1817
-
1818
- def ant_points(points, steps):
1819
- points = list(points)
1820
- movement = 1 + int(steps / 10)
1821
- forward_steps = steps + movement
1822
- pos = 0
1823
- size = len(points)
1824
- cycles = int(size / movement) + 1
1825
- for cycle in range(cycles):
1826
- for f in range(pos, pos + forward_steps, 1):
1827
- index = f % size
1828
- point = points[index]
1829
- yield point
1830
- pos += forward_steps
1831
- for f in range(pos, pos - steps, -1):
1832
- index = f % size
1833
- point = points[index]
1834
- yield point
1835
- pos -= steps
1836
-
1837
- @self.console_option(
1838
- "quantization",
1839
- "q",
1840
- default=50,
1841
- type=int,
1842
- help="Number of segments to break each path into.",
1843
- )
1844
- @self.console_command(
1845
- "ants",
1846
- help=_("Marching ants of the given element path."),
1847
- input_type=(None, "elements"),
1848
- output_type="geometry",
1849
- )
1850
- def element_ants(command, channel, _, data=None, quantization=50, **kwargs):
1851
- """
1852
- Draws an outline of the current shape.
1853
- """
1854
- if data is None:
1855
- data = list(self.elements.elems(emphasized=True))
1856
- geom = Geomstr()
1857
- for e in data:
1858
- try:
1859
- path = e.as_geometry()
1860
- except AttributeError:
1861
- continue
1862
- ants = list(
1863
- ant_points(
1864
- path.as_interpolated_points(interpolate=quantization),
1865
- int(quantization / 2),
1866
- )
1867
- )
1868
- geom.polyline(ants)
1869
- geom.end()
1870
- return "geometry", geom
1871
-
1872
- @self.console_argument("filename", type=str)
1873
- @self.console_command(
1874
- "clone_init",
1875
- help=_("Initializes a galvo clone board from specified file."),
1876
- )
1877
- def codes_update(channel, filename, **kwargs):
1878
- import platform
1879
-
1880
- from meerk40t.balormk.clone_loader import load_sys
1881
- from meerk40t.kernel import get_safe_path
1882
-
1883
- self.setting(str, "clone_sys", "chunks")
1884
- if filename is not None:
1885
- self.clone_sys = filename
1886
- if self.clone_sys == "chunks":
1887
- from meerk40t.balormk.clone_loader import load_chunks
1888
-
1889
- load_chunks(channel=channel)
1890
- return
1891
-
1892
- # Check for file in local directory
1893
- p = self.clone_sys
1894
- if os.path.exists(p):
1895
- load_sys(p, channel=channel)
1896
- return
1897
-
1898
- # Check for file in the meerk40t directory (safe_path)
1899
- directory = get_safe_path(kernel.name, create=True)
1900
- p = os.path.join(directory, self.clone_sys)
1901
- if os.path.exists(p):
1902
- load_sys(p, channel=channel)
1903
- return
1904
-
1905
- if platform.system() != "Windows":
1906
- return
1907
-
1908
- # In windows, check the system32/drivers directory.
1909
- system32 = os.path.join(
1910
- os.environ["SystemRoot"],
1911
- "SysNative" if platform.architecture()[0] == "32bit" else "System32",
1912
- )
1913
- p = os.path.join(system32, "drivers", self.clone_sys)
1914
- if os.path.exists(p):
1915
- load_sys(p, channel=channel)
1916
- return
1917
-
1918
- channel(f"{self.clone_sys} file was not found.")
1919
-
1920
- @self.console_command(
1921
- "viewport_update",
1922
- hidden=True,
1923
- help=_("Update galvo flips for movement"),
1924
- )
1925
- def codes_update(**kwargs):
1926
- self.realize()
1927
-
1928
- def service_attach(self, *args, **kwargs):
1929
- self.realize()
1930
-
1931
- @signal_listener("flip_x")
1932
- @signal_listener("flip_y")
1933
- @signal_listener("swap_xy")
1934
- def realize(self, origin=None, *args):
1935
- self.view.set_dims(self.lens_size, self.lens_size)
1936
- self.view.transform(
1937
- flip_x=self.flip_x,
1938
- flip_y=self.flip_y,
1939
- swap_xy=self.swap_xy,
1940
- )
1941
- self.space.update_bounds(0, 0, self.lens_size, self.lens_size)
1942
-
1943
- @property
1944
- def current(self):
1945
- """
1946
- @return: the location in units for the current known position.
1947
- """
1948
- return self.view.iposition(self.driver.native_x, self.driver.native_y)
1949
-
1950
- @property
1951
- def native(self):
1952
- """
1953
- @return: the location in device native units for the current known position.
1954
- """
1955
- return self.driver.native_x, self.driver.native_y
1956
-
1957
- @property
1958
- def calibration_file(self):
1959
- return None
1
+ """
2
+ Galvo Device
3
+
4
+ Defines how the balor device interacts with the scene, and accepts data via the spooler.
5
+ """
6
+
7
+ from meerk40t.balormk.driver import BalorDriver
8
+ from meerk40t.core.spoolers import Spooler
9
+ from meerk40t.core.units import Angle, Length
10
+ from meerk40t.core.view import View
11
+ from meerk40t.device.mixins import Status
12
+ from meerk40t.kernel import Service, signal_listener
13
+ from meerk40t.device.devicechoices import get_effect_choices
14
+
15
+
16
+ class BalorDevice(Service, Status):
17
+ """
18
+ The BalorDevice is a MeerK40t service for the device type. It should be the main method of interacting with
19
+ the rest of meerk40t. It defines how the scene should look and contains a spooler which meerk40t will give jobs
20
+ to. This class additionally defines commands which exist as console commands while this service is activated.
21
+ """
22
+
23
+ def __init__(self, kernel, path, *args, choices=None, **kwargs):
24
+ Service.__init__(self, kernel, path)
25
+ Status.__init__(self)
26
+ self.name = "balor"
27
+ self.extension = "lmc"
28
+ self.job = None
29
+ if choices is not None:
30
+ for c in choices:
31
+ attr = c.get("attr")
32
+ default = c.get("default")
33
+ if attr is not None and default is not None:
34
+ setattr(self, attr, default)
35
+
36
+ _ = kernel.translation
37
+ self.register("frequency", (0, 1000))
38
+ self.register(
39
+ "format/op cut",
40
+ "{danger}{defop}{enabled}{pass}{element_type} {speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
41
+ )
42
+ self.register(
43
+ "format/op engrave",
44
+ "{danger}{defop}{enabled}{pass}{element_type} {speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
45
+ )
46
+ self.register(
47
+ "format/op hatch",
48
+ "{danger}{defop}{enabled}{penpass}{pass}{element_type} {speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
49
+ )
50
+ self.register(
51
+ "format/op raster",
52
+ "{danger}{defop}{enabled}{pass}{element_type}{direction}{speed}mm/s @{power} {frequency}kHz {colcode} {opstop}",
53
+ )
54
+ self.register(
55
+ "format/op image",
56
+ "{danger}{defop}{enabled}{penvalue}{pass}{element_type}{direction}{speed}mm/s @{power} {frequency}kHz {colcode}",
57
+ )
58
+ self.register(
59
+ "format/op dots",
60
+ "{danger}{defop}{enabled}{pass}{element_type} {dwell_time}ms dwell {frequency}kHz {colcode} {opstop}",
61
+ )
62
+ self.register("format/util console", "{enabled}{command}")
63
+ # This device prefers to display power level in percent
64
+ self.setting(bool, "use_percent_for_power_display", True)
65
+ # Tuple contains 4 value pairs: Speed Low, Speed High, Power Low, Power High, each with enabled, value
66
+ self.setting(
67
+ list, "dangerlevel_op_cut", (False, 0, False, 0, False, 0, False, 0)
68
+ )
69
+ self.setting(
70
+ list, "dangerlevel_op_engrave", (False, 0, False, 0, False, 0, False, 0)
71
+ )
72
+ self.setting(
73
+ list, "dangerlevel_op_hatch", (False, 0, False, 0, False, 0, False, 0)
74
+ )
75
+ self.setting(
76
+ list, "dangerlevel_op_raster", (False, 0, False, 0, False, 0, False, 0)
77
+ )
78
+ self.setting(
79
+ list, "dangerlevel_op_image", (False, 0, False, 0, False, 0, False, 0)
80
+ )
81
+ self.setting(
82
+ list, "dangerlevel_op_dots", (False, 0, False, 0, False, 0, False, 0)
83
+ )
84
+ choices = [
85
+ {
86
+ "attr": "label",
87
+ "object": self,
88
+ "default": "balor-device",
89
+ "type": str,
90
+ "label": _("Label"),
91
+ "tip": _("What is this device called."),
92
+ "section": "_00_General",
93
+ "priority": "10",
94
+ "signals": "device;renamed",
95
+ },
96
+ {
97
+ "attr": "source",
98
+ "object": self,
99
+ "default": "fiber",
100
+ "type": str,
101
+ "style": "combo",
102
+ "choices": ["fiber", "co2", "uv"],
103
+ "label": _("Laser Source"),
104
+ "tip": _("What type of laser is this?"),
105
+ },
106
+ {
107
+ "attr": "corfile_enabled",
108
+ "object": self,
109
+ "default": False,
110
+ "type": bool,
111
+ "label": _("Enable"),
112
+ "tip": _("Use correction file?"),
113
+ "section": "_00_General",
114
+ "subsection": "Correction File",
115
+ },
116
+ {
117
+ "attr": "corfile",
118
+ "object": self,
119
+ "default": None,
120
+ "type": str,
121
+ "style": "file",
122
+ "wildcard": "*.cor",
123
+ "conditional": (self, "corfile_enabled"),
124
+ "label": _("File"),
125
+ "tip": _("Provide a correction file for the machine"),
126
+ "weight": 3,
127
+ "section": "_00_General",
128
+ "subsection": "Correction File",
129
+ },
130
+ {
131
+ "attr": "lens_size",
132
+ "object": self,
133
+ "default": "110mm",
134
+ "type": Length,
135
+ "label": _("Width"),
136
+ "tip": _("Lens Size"),
137
+ "section": "_00_General",
138
+ "subsection": "_00_",
139
+ "priority": "20",
140
+ "nonzero": True,
141
+ # intentionally not bed_size
142
+ },
143
+ {
144
+ "attr": "laserspot",
145
+ "object": self,
146
+ "default": "0.3mm",
147
+ "type": Length,
148
+ "label": _("Laserspot"),
149
+ "tip": _("Laser spot size"),
150
+ "section": "_00_General",
151
+ "subsection": "_00_",
152
+ "priority": "20",
153
+ "nonzero": True,
154
+ },
155
+ {
156
+ "attr": "flip_x",
157
+ "object": self,
158
+ "default": False,
159
+ "type": bool,
160
+ "label": _("Flip X"),
161
+ "tip": _("Flip the X axis for the device"),
162
+ "section": "_10_Parameters",
163
+ "subsection": "_10_Axis corrections",
164
+ },
165
+ {
166
+ "attr": "flip_y",
167
+ "object": self,
168
+ "default": True,
169
+ "type": bool,
170
+ "label": _("Flip Y"),
171
+ "tip": _("Flip the Y axis for the device"),
172
+ "section": "_10_Parameters",
173
+ "subsection": "_10_Axis corrections",
174
+ },
175
+ {
176
+ "attr": "swap_xy",
177
+ "object": self,
178
+ "default": True,
179
+ "type": bool,
180
+ "label": _("Swap XY"),
181
+ "tip": _("Swap the X and Y axis for the device"),
182
+ "section": "_10_Parameters",
183
+ "subsection": "_10_Axis corrections",
184
+ },
185
+ {
186
+ "attr": "rotate",
187
+ "object": self,
188
+ "default": 0,
189
+ "type": int,
190
+ "style": "combo",
191
+ "trailer": "°",
192
+ "choices": [
193
+ 0,
194
+ 90,
195
+ 180,
196
+ 270,
197
+ ],
198
+ "label": _("Rotate View"),
199
+ "tip": _("Rotate the device field"),
200
+ "section": "_10_Parameters",
201
+ "subsection": "_10_Axis corrections",
202
+ },
203
+ {
204
+ "attr": "user_margin_x",
205
+ "object": self,
206
+ "default": "0",
207
+ "type": str,
208
+ "label": _("X-Margin"),
209
+ "tip": _(
210
+ "Margin for the X-axis. This will be a kind of unused space at the left side."
211
+ ),
212
+ "section": "_10_Parameters",
213
+ # _("User Offset")
214
+ "subsection": "_30_User Offset",
215
+ },
216
+ {
217
+ "attr": "user_margin_y",
218
+ "object": self,
219
+ "default": "0",
220
+ "type": str,
221
+ "label": _("Y-Margin"),
222
+ "tip": _(
223
+ "Margin for the Y-axis. This will be a kind of unused space at the top."
224
+ ),
225
+ "section": "_10_Parameters",
226
+ "subsection": "_30_User Offset",
227
+ },
228
+ {
229
+ "attr": "interp",
230
+ "object": self,
231
+ "default": 5,
232
+ "type": int,
233
+ "label": _("Curve Interpolation"),
234
+ "section": "_10_Parameters",
235
+ "tip": _("Number of curve interpolation points"),
236
+ },
237
+ {
238
+ "attr": "mock",
239
+ "object": self,
240
+ "default": False,
241
+ "type": bool,
242
+ "label": _("Run mock-usb backend"),
243
+ "tip": _(
244
+ "This starts connects to fake software laser rather than real one for debugging."
245
+ ),
246
+ "section": "_00_General",
247
+ "priority": "30",
248
+ },
249
+ {
250
+ "attr": "machine_index",
251
+ "object": self,
252
+ "default": 0,
253
+ "type": int,
254
+ "label": _("Machine index to select"),
255
+ "tip": _(
256
+ "Which machine should we connect to? -- Leave at 0 if you have 1 machine."
257
+ ),
258
+ "section": "_00_General",
259
+ "subsection": "_10_Device Selection",
260
+ },
261
+ { "attr": "serial_enable",
262
+ "object": self,
263
+ "default": False,
264
+ "type": bool,
265
+ "label": _("Check serial no"),
266
+ "tip": _(
267
+ "Does the machine need to have a specific serial number?"
268
+ ),
269
+ "section": "_00_General",
270
+ "subsection": "_10_Device Selection",
271
+ },
272
+ {
273
+ "attr": "serial",
274
+ "object": self,
275
+ "default": "",
276
+ "type": str,
277
+ "tip": _(
278
+ "Does the machine need to have a specific serial number?"
279
+ ),
280
+ "label": "",
281
+ "section": "_00_General",
282
+ "subsection": "_10_Device Selection",
283
+ "conditional": (self, "serial_enable")
284
+ },
285
+ {
286
+ "attr": "footpedal_pin",
287
+ "object": self,
288
+ "default": 15,
289
+ "type": int,
290
+ "label": _("Footpedal"),
291
+ "tip": _("What pin is your foot pedal hooked to on the GPIO"),
292
+ "section": "_10_Parameters",
293
+ "subsection": "_30_Pin-Index",
294
+ "signals": "balorpin",
295
+ },
296
+ {
297
+ "attr": "light_pin",
298
+ "object": self,
299
+ "default": 8,
300
+ "type": int,
301
+ "label": _("Redlight laser"),
302
+ "tip": _("What pin is your redlight hooked to on the GPIO"),
303
+ "section": "_10_Parameters",
304
+ "subsection": "_30_Pin-Index",
305
+ "signals": "balorpin",
306
+ },
307
+ {
308
+ "attr": "signal_updates",
309
+ "object": self,
310
+ "default": True,
311
+ "type": bool,
312
+ "label": _("Device Position"),
313
+ "tip": _(
314
+ "Do you want to see some indicator about the current device position?"
315
+ ),
316
+ "section": "_95_" + _("Screen updates"),
317
+ "signals": "restart",
318
+ },
319
+ {
320
+ "attr": "device_coolant",
321
+ "object": self,
322
+ "default": "",
323
+ "type": str,
324
+ "style": "option",
325
+ "label": _("Coolant"),
326
+ "tip": _(
327
+ "Does this device has a method to turn on / off a coolant associated to it?"
328
+ ),
329
+ "section": "_99_" + _("Coolant Support"),
330
+ "dynamic": self.cool_helper,
331
+ "signals": "coolant_changed",
332
+ },
333
+ ]
334
+ self.register_choices("balor", choices)
335
+
336
+ self.register_choices("balor-effects", get_effect_choices(self))
337
+
338
+ choices = [
339
+ {
340
+ "attr": "redlight_speed",
341
+ "object": self,
342
+ "default": "3000",
343
+ "type": int,
344
+ "label": _("Redlight travel speed"),
345
+ "tip": _("Speed of the galvo when using the red laser."),
346
+ },
347
+ {
348
+ "attr": "redlight_offset_x",
349
+ "object": self,
350
+ "default": "0mm",
351
+ "type": Length,
352
+ "label": _("X-Offset"),
353
+ "tip": _("Offset the redlight positions by this amount in x"),
354
+ "subsection": "Redlight-Offset",
355
+ },
356
+ {
357
+ "attr": "redlight_offset_y",
358
+ "object": self,
359
+ "default": "0mm",
360
+ "type": Length,
361
+ "label": _("Y-Offset"),
362
+ "tip": _("Offset the redlight positions by this amount in y"),
363
+ "subsection": "Redlight-Offset",
364
+ },
365
+ {
366
+ "attr": "redlight_angle",
367
+ "object": self,
368
+ "default": "0deg",
369
+ "type": Angle,
370
+ "label": _("Angle Offset"),
371
+ "tip": _(
372
+ "Offset the redlight positions by this angle, curving around center"
373
+ ),
374
+ "subsection": "Redlight-Offset",
375
+ },
376
+ {
377
+ "attr": "redlight_preferred",
378
+ "object": self,
379
+ "default": False,
380
+ "type": bool,
381
+ "label": _("Prefer redlight on"),
382
+ "tip": _(
383
+ "Redlight preference will turn toggleable redlights on after a job completes."
384
+ ),
385
+ "priority": "0",
386
+ },
387
+ ]
388
+ self.register_choices("balor-redlight", choices)
389
+
390
+ choices = [
391
+ {
392
+ "attr": "default_power",
393
+ "object": self,
394
+ "default": 50.0,
395
+ "type": float,
396
+ "label": _("Laser Power"),
397
+ "trailer": "%",
398
+ "tip": _("What power level do we cut at?"),
399
+ },
400
+ {
401
+ "attr": "default_speed",
402
+ "object": self,
403
+ "default": 100.0,
404
+ "type": float,
405
+ "trailer": "mm/s",
406
+ "label": _("Cut Speed"),
407
+ "tip": _("How fast do we cut?"),
408
+ },
409
+ {
410
+ "attr": "default_frequency",
411
+ "object": self,
412
+ "default": 30.0,
413
+ "type": float,
414
+ "trailer": "kHz",
415
+ "label": _("Q Switch Frequency"),
416
+ "tip": _("QSwitch Frequency value"),
417
+ },
418
+ {
419
+ "attr": "default_fpk",
420
+ "object": self,
421
+ "default": 10.0,
422
+ "type": float,
423
+ "trailer": "%",
424
+ "label": _("First Pulse Killer"),
425
+ "conditional": (self, "source", "co2"),
426
+ "tip": _("Percent of First Pulse Killer for co2 source"),
427
+ },
428
+ {
429
+ "attr": "default_rapid_speed",
430
+ "object": self,
431
+ "default": 2000.0,
432
+ "type": float,
433
+ "label": _("Travel Speed"),
434
+ "trailer": "mm/s",
435
+ "tip": _("How fast do we travel when not cutting?"),
436
+ },
437
+ {
438
+ "attr": "pulse_width_enabled",
439
+ "object": self,
440
+ "default": False,
441
+ "type": bool,
442
+ "label": _("Enable"),
443
+ "tip": _("Enable using Pulse Width (MOPA)"),
444
+ # "conditional": (self, "source", "fiber"),
445
+ "subsection": "Pulse Width",
446
+ },
447
+ {
448
+ "attr": "default_pulse_width",
449
+ "object": self,
450
+ "default": 4,
451
+ "type": int,
452
+ "style": "combo",
453
+ "choices": [
454
+ 1,
455
+ 2,
456
+ 4,
457
+ 6,
458
+ 9,
459
+ 13,
460
+ 20,
461
+ 30,
462
+ 45,
463
+ 55,
464
+ 60,
465
+ 80,
466
+ 100,
467
+ 150,
468
+ 200,
469
+ 250,
470
+ ],
471
+ "conditional": (self, "pulse_width_enabled"),
472
+ "label": _("Set Pulse Width (ns)"),
473
+ "trailer": "ns",
474
+ "tip": _("Set the MOPA pulse width setting"),
475
+ "subsection": "Pulse Width",
476
+ },
477
+ ]
478
+ self.register_choices("balor-global", choices)
479
+
480
+ choices = [
481
+ {
482
+ "attr": "delay_laser_on",
483
+ "object": self,
484
+ "default": 100.0,
485
+ "type": float,
486
+ "label": _("Laser On"),
487
+ "trailer": "µs",
488
+ "tip": _(
489
+ "Start delay (Start TC) at the beginning of each mark command"
490
+ ),
491
+ "section": "_10_General",
492
+ "subsection": "Delays",
493
+ "priority": "00",
494
+ },
495
+ {
496
+ "attr": "delay_laser_off",
497
+ "object": self,
498
+ "default": 100.0,
499
+ "type": float,
500
+ "label": _("Laser Off"),
501
+ "trailer": "µs",
502
+ "tip": _(
503
+ "The delay time of the laser shutting down after marking finished"
504
+ ),
505
+ "section": "_10_General",
506
+ "subsection": "Delays",
507
+ "priority": "10",
508
+ },
509
+ {
510
+ "attr": "delay_polygon",
511
+ "object": self,
512
+ "default": 100.0,
513
+ "type": float,
514
+ "label": _("Polygon Delay"),
515
+ "trailer": "µs",
516
+ "tip": _("Delay amount between different points in the path travel."),
517
+ "section": "_10_General",
518
+ "subsection": "Delays",
519
+ "priority": "30",
520
+ },
521
+ {
522
+ "attr": "delay_end",
523
+ "object": self,
524
+ "default": 300.0,
525
+ "type": float,
526
+ "label": _("End Delay"),
527
+ "trailer": "µs",
528
+ "tip": _("Delay amount for the end TC"),
529
+ "section": "_10_General",
530
+ "subsection": "Delays",
531
+ "priority": "20",
532
+ },
533
+ {
534
+ "attr": "delay_jump_long",
535
+ "object": self,
536
+ "default": 200.0,
537
+ "type": float,
538
+ "label": _("Long jump delay"),
539
+ "trailer": "µs",
540
+ "tip": _("Delay for a long jump distance"),
541
+ "section": "_10_General",
542
+ "subsection": "Jump-Settings",
543
+ },
544
+ {
545
+ "attr": "delay_jump_short",
546
+ "object": self,
547
+ "default": 8,
548
+ "type": float,
549
+ "label": _("Short jump delay"),
550
+ "trailer": "µs",
551
+ "tip": _("Delay for a short jump distance"),
552
+ "section": "_10_General",
553
+ "subsection": "Jump-Settings",
554
+ },
555
+ {
556
+ "attr": "delay_distance_long",
557
+ "object": self,
558
+ "default": "10mm",
559
+ "type": Length,
560
+ "label": _("Long jump distance"),
561
+ "tip": _("Distance divide between long and short jump distances"),
562
+ "section": "_10_General",
563
+ "subsection": "Jump-Settings",
564
+ },
565
+ {
566
+ "attr": "delay_openmo",
567
+ "object": self,
568
+ "default": 8.0,
569
+ "type": float,
570
+ "label": _("Open MO delay"),
571
+ "trailer": "ms",
572
+ "tip": _("OpenMO delay in ms"),
573
+ "section": "_90_Other",
574
+ },
575
+ ]
576
+ self.register_choices("balor-global-timing", choices)
577
+
578
+ choices = [
579
+ {
580
+ "attr": "first_pulse_killer",
581
+ "object": self,
582
+ "default": 200,
583
+ "type": int,
584
+ "label": _("First Pulse Killer"),
585
+ "trailer": "µs",
586
+ "tip": _(
587
+ "First Pulse Killer (F.P.K): the lasting time for the first pulse suppress"
588
+ ),
589
+ "section": "First Pulse Killer",
590
+ },
591
+ {
592
+ "attr": "pwm_half_period",
593
+ "object": self,
594
+ "default": 125,
595
+ "type": int,
596
+ "label": _("PWM Half Period"),
597
+ "tip": _("Pulse Period: the frequency of the preionization signal"),
598
+ "subsection": "Pulse-Width-Modulation",
599
+ },
600
+ {
601
+ "attr": "pwm_pulse_width",
602
+ "object": self,
603
+ "default": 125,
604
+ "type": int,
605
+ "label": _("PWM Pulse Width"),
606
+ "tip": _("Pulse Width: the pulse width of the preionization signal"),
607
+ "subsection": "Pulse-Width-Modulation",
608
+ },
609
+ {
610
+ "attr": "standby_param_1",
611
+ "object": self,
612
+ "default": 2000,
613
+ "type": int,
614
+ "label": _("Parameter 1"),
615
+ # "tip": _(""),
616
+ "subsection": "Standby-Parameter",
617
+ },
618
+ {
619
+ "attr": "standby_param_2",
620
+ "object": self,
621
+ "default": 20,
622
+ "type": int,
623
+ "label": _("Parameter 2"),
624
+ # "tip": _(""),
625
+ "subsection": "Standby-Parameter",
626
+ },
627
+ {
628
+ "attr": "timing_mode",
629
+ "object": self,
630
+ "default": 1,
631
+ "type": int,
632
+ "label": _("Timing Mode"),
633
+ # "tip": _(""),
634
+ "subsection": "Modes",
635
+ },
636
+ {
637
+ "attr": "delay_mode",
638
+ "object": self,
639
+ "default": 1,
640
+ "type": int,
641
+ "label": _("Delay Mode"),
642
+ # "tip": _(""),
643
+ "subsection": "Modes",
644
+ },
645
+ {
646
+ "attr": "laser_mode",
647
+ "object": self,
648
+ "default": 1,
649
+ "type": int,
650
+ "label": _("Laser Mode"),
651
+ # "tip": _(""),
652
+ "subsection": "Modes",
653
+ },
654
+ {
655
+ "attr": "control_mode",
656
+ "object": self,
657
+ "default": 0,
658
+ "type": int,
659
+ "label": _("Control Mode"),
660
+ # "tip": _(""),
661
+ "subsection": "Modes",
662
+ },
663
+ {
664
+ "attr": "fpk2_p1",
665
+ "object": self,
666
+ "default": 0xFFB,
667
+ "type": int,
668
+ "label": _("Max Voltage"),
669
+ # "tip": _(""),
670
+ "trailer": "V",
671
+ "section": "First Pulse Killer",
672
+ "subsection": "Parameters",
673
+ },
674
+ {
675
+ "attr": "fpk2_p2",
676
+ "object": self,
677
+ "default": 1,
678
+ "type": int,
679
+ "label": _("Min Voltage"),
680
+ "trailer": "V",
681
+ # "tip": _(""),
682
+ "section": "First Pulse Killer",
683
+ "subsection": "Parameters",
684
+ },
685
+ {
686
+ "attr": "fpk2_p3",
687
+ "object": self,
688
+ "default": 409,
689
+ "type": int,
690
+ "label": _("T1"),
691
+ "trailer": "µs",
692
+ # "tip": _(""),
693
+ "section": "First Pulse Killer",
694
+ "subsection": "Parameters",
695
+ },
696
+ {
697
+ "attr": "fpk2_p4",
698
+ "object": self,
699
+ "default": 100,
700
+ "type": int,
701
+ "label": _("T2"),
702
+ "trailer": "µs",
703
+ # "tip": _(""),
704
+ "section": "First Pulse Killer",
705
+ "subsection": "Parameters",
706
+ },
707
+ {
708
+ "attr": "fly_res_p1",
709
+ "object": self,
710
+ "default": 0,
711
+ "type": int,
712
+ "label": _("Param 1"),
713
+ # "tip": _(""),
714
+ "subsection": "Fly Resolution",
715
+ },
716
+ {
717
+ "attr": "fly_res_p2",
718
+ "object": self,
719
+ "default": 99,
720
+ "type": int,
721
+ "label": _("Param 2"),
722
+ # "tip": _(""),
723
+ "subsection": "Fly Resolution",
724
+ },
725
+ {
726
+ "attr": "fly_res_p3",
727
+ "object": self,
728
+ "default": 1000,
729
+ "type": int,
730
+ "label": _("Param 3"),
731
+ # "tip": _(""),
732
+ "subsection": "Fly Resolution",
733
+ },
734
+ {
735
+ "attr": "fly_res_p4",
736
+ "object": self,
737
+ "default": 25,
738
+ "type": int,
739
+ "label": _("Param 4"),
740
+ # "tip": _(""),
741
+ "subsection": "Fly Resolution",
742
+ },
743
+ {
744
+ "attr": "input_passes_required",
745
+ "object": self,
746
+ "default": 3,
747
+ "type": int,
748
+ "label": _("Input Signal Hold"),
749
+ "tip": _(
750
+ "How long does the input operation need to hold for to count as a pass"
751
+ ),
752
+ },
753
+ {
754
+ "attr": "input_operation_hardware",
755
+ "object": self,
756
+ "default": False,
757
+ "type": bool,
758
+ "label": _("Input Operation Hardware"),
759
+ "tip": _("Use hardware based input operation command"),
760
+ },
761
+ ]
762
+ self.register_choices("balor-extra", choices)
763
+
764
+ choices = [
765
+ {
766
+ "attr": "cf_1",
767
+ "object": self,
768
+ "default": "50",
769
+ "type": float,
770
+ "label": _("Corfile distance {index}").format(index=1),
771
+ "section": _("Correction-Values"),
772
+ },
773
+ {
774
+ "attr": "cf_2",
775
+ "object": self,
776
+ "default": "50",
777
+ "type": float,
778
+ "label": _("Corfile distance {index}").format(index=2),
779
+ "section": _("Correction-Values"),
780
+ },
781
+ {
782
+ "attr": "cf_3",
783
+ "object": self,
784
+ "default": "50",
785
+ "type": float,
786
+ "label": _("Corfile distance {index}").format(index=3),
787
+ "section": _("Correction-Values"),
788
+ },
789
+ {
790
+ "attr": "cf_4",
791
+ "object": self,
792
+ "default": "50",
793
+ "type": float,
794
+ "label": _("Corfile distance {index}").format(index=4),
795
+ "section": _("Correction-Values"),
796
+ },
797
+ {
798
+ "attr": "cf_5",
799
+ "object": self,
800
+ "default": "50",
801
+ "type": float,
802
+ "label": _("Corfile distance {index}").format(index=5),
803
+ "section": _("Correction-Values"),
804
+ },
805
+ {
806
+ "attr": "cf_6",
807
+ "object": self,
808
+ "default": "50",
809
+ "type": float,
810
+ "label": _("Corfile distance {index}").format(index=6),
811
+ "section": _("Correction-Values"),
812
+ },
813
+ {
814
+ "attr": "cf_7",
815
+ "object": self,
816
+ "default": "50",
817
+ "type": float,
818
+ "label": _("Corfile distance {index}").format(index=7),
819
+ "section": _("Correction-Values"),
820
+ },
821
+ {
822
+ "attr": "cf_8",
823
+ "object": self,
824
+ "default": "50",
825
+ "type": float,
826
+ "label": _("Corfile distance {index}").format(index=8),
827
+ "section": _("Correction-Values"),
828
+ },
829
+ {
830
+ "attr": "cf_9",
831
+ "object": self,
832
+ "default": "50",
833
+ "type": float,
834
+ "label": _("Corfile distance {index}").format(index=9),
835
+ "section": _("Correction-Values"),
836
+ },
837
+ {
838
+ "attr": "cf_10",
839
+ "object": self,
840
+ "default": "50",
841
+ "type": float,
842
+ "label": _("Corfile distance {index}").format(index=10),
843
+ "section": _("Correction-Values"),
844
+ },
845
+ {
846
+ "attr": "cf_11",
847
+ "object": self,
848
+ "default": "50",
849
+ "type": float,
850
+ "label": _("Corfile distance {index}").format(index=11),
851
+ "section": _("Correction-Values"),
852
+ },
853
+ {
854
+ "attr": "cf_12",
855
+ "object": self,
856
+ "default": "50",
857
+ "type": float,
858
+ "label": _("Corfile distance {index}").format(index=12),
859
+ "section": _("Correction-Values"),
860
+ },
861
+ ]
862
+ self.register_choices("balor-corfile", choices)
863
+ self.kernel.root.coolant.claim_coolant(self, self.device_coolant)
864
+
865
+ self.state = 0
866
+
867
+ unit_size = float(Length(self.lens_size))
868
+ galvo_range = 0xFFFF
869
+ units_per_galvo = unit_size / galvo_range
870
+ self.view = View(
871
+ self.lens_size,
872
+ self.lens_size,
873
+ native_scale_x=units_per_galvo,
874
+ native_scale_y=units_per_galvo,
875
+ )
876
+ self.realize()
877
+
878
+ self.spooler = Spooler(self)
879
+ self.driver = BalorDriver(self)
880
+ self.spooler.driver = self.driver
881
+
882
+ self.add_service_delegate(self.spooler)
883
+
884
+ self.viewbuffer = ""
885
+ self._simulate = False
886
+ self.laser_status = "idle"
887
+
888
+ @property
889
+ def safe_label(self):
890
+ """
891
+ Provides a safe label without spaces or / which could cause issues when used in timer or other names.
892
+ @return:
893
+ """
894
+ if not hasattr(self, "label"):
895
+ return self.name
896
+ name = self.label.replace(" ", "-")
897
+ return name.replace("/", "-")
898
+
899
+ def service_attach(self, *args, **kwargs):
900
+ self.realize()
901
+
902
+ @signal_listener("lens_size")
903
+ @signal_listener("rotate")
904
+ @signal_listener("flip_x")
905
+ @signal_listener("flip_y")
906
+ @signal_listener("swap_xy")
907
+ @signal_listener("user_margin_x")
908
+ @signal_listener("user_margin_y")
909
+ def realize(self, origin=None, *args):
910
+ if origin is not None and origin != self.path:
911
+ return
912
+ try:
913
+ unit_size = float(Length(self.lens_size))
914
+ except ValueError:
915
+ return
916
+ galvo_range = 0xFFFF
917
+ units_per_galvo = unit_size / galvo_range
918
+
919
+ self.view.set_dims(self.lens_size, self.lens_size)
920
+ self.view.set_margins(self.user_margin_x, self.user_margin_y)
921
+ self.view.set_native_scale(units_per_galvo, units_per_galvo)
922
+ self.view.transform(
923
+ flip_x=self.flip_x,
924
+ flip_y=self.flip_y,
925
+ swap_xy=self.swap_xy,
926
+ )
927
+ if self.rotate >= 90:
928
+ self.view.rotate_cw()
929
+ if self.rotate >= 180:
930
+ self.view.rotate_cw()
931
+ if self.rotate >= 270:
932
+ self.view.rotate_cw()
933
+ self.signal("view;realized")
934
+
935
+ @property
936
+ def current(self):
937
+ """
938
+ @return: the location in units for the current known position.
939
+ """
940
+ return self.view.iposition(self.driver.native_x, self.driver.native_y)
941
+
942
+ @property
943
+ def native(self):
944
+ """
945
+ @return: the location in device native units for the current known position.
946
+ """
947
+ return self.driver.native_x, self.driver.native_y
948
+
949
+ @property
950
+ def calibration_file(self):
951
+ return None
952
+
953
+ @signal_listener("light_simulate")
954
+ def simulate_state(self, origin, v=True):
955
+ self._simulate = False
956
+
957
+ def outline(self):
958
+ if not self._simulate:
959
+ self._simulate = True
960
+ self("full-light\n")
961
+ else:
962
+ self._simulate = False
963
+ self("stop\n")
964
+
965
+ def cool_helper(self, choice_dict):
966
+ self.kernel.root.coolant.coolant_choice_helper(self)(choice_dict)