@theox This is documented here : https://github.com/LoicGRENON/DSF_ExecOnMcode_Plugin?tab=readme-ov-file#limitations
Posts made by Falcounet
-
dsf-python-3.5.0.2rc2 released
The Python bindings for DSF dsf-python v3.5.0.2rc2 has been released.
Please note this is a pre-release version so you may need to add
--pre
argument topip
to install or upgrade to this version. Another option is to specify the version number :
To install :sudo pip3 install --pre dsf-python
To upgrade :sudo pip3 install --upgrade --pre dsf-python
Release Notes
Compatible versions:
- Python 3.7 or newer
- RepRapFirmware 3.5.0-rc2
- DuetSoftwareFramework 3.5.0-rc2
New features:
- Added new object model fields introduced by RepRapFirmware/DuetSoftwareFramework
- Add DeprecationWarning where applicable
Bug fixes:
- Do not time out the connection for zero-byte payloads as DSF may send it to check if the socket is still open
- Raise IPCSocketBrokenException when the IPC socket is closed on the remote server
Downloads
Installation
To install the latest version :
sudo pip3 install --pre dsf-python
To upgrade to the latest version :sudo pip3 install --upgrade --pre dsf-python
To install this specific version :pip install dsf-python==3.5.0.2rc2
-
RE: Object model subscription - sometimes fails
@Lem I just releaseed a new version of dsf-python which raises an
dsf.connections.exceptions.IPCSocketBrokenException
exception when the IPC socket is closed.
Please try and report back if you run in other problems. -
RE: Object model subscription - sometimes fails
@chrishamm @Lem I'm going to look at this
-
RE: ExecOnMcode + 3.4.6, sudo commands are not executed
@EagleB3 plugins including ExecOnMcode doesn't have the right (unless you change the DSF config) to use sudo commands. That's intended.
As Jay said, duetpimanagement plugin is the way to go for this. -
RE: Automating 3rd Party Plugin Installation+Updates
@curieos You can use DSF for this and in particular dsf-python
-
RE: dsf-python: type object is not subscriptable?
@aleohl I released a new version which fixes that issues so dsf-python still works with Python 3.7
Please let me know if you run it others problems. -
RE: dsf-python: type object is not subscriptable?
The problem is that your are using an old version of Python.
I know 3.7 is the latest version available on Debian Buster on which the DuetPi image is based on ...
I will see if I can change the code of dsf-python to stay compatible with the 3.7 version of Python. -
RE: [Solved] Sidewinder X1 SKR replacement with Duet 3 mini 5+
@aldiallo said in Sidewinder X1 SKR replacement with Duet 3 mini 5+:
That being said, I've starting cabling the new board to the artillery, I believe that I'm mostly done but I'm having some issues identifying some of the cables; I have an adapter on a white cable that you can see at the bottom right of the image.
Can someone please confirm what the white cable is and where should it be plugged in also(I completely forgot to label it ), is any one also using a BL touch or a super pinda with the sidewinder x1 ?
Isn't the white cable for the TFT screen ?
What is stopping you to follow where the second end goes ?Also I believe I can power up a raspberry pi from one of the 5V connectors if so what would be the best pins to use in this case??
No, it is not advised to power the SBC from the Mini5+
-
RE: Parse objectmodel in DSF_Python?
@oozeBot Yes I agree there is some lack of documentation ... and for now it mainly requires reading the code.
But on other hand, an IDE would suggest you the class attributes/properties and I believe the names are still pretty explicit. -
RE: Parse objectmodel in DSF_Python?
@oozeBot I actually don't get why you are using the json ...
If you want to get the filename, you can get it usingobject_model.job.file.file_name
, same as filePosition :object_model.job.file_position
There is a little trick here the camelCase naming using by DSF is replaced by snake_casing as suggested by PEP8
-
RE: Parse objectmodel in DSF_Python?
@oozeBot globals is a dictionary so you can't use str() on this.
Sorry the return type is missing for that property but that's seems pretty clear in the docstring.And no, there is nothing yet to get it back to the JSON format, you may have to do it yourself.
I suggest using a list comprehension over the dict elements with the String join() method. -
RE: [3.4.5] DSF-Python - timeout failures
@oozeBot I will need more of the source code to understand what is going on, not only the imports.
-
RE: Parse objectmodel in DSF_Python?
@oozeBot
global
is a keyword in Python so it is replaced byglobals
: https://github.com/Duet3D/dsf-python/blob/main/src/dsf/object_model/object_model.py#L71 -
RE: dsf-python 3.4.5 released
@oozeBot I suggest first to update to dsf-python 3.4.6 as I fixed
CodeParameter.is_expression
in that version.In your exemple
cde
is an instance ofdsf.commands.code.Code
.
TheCode
class has aparameters
attributes (eg :cde.parameters
) which is a List containing the GCode parameters.The class
dsf.commands.code_parameter.CodeParameter
has the following attributes :letter
: which contains the letter of the Gcode (eg : H)is_expression
: which return either if the parameter value is an expression or notstring_value
: The value of the gcode as a string
If you want to parse an expression, you have to use the generic function
evaluate_expression
over the string_valueAs an example :
from dsf.connections import InterceptConnection, InterceptionMode from dsf.commands.code import CodeType def start_intercept(): filters = ["M1234"] intercept_connection = InterceptConnection(InterceptionMode.PRE, filters=filters, debug=True) intercept_connection.connect() try: while True: # Wait for a code to arrive cde = intercept_connection.receive_code() # Check for the type of the code if cde.type == CodeType.MCode and cde.majorNumber == 1234: # Go through all the Gcode parameters for parameter in cde.parameters: if parameter.is_expression: print(intercept_connection.evaluate_expression(parameter.string_value)) # Resolve it so that DCS knows we took care of it intercept_connection.resolve_code() else: # We did not handle it so we ignore it and it will be continued to be processed intercept_connection.ignore_code() except Exception as e: print("Closing connection: ", e) traceback.print_exc() intercept_connection.close() if __name__ == "__main__": start_intercept()
-
dsf-python 3.4.6 released
The Python bindings for DSF dsf-python v3.4.6 has been released.
Release Notes
- Fix: Do not time out the connection for zero-byte payloads as DSF may send it to check if the socket is still open
- Fix check if code parameter is an expression
- Removed obsolete OM field state.restore_point.spindle_speeds
- Fixed unit of sensors.probes[].travelSpeed
- Fixed typo with priority_codes parameter to code interceptor API
- Replace CodeResult by Message
- Refactor commands.Code into separate modules and add class arguments in the constructor as well as their docstring
- Improve docstrings
Downloads
Installation
To install the latest version :
sudo pip3 install dsf-python
To upgrade to the latest version :sudo pip3 install --upgrade dsf-python
To install this specific version :pip install dsf-python==3.4.6
-
RE: [3.4.5] DSF-Python - timeout failures
@oozeBot The codebase was updated some months ago but I forgot to release the new version, sorry.
dsf-python 3.4.6 is released today -
RE: ExecOnMcode
@scumdead I released a new version with fixed version dependencies so it installs fine on DWC 3.4.6.
Thanks for reporting the problem. -
RE: ExecOnMcode + 3.4.6
@scumdead I released a new version with fixed version dependencies so it installs fine on DWC 3.4.6
-
RE: [3.4.5] DSF-Python - timeout failures
@oozeBot They are renamed because dsf-python has been refactored mainly to follow DuetAPI
Your imports should be changed as :
from dsf.commands.code import CodeType from dsf.connections import CommandConnection, InterceptConnection, InterceptionMode from dsf.object_model import LogLevel, MessageType