meerk40t 0.9.3001__py2.py3-none-any.whl → 0.9.7010__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meerk40t/__init__.py +1 -1
- meerk40t/balormk/balor_params.py +167 -167
- meerk40t/balormk/clone_loader.py +457 -457
- meerk40t/balormk/controller.py +1566 -1512
- meerk40t/balormk/cylindermod.py +64 -0
- meerk40t/balormk/device.py +966 -1959
- meerk40t/balormk/driver.py +778 -591
- meerk40t/balormk/galvo_commands.py +1195 -0
- meerk40t/balormk/gui/balorconfig.py +237 -111
- meerk40t/balormk/gui/balorcontroller.py +191 -184
- meerk40t/balormk/gui/baloroperationproperties.py +116 -115
- meerk40t/balormk/gui/corscene.py +845 -0
- meerk40t/balormk/gui/gui.py +179 -147
- meerk40t/balormk/livelightjob.py +466 -382
- meerk40t/balormk/mock_connection.py +131 -109
- meerk40t/balormk/plugin.py +133 -135
- meerk40t/balormk/usb_connection.py +306 -301
- meerk40t/camera/__init__.py +1 -1
- meerk40t/camera/camera.py +514 -397
- meerk40t/camera/gui/camerapanel.py +1241 -1095
- meerk40t/camera/gui/gui.py +58 -58
- meerk40t/camera/plugin.py +441 -399
- meerk40t/ch341/__init__.py +27 -27
- meerk40t/ch341/ch341device.py +628 -628
- meerk40t/ch341/libusb.py +595 -589
- meerk40t/ch341/mock.py +171 -171
- meerk40t/ch341/windriver.py +157 -157
- meerk40t/constants.py +13 -0
- meerk40t/core/__init__.py +1 -1
- meerk40t/core/bindalias.py +550 -539
- meerk40t/core/core.py +47 -47
- meerk40t/core/cutcode/cubiccut.py +73 -73
- meerk40t/core/cutcode/cutcode.py +315 -312
- meerk40t/core/cutcode/cutgroup.py +141 -137
- meerk40t/core/cutcode/cutobject.py +192 -185
- meerk40t/core/cutcode/dwellcut.py +37 -37
- meerk40t/core/cutcode/gotocut.py +29 -29
- meerk40t/core/cutcode/homecut.py +29 -29
- meerk40t/core/cutcode/inputcut.py +34 -34
- meerk40t/core/cutcode/linecut.py +33 -33
- meerk40t/core/cutcode/outputcut.py +34 -34
- meerk40t/core/cutcode/plotcut.py +335 -335
- meerk40t/core/cutcode/quadcut.py +61 -61
- meerk40t/core/cutcode/rastercut.py +168 -148
- meerk40t/core/cutcode/waitcut.py +34 -34
- meerk40t/core/cutplan.py +1843 -1316
- meerk40t/core/drivers.py +330 -329
- meerk40t/core/elements/align.py +801 -669
- meerk40t/core/elements/branches.py +1844 -1507
- meerk40t/core/elements/clipboard.py +229 -219
- meerk40t/core/elements/element_treeops.py +4561 -2837
- meerk40t/core/elements/element_types.py +125 -105
- meerk40t/core/elements/elements.py +4329 -3617
- meerk40t/core/elements/files.py +117 -64
- meerk40t/core/elements/geometry.py +473 -224
- meerk40t/core/elements/grid.py +467 -316
- meerk40t/core/elements/materials.py +158 -94
- meerk40t/core/elements/notes.py +50 -38
- meerk40t/core/elements/offset_clpr.py +933 -912
- meerk40t/core/elements/offset_mk.py +963 -955
- meerk40t/core/elements/penbox.py +339 -267
- meerk40t/core/elements/placements.py +300 -83
- meerk40t/core/elements/render.py +785 -687
- meerk40t/core/elements/shapes.py +2618 -2092
- meerk40t/core/elements/trace.py +651 -563
- meerk40t/core/elements/tree_commands.py +415 -409
- meerk40t/core/elements/undo_redo.py +116 -58
- meerk40t/core/elements/wordlist.py +319 -200
- meerk40t/core/exceptions.py +9 -9
- meerk40t/core/laserjob.py +220 -220
- meerk40t/core/logging.py +63 -63
- meerk40t/core/node/blobnode.py +83 -86
- meerk40t/core/node/bootstrap.py +105 -103
- meerk40t/core/node/branch_elems.py +40 -31
- meerk40t/core/node/branch_ops.py +45 -38
- meerk40t/core/node/branch_regmark.py +48 -41
- meerk40t/core/node/cutnode.py +29 -32
- meerk40t/core/node/effect_hatch.py +375 -257
- meerk40t/core/node/effect_warp.py +398 -0
- meerk40t/core/node/effect_wobble.py +441 -309
- meerk40t/core/node/elem_ellipse.py +404 -309
- meerk40t/core/node/elem_image.py +1082 -801
- meerk40t/core/node/elem_line.py +358 -292
- meerk40t/core/node/elem_path.py +259 -201
- meerk40t/core/node/elem_point.py +129 -102
- meerk40t/core/node/elem_polyline.py +310 -246
- meerk40t/core/node/elem_rect.py +376 -286
- meerk40t/core/node/elem_text.py +445 -418
- meerk40t/core/node/filenode.py +59 -40
- meerk40t/core/node/groupnode.py +138 -74
- meerk40t/core/node/image_processed.py +777 -766
- meerk40t/core/node/image_raster.py +156 -113
- meerk40t/core/node/layernode.py +31 -31
- meerk40t/core/node/mixins.py +135 -107
- meerk40t/core/node/node.py +1427 -1304
- meerk40t/core/node/nutils.py +117 -114
- meerk40t/core/node/op_cut.py +462 -335
- meerk40t/core/node/op_dots.py +296 -251
- meerk40t/core/node/op_engrave.py +414 -311
- meerk40t/core/node/op_image.py +755 -369
- meerk40t/core/node/op_raster.py +787 -522
- meerk40t/core/node/place_current.py +37 -40
- meerk40t/core/node/place_point.py +329 -126
- meerk40t/core/node/refnode.py +58 -47
- meerk40t/core/node/rootnode.py +225 -219
- meerk40t/core/node/util_console.py +48 -48
- meerk40t/core/node/util_goto.py +84 -65
- meerk40t/core/node/util_home.py +61 -61
- meerk40t/core/node/util_input.py +102 -102
- meerk40t/core/node/util_output.py +102 -102
- meerk40t/core/node/util_wait.py +65 -65
- meerk40t/core/parameters.py +709 -707
- meerk40t/core/planner.py +875 -785
- meerk40t/core/plotplanner.py +656 -652
- meerk40t/core/space.py +120 -113
- meerk40t/core/spoolers.py +706 -705
- meerk40t/core/svg_io.py +1836 -1549
- meerk40t/core/treeop.py +534 -445
- meerk40t/core/undos.py +278 -124
- meerk40t/core/units.py +784 -680
- meerk40t/core/view.py +393 -322
- meerk40t/core/webhelp.py +62 -62
- meerk40t/core/wordlist.py +513 -504
- meerk40t/cylinder/cylinder.py +247 -0
- meerk40t/cylinder/gui/cylindersettings.py +41 -0
- meerk40t/cylinder/gui/gui.py +24 -0
- meerk40t/device/__init__.py +1 -1
- meerk40t/device/basedevice.py +322 -123
- meerk40t/device/devicechoices.py +50 -0
- meerk40t/device/dummydevice.py +163 -128
- meerk40t/device/gui/defaultactions.py +618 -602
- meerk40t/device/gui/effectspanel.py +114 -0
- meerk40t/device/gui/formatterpanel.py +253 -290
- meerk40t/device/gui/warningpanel.py +337 -260
- meerk40t/device/mixins.py +13 -13
- meerk40t/dxf/__init__.py +1 -1
- meerk40t/dxf/dxf_io.py +766 -554
- meerk40t/dxf/plugin.py +47 -35
- meerk40t/external_plugins.py +79 -79
- meerk40t/external_plugins_build.py +28 -28
- meerk40t/extra/cag.py +112 -116
- meerk40t/extra/coolant.py +403 -0
- meerk40t/extra/encode_detect.py +198 -0
- meerk40t/extra/ezd.py +1165 -1165
- meerk40t/extra/hershey.py +835 -340
- meerk40t/extra/imageactions.py +322 -316
- meerk40t/extra/inkscape.py +630 -622
- meerk40t/extra/lbrn.py +424 -424
- meerk40t/extra/outerworld.py +284 -0
- meerk40t/extra/param_functions.py +1542 -1556
- meerk40t/extra/potrace.py +257 -253
- meerk40t/extra/serial_exchange.py +118 -0
- meerk40t/extra/updater.py +602 -453
- meerk40t/extra/vectrace.py +147 -146
- meerk40t/extra/winsleep.py +83 -83
- meerk40t/extra/xcs_reader.py +597 -0
- meerk40t/fill/fills.py +781 -335
- meerk40t/fill/patternfill.py +1061 -1061
- meerk40t/fill/patterns.py +614 -567
- meerk40t/grbl/control.py +87 -87
- meerk40t/grbl/controller.py +990 -903
- meerk40t/grbl/device.py +1081 -768
- meerk40t/grbl/driver.py +989 -771
- meerk40t/grbl/emulator.py +532 -497
- meerk40t/grbl/gcodejob.py +783 -767
- meerk40t/grbl/gui/grblconfiguration.py +373 -298
- meerk40t/grbl/gui/grblcontroller.py +485 -271
- meerk40t/grbl/gui/grblhardwareconfig.py +269 -153
- meerk40t/grbl/gui/grbloperationconfig.py +105 -0
- meerk40t/grbl/gui/gui.py +147 -116
- meerk40t/grbl/interpreter.py +44 -44
- meerk40t/grbl/loader.py +22 -22
- meerk40t/grbl/mock_connection.py +56 -56
- meerk40t/grbl/plugin.py +294 -264
- meerk40t/grbl/serial_connection.py +93 -88
- meerk40t/grbl/tcp_connection.py +81 -79
- meerk40t/grbl/ws_connection.py +112 -0
- meerk40t/gui/__init__.py +1 -1
- meerk40t/gui/about.py +2042 -296
- meerk40t/gui/alignment.py +1644 -1608
- meerk40t/gui/autoexec.py +199 -0
- meerk40t/gui/basicops.py +791 -670
- meerk40t/gui/bufferview.py +77 -71
- meerk40t/gui/busy.py +170 -133
- meerk40t/gui/choicepropertypanel.py +1673 -1469
- meerk40t/gui/consolepanel.py +706 -542
- meerk40t/gui/devicepanel.py +687 -581
- meerk40t/gui/dialogoptions.py +110 -107
- meerk40t/gui/executejob.py +316 -306
- meerk40t/gui/fonts.py +90 -90
- meerk40t/gui/functionwrapper.py +252 -0
- meerk40t/gui/gui_mixins.py +729 -0
- meerk40t/gui/guicolors.py +205 -182
- meerk40t/gui/help_assets/help_assets.py +218 -201
- meerk40t/gui/helper.py +154 -0
- meerk40t/gui/hersheymanager.py +1430 -846
- meerk40t/gui/icons.py +3422 -2747
- meerk40t/gui/imagesplitter.py +555 -508
- meerk40t/gui/keymap.py +354 -344
- meerk40t/gui/laserpanel.py +892 -806
- meerk40t/gui/laserrender.py +1470 -1232
- meerk40t/gui/lasertoolpanel.py +805 -793
- meerk40t/gui/magnetoptions.py +436 -0
- meerk40t/gui/materialmanager.py +2917 -0
- meerk40t/gui/materialtest.py +1722 -1694
- meerk40t/gui/mkdebug.py +646 -359
- meerk40t/gui/mwindow.py +163 -140
- meerk40t/gui/navigationpanels.py +2605 -2467
- meerk40t/gui/notes.py +143 -142
- meerk40t/gui/opassignment.py +414 -410
- meerk40t/gui/operation_info.py +310 -299
- meerk40t/gui/plugin.py +494 -328
- meerk40t/gui/position.py +714 -669
- meerk40t/gui/preferences.py +901 -650
- meerk40t/gui/propertypanels/attributes.py +1461 -1131
- meerk40t/gui/propertypanels/blobproperty.py +117 -114
- meerk40t/gui/propertypanels/consoleproperty.py +83 -80
- meerk40t/gui/propertypanels/gotoproperty.py +77 -0
- meerk40t/gui/propertypanels/groupproperties.py +223 -217
- meerk40t/gui/propertypanels/hatchproperty.py +489 -469
- meerk40t/gui/propertypanels/imageproperty.py +2244 -1384
- meerk40t/gui/propertypanels/inputproperty.py +59 -58
- meerk40t/gui/propertypanels/opbranchproperties.py +82 -80
- meerk40t/gui/propertypanels/operationpropertymain.py +1890 -1638
- meerk40t/gui/propertypanels/outputproperty.py +59 -58
- meerk40t/gui/propertypanels/pathproperty.py +389 -380
- meerk40t/gui/propertypanels/placementproperty.py +1214 -383
- meerk40t/gui/propertypanels/pointproperty.py +140 -136
- meerk40t/gui/propertypanels/propertywindow.py +313 -181
- meerk40t/gui/propertypanels/rasterwizardpanels.py +996 -912
- meerk40t/gui/propertypanels/regbranchproperties.py +76 -0
- meerk40t/gui/propertypanels/textproperty.py +770 -755
- meerk40t/gui/propertypanels/waitproperty.py +56 -55
- meerk40t/gui/propertypanels/warpproperty.py +121 -0
- meerk40t/gui/propertypanels/wobbleproperty.py +255 -204
- meerk40t/gui/ribbon.py +2468 -2210
- meerk40t/gui/scene/scene.py +1100 -1051
- meerk40t/gui/scene/sceneconst.py +22 -22
- meerk40t/gui/scene/scenepanel.py +439 -349
- meerk40t/gui/scene/scenespacewidget.py +365 -365
- meerk40t/gui/scene/widget.py +518 -505
- meerk40t/gui/scenewidgets/affinemover.py +215 -215
- meerk40t/gui/scenewidgets/attractionwidget.py +315 -309
- meerk40t/gui/scenewidgets/bedwidget.py +120 -97
- meerk40t/gui/scenewidgets/elementswidget.py +137 -107
- meerk40t/gui/scenewidgets/gridwidget.py +785 -745
- meerk40t/gui/scenewidgets/guidewidget.py +765 -765
- meerk40t/gui/scenewidgets/laserpathwidget.py +66 -66
- meerk40t/gui/scenewidgets/machineoriginwidget.py +86 -86
- meerk40t/gui/scenewidgets/nodeselector.py +28 -28
- meerk40t/gui/scenewidgets/rectselectwidget.py +589 -346
- meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
- meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
- meerk40t/gui/scenewidgets/selectionwidget.py +2952 -2756
- meerk40t/gui/simpleui.py +357 -333
- meerk40t/gui/simulation.py +2431 -2094
- meerk40t/gui/snapoptions.py +208 -203
- meerk40t/gui/spoolerpanel.py +1227 -1180
- meerk40t/gui/statusbarwidgets/defaultoperations.py +480 -353
- meerk40t/gui/statusbarwidgets/infowidget.py +520 -483
- meerk40t/gui/statusbarwidgets/opassignwidget.py +356 -355
- meerk40t/gui/statusbarwidgets/selectionwidget.py +172 -171
- meerk40t/gui/statusbarwidgets/shapepropwidget.py +754 -236
- meerk40t/gui/statusbarwidgets/statusbar.py +272 -260
- meerk40t/gui/statusbarwidgets/statusbarwidget.py +268 -270
- meerk40t/gui/statusbarwidgets/strokewidget.py +267 -251
- meerk40t/gui/themes.py +200 -78
- meerk40t/gui/tips.py +591 -0
- meerk40t/gui/toolwidgets/circlebrush.py +35 -35
- meerk40t/gui/toolwidgets/toolcircle.py +248 -242
- meerk40t/gui/toolwidgets/toolcontainer.py +82 -77
- meerk40t/gui/toolwidgets/tooldraw.py +97 -90
- meerk40t/gui/toolwidgets/toolellipse.py +219 -212
- meerk40t/gui/toolwidgets/toolimagecut.py +25 -132
- meerk40t/gui/toolwidgets/toolline.py +39 -144
- meerk40t/gui/toolwidgets/toollinetext.py +79 -236
- meerk40t/gui/toolwidgets/toollinetext_inline.py +296 -0
- meerk40t/gui/toolwidgets/toolmeasure.py +160 -216
- meerk40t/gui/toolwidgets/toolnodeedit.py +2088 -2074
- meerk40t/gui/toolwidgets/toolnodemove.py +92 -94
- meerk40t/gui/toolwidgets/toolparameter.py +754 -668
- meerk40t/gui/toolwidgets/toolplacement.py +108 -108
- meerk40t/gui/toolwidgets/toolpoint.py +68 -59
- meerk40t/gui/toolwidgets/toolpointlistbuilder.py +294 -0
- meerk40t/gui/toolwidgets/toolpointmove.py +183 -0
- meerk40t/gui/toolwidgets/toolpolygon.py +288 -403
- meerk40t/gui/toolwidgets/toolpolyline.py +38 -196
- meerk40t/gui/toolwidgets/toolrect.py +211 -207
- meerk40t/gui/toolwidgets/toolrelocate.py +72 -72
- meerk40t/gui/toolwidgets/toolribbon.py +598 -113
- meerk40t/gui/toolwidgets/tooltabedit.py +546 -0
- meerk40t/gui/toolwidgets/tooltext.py +98 -89
- meerk40t/gui/toolwidgets/toolvector.py +213 -204
- meerk40t/gui/toolwidgets/toolwidget.py +39 -39
- meerk40t/gui/usbconnect.py +98 -91
- meerk40t/gui/utilitywidgets/buttonwidget.py +18 -18
- meerk40t/gui/utilitywidgets/checkboxwidget.py +90 -90
- meerk40t/gui/utilitywidgets/controlwidget.py +14 -14
- meerk40t/gui/utilitywidgets/cyclocycloidwidget.py +343 -340
- meerk40t/gui/utilitywidgets/debugwidgets.py +148 -0
- meerk40t/gui/utilitywidgets/handlewidget.py +27 -27
- meerk40t/gui/utilitywidgets/harmonograph.py +450 -447
- meerk40t/gui/utilitywidgets/openclosewidget.py +40 -40
- meerk40t/gui/utilitywidgets/rotationwidget.py +54 -54
- meerk40t/gui/utilitywidgets/scalewidget.py +75 -75
- meerk40t/gui/utilitywidgets/seekbarwidget.py +183 -183
- meerk40t/gui/utilitywidgets/togglewidget.py +142 -142
- meerk40t/gui/utilitywidgets/toolbarwidget.py +8 -8
- meerk40t/gui/wordlisteditor.py +985 -931
- meerk40t/gui/wxmeerk40t.py +1444 -1169
- meerk40t/gui/wxmmain.py +5578 -4112
- meerk40t/gui/wxmribbon.py +1591 -1076
- meerk40t/gui/wxmscene.py +1635 -1453
- meerk40t/gui/wxmtree.py +2410 -2089
- meerk40t/gui/wxutils.py +1769 -1099
- meerk40t/gui/zmatrix.py +102 -102
- meerk40t/image/__init__.py +1 -1
- meerk40t/image/dither.py +429 -0
- meerk40t/image/imagetools.py +2778 -2269
- meerk40t/internal_plugins.py +150 -130
- meerk40t/kernel/__init__.py +63 -12
- meerk40t/kernel/channel.py +259 -212
- meerk40t/kernel/context.py +538 -538
- meerk40t/kernel/exceptions.py +41 -41
- meerk40t/kernel/functions.py +463 -414
- meerk40t/kernel/jobs.py +100 -100
- meerk40t/kernel/kernel.py +3809 -3571
- meerk40t/kernel/lifecycles.py +71 -71
- meerk40t/kernel/module.py +49 -49
- meerk40t/kernel/service.py +147 -147
- meerk40t/kernel/settings.py +383 -343
- meerk40t/lihuiyu/controller.py +883 -876
- meerk40t/lihuiyu/device.py +1181 -1069
- meerk40t/lihuiyu/driver.py +1466 -1372
- meerk40t/lihuiyu/gui/gui.py +127 -106
- meerk40t/lihuiyu/gui/lhyaccelgui.py +377 -363
- meerk40t/lihuiyu/gui/lhycontrollergui.py +741 -651
- meerk40t/lihuiyu/gui/lhydrivergui.py +470 -446
- meerk40t/lihuiyu/gui/lhyoperationproperties.py +238 -237
- meerk40t/lihuiyu/gui/tcpcontroller.py +226 -190
- meerk40t/lihuiyu/interpreter.py +53 -53
- meerk40t/lihuiyu/laserspeed.py +450 -450
- meerk40t/lihuiyu/loader.py +90 -90
- meerk40t/lihuiyu/parser.py +404 -404
- meerk40t/lihuiyu/plugin.py +101 -102
- meerk40t/lihuiyu/tcp_connection.py +111 -109
- meerk40t/main.py +231 -165
- meerk40t/moshi/builder.py +788 -781
- meerk40t/moshi/controller.py +505 -499
- meerk40t/moshi/device.py +495 -442
- meerk40t/moshi/driver.py +862 -696
- meerk40t/moshi/gui/gui.py +78 -76
- meerk40t/moshi/gui/moshicontrollergui.py +538 -522
- meerk40t/moshi/gui/moshidrivergui.py +87 -75
- meerk40t/moshi/plugin.py +43 -43
- meerk40t/network/console_server.py +102 -57
- meerk40t/network/kernelserver.py +10 -9
- meerk40t/network/tcp_server.py +142 -140
- meerk40t/network/udp_server.py +103 -77
- meerk40t/network/web_server.py +390 -0
- meerk40t/newly/controller.py +1158 -1144
- meerk40t/newly/device.py +874 -732
- meerk40t/newly/driver.py +540 -412
- meerk40t/newly/gui/gui.py +219 -188
- meerk40t/newly/gui/newlyconfig.py +116 -101
- meerk40t/newly/gui/newlycontroller.py +193 -186
- meerk40t/newly/gui/operationproperties.py +51 -51
- meerk40t/newly/mock_connection.py +82 -82
- meerk40t/newly/newly_params.py +56 -56
- meerk40t/newly/plugin.py +1214 -1246
- meerk40t/newly/usb_connection.py +322 -322
- meerk40t/rotary/gui/gui.py +52 -46
- meerk40t/rotary/gui/rotarysettings.py +240 -232
- meerk40t/rotary/rotary.py +202 -98
- meerk40t/ruida/control.py +291 -91
- meerk40t/ruida/controller.py +138 -1088
- meerk40t/ruida/device.py +672 -231
- meerk40t/ruida/driver.py +534 -472
- meerk40t/ruida/emulator.py +1494 -1491
- meerk40t/ruida/exceptions.py +4 -4
- meerk40t/ruida/gui/gui.py +71 -76
- meerk40t/ruida/gui/ruidaconfig.py +239 -72
- meerk40t/ruida/gui/ruidacontroller.py +187 -184
- meerk40t/ruida/gui/ruidaoperationproperties.py +48 -47
- meerk40t/ruida/loader.py +54 -52
- meerk40t/ruida/mock_connection.py +57 -109
- meerk40t/ruida/plugin.py +124 -87
- meerk40t/ruida/rdjob.py +2084 -945
- meerk40t/ruida/serial_connection.py +116 -0
- meerk40t/ruida/tcp_connection.py +146 -0
- meerk40t/ruida/udp_connection.py +73 -0
- meerk40t/svgelements.py +9671 -9669
- meerk40t/tools/driver_to_path.py +584 -579
- meerk40t/tools/geomstr.py +5583 -4680
- meerk40t/tools/jhfparser.py +357 -292
- meerk40t/tools/kerftest.py +904 -890
- meerk40t/tools/livinghinges.py +1168 -1033
- meerk40t/tools/pathtools.py +987 -949
- meerk40t/tools/pmatrix.py +234 -0
- meerk40t/tools/pointfinder.py +942 -942
- meerk40t/tools/polybool.py +940 -940
- meerk40t/tools/rasterplotter.py +1660 -547
- meerk40t/tools/shxparser.py +989 -901
- meerk40t/tools/ttfparser.py +726 -446
- meerk40t/tools/zinglplotter.py +595 -593
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/LICENSE +21 -21
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/METADATA +150 -139
- meerk40t-0.9.7010.dist-info/RECORD +445 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/WHEEL +1 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/top_level.txt +0 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/zip-safe +1 -1
- meerk40t/balormk/elementlightjob.py +0 -159
- meerk40t-0.9.3001.dist-info/RECORD +0 -437
- test/bootstrap.py +0 -63
- test/test_cli.py +0 -12
- test/test_core_cutcode.py +0 -418
- test/test_core_elements.py +0 -144
- test/test_core_plotplanner.py +0 -397
- test/test_core_viewports.py +0 -312
- test/test_drivers_grbl.py +0 -108
- test/test_drivers_lihuiyu.py +0 -443
- test/test_drivers_newly.py +0 -113
- test/test_element_degenerate_points.py +0 -43
- test/test_elements_classify.py +0 -97
- test/test_elements_penbox.py +0 -22
- test/test_file_svg.py +0 -176
- test/test_fill.py +0 -155
- test/test_geomstr.py +0 -1523
- test/test_geomstr_nodes.py +0 -18
- test/test_imagetools_actualize.py +0 -306
- test/test_imagetools_wizard.py +0 -258
- test/test_kernel.py +0 -200
- test/test_laser_speeds.py +0 -3303
- test/test_length.py +0 -57
- test/test_lifecycle.py +0 -66
- test/test_operations.py +0 -251
- test/test_operations_hatch.py +0 -57
- test/test_ruida.py +0 -19
- test/test_spooler.py +0 -22
- test/test_tools_rasterplotter.py +0 -29
- test/test_wobble.py +0 -133
- test/test_zingl.py +0 -124
- {test → meerk40t/cylinder}/__init__.py +0 -0
- /meerk40t/{core/element_commands.py → cylinder/gui/__init__.py} +0 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7010.dist-info}/entry_points.txt +0 -0
@@ -1,1556 +1,1542 @@
|
|
1
|
-
"""
|
2
|
-
This module exposes a couple of routines to create shapes,
|
3
|
-
that have additional functional parameters set to allow
|
4
|
-
parametric editing
|
5
|
-
"""
|
6
|
-
import
|
7
|
-
|
8
|
-
|
9
|
-
from meerk40t.
|
10
|
-
from meerk40t.
|
11
|
-
from meerk40t.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
@self.console_argument("
|
59
|
-
@self.console_argument("
|
60
|
-
@self.console_argument("
|
61
|
-
@self.console_argument("
|
62
|
-
@self.
|
63
|
-
@self.console_option("
|
64
|
-
@
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
node.
|
134
|
-
node.
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
start_pt.
|
141
|
-
|
142
|
-
|
143
|
-
start_pt.
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
post.append(classify_new(data))
|
153
|
-
return "elements", data
|
154
|
-
|
155
|
-
def update_node_grid(node):
|
156
|
-
my_id = "grid"
|
157
|
-
|
158
|
-
|
159
|
-
param
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
if
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
bb[
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
newstart
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
@self.console_argument(
|
242
|
-
"
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
1,
|
308
|
-
|
309
|
-
1,
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
)
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
)
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
param
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
return
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
#
|
560
|
-
#
|
561
|
-
#
|
562
|
-
#
|
563
|
-
#
|
564
|
-
#
|
565
|
-
#
|
566
|
-
#
|
567
|
-
#
|
568
|
-
#
|
569
|
-
#
|
570
|
-
#
|
571
|
-
#
|
572
|
-
#
|
573
|
-
#
|
574
|
-
#
|
575
|
-
#
|
576
|
-
#
|
577
|
-
#
|
578
|
-
#
|
579
|
-
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
#
|
583
|
-
#
|
584
|
-
#
|
585
|
-
#
|
586
|
-
#
|
587
|
-
#
|
588
|
-
#
|
589
|
-
#
|
590
|
-
#
|
591
|
-
#
|
592
|
-
#
|
593
|
-
#
|
594
|
-
#
|
595
|
-
#
|
596
|
-
#
|
597
|
-
#
|
598
|
-
#
|
599
|
-
#
|
600
|
-
#
|
601
|
-
#
|
602
|
-
#
|
603
|
-
#
|
604
|
-
#
|
605
|
-
#
|
606
|
-
#
|
607
|
-
#
|
608
|
-
#
|
609
|
-
#
|
610
|
-
#
|
611
|
-
# )
|
612
|
-
#
|
613
|
-
#
|
614
|
-
#
|
615
|
-
#
|
616
|
-
#
|
617
|
-
#
|
618
|
-
#
|
619
|
-
#
|
620
|
-
#
|
621
|
-
#
|
622
|
-
#
|
623
|
-
#
|
624
|
-
#
|
625
|
-
#
|
626
|
-
#
|
627
|
-
#
|
628
|
-
#
|
629
|
-
#
|
630
|
-
#
|
631
|
-
#
|
632
|
-
#
|
633
|
-
#
|
634
|
-
#
|
635
|
-
#
|
636
|
-
#
|
637
|
-
#
|
638
|
-
#
|
639
|
-
#
|
640
|
-
#
|
641
|
-
#
|
642
|
-
#
|
643
|
-
#
|
644
|
-
#
|
645
|
-
#
|
646
|
-
#
|
647
|
-
#
|
648
|
-
#
|
649
|
-
#
|
650
|
-
#
|
651
|
-
#
|
652
|
-
#
|
653
|
-
#
|
654
|
-
#
|
655
|
-
#
|
656
|
-
#
|
657
|
-
#
|
658
|
-
#
|
659
|
-
#
|
660
|
-
#
|
661
|
-
#
|
662
|
-
#
|
663
|
-
# valid = False
|
664
|
-
# if
|
665
|
-
#
|
666
|
-
#
|
667
|
-
#
|
668
|
-
#
|
669
|
-
#
|
670
|
-
#
|
671
|
-
#
|
672
|
-
#
|
673
|
-
#
|
674
|
-
#
|
675
|
-
#
|
676
|
-
#
|
677
|
-
#
|
678
|
-
#
|
679
|
-
#
|
680
|
-
#
|
681
|
-
#
|
682
|
-
#
|
683
|
-
|
684
|
-
#
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
radius_major
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
if param
|
809
|
-
|
810
|
-
except
|
811
|
-
|
812
|
-
if
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
if
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
"
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
"
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
)
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
if
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
node.
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
corners
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
pt0 =
|
1299
|
-
pt1 =
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
)
|
1313
|
-
node.
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
if
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
"
|
1463
|
-
"
|
1464
|
-
"
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
"
|
1498
|
-
"
|
1499
|
-
"
|
1500
|
-
"
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
info = (
|
1508
|
-
|
1509
|
-
{
|
1510
|
-
"0": ("
|
1511
|
-
"1": ("
|
1512
|
-
"2": ("
|
1513
|
-
"3": ("
|
1514
|
-
"4": ("
|
1515
|
-
"5": ("
|
1516
|
-
},
|
1517
|
-
False,
|
1518
|
-
)
|
1519
|
-
kernel.register("element_update/
|
1520
|
-
|
1521
|
-
info = (
|
1522
|
-
|
1523
|
-
{
|
1524
|
-
"0": ("
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
"
|
1539
|
-
},
|
1540
|
-
False,
|
1541
|
-
)
|
1542
|
-
kernel.register("element_update/
|
1543
|
-
|
1544
|
-
info = (
|
1545
|
-
update_node_growing_shape,
|
1546
|
-
{
|
1547
|
-
"0": ("First point",),
|
1548
|
-
"1": ("First edge",),
|
1549
|
-
"2": ("Growth Ratio", 0, 100),
|
1550
|
-
"3": ("Sides", 3, 12),
|
1551
|
-
"4": ("Iterations", 1, 45),
|
1552
|
-
"5": ("Gap", 0, 15),
|
1553
|
-
},
|
1554
|
-
False,
|
1555
|
-
)
|
1556
|
-
kernel.register("element_update/growingshape", info)
|
1
|
+
"""
|
2
|
+
This module exposes a couple of routines to create shapes,
|
3
|
+
that have additional functional parameters set to allow
|
4
|
+
parametric editing
|
5
|
+
"""
|
6
|
+
import math
|
7
|
+
|
8
|
+
from meerk40t.core.units import Angle, Length
|
9
|
+
from meerk40t.kernel import CommandSyntaxError
|
10
|
+
from meerk40t.svgelements import Point
|
11
|
+
from meerk40t.tools.geomstr import Geomstr
|
12
|
+
|
13
|
+
|
14
|
+
def plugin(kernel, lifecycle):
|
15
|
+
if lifecycle == "register":
|
16
|
+
_ = kernel.translation
|
17
|
+
context = kernel.root
|
18
|
+
self = context.elements
|
19
|
+
classify_new = self.post_classify
|
20
|
+
|
21
|
+
def getit(param, idx, default):
|
22
|
+
if idx >= len(param):
|
23
|
+
return default
|
24
|
+
return param[idx]
|
25
|
+
|
26
|
+
def create_copied_grid(start_pt, node, cols, rows, sdx, sdy):
|
27
|
+
# print(
|
28
|
+
# f"Create a {cols}x{rows} grid, gap={sdx:.0f} x {sdy:.0f} at ({start_pt.x:.0f}, {start_pt.y:.0f})..."
|
29
|
+
# )
|
30
|
+
geom = Geomstr()
|
31
|
+
try:
|
32
|
+
if isinstance(node, Geomstr):
|
33
|
+
# That may be the case if we have lost the connection to the original node.
|
34
|
+
# In that case we are getting passed the first geometry subpath to reuse
|
35
|
+
orggeom = node
|
36
|
+
else:
|
37
|
+
orggeom = node.as_geometry()
|
38
|
+
bb = orggeom.bbox()
|
39
|
+
width = bb[2] - bb[0]
|
40
|
+
height = bb[3] - bb[1]
|
41
|
+
except AttributeError:
|
42
|
+
return geom
|
43
|
+
x = start_pt.x
|
44
|
+
for scol in range(cols):
|
45
|
+
y = start_pt.y
|
46
|
+
for srow in range(rows):
|
47
|
+
tempgeom = Geomstr(orggeom)
|
48
|
+
dx = x - bb[0]
|
49
|
+
dy = y - bb[1]
|
50
|
+
# print(f"{scol}x{srow}: translate by {dx:.0f}x{dy:.0f}")
|
51
|
+
tempgeom.translate(dx, dy)
|
52
|
+
geom.append(tempgeom)
|
53
|
+
y += sdy + height
|
54
|
+
x += sdx + width
|
55
|
+
return geom
|
56
|
+
|
57
|
+
@self.console_argument("sx", type=Length)
|
58
|
+
@self.console_argument("sy", type=Length)
|
59
|
+
@self.console_argument("cols", type=int)
|
60
|
+
@self.console_argument("rows", type=int)
|
61
|
+
@self.console_argument("id", type=str)
|
62
|
+
@self.console_option("dx", "x", type=Length, help=_("Horizontal delta"))
|
63
|
+
@self.console_option("dy", "y", type=Length, help=_("Vertical delta"))
|
64
|
+
@context.console_command("pgrid", help=_("pgrid sx, sy, cols, rows, id"))
|
65
|
+
def param_grid(
|
66
|
+
command,
|
67
|
+
channel,
|
68
|
+
_,
|
69
|
+
sx=None,
|
70
|
+
sy=None,
|
71
|
+
cols=None,
|
72
|
+
rows=None,
|
73
|
+
id=None,
|
74
|
+
dx=None,
|
75
|
+
dy=None,
|
76
|
+
clone=None,
|
77
|
+
post=None,
|
78
|
+
**kwargs,
|
79
|
+
):
|
80
|
+
try:
|
81
|
+
if sx is None:
|
82
|
+
sx = Length("0cm")
|
83
|
+
ssx = float(sx)
|
84
|
+
if sy is None:
|
85
|
+
sy = Length("0cm")
|
86
|
+
ssy = float(sy)
|
87
|
+
if cols is None:
|
88
|
+
cols = 2
|
89
|
+
if rows is None:
|
90
|
+
rows = 2
|
91
|
+
if dx is None:
|
92
|
+
dx = Length("0mm")
|
93
|
+
sdx = float(dx)
|
94
|
+
if dy is None:
|
95
|
+
dy = Length("0mm")
|
96
|
+
sdy = float(dy)
|
97
|
+
except ValueError:
|
98
|
+
channel("Invalid data provided")
|
99
|
+
return
|
100
|
+
self.validate_ids()
|
101
|
+
found_node = None
|
102
|
+
if id is not None:
|
103
|
+
# We look for such a node, both in elements and regmarks.
|
104
|
+
for node in self.elems():
|
105
|
+
if node.id == id and hasattr(node, "as_geometry"):
|
106
|
+
found_node = node
|
107
|
+
break
|
108
|
+
if found_node is None:
|
109
|
+
for node in self.regmarks():
|
110
|
+
if node.id == id and hasattr(node, "as_geometry"):
|
111
|
+
found_node = node
|
112
|
+
break
|
113
|
+
if found_node is None:
|
114
|
+
# We try the first selected element
|
115
|
+
for node in self.elems(emphasized=True):
|
116
|
+
if hasattr(node, "as_geometry"):
|
117
|
+
id = node.id
|
118
|
+
found_node = node
|
119
|
+
break
|
120
|
+
if found_node is None:
|
121
|
+
channel("No matching element found.")
|
122
|
+
start_pt = Point(ssx, ssy)
|
123
|
+
geom = create_copied_grid(start_pt, found_node, cols, rows, sdx, sdy)
|
124
|
+
node = self.elem_branch.add(type="elem path", geometry=geom)
|
125
|
+
bb = geom.bbox()
|
126
|
+
width = bb[2] - bb[0]
|
127
|
+
# height = bb[3] - bb[1]
|
128
|
+
if hasattr(found_node, "stroke"):
|
129
|
+
node.stroke = found_node.stroke
|
130
|
+
else:
|
131
|
+
node.stroke = self.default_stroke
|
132
|
+
node.stroke_width = self.default_strokewidth
|
133
|
+
node.altered()
|
134
|
+
node.functional_parameter = (
|
135
|
+
"grid",
|
136
|
+
3,
|
137
|
+
id,
|
138
|
+
0,
|
139
|
+
start_pt.x + sdx,
|
140
|
+
start_pt.y,
|
141
|
+
0,
|
142
|
+
start_pt.x + width,
|
143
|
+
start_pt.y + sdy,
|
144
|
+
1,
|
145
|
+
cols,
|
146
|
+
1,
|
147
|
+
rows,
|
148
|
+
)
|
149
|
+
# Newly created! Classification needed?
|
150
|
+
data = [node]
|
151
|
+
node.emphasized = True
|
152
|
+
post.append(classify_new(data))
|
153
|
+
return "elements", data
|
154
|
+
|
155
|
+
def update_node_grid(node):
|
156
|
+
my_id = "grid"
|
157
|
+
try:
|
158
|
+
param = node.functional_parameter
|
159
|
+
if param is None or param[0] != my_id:
|
160
|
+
return
|
161
|
+
except (AttributeError, IndexError):
|
162
|
+
return
|
163
|
+
node_id = getit(param, 2, None)
|
164
|
+
if node_id is None:
|
165
|
+
return
|
166
|
+
found_node = None
|
167
|
+
for e in self.elems():
|
168
|
+
if e.id == node_id and hasattr(e, "as_geometry"):
|
169
|
+
found_node = e
|
170
|
+
break
|
171
|
+
if found_node is None:
|
172
|
+
for e in self.regmarks():
|
173
|
+
if e.id == node_id and hasattr(e, "as_geometry"):
|
174
|
+
found_node = e
|
175
|
+
break
|
176
|
+
if found_node is None:
|
177
|
+
return
|
178
|
+
geom = node.as_geometry()
|
179
|
+
# That has already the matrix applied, so we need to reverse that
|
180
|
+
# Use ~ inversion operator to create an inversed copy
|
181
|
+
geom.transform(~node.matrix)
|
182
|
+
bb = geom.bbox()
|
183
|
+
start_pt = Point(bb[0], bb[1])
|
184
|
+
|
185
|
+
sdx = getit(param, 4, bb[0])
|
186
|
+
sdy = getit(param, 8, bb[1])
|
187
|
+
sdx = sdx - bb[0]
|
188
|
+
sdy = sdy - bb[1]
|
189
|
+
cols = getit(param, 10, 1)
|
190
|
+
rows = getit(param, 12, 1)
|
191
|
+
|
192
|
+
geom = create_copied_grid(start_pt, found_node, cols, rows, sdx, sdy)
|
193
|
+
node.geometry = geom
|
194
|
+
bb = geom.bbox()
|
195
|
+
node.functional_parameter = (
|
196
|
+
"grid",
|
197
|
+
3,
|
198
|
+
node_id,
|
199
|
+
0,
|
200
|
+
bb[0] + sdx,
|
201
|
+
bb[1],
|
202
|
+
0,
|
203
|
+
bb[2],
|
204
|
+
bb[1] + sdy,
|
205
|
+
1,
|
206
|
+
cols,
|
207
|
+
1,
|
208
|
+
rows,
|
209
|
+
)
|
210
|
+
node.altered()
|
211
|
+
|
212
|
+
# --- Fractal Tree
|
213
|
+
def create_fractal_tree(first_pt, second_pt, iterations, ratio):
|
214
|
+
def tree_fractal(geom, startpt, endpt, depth, ratio):
|
215
|
+
#
|
216
|
+
# create a line from startpt to endpt and add it to the geometry
|
217
|
+
if depth < 0:
|
218
|
+
return
|
219
|
+
angle = startpt.angle_to(endpt)
|
220
|
+
dist = startpt.distance_to(endpt)
|
221
|
+
delta = math.tau / 8
|
222
|
+
# print(
|
223
|
+
# f"{depth}: ({startpt.x:.0f}, {startpt.y:.0f}) - ({endpt.x:.0f}, {endpt.y:.0f}) : {dist:.0f}"
|
224
|
+
# )
|
225
|
+
geom.line(complex(startpt.x, startpt.y), complex(endpt.x, endpt.y))
|
226
|
+
newstart = Point(endpt)
|
227
|
+
newend = Point.polar(endpt, angle - delta, dist * ratio)
|
228
|
+
tree_fractal(geom, newstart, newend, depth - 1, ratio)
|
229
|
+
newend = Point.polar(endpt, angle + delta, dist * ratio)
|
230
|
+
tree_fractal(geom, newstart, newend, depth - 1, ratio)
|
231
|
+
|
232
|
+
geometry = Geomstr()
|
233
|
+
# print("create fractal", first_pt, second_pt)
|
234
|
+
tree_fractal(geometry, first_pt, second_pt, iterations, ratio)
|
235
|
+
return geometry
|
236
|
+
|
237
|
+
@self.console_argument(
|
238
|
+
"turtle", type=str, help="turtle-path for the fractal seed"
|
239
|
+
)
|
240
|
+
@self.console_argument("n", type=int, default=4, help="Angle divisors")
|
241
|
+
@self.console_argument(
|
242
|
+
"iterations",
|
243
|
+
type=int,
|
244
|
+
default=5,
|
245
|
+
help="Number of fractal iterations to add",
|
246
|
+
)
|
247
|
+
@self.console_option(
|
248
|
+
"base", "b", type=str, help="turtle-path for the fractal base"
|
249
|
+
)
|
250
|
+
@context.console_command(
|
251
|
+
"tfractal",
|
252
|
+
help=_("tfractal iterations"),
|
253
|
+
output_type="geometry",
|
254
|
+
hidden=True,
|
255
|
+
)
|
256
|
+
def fractal_t(command, channel, turtle, n, iterations, base=None, **kwargs):
|
257
|
+
"""
|
258
|
+
Add a turtle fractal to the scene. All fractals are geometry outputs.
|
259
|
+
F - Forward
|
260
|
+
f - Forward (y-flipped)
|
261
|
+
B - Forward (walking backwards)
|
262
|
+
b - Forward(walking backwards, y-flipped).
|
263
|
+
D - Set new distance (units in sqrt of specified value)
|
264
|
+
d - Set new distance (units given)
|
265
|
+
+ - Turn right (also R).
|
266
|
+
- - Turn left (also L).
|
267
|
+
|
268
|
+
For example:
|
269
|
+
tfractal F+++D2Fd1-B 8 7 node
|
270
|
+
|
271
|
+
Would produce the Dragon of Eve fractal (iteration=7)
|
272
|
+
"""
|
273
|
+
if turtle is None:
|
274
|
+
channel("No turtle definition found")
|
275
|
+
return
|
276
|
+
seed = Geomstr.turtle(turtle, n)
|
277
|
+
pattern_base = base
|
278
|
+
pattern_repeat = 1
|
279
|
+
if base is None:
|
280
|
+
base = Geomstr.svg("M0,0 H65535")
|
281
|
+
else:
|
282
|
+
base = Geomstr.turtle(base, n, d=65535)
|
283
|
+
if pattern_base.startswith("n"):
|
284
|
+
idx = 1
|
285
|
+
pattern = ""
|
286
|
+
while pattern_base[idx] in "0123456789":
|
287
|
+
pattern += pattern_base[idx]
|
288
|
+
idx += 1
|
289
|
+
try:
|
290
|
+
pattern_repeat = int(pattern)
|
291
|
+
except ValueError:
|
292
|
+
pass
|
293
|
+
|
294
|
+
for i in range(iterations):
|
295
|
+
base.fractal(seed)
|
296
|
+
|
297
|
+
base.parameter_store = (
|
298
|
+
"tfractal",
|
299
|
+
3,
|
300
|
+
turtle,
|
301
|
+
3,
|
302
|
+
pattern_base,
|
303
|
+
1,
|
304
|
+
n,
|
305
|
+
1,
|
306
|
+
iterations,
|
307
|
+
1,
|
308
|
+
pattern_repeat,
|
309
|
+
1,
|
310
|
+
0, # line connector
|
311
|
+
)
|
312
|
+
return "geometry", base
|
313
|
+
|
314
|
+
@self.console_option(
|
315
|
+
"amount", "a", type=float, help="corner rounding amount", default=0.2
|
316
|
+
)
|
317
|
+
@self.console_command(
|
318
|
+
"round_corners", input_type="geometry", output_type="geometry"
|
319
|
+
)
|
320
|
+
def round_corners(command, channel, data, amount=0.2, **kwargs):
|
321
|
+
data.round_corners(amount)
|
322
|
+
if hasattr(data, "parameter_store"):
|
323
|
+
param = list(data.parameter_store) # make it editable
|
324
|
+
if len(param) > 12:
|
325
|
+
# Round corners
|
326
|
+
param[12] = 1
|
327
|
+
data.parameter_store = param
|
328
|
+
return "geometry", data
|
329
|
+
|
330
|
+
@self.console_option(
|
331
|
+
"amount", "a", type=float, help="corner-bezier amount", default=0.2
|
332
|
+
)
|
333
|
+
@self.console_command(
|
334
|
+
"quad_corners", input_type="geometry", output_type="geometry"
|
335
|
+
)
|
336
|
+
def quad_corners(command, channel, data, amount=0.2, **kwargs):
|
337
|
+
data.bezier_corners(amount)
|
338
|
+
if hasattr(data, "parameter_store"):
|
339
|
+
param = list(data.parameter_store) # make it editable
|
340
|
+
if len(param) > 12:
|
341
|
+
# Bezier corners
|
342
|
+
param[12] = 2
|
343
|
+
data.parameter_store = param
|
344
|
+
return "geometry", data
|
345
|
+
|
346
|
+
def update_node_tfractal(node):
|
347
|
+
my_id = "tfractal"
|
348
|
+
try:
|
349
|
+
param = node.functional_parameter
|
350
|
+
if param is None or param[0] != my_id:
|
351
|
+
return
|
352
|
+
except (AttributeError, IndexError):
|
353
|
+
return
|
354
|
+
turtle = getit(param, 2, "")
|
355
|
+
basepattern = getit(param, 4, "")
|
356
|
+
if basepattern == "":
|
357
|
+
basepattern = None
|
358
|
+
n = getit(param, 6, 1)
|
359
|
+
iterations = getit(param, 8, 1)
|
360
|
+
pattern_repeat = getit(param, 10, 1)
|
361
|
+
connector = getit(param, 12, 0)
|
362
|
+
seed = Geomstr.turtle(turtle, n)
|
363
|
+
# Let's see whether we need to reconstruct the base
|
364
|
+
# Store it
|
365
|
+
targetpattern = basepattern
|
366
|
+
if basepattern is not None:
|
367
|
+
if basepattern.startswith("n"):
|
368
|
+
basepattern = basepattern[1:]
|
369
|
+
previous = ""
|
370
|
+
while len(basepattern) and basepattern[0] in "0123456789":
|
371
|
+
previous += basepattern[0]
|
372
|
+
basepattern = basepattern[1:]
|
373
|
+
if previous:
|
374
|
+
try:
|
375
|
+
prev_len = int(previous)
|
376
|
+
except ValueError:
|
377
|
+
prev_len = 1
|
378
|
+
# Need add 1 to the length as the connector symbol
|
379
|
+
# is not present after the last repetition
|
380
|
+
if (len(basepattern) + 1) % prev_len == 0:
|
381
|
+
# old = basepattern
|
382
|
+
basepattern = basepattern[
|
383
|
+
0 : int(len(basepattern) / prev_len)
|
384
|
+
]
|
385
|
+
else:
|
386
|
+
# that's wrong...
|
387
|
+
pattern_repeat = 1
|
388
|
+
|
389
|
+
if pattern_repeat > 1:
|
390
|
+
targetpattern = f"n{pattern_repeat}"
|
391
|
+
for idx in range(pattern_repeat):
|
392
|
+
if idx > 0:
|
393
|
+
targetpattern += "+"
|
394
|
+
targetpattern += basepattern
|
395
|
+
else:
|
396
|
+
targetpattern = basepattern
|
397
|
+
|
398
|
+
if targetpattern == "":
|
399
|
+
targetpattern = None
|
400
|
+
|
401
|
+
if targetpattern is None:
|
402
|
+
base = Geomstr.svg("M0,0 H65535")
|
403
|
+
else:
|
404
|
+
base = Geomstr.turtle(targetpattern, n, d=65535)
|
405
|
+
|
406
|
+
for i in range(iterations):
|
407
|
+
base.fractal(seed)
|
408
|
+
if connector == 2:
|
409
|
+
amount = 0.2
|
410
|
+
base.bezier_corners(amount)
|
411
|
+
elif connector == 1:
|
412
|
+
amount = 0.2
|
413
|
+
base.round_corners(amount)
|
414
|
+
node.geometry = base
|
415
|
+
node.altered()
|
416
|
+
# Rewrite the functional_parameter
|
417
|
+
node.functional_parameter = (
|
418
|
+
"tfractal",
|
419
|
+
3,
|
420
|
+
turtle,
|
421
|
+
3,
|
422
|
+
targetpattern,
|
423
|
+
1,
|
424
|
+
n,
|
425
|
+
1,
|
426
|
+
iterations,
|
427
|
+
1,
|
428
|
+
pattern_repeat,
|
429
|
+
1,
|
430
|
+
connector, # line connector
|
431
|
+
)
|
432
|
+
|
433
|
+
@self.console_argument("svg_path", type=str)
|
434
|
+
@self.console_argument("iterations", type=int)
|
435
|
+
@self.console_argument("inversions", nargs="*", type=int)
|
436
|
+
@context.console_command(
|
437
|
+
"ffractal",
|
438
|
+
help=_("ffractal iterations"),
|
439
|
+
output_type="geometry",
|
440
|
+
hidden=True,
|
441
|
+
)
|
442
|
+
def fractal_f(command, channel, svg_path, iterations, inversions, **kwargs):
|
443
|
+
seed = Geomstr.svg(svg_path)
|
444
|
+
segments = seed.segments
|
445
|
+
for i, q in enumerate(inversions):
|
446
|
+
if len(segments) > i:
|
447
|
+
segments[i][1] = q
|
448
|
+
segments[i][3] = q
|
449
|
+
base = Geomstr.svg("M0,0 H65535")
|
450
|
+
for i in range(iterations):
|
451
|
+
base.fractal(seed)
|
452
|
+
return "geometry", base
|
453
|
+
|
454
|
+
@self.console_argument("sx", type=Length)
|
455
|
+
@self.console_argument("sy", type=Length)
|
456
|
+
@self.console_argument("branch", type=Length)
|
457
|
+
@self.console_argument("iterations", type=int)
|
458
|
+
@context.console_command(
|
459
|
+
"fractal_tree", help=_("fractal_tree sx, sy, branch, iterations")
|
460
|
+
)
|
461
|
+
def fractal_tree(
|
462
|
+
command,
|
463
|
+
channel,
|
464
|
+
_,
|
465
|
+
sx=None,
|
466
|
+
sy=None,
|
467
|
+
branch=None,
|
468
|
+
iterations=None,
|
469
|
+
data=None,
|
470
|
+
post=None,
|
471
|
+
**kwargs,
|
472
|
+
):
|
473
|
+
ratio = 0.75
|
474
|
+
try:
|
475
|
+
if sx is None:
|
476
|
+
sx = Length("5cm")
|
477
|
+
ssx = float(sx)
|
478
|
+
if sy is None:
|
479
|
+
sy = Length("5cm")
|
480
|
+
ssy = float(sy)
|
481
|
+
if branch is None:
|
482
|
+
branch = Length("4cm")
|
483
|
+
blen = float(branch)
|
484
|
+
if iterations is None:
|
485
|
+
iterations = 10
|
486
|
+
iterations = int(iterations)
|
487
|
+
except ValueError:
|
488
|
+
channel("Invalid data provided")
|
489
|
+
return
|
490
|
+
start_pt = Point(ssx, ssy)
|
491
|
+
end_pt = Point.polar(start_pt, 0, blen)
|
492
|
+
geom = create_fractal_tree(start_pt, end_pt, iterations, ratio)
|
493
|
+
node = self.elem_branch.add(type="elem path", geometry=geom)
|
494
|
+
node.stroke = self.default_stroke
|
495
|
+
node.stroke_width = self.default_strokewidth
|
496
|
+
node.altered()
|
497
|
+
node.functional_parameter = (
|
498
|
+
"fractaltree",
|
499
|
+
0,
|
500
|
+
start_pt.x,
|
501
|
+
start_pt.y,
|
502
|
+
0,
|
503
|
+
end_pt.x,
|
504
|
+
end_pt.y,
|
505
|
+
1,
|
506
|
+
iterations,
|
507
|
+
2,
|
508
|
+
ratio,
|
509
|
+
)
|
510
|
+
# Newly created! Classification needed?
|
511
|
+
data = [node]
|
512
|
+
node.emphasized = True
|
513
|
+
post.append(classify_new(data))
|
514
|
+
return "elements", data
|
515
|
+
|
516
|
+
def update_node_fractaltree(node):
|
517
|
+
my_id = "fractaltree"
|
518
|
+
try:
|
519
|
+
param = node.functional_parameter
|
520
|
+
if param is None or param[0] != my_id:
|
521
|
+
return
|
522
|
+
except (AttributeError, IndexError):
|
523
|
+
return
|
524
|
+
point_a = None
|
525
|
+
point_b = None
|
526
|
+
iterations = 5
|
527
|
+
ratio = 0.75
|
528
|
+
try:
|
529
|
+
if param[1] == 0:
|
530
|
+
point_a = Point(param[2], param[3])
|
531
|
+
if param[4] == 0:
|
532
|
+
point_b = Point(param[5], param[6])
|
533
|
+
if param[7] == 1:
|
534
|
+
iterations = param[8]
|
535
|
+
if param[9] == 2:
|
536
|
+
ratio = param[10]
|
537
|
+
except IndexError:
|
538
|
+
return
|
539
|
+
if point_a is None or point_b is None:
|
540
|
+
return
|
541
|
+
geom = create_fractal_tree(point_a, point_b, iterations, ratio)
|
542
|
+
node.geometry = geom
|
543
|
+
node.altered()
|
544
|
+
|
545
|
+
# --- Fractal Dragon - now superceded by generic tfractal routine
|
546
|
+
# def create_fractal_dragon(first_pt, second_pt, iterations):
|
547
|
+
#
|
548
|
+
# # Code based on https://github.com/GuidoDipietro/python_art
|
549
|
+
# def rotate(t):
|
550
|
+
# t[0], t[1] = -1 * t[1], t[0]
|
551
|
+
# return t
|
552
|
+
#
|
553
|
+
# def turtle_lines(coords, x, y):
|
554
|
+
# turtle_coords = []
|
555
|
+
# for i, point in enumerate(coords):
|
556
|
+
# line_coords = [(x, y), (x + point[0], y + point[1])]
|
557
|
+
# x, y = x + point[0], y + point[1]
|
558
|
+
# turtle_coords.append(line_coords)
|
559
|
+
# return turtle_coords
|
560
|
+
#
|
561
|
+
# step = first_pt.distance_to(second_pt)
|
562
|
+
# origin_x = first_pt.x
|
563
|
+
# origin_y = first_pt.y
|
564
|
+
#
|
565
|
+
# # list of moves in x,y axes. Start with (1,0) (straight line to right)
|
566
|
+
# moves = [[step, 0]]
|
567
|
+
#
|
568
|
+
# for i in range(0, iterations):
|
569
|
+
# copied = list(map(rotate, copy.deepcopy(moves)[::-1]))
|
570
|
+
# moves += copied
|
571
|
+
#
|
572
|
+
# dragon_coords = turtle_lines(moves, origin_x, origin_y)
|
573
|
+
#
|
574
|
+
# geometry = Geomstr()
|
575
|
+
# for c in dragon_coords:
|
576
|
+
# geometry.line(c[0][0] + 1j * c[0][1], c[1][0] + 1j * c[1][1])
|
577
|
+
# return geometry
|
578
|
+
#
|
579
|
+
# @self.console_argument("sx", type=Length)
|
580
|
+
# @self.console_argument("sy", type=Length)
|
581
|
+
# @self.console_argument("step", type=Length)
|
582
|
+
# @self.console_argument("iterations", type=int)
|
583
|
+
# @context.console_command(
|
584
|
+
# "fractal_dragon", help=_("fractal_dragon sx, sy, step, iterations")
|
585
|
+
# )
|
586
|
+
# def fractal_dragon(
|
587
|
+
# command,
|
588
|
+
# channel,
|
589
|
+
# _,
|
590
|
+
# sx=None,
|
591
|
+
# sy=None,
|
592
|
+
# step=None,
|
593
|
+
# iterations=None,
|
594
|
+
# data=None,
|
595
|
+
# post=None,
|
596
|
+
# **kwargs,
|
597
|
+
# ):
|
598
|
+
# ratio = 0.75
|
599
|
+
# try:
|
600
|
+
# if sx is None:
|
601
|
+
# sx = Length("5cm")
|
602
|
+
# ssx = float(sx)
|
603
|
+
# if sy is None:
|
604
|
+
# sy = Length("5cm")
|
605
|
+
# ssy = float(sy)
|
606
|
+
# if step is None:
|
607
|
+
# step = Length("0.5cm")
|
608
|
+
# blen = float(step)
|
609
|
+
# if iterations is None:
|
610
|
+
# iterations = 10
|
611
|
+
# iterations = int(iterations)
|
612
|
+
# except ValueError:
|
613
|
+
# channel("Invalid data provided")
|
614
|
+
# return
|
615
|
+
# start_pt = Point(ssx, ssy)
|
616
|
+
# end_pt = Point.polar(start_pt, 0, blen)
|
617
|
+
# geom = create_fractal_dragon(start_pt, end_pt, iterations)
|
618
|
+
# node = self.elem_branch.add(type="elem path", geometry=geom)
|
619
|
+
# node.stroke = self.default_stroke
|
620
|
+
# node.stroke_width = self.default_strokewidth
|
621
|
+
# node.altered()
|
622
|
+
# node.functional_parameter = (
|
623
|
+
# "fractaldragon",
|
624
|
+
# 0,
|
625
|
+
# start_pt.x,
|
626
|
+
# start_pt.y,
|
627
|
+
# 0,
|
628
|
+
# end_pt.x,
|
629
|
+
# end_pt.y,
|
630
|
+
# 1,
|
631
|
+
# iterations,
|
632
|
+
# )
|
633
|
+
# # Newly created! Classification needed?
|
634
|
+
# data = [node]
|
635
|
+
# post.append(classify_new(data))
|
636
|
+
# return "elements", data
|
637
|
+
#
|
638
|
+
# def update_node_fractaldragon(node):
|
639
|
+
# my_id = "fractaldragon"
|
640
|
+
# point_a = None
|
641
|
+
# point_b = None
|
642
|
+
# iterations = 5
|
643
|
+
# valid = True
|
644
|
+
# try:
|
645
|
+
# param = node.functional_parameter
|
646
|
+
# if param is None or param[0] != my_id:
|
647
|
+
# valid = False
|
648
|
+
# except (AttributeError, IndexError):
|
649
|
+
# valid = False
|
650
|
+
# if not valid:
|
651
|
+
# # Not for me...
|
652
|
+
# return
|
653
|
+
# try:
|
654
|
+
# if param[1] == 0:
|
655
|
+
# point_a = Point(param[2], param[3])
|
656
|
+
# if param[4] == 0:
|
657
|
+
# point_b = Point(param[5], param[6])
|
658
|
+
# if param[7] == 1:
|
659
|
+
# iterations = param[8]
|
660
|
+
# except IndexError:
|
661
|
+
# valid = False
|
662
|
+
# if point_a is None or point_b is None:
|
663
|
+
# valid = False
|
664
|
+
# if valid:
|
665
|
+
# geom = create_fractal_dragon(point_a, point_b, iterations)
|
666
|
+
# node.geometry = geom
|
667
|
+
# node.altered()
|
668
|
+
# dist = point_a.distance_to(point_b)
|
669
|
+
# # Put second pt at right spot
|
670
|
+
# point_b = Point(point_a.x + dist, point_a.y)
|
671
|
+
#
|
672
|
+
# node.functional_parameter = (
|
673
|
+
# "fractaldragon",
|
674
|
+
# 0,
|
675
|
+
# point_a.x,
|
676
|
+
# point_a.y,
|
677
|
+
# 0,
|
678
|
+
# point_b.x,
|
679
|
+
# point_b.y,
|
680
|
+
# 1,
|
681
|
+
# iterations,
|
682
|
+
# )
|
683
|
+
|
684
|
+
# Cycloid Shape
|
685
|
+
def create_cycloid_shape(cx, cy, r_major, r_minor, rotations):
|
686
|
+
series = []
|
687
|
+
degree_step = 1
|
688
|
+
if rotations == 0:
|
689
|
+
rotations = 20
|
690
|
+
|
691
|
+
radian_step = math.radians(degree_step)
|
692
|
+
t = 0
|
693
|
+
m = math.tau * rotations
|
694
|
+
if r_minor == 0:
|
695
|
+
r_minor = 1
|
696
|
+
count = 0
|
697
|
+
offset = 0
|
698
|
+
while t < m:
|
699
|
+
px = (r_minor + r_major) * math.cos(t) - (r_minor + offset) * math.cos(
|
700
|
+
((r_major + r_minor) / r_minor) * t
|
701
|
+
)
|
702
|
+
py = (r_minor + r_major) * math.sin(t) - (r_minor + offset) * math.sin(
|
703
|
+
((r_major + r_minor) / r_minor) * t
|
704
|
+
)
|
705
|
+
series.append((px + cx, py + cy))
|
706
|
+
t += radian_step
|
707
|
+
count += 1
|
708
|
+
# print(
|
709
|
+
# f"Done: {count} steps, major={r_major:.0f}, minor={r_minor:.0f}, offset={offset:.0f}, rot={rotations}"
|
710
|
+
# )
|
711
|
+
geometry = Geomstr()
|
712
|
+
last = None
|
713
|
+
for m in series:
|
714
|
+
if last is not None:
|
715
|
+
geometry.line(last[0] + 1j * last[1], m[0] + 1j * m[1])
|
716
|
+
last = m
|
717
|
+
return geometry
|
718
|
+
|
719
|
+
@self.console_argument("sx", type=Length)
|
720
|
+
@self.console_argument("sy", type=Length)
|
721
|
+
@self.console_argument("r_major", type=Length)
|
722
|
+
@self.console_argument("r_minor", type=Length)
|
723
|
+
@self.console_argument("iterations", type=int)
|
724
|
+
@context.console_command(
|
725
|
+
"cycloid", help=_("cycloid sx sy r_major r_minor iterations")
|
726
|
+
)
|
727
|
+
def cycloid(
|
728
|
+
command,
|
729
|
+
channel,
|
730
|
+
_,
|
731
|
+
sx=None,
|
732
|
+
sy=None,
|
733
|
+
r_major=None,
|
734
|
+
r_minor=None,
|
735
|
+
iterations=None,
|
736
|
+
data=None,
|
737
|
+
post=None,
|
738
|
+
**kwargs,
|
739
|
+
):
|
740
|
+
try:
|
741
|
+
if sx is None:
|
742
|
+
sx = Length("5cm")
|
743
|
+
ssx = float(sx)
|
744
|
+
if sy is None:
|
745
|
+
sy = Length("5cm")
|
746
|
+
ssy = float(sy)
|
747
|
+
if r_major is None:
|
748
|
+
r_major = Length("5cm")
|
749
|
+
radius_major = float(r_major)
|
750
|
+
if r_minor is None:
|
751
|
+
r_minor = Length("3cm")
|
752
|
+
radius_minor = float(r_minor)
|
753
|
+
if iterations is None:
|
754
|
+
iterations = 20
|
755
|
+
iterations = int(iterations)
|
756
|
+
except ValueError:
|
757
|
+
channel("Invalid data provided")
|
758
|
+
return
|
759
|
+
start_pt = Point(ssx, ssy)
|
760
|
+
point_major = Point(ssx + radius_major, ssy)
|
761
|
+
point_minor = Point(ssx, ssy - radius_minor)
|
762
|
+
geom = create_cycloid_shape(
|
763
|
+
ssx, ssy, radius_major, radius_minor, iterations
|
764
|
+
)
|
765
|
+
node = self.elem_branch.add(type="elem path", geometry=geom)
|
766
|
+
node.label = f"Cycloid {iterations} iterations"
|
767
|
+
node.stroke = self.default_stroke
|
768
|
+
node.stroke_width = self.default_strokewidth
|
769
|
+
node.altered()
|
770
|
+
node.functional_parameter = (
|
771
|
+
"cycloid",
|
772
|
+
0,
|
773
|
+
start_pt.x,
|
774
|
+
start_pt.y,
|
775
|
+
0,
|
776
|
+
point_major.x,
|
777
|
+
point_major.y,
|
778
|
+
0,
|
779
|
+
point_minor.x,
|
780
|
+
point_minor.y,
|
781
|
+
1,
|
782
|
+
iterations,
|
783
|
+
)
|
784
|
+
# Newly created! Classification needed?
|
785
|
+
data = [node]
|
786
|
+
node.emphasized = True
|
787
|
+
post.append(classify_new(data))
|
788
|
+
return "elements", data
|
789
|
+
|
790
|
+
def update_node_cycloid(node):
|
791
|
+
my_id = "cycloid"
|
792
|
+
try:
|
793
|
+
param = node.functional_parameter
|
794
|
+
if param is None or param[0] != my_id:
|
795
|
+
return
|
796
|
+
except (AttributeError, IndexError):
|
797
|
+
return
|
798
|
+
point_c = None
|
799
|
+
point_major = None
|
800
|
+
point_minor = None
|
801
|
+
try:
|
802
|
+
if param[1] == 0:
|
803
|
+
point_c = Point(param[2], param[3])
|
804
|
+
if param[4] == 0:
|
805
|
+
point_major = Point(param[5], param[6])
|
806
|
+
if param[7] == 0:
|
807
|
+
point_minor = Point(param[8], param[9])
|
808
|
+
if param[10] == 1:
|
809
|
+
iterations = param[11]
|
810
|
+
except IndexError:
|
811
|
+
return
|
812
|
+
if point_c is None or point_major is None or point_minor is None:
|
813
|
+
return
|
814
|
+
radius_major = point_c.distance_to(point_major)
|
815
|
+
radius_minor = point_c.distance_to(point_minor)
|
816
|
+
ssx = point_c.x
|
817
|
+
ssy = point_c.y
|
818
|
+
geom = create_cycloid_shape(
|
819
|
+
ssx, ssy, radius_major, radius_minor, iterations
|
820
|
+
)
|
821
|
+
node.geometry = geom
|
822
|
+
node.altered()
|
823
|
+
point_major = Point(ssx + radius_major, ssy)
|
824
|
+
point_minor = Point(ssx, ssy - radius_minor)
|
825
|
+
node.functional_parameter = (
|
826
|
+
"cycloid",
|
827
|
+
0,
|
828
|
+
point_c.x,
|
829
|
+
point_c.y,
|
830
|
+
0,
|
831
|
+
point_major.x,
|
832
|
+
point_major.y,
|
833
|
+
0,
|
834
|
+
point_minor.x,
|
835
|
+
point_minor.y,
|
836
|
+
1,
|
837
|
+
iterations,
|
838
|
+
)
|
839
|
+
|
840
|
+
# --- Star like shapes
|
841
|
+
def create_star_shape(
|
842
|
+
cx,
|
843
|
+
cy,
|
844
|
+
corners,
|
845
|
+
startangle,
|
846
|
+
radius,
|
847
|
+
radius_inner,
|
848
|
+
alternate_seq,
|
849
|
+
density,
|
850
|
+
):
|
851
|
+
geom = Geomstr()
|
852
|
+
# center = Point(cx, cy)
|
853
|
+
if startangle is None:
|
854
|
+
startangle = 0
|
855
|
+
|
856
|
+
if corners <= 2:
|
857
|
+
if corners == 1:
|
858
|
+
geom.point(cx + 1j * cy)
|
859
|
+
if corners == 2:
|
860
|
+
x = cx + math.cos(startangle) * radius
|
861
|
+
y = cy + math.sin(startangle) * radius
|
862
|
+
geom.line(cx + 1j * cy, x + 1j * y)
|
863
|
+
else:
|
864
|
+
i_angle = startangle
|
865
|
+
delta_angle = math.tau / corners
|
866
|
+
ct = 0
|
867
|
+
pts = []
|
868
|
+
for j in range(corners):
|
869
|
+
if ct < alternate_seq:
|
870
|
+
r = radius
|
871
|
+
# dbg = "outer"
|
872
|
+
else:
|
873
|
+
r = radius_inner
|
874
|
+
# dbg = "inner"
|
875
|
+
thisx = cx + r * math.cos(i_angle)
|
876
|
+
thisy = cy + r * math.sin(i_angle)
|
877
|
+
# tpoint = center.polar_to(i_angle, r)
|
878
|
+
# thisx = tpoint.x
|
879
|
+
# thisy = tpoint.y
|
880
|
+
# print(
|
881
|
+
# "pt %d, Angle=%.1f: %s radius=%.1f: (%.1f, %.1f)"
|
882
|
+
# % (j, i_angle / math.pi * 180, dbg, r, thisx, thisy)
|
883
|
+
# )
|
884
|
+
ct += 1
|
885
|
+
if ct >= 2 * alternate_seq:
|
886
|
+
ct = 0
|
887
|
+
if j == 0:
|
888
|
+
firstx = thisx
|
889
|
+
firsty = thisy
|
890
|
+
i_angle += delta_angle
|
891
|
+
thispt = thisx + 1j * thisy
|
892
|
+
pts.append(thispt)
|
893
|
+
# Close the path
|
894
|
+
thispt = firstx + 1j * firsty
|
895
|
+
pts.append(thispt)
|
896
|
+
|
897
|
+
if len(pts) > 0:
|
898
|
+
star_points = [pts[0]]
|
899
|
+
idx = density
|
900
|
+
hitted = []
|
901
|
+
while idx != 0:
|
902
|
+
if idx in hitted:
|
903
|
+
break
|
904
|
+
hitted.append(idx)
|
905
|
+
star_points.append(pts[idx])
|
906
|
+
idx += density
|
907
|
+
if idx >= corners:
|
908
|
+
idx -= corners
|
909
|
+
for idx in range(1, len(star_points)):
|
910
|
+
geom.line(star_points[idx - 1], star_points[idx])
|
911
|
+
geom.line(star_points[-1], star_points[0])
|
912
|
+
# print(f"Created geometry from {len(pts) / 2} pts: {geom.capacity}")
|
913
|
+
return geom
|
914
|
+
|
915
|
+
# Shape (i.e. star) routine
|
916
|
+
@self.console_argument(
|
917
|
+
"corners", type=int, help=_("Number of corners/vertices")
|
918
|
+
)
|
919
|
+
@self.console_argument(
|
920
|
+
"cx", type=self.length_x, help=_("X-Value of polygon's center")
|
921
|
+
)
|
922
|
+
@self.console_argument(
|
923
|
+
"cy", type=self.length_y, help=_("Y-Value of polygon's center")
|
924
|
+
)
|
925
|
+
@self.console_argument(
|
926
|
+
"radius",
|
927
|
+
type=self.length_x,
|
928
|
+
help=_("Radius (length of side if --side_length is used)"),
|
929
|
+
)
|
930
|
+
@self.console_option("startangle", "s", type=Angle, help=_("Start-Angle"))
|
931
|
+
@self.console_option(
|
932
|
+
"inscribed",
|
933
|
+
"i",
|
934
|
+
type=bool,
|
935
|
+
action="store_true",
|
936
|
+
help=_("Shall the polygon touch the inscribing circle?"),
|
937
|
+
)
|
938
|
+
@self.console_option(
|
939
|
+
"side_length",
|
940
|
+
"l",
|
941
|
+
type=bool,
|
942
|
+
action="store_true",
|
943
|
+
help=_(
|
944
|
+
"Do you want to treat the length value for radius as the length of one edge instead?"
|
945
|
+
),
|
946
|
+
)
|
947
|
+
@self.console_option(
|
948
|
+
"radius_inner",
|
949
|
+
"r",
|
950
|
+
type=str,
|
951
|
+
help=_("Alternating radius for every other vertex"),
|
952
|
+
)
|
953
|
+
@self.console_option(
|
954
|
+
"alternate_seq",
|
955
|
+
"a",
|
956
|
+
type=int,
|
957
|
+
help=_(
|
958
|
+
"Length of alternating sequence (1 for starlike figures, >=2 for more gear-like patterns)"
|
959
|
+
),
|
960
|
+
)
|
961
|
+
@self.console_option(
|
962
|
+
"density", "d", type=int, help=_("Amount of vertices to skip")
|
963
|
+
)
|
964
|
+
@self.console_command(
|
965
|
+
"shape",
|
966
|
+
help=_(
|
967
|
+
"shape <corners> <x> <y> <r> <startangle> <inscribed> or shape <corners> <r>"
|
968
|
+
),
|
969
|
+
input_type=("elements", None),
|
970
|
+
output_type="elements",
|
971
|
+
)
|
972
|
+
def element_shape(
|
973
|
+
command,
|
974
|
+
channel,
|
975
|
+
_,
|
976
|
+
corners,
|
977
|
+
cx,
|
978
|
+
cy,
|
979
|
+
radius,
|
980
|
+
startangle=None,
|
981
|
+
inscribed=None,
|
982
|
+
side_length=None,
|
983
|
+
radius_inner=None,
|
984
|
+
alternate_seq=None,
|
985
|
+
density=None,
|
986
|
+
data=None,
|
987
|
+
post=None,
|
988
|
+
**kwargs,
|
989
|
+
):
|
990
|
+
if corners is None:
|
991
|
+
raise CommandSyntaxError
|
992
|
+
|
993
|
+
if cx is None:
|
994
|
+
if corners <= 2:
|
995
|
+
raise CommandSyntaxError(
|
996
|
+
_(
|
997
|
+
"Please provide at least one additional value (which will act as radius then)"
|
998
|
+
)
|
999
|
+
)
|
1000
|
+
cx = 0
|
1001
|
+
if cy is None:
|
1002
|
+
cy = 0
|
1003
|
+
if radius is None:
|
1004
|
+
radius = 0
|
1005
|
+
sangle = float(startangle)
|
1006
|
+
if corners <= 2:
|
1007
|
+
# No need to look at side_length parameter as we are considering the radius value as an edge anyway...
|
1008
|
+
geom = create_star_shape(
|
1009
|
+
cx,
|
1010
|
+
cy,
|
1011
|
+
corners,
|
1012
|
+
sangle,
|
1013
|
+
radius,
|
1014
|
+
radius_inner,
|
1015
|
+
alternate_seq,
|
1016
|
+
density,
|
1017
|
+
)
|
1018
|
+
else:
|
1019
|
+
# do we have something like 'shape 3 4cm' ? If yes, reassign the parameters
|
1020
|
+
if radius is None:
|
1021
|
+
radius = cx
|
1022
|
+
cx = 0
|
1023
|
+
cy = 0
|
1024
|
+
if startangle is None:
|
1025
|
+
startangle = Angle("0deg")
|
1026
|
+
|
1027
|
+
sangle = float(startangle)
|
1028
|
+
if alternate_seq is None:
|
1029
|
+
if radius_inner is None:
|
1030
|
+
alternate_seq = 0
|
1031
|
+
else:
|
1032
|
+
alternate_seq = 1
|
1033
|
+
|
1034
|
+
if density is None:
|
1035
|
+
density = 1
|
1036
|
+
if density < 1 or density > corners:
|
1037
|
+
density = 1
|
1038
|
+
|
1039
|
+
# Do we have to consider the radius value as the length of one corner?
|
1040
|
+
if side_length is not None:
|
1041
|
+
# Let's recalculate the radius then...
|
1042
|
+
# d_oc = s * csc( math.pi / n)
|
1043
|
+
radius = 0.5 * radius / math.sin(math.pi / corners)
|
1044
|
+
|
1045
|
+
if radius_inner is None:
|
1046
|
+
radius_inner = radius
|
1047
|
+
else:
|
1048
|
+
try:
|
1049
|
+
radius_inner = float(
|
1050
|
+
Length(radius_inner, relative_length=radius)
|
1051
|
+
)
|
1052
|
+
except ValueError:
|
1053
|
+
raise CommandSyntaxError
|
1054
|
+
|
1055
|
+
if inscribed:
|
1056
|
+
if side_length is None:
|
1057
|
+
radius = radius / math.cos(math.pi / corners)
|
1058
|
+
else:
|
1059
|
+
channel(
|
1060
|
+
_(
|
1061
|
+
"You have as well provided the --side_length parameter, this takes precedence, so --inscribed is ignored"
|
1062
|
+
)
|
1063
|
+
)
|
1064
|
+
|
1065
|
+
if alternate_seq < 1:
|
1066
|
+
radius_inner = radius
|
1067
|
+
|
1068
|
+
# print(
|
1069
|
+
# "Your parameters are:\n cx=%.1f, cy=%.1f\n radius=%.1f, inner=%.1f\n corners=%d, density=%d\n seq=%d, angle=%.1f"
|
1070
|
+
# % (cx, cy, radius, radius_inner, corners, density, alternate_seq, startangle)
|
1071
|
+
# )
|
1072
|
+
geom = create_star_shape(
|
1073
|
+
cx,
|
1074
|
+
cy,
|
1075
|
+
corners,
|
1076
|
+
sangle,
|
1077
|
+
radius,
|
1078
|
+
radius_inner,
|
1079
|
+
alternate_seq,
|
1080
|
+
density,
|
1081
|
+
)
|
1082
|
+
pts = list(geom.as_points())
|
1083
|
+
if len(pts) < corners:
|
1084
|
+
ct = 0
|
1085
|
+
possible_combinations = ""
|
1086
|
+
for i in range(corners - 1):
|
1087
|
+
j = i + 2
|
1088
|
+
if math.gcd(j, corners) == 1:
|
1089
|
+
if ct % 3 == 0:
|
1090
|
+
possible_combinations += (
|
1091
|
+
f"\n shape {corners} ... -d {j}"
|
1092
|
+
)
|
1093
|
+
else:
|
1094
|
+
possible_combinations += (
|
1095
|
+
f", shape {corners} ... -d {j} "
|
1096
|
+
)
|
1097
|
+
ct += 1
|
1098
|
+
channel(_("Just for info: we have missed a couple of vertices..."))
|
1099
|
+
channel(
|
1100
|
+
_(
|
1101
|
+
"To hit all, the density parameters should be e.g. {combinations}"
|
1102
|
+
).format(combinations=possible_combinations)
|
1103
|
+
)
|
1104
|
+
# _("Create shape")
|
1105
|
+
with self.undoscope("Create shape"):
|
1106
|
+
node = self.elem_branch.add(type="elem path", geometry=geom)
|
1107
|
+
node.stroke = self.default_stroke
|
1108
|
+
node.stroke_width = self.default_strokewidth
|
1109
|
+
node.fill = self.default_fill
|
1110
|
+
node.altered()
|
1111
|
+
self.set_emphasis([node])
|
1112
|
+
node.focus()
|
1113
|
+
|
1114
|
+
data = [node]
|
1115
|
+
# Newly created! Classification needed?
|
1116
|
+
post.append(classify_new(data))
|
1117
|
+
|
1118
|
+
center = Point(cx, cy)
|
1119
|
+
sangle = float(startangle)
|
1120
|
+
opposing_angle = sangle + math.tau / 2
|
1121
|
+
while opposing_angle < 0:
|
1122
|
+
opposing_angle += math.tau
|
1123
|
+
while opposing_angle >= math.tau:
|
1124
|
+
opposing_angle -= math.tau
|
1125
|
+
first_point = Point.polar(center, sangle, radius)
|
1126
|
+
second_point = Point.polar(center, opposing_angle, radius_inner)
|
1127
|
+
node.functional_parameter = (
|
1128
|
+
"star",
|
1129
|
+
0,
|
1130
|
+
cx,
|
1131
|
+
cy,
|
1132
|
+
0,
|
1133
|
+
first_point.x,
|
1134
|
+
first_point.y,
|
1135
|
+
0,
|
1136
|
+
second_point.x,
|
1137
|
+
second_point.y,
|
1138
|
+
1,
|
1139
|
+
corners,
|
1140
|
+
1,
|
1141
|
+
alternate_seq,
|
1142
|
+
1,
|
1143
|
+
density,
|
1144
|
+
)
|
1145
|
+
|
1146
|
+
return "elements", data
|
1147
|
+
|
1148
|
+
# --- end of node update routines
|
1149
|
+
def update_node_star_shape(node):
|
1150
|
+
my_id = "star"
|
1151
|
+
valid = True
|
1152
|
+
try:
|
1153
|
+
param = node.functional_parameter
|
1154
|
+
if param is None or param[0] != my_id:
|
1155
|
+
valid = False
|
1156
|
+
except (AttributeError, IndexError):
|
1157
|
+
valid = False
|
1158
|
+
if not valid:
|
1159
|
+
# Not for me...
|
1160
|
+
return
|
1161
|
+
param = node.functional_parameter
|
1162
|
+
if param is None:
|
1163
|
+
return
|
1164
|
+
cx = getit(param, 2, 0)
|
1165
|
+
cy = getit(param, 3, 0)
|
1166
|
+
p1x = getit(param, 5, 0)
|
1167
|
+
p1y = getit(param, 6, 0)
|
1168
|
+
p2x = getit(param, 8, 0)
|
1169
|
+
p2y = getit(param, 9, 0)
|
1170
|
+
corners = getit(param, 11, 3)
|
1171
|
+
alternate_seq = getit(param, 13, 0)
|
1172
|
+
density = getit(param, 15, 1)
|
1173
|
+
if density < 1 or density > corners:
|
1174
|
+
density = 1
|
1175
|
+
center = Point(cx, cy)
|
1176
|
+
pt1 = Point(p1x, p1y)
|
1177
|
+
pt2 = Point(p2x, p2y)
|
1178
|
+
startangle = center.angle_to(pt1)
|
1179
|
+
radius = center.distance_to(pt1)
|
1180
|
+
radius_inner = center.distance_to(pt2)
|
1181
|
+
if alternate_seq < 1:
|
1182
|
+
radius_inner = radius
|
1183
|
+
if radius_inner == radius:
|
1184
|
+
alternate_seq = 0
|
1185
|
+
if radius == 0:
|
1186
|
+
valid = False
|
1187
|
+
if corners <= 0:
|
1188
|
+
valid = False
|
1189
|
+
if alternate_seq < 0:
|
1190
|
+
valid = False
|
1191
|
+
if valid:
|
1192
|
+
geom = create_star_shape(
|
1193
|
+
cx,
|
1194
|
+
cy,
|
1195
|
+
corners,
|
1196
|
+
startangle,
|
1197
|
+
radius,
|
1198
|
+
radius_inner,
|
1199
|
+
alternate_seq,
|
1200
|
+
density,
|
1201
|
+
)
|
1202
|
+
node.geometry = geom
|
1203
|
+
node.altered()
|
1204
|
+
center = Point(cx, cy)
|
1205
|
+
opposing_angle = startangle + math.tau / 2
|
1206
|
+
while opposing_angle < 0:
|
1207
|
+
opposing_angle += math.tau
|
1208
|
+
while opposing_angle >= math.tau:
|
1209
|
+
opposing_angle -= math.tau
|
1210
|
+
first_point = Point.polar(center, startangle, radius)
|
1211
|
+
second_point = Point.polar(center, opposing_angle, radius_inner)
|
1212
|
+
node.functional_parameter = (
|
1213
|
+
"star",
|
1214
|
+
0,
|
1215
|
+
cx,
|
1216
|
+
cy,
|
1217
|
+
0,
|
1218
|
+
first_point.x,
|
1219
|
+
first_point.y,
|
1220
|
+
0,
|
1221
|
+
second_point.x,
|
1222
|
+
second_point.y,
|
1223
|
+
1,
|
1224
|
+
corners,
|
1225
|
+
1,
|
1226
|
+
alternate_seq,
|
1227
|
+
1,
|
1228
|
+
density,
|
1229
|
+
)
|
1230
|
+
|
1231
|
+
def create_growing_shape(
|
1232
|
+
cx, cy, sides, iterations, ratio_in_percent, sidelen, startangle, gap
|
1233
|
+
):
|
1234
|
+
geom = Geomstr()
|
1235
|
+
if sides < 3:
|
1236
|
+
sides = 3
|
1237
|
+
shape_angle = math.tau / sides
|
1238
|
+
myangle = startangle
|
1239
|
+
sidelength = sidelen
|
1240
|
+
sidedelta = sidelength * ratio_in_percent / 100.0
|
1241
|
+
pt1 = cx + 1j * cy
|
1242
|
+
for idx in range(iterations):
|
1243
|
+
for side in range(sides):
|
1244
|
+
while myangle < 0:
|
1245
|
+
myangle += math.tau
|
1246
|
+
while myangle > math.tau:
|
1247
|
+
myangle -= math.tau
|
1248
|
+
|
1249
|
+
pt2 = geom.polar(pt1, myangle, sidelength)
|
1250
|
+
geom.line(pt1, pt2)
|
1251
|
+
pt1 = pt2
|
1252
|
+
sidelength += sidedelta
|
1253
|
+
# sidedelta = sidelength * ratio_in_percent
|
1254
|
+
myangle += shape_angle
|
1255
|
+
myangle += gap
|
1256
|
+
return geom
|
1257
|
+
|
1258
|
+
def update_node_growing_shape(node):
|
1259
|
+
my_id = "growingshape"
|
1260
|
+
valid = True
|
1261
|
+
try:
|
1262
|
+
param = node.functional_parameter
|
1263
|
+
if param is None or param[0] != my_id:
|
1264
|
+
valid = False
|
1265
|
+
except (AttributeError, IndexError):
|
1266
|
+
valid = False
|
1267
|
+
if not valid:
|
1268
|
+
# Not for me...
|
1269
|
+
return
|
1270
|
+
param = node.functional_parameter
|
1271
|
+
if param is None:
|
1272
|
+
return
|
1273
|
+
pt0x = getit(param, 2, 0)
|
1274
|
+
pt0y = getit(param, 3, 0)
|
1275
|
+
pt1x = getit(param, 5, 0)
|
1276
|
+
pt1y = getit(param, 6, 0)
|
1277
|
+
ratio_in_percent = getit(param, 8, 0)
|
1278
|
+
sides = getit(param, 10, 0)
|
1279
|
+
iterations = getit(param, 12, 0)
|
1280
|
+
igap = getit(param, 14, 0)
|
1281
|
+
pt0 = Point(pt0x, pt0y)
|
1282
|
+
pt1 = Point(pt1x, pt1y)
|
1283
|
+
sidelen = pt0.distance_to(pt1)
|
1284
|
+
startangle = pt0.angle_to(pt1)
|
1285
|
+
gap = igap / 360 * math.tau
|
1286
|
+
geom = create_growing_shape(
|
1287
|
+
pt0x,
|
1288
|
+
pt0y,
|
1289
|
+
sides,
|
1290
|
+
iterations,
|
1291
|
+
ratio_in_percent,
|
1292
|
+
sidelen,
|
1293
|
+
startangle,
|
1294
|
+
gap,
|
1295
|
+
)
|
1296
|
+
node.geometry = geom
|
1297
|
+
node.altered()
|
1298
|
+
pt0 = None
|
1299
|
+
pt1 = None
|
1300
|
+
for pt in geom.as_points():
|
1301
|
+
if pt0 is None:
|
1302
|
+
pt0 = Point(pt.real, pt.imag)
|
1303
|
+
elif pt1 is None:
|
1304
|
+
pt1 = Point(pt.real, pt.imag)
|
1305
|
+
else:
|
1306
|
+
break
|
1307
|
+
opposite_angle = math.tau / 2 + gap
|
1308
|
+
while opposite_angle > math.tau:
|
1309
|
+
opposite_angle -= math.tau
|
1310
|
+
while opposite_angle < 0:
|
1311
|
+
opposite_angle += math.tau
|
1312
|
+
# pt2 = Point.polar(pt0, opposite_angle, sidelen * ratio_in_percent)
|
1313
|
+
node.functional_parameter = (
|
1314
|
+
"growingshape",
|
1315
|
+
0,
|
1316
|
+
pt0.x,
|
1317
|
+
pt0.y,
|
1318
|
+
0,
|
1319
|
+
pt1.x,
|
1320
|
+
pt1.y,
|
1321
|
+
1,
|
1322
|
+
ratio_in_percent,
|
1323
|
+
1,
|
1324
|
+
sides,
|
1325
|
+
1,
|
1326
|
+
iterations,
|
1327
|
+
1,
|
1328
|
+
igap,
|
1329
|
+
)
|
1330
|
+
|
1331
|
+
@self.console_argument("sx", type=Length)
|
1332
|
+
@self.console_argument("sy", type=Length)
|
1333
|
+
@self.console_argument("sides", type=int)
|
1334
|
+
@self.console_argument("iterations", type=int)
|
1335
|
+
@self.console_argument("firstlength", type=Length)
|
1336
|
+
@self.console_option("ratio", "r", type=int, help=_("Growth in %"))
|
1337
|
+
@self.console_option("angle", "a", type=Angle, help=_("Start angle"))
|
1338
|
+
@self.console_option(
|
1339
|
+
"gap", "g", type=int, help=_("Delta angle between moves in degrees")
|
1340
|
+
)
|
1341
|
+
@context.console_command(
|
1342
|
+
"growingshape", help=_("growingshape sx sy sides iterations")
|
1343
|
+
)
|
1344
|
+
def growing_shape(
|
1345
|
+
command,
|
1346
|
+
channel,
|
1347
|
+
_,
|
1348
|
+
sx=None,
|
1349
|
+
sy=None,
|
1350
|
+
sides=None,
|
1351
|
+
iterations=None,
|
1352
|
+
firstlength=None,
|
1353
|
+
ratio=None,
|
1354
|
+
angle=None,
|
1355
|
+
gap=None,
|
1356
|
+
data=None,
|
1357
|
+
post=None,
|
1358
|
+
**kwargs,
|
1359
|
+
):
|
1360
|
+
try:
|
1361
|
+
if sx is None:
|
1362
|
+
sx = Length("0cm")
|
1363
|
+
ssx = float(sx)
|
1364
|
+
if sy is None:
|
1365
|
+
sy = Length("0cm")
|
1366
|
+
ssy = float(sy)
|
1367
|
+
if sides is None or sides < 3:
|
1368
|
+
sides = 3
|
1369
|
+
if iterations is None:
|
1370
|
+
iterations = 5
|
1371
|
+
if iterations < 1:
|
1372
|
+
iterations = 1
|
1373
|
+
if angle is None:
|
1374
|
+
angle = Angle("0deg")
|
1375
|
+
startangle = float(angle)
|
1376
|
+
if firstlength is None:
|
1377
|
+
firstlength = Length("0.5cm")
|
1378
|
+
sidelen = float(firstlength)
|
1379
|
+
if ratio is None:
|
1380
|
+
ratio = 2 # 2% growth
|
1381
|
+
if gap is None:
|
1382
|
+
gap = 0
|
1383
|
+
except ValueError:
|
1384
|
+
channel("Invalid data provided")
|
1385
|
+
return
|
1386
|
+
gap_angle = gap / 360 * math.tau
|
1387
|
+
geom = create_growing_shape(
|
1388
|
+
ssx,
|
1389
|
+
ssy,
|
1390
|
+
sides,
|
1391
|
+
iterations,
|
1392
|
+
ratio,
|
1393
|
+
sidelen,
|
1394
|
+
startangle,
|
1395
|
+
gap_angle,
|
1396
|
+
)
|
1397
|
+
# _("Create shape")
|
1398
|
+
with self.undoscope("Create shape"):
|
1399
|
+
node = self.elem_branch.add(type="elem path", geometry=geom)
|
1400
|
+
node.label = f"Growing Polygon w. {sides} sides"
|
1401
|
+
node.stroke = self.default_stroke
|
1402
|
+
node.stroke_width = 1000 # self.default_strokewidth
|
1403
|
+
node.altered()
|
1404
|
+
pt0 = None
|
1405
|
+
pt1 = None
|
1406
|
+
for pt in geom.as_points():
|
1407
|
+
if pt0 is None:
|
1408
|
+
pt0 = Point(pt.real, pt.imag)
|
1409
|
+
elif pt1 is None:
|
1410
|
+
pt1 = Point(pt.real, pt.imag)
|
1411
|
+
else:
|
1412
|
+
break
|
1413
|
+
node.functional_parameter = (
|
1414
|
+
"growingshape",
|
1415
|
+
0,
|
1416
|
+
pt0.x,
|
1417
|
+
pt0.y,
|
1418
|
+
0,
|
1419
|
+
pt1.x,
|
1420
|
+
pt1.y,
|
1421
|
+
1,
|
1422
|
+
ratio,
|
1423
|
+
1,
|
1424
|
+
sides,
|
1425
|
+
1,
|
1426
|
+
iterations,
|
1427
|
+
1,
|
1428
|
+
gap,
|
1429
|
+
)
|
1430
|
+
# Newly created! Classification needed?
|
1431
|
+
data = [node]
|
1432
|
+
node.emphasized = True
|
1433
|
+
post.append(classify_new(data))
|
1434
|
+
return "elements", data
|
1435
|
+
|
1436
|
+
# Let's register them
|
1437
|
+
# The info tuple contains three entries
|
1438
|
+
# 1) The function to be called to update the node after a parameter change
|
1439
|
+
# 2) A dict with information how to read/display the different parameter entries
|
1440
|
+
# 3) A boolean parameter that indicates whether this is a routine that needs
|
1441
|
+
# to be automatically called after a change of a related source node
|
1442
|
+
# This needs the id of the related node to be in the very 'first' parameter
|
1443
|
+
# of the functional_parameter structure, so something like
|
1444
|
+
# node.functional_parameter = ("grid", 3, source_node.id, ....)
|
1445
|
+
info = (
|
1446
|
+
update_node_grid,
|
1447
|
+
{
|
1448
|
+
"0": ("ID",),
|
1449
|
+
"1": ("Horizontal gap",),
|
1450
|
+
"2": ("Vertical gap",),
|
1451
|
+
"3": ("Columns", 1, 25),
|
1452
|
+
"4": ("Rows", 1, 25),
|
1453
|
+
},
|
1454
|
+
True, # Yes this something that needs to be updated on source changes
|
1455
|
+
)
|
1456
|
+
kernel.register("element_update/grid", info)
|
1457
|
+
|
1458
|
+
info = (
|
1459
|
+
update_node_fractaltree,
|
1460
|
+
{
|
1461
|
+
"0": ("Startpoint",),
|
1462
|
+
"1": ("End of base stem",),
|
1463
|
+
"2": ("Iterations", 2, 13),
|
1464
|
+
"3": ("Branch length",),
|
1465
|
+
},
|
1466
|
+
False,
|
1467
|
+
)
|
1468
|
+
kernel.register("element_update/fractaltree", info)
|
1469
|
+
|
1470
|
+
# info = (
|
1471
|
+
# update_node_fractaldragon,
|
1472
|
+
# {
|
1473
|
+
# "0": ("Startpoint",),
|
1474
|
+
# "1": ("End of base stem",),
|
1475
|
+
# "2": ("Iterations", 2, 20),
|
1476
|
+
# },
|
1477
|
+
# )
|
1478
|
+
# kernel.register("element_update/fractaldragon", info)
|
1479
|
+
|
1480
|
+
info = (
|
1481
|
+
update_node_cycloid,
|
1482
|
+
{
|
1483
|
+
"0": ("Startpoint",),
|
1484
|
+
"1": ("Major axis",),
|
1485
|
+
"2": ("Minor axis",),
|
1486
|
+
"3": ("Iterations", 2, 30),
|
1487
|
+
},
|
1488
|
+
False,
|
1489
|
+
)
|
1490
|
+
kernel.register("element_update/cycloid", info)
|
1491
|
+
|
1492
|
+
max_corner_gui = 32
|
1493
|
+
info = (
|
1494
|
+
update_node_star_shape,
|
1495
|
+
{
|
1496
|
+
"0": ("Center",),
|
1497
|
+
"1": ("Outer radius",),
|
1498
|
+
"2": ("Inner radius",),
|
1499
|
+
"3": ("Corners", 3, max_corner_gui),
|
1500
|
+
"4": ("Alternation", 0, 10),
|
1501
|
+
"5": ("Density", 1, max_corner_gui - 1),
|
1502
|
+
},
|
1503
|
+
False,
|
1504
|
+
)
|
1505
|
+
kernel.register("element_update/star", info)
|
1506
|
+
|
1507
|
+
info = (
|
1508
|
+
update_node_tfractal,
|
1509
|
+
{
|
1510
|
+
"0": ("Turtle code",),
|
1511
|
+
"1": ("Base code",),
|
1512
|
+
"2": ("Segmentation", 1, 20),
|
1513
|
+
"3": ("Iterations", 1, 20),
|
1514
|
+
"4": ("Shaping", 1, 20),
|
1515
|
+
"5": ("Cornertype", 0, 2),
|
1516
|
+
},
|
1517
|
+
False,
|
1518
|
+
)
|
1519
|
+
kernel.register("element_update/tfractal", info)
|
1520
|
+
|
1521
|
+
info = (
|
1522
|
+
None, # Let the node deal with it
|
1523
|
+
{
|
1524
|
+
"0": ("Rounded corner",),
|
1525
|
+
},
|
1526
|
+
False,
|
1527
|
+
)
|
1528
|
+
kernel.register("element_update/rect", info)
|
1529
|
+
|
1530
|
+
info = (
|
1531
|
+
update_node_growing_shape,
|
1532
|
+
{
|
1533
|
+
"0": ("First point",),
|
1534
|
+
"1": ("First edge",),
|
1535
|
+
"2": ("Growth Ratio", 0, 100),
|
1536
|
+
"3": ("Sides", 3, 12),
|
1537
|
+
"4": ("Iterations", 1, 45),
|
1538
|
+
"5": ("Gap", 0, 15),
|
1539
|
+
},
|
1540
|
+
False,
|
1541
|
+
)
|
1542
|
+
kernel.register("element_update/growingshape", info)
|