1

I'm programming an opc server for a octoprint server. The opc server has to communicate with the octoprint server. One opc method is to issue a slicing process by passing the path of the stl-file over a opc client gui. As I'm a noob in this section I don't know how to define a name and type of the input arguments.

inargs = []
for name, dtype in {"File Path": VariantType.String,
                 "Output Path": VariantType.String,
                 "Config File": VariantType.String,
                 "Auto Upload": VariantType.Boolean}.items():
        # inarg = ua.Argument()
        # inarg.Name = name
        inargs.append(dtype)
outargs = [VariantType.String, VariantType.Boolean]
self.sliceStl: Node = self.processData.add_method(self.addrSpace, "Slice STL", self._sliceStl, inargs, outargs)

@uamethod
def _sliceStl(self, parent, filePath: str="~/Uploads/CalibrationCube.stl",
             outputPath: str="~/GCODE/",
             configFile: str="~/Slic3r/tevo_config.ini",
             autoUpload=True,
             select=False,
             _print=False):
    if not filePath.endswith(".stl"):
        raise Exception("Slic3rError: File must have *.stl format!")
    command = f"~/Slic3r/slic3r  {filePath} " \
              f"--load {configFile} -o {outputPath} " \
              "--output-filename-format [input_filename_base].gcode"
    os.system(command)
    if autoUpload:
        return self._uploadGcode(filePath.replace(".stl", ".gcode"), select, print)
    else:
        return True  

When the sliceStl() is called in the opc-client gui OPC Client Gui Method Form a form pops up with 4 input fields. But none of them has a name or a type. I want that every input field has a name and a data type.

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186

0 Answers0