Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login
    1. Home
    2. cnc65
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 16
    • Best 1
    • Controversial 0
    • Groups 0

    cnc65

    @cnc65

    2
    Reputation
    1
    Profile views
    16
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    cnc65 Unfollow Follow

    Best posts made by cnc65

    • RE: Gcode upload with python and OpenAPI

      @chrishamm @T3P3Tony
      I have changed the requestBody in the OpenAPI.yaml file so that a parameter body is generated in Python. This works for uploading gcode files. I have not tested other files.

      requestBody:
      	required: true
      	description: 'File content'
      		content:
      			application/octet-stream:
      			schema:
      				type: string
      				format: binary
      

      The function call in Python then looks like this:

      # Upload a file
      file = "f:/temp/test.g"
      name = "0:/gcodes/test-1.g"
      try:
          body = open(file).read()
          duet_response = api_instance.rr_upload_post(body, name)
      except ApiException as e:
          print("Exception when calling DefaultApi->rr_upload_post: %s\n" % e)
      
      posted in Third-party software
      cnc65undefined
      cnc65

    Latest posts made by cnc65

    • RE: Gcode upload with python and OpenAPI

      @chrishamm @T3P3Tony
      I have changed the requestBody in the OpenAPI.yaml file so that a parameter body is generated in Python. This works for uploading gcode files. I have not tested other files.

      requestBody:
      	required: true
      	description: 'File content'
      		content:
      			application/octet-stream:
      			schema:
      				type: string
      				format: binary
      

      The function call in Python then looks like this:

      # Upload a file
      file = "f:/temp/test.g"
      name = "0:/gcodes/test-1.g"
      try:
          body = open(file).read()
          duet_response = api_instance.rr_upload_post(body, name)
      except ApiException as e:
          print("Exception when calling DefaultApi->rr_upload_post: %s\n" % e)
      
      posted in Third-party software
      cnc65undefined
      cnc65
    • RE: Gcode upload with python and OpenAPI

      Is a solution to this problem in progress?

      posted in Third-party software
      cnc65undefined
      cnc65
    • RE: Gcode upload with python and OpenAPI

      @T3P3Tony Thank you for your help.
      What I have tried so far:

      1. Update RRF to 3.6beta4
      2. Test CURL commands:
      F:\temp>curl http://192.168.2.1/rr_connect?password=
      {"err":0,"sessionTimeout":8000,"boardType":"duet3mb6hc102","apiLevel":2,"sessionKey":0}
      F:\temp>curl --data-binary @"test.g" "http://192.168.2.1/rr_upload?name=/gcodes/test.g"
      {"err":0}
      F:\temp>
      

      No success with Python so far.

      What I dont understand is that the Python function generated from OpenAPI has only one parameter "name". The parameters "time" and "crc32" are optional. But at least two variables are required: source(path_and_filename.gcode) and destination(name) like in CURL.

      rr_upload_post

      Example

      from __future__ import print_function
      import time
      import swagger_client
      from swagger_client.rest import ApiException
      from pprint import pprint
      
      # create an instance of the API class
      api_instance = swagger_client.DefaultApi()
      name = 'name_example' # str | Path to the file to upload
      time = '2013-10-20T19:20:30+01:00' # datetime | ISO8601-like represenation of the time the file was last modified (optional)
      crc32 = 'crc32_example' # str | CRC32 checksum of the file content as hex string *without* leading `0x`. Usage of this parameter is encouraged (optional)
      
      try:
          # Upload a file 
          api_response = api_instance.rr_upload_post(name, time=time, crc32=crc32)
          pprint(api_response)
      except ApiException as e:
          print("Exception when calling DefaultApi->rr_upload_post: %s\n" % e)
      

      Parameters

      Name Type Description Notes
      name str Path to the file to upload
      time datetime ISO8601-like represenation of the time the file was last modified [optional]
      crc32 str CRC32 checksum of the file content as hex string without leading `0x`. Usage of this parameter is encouraged [optional]
      posted in Third-party software
      cnc65undefined
      cnc65
    • RE: Gcode upload with python and OpenAPI

      RepRapFirmware: 3.5.4
      OpenAPI yaml: 3.6 and also tested with 3.4

      posted in Third-party software
      cnc65undefined
      cnc65
    • Gcode upload with python and OpenAPI

      I am trying to write a Python program to control a Duet 3 mainboard 6HC via Ethernet. I am using the OpenAPI definition for standalone mode. Everything works well except for the file upload function.

      When I run my test program, I get this error message:

      File Path exists: True
      Exception when calling DefaultApi->rr_upload_post: (0)
      Reason: Cannot prepare a request message for provided arguments. Please check that your arguments match declared content type.

      Does anyone have any idea what I am doing wrong?

      Here is my test program:

      #! /usr/bin/python3
      # -*- coding: utf-8 -*-
      """
      Duet file upload test
      """
      from __future__ import print_function
      import os
      from datetime import datetime
      import swagger_client
      from swagger_client.rest import ApiException
      from pprint import pprint
      
      """
      create an instance of the API class and connect Duet to
      fixed host address DUET_HOST
      """
      configuration = swagger_client.Configuration()
      configuration.host = "http://192.168.2.1"
      
      # instance of the API class
      api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
      time = datetime.now()
      try:
          # new connection and log in
          duet_response = api_instance.rr_connect_get(password="", time=time)
      
      except ApiException as e:
          print("Exception when calling DefaultApi->rr_connect_get: %s\n" % e)
      
      # Upload a file
      file = "f:/temp/test.g"
      print("File Path exists: ", os.path.exists(file))
      
      try:
          duet_response = api_instance.rr_upload_post(file)
      except ApiException as e:
          print("Exception when calling DefaultApi->rr_upload_post: %s\n" % e)
      
      # Disconnect Duet
      try:
          duet_response = api_instance.rr_disconnect_get()
          # pprint(duet_response)
      except ApiException as e:
          print("Exception when calling DefaultApi->rr_disconnect_get: %s\n" % e)
      
      posted in Third-party software
      cnc65undefined
      cnc65
    • RE: OpenAPI definitions

      @chrishamm Thank you. That's exactly what I was looking for.

      posted in Firmware developers
      cnc65undefined
      cnc65
    • OpenAPI definitions

      Re: OpenAPI definitions
      Will there be an update of the OpenAPI definition for software version 3.5.x?

      posted in Firmware developers
      cnc65undefined
      cnc65
    • RE: VFD spindle drive 0-10V output

      In the CNC world 0-10VDC VFD spindle controls are standard. Only a few VFDs accept also a PWM input. Of course that can be solved with an external PWM to analog converter. But I prefer an integrated solution like the Azteeg X5 GT has:

      http://www.panucatt.com/azteeg_X5_GT_reprap_3d_printer_controller_p/ax5gt.htm

      posted in CNC
      cnc65undefined
      cnc65
    • VFD spindle drive 0-10V output

      Are there any plans to add a 0-10VDC output to control a VFD spindle drive?

      posted in CNC
      cnc65undefined
      cnc65
    • RE: Workpiece Coordinate System (WCS)

      Thanks for the new RC!
      I tried G53 to G56. All is working as expected.

      posted in Firmware wishlist
      cnc65undefined
      cnc65