Jump to content

thebelin

Member
  • Posts

    2
  • Joined

  • Last visited

Personal Information

  • 3D printer
    Other 3D printer

thebelin's Achievements

0

Reputation

  1. I wrote a post process plugin to solve this problem # Copyright (c) 2020 Belin Fieldson # LaserCode is released under the terms of the AGPLv3 or higher. from ..Script import Script class LaserCode(Script): version = "1.01" def __init__(self): super().__init__() def getSettingDataString(self): return """{ "name":"Laser Code v.(""" + self.version + """)", "key":"LaserCode", "metadata": {}, "version": 2, "settings": { "_activation": { "label": "Laser Activate", "description": "The code to use to activate the laser", "type": "str", "default_value": "M3" }, "_deactivation": { "label": "Laser Deactivate", "description": "The code to use to deactivate the laser", "type": "str", "default_value": "M5" }, "_prefixActivation": { "label": "Active GCODE", "description": "The gcode that the activate code should be prefixed to", "type": "str", "default_value": "G1" }, "_prefixDeactivation": { "label": "Inactive GCODE", "description": "The gcode that the deactivate code should be prefixed to", "type": "str", "default_value": "G0" } } }""" def execute(self, data): activation = self.getSettingValueByKey("_activation"); deactivation = self.getSettingValueByKey("_deactivation"); searchActivation = self.getSettingValueByKey("_prefixActivation"); searchDeactivation = self.getSettingValueByKey("_prefixDeactivation"); activated = False; # Declare output gcode for layer in data: index = data.index(layer) lines = layer.split("\n") newLayer = "" for line in lines: if (searchActivation in line and not activated): newLayer += activation + "\n" activated = True if (searchDeactivation in line and activated): newLayer += deactivation + "\n" activated = False newLayer += line + "\n" data[index] = newLayer return data
  2. I made this plugin today so that I could operate my laser cutter with Cura: # Copyright (c) 2020 Belin Fieldson # LaserCode is released under the terms of the AGPLv3 or higher. from ..Script import Script class LaserCode(Script): version = "1.01" def __init__(self): super().__init__() def getSettingDataString(self): return """{ "name":"Laser Code v.(""" + self.version + """)", "key":"LaserCode", "metadata": {}, "version": 2, "settings": { "_activation": { "label": "Laser Activate", "description": "The code to use to activate the laser", "type": "str", "default_value": "M3" }, "_deactivation": { "label": "Laser Deactivate", "description": "The code to use to deactivate the laser", "type": "str", "default_value": "M5" }, "_prefixActivation": { "label": "Active GCODE", "description": "The gcode that the activate code should be prefixed to", "type": "str", "default_value": "G1" }, "_prefixDeactivation": { "label": "Inactive GCODE", "description": "The gcode that the deactivate code should be prefixed to", "type": "str", "default_value": "G0" } } }""" def execute(self, data): activation = self.getSettingValueByKey("_activation"); deactivation = self.getSettingValueByKey("_deactivation"); searchActivation = self.getSettingValueByKey("_prefixActivation"); searchDeactivation = self.getSettingValueByKey("_prefixDeactivation"); activated = False; # Declare output gcode for layer in data: index = data.index(layer) lines = layer.split("\n") newLayer = "" for line in lines: if (searchActivation in line and not activated): newLayer += activation + "\n" activated = True if (searchDeactivation in line and activated): newLayer += deactivation + "\n" activated = False newLayer += line + "\n" data[index] = newLayer return data
×
×
  • Create New...