Jump to content

Recommended Posts

Posted (edited) · Plugins HowTo

Hmmm,

 

I try to reengineer a plugin and looking for a funktion which I can't find neither in uranium nor somwhere else in Cura:

Application.getInstance().getMainWindow().screenshotImages()

 

Can anybody help me to find it? Or the replacement in newer versions of Cura?

 

Regards

 

Edited by Daniel26
  • Link to post
    Share on other sites

    Posted (edited) · Plugins HowTo

    Ok, Nice.

    What is this plugin doing?

    But isn't there anywhere a howto?

    When is a plugin called?

    I wan't to include a preview of the model with specific g-codes to the G-Code-File.

     

    Edited by Daniel26
  • Link to post
    Share on other sites

    Posted · Plugins HowTo

    That is what this plugin does. Use file -> export and select UFP as the output format. Inspect the saved file as if it were a zip file.

  • Link to post
    Share on other sites

    Posted · Plugins HowTo

    Hmm, no. It seems not to be the same. The UFP creates a bundle. I wan't the code in the gcode-file.

    Butr I think it will bring me a step further.

    Thanks.

     

    But when will a plugin be executed? Everytime I slice a file? Or can I configure when a plugin will be executed?

  • Link to post
    Share on other sites

    Posted (edited) · Plugins HowTo

    The UFPWriter plugin is an OutputDevice plugin. Those are documented in an example here:

    https://github.com/Ultimaker/UraniumExampleOutputDevicePlugin

     

    Sorry, the UFPWriter is a MeshWriter plugin. There is no example plugin for that. But the UFPWriter plugin itself is fairly simple, code-wise. A MeshWriter plugin has a "write" method that you override. This method is called when you save a file in the format the MeshWriter plugin is configured for. Other types of plugins have other ways they are called. What sort of plugin you want to write really depends on what you want it to do.

     

    The simplest type of plugin to start with is an Extension plugin: https://github.com/Ultimaker/UraniumExampleExtensionPlugin

    Edited by ahoeben
  • Link to post
    Share on other sites

    Posted · Plugins HowTo

    I wan't  to execute the plugin everytime a gcode file is being created.

    Best would be a point in the settings to activate it.

    What are the qml files for?

     

    I'm not totally nw to python, I'm also writing apps with pyQT in business. But I don't have any clue how to write a plugin for cura.

     

  • Link to post
    Share on other sites

    Posted · Plugins HowTo

    QML files describe the UI. They are pretty integral parts of creating UIs with Qt and conversely pyqt.

     

    You could act every time a gcode file is written, sent to the printer via USB or the network like this:

    class SomePlugin(Extension):
        def __init__(self):
            super().__init__()
    
            application = CuraApplication.getInstance()
            application.getOutputDeviceManager().writeStarted.connect(self._onWriteGcode)
    
        def _onWriteGcode(self, output_device):
            # do things
            pass

    Alternatively, you could listen to the state of the backend:

    class SomePlugin(Extension):
        def __init__(self):
            super().__init__()
    
            application = CuraApplication.getInstance()
            application.getBackend().backendStateChange.connect(self._onBackendStateChange)
    
        def _onBackendStateChange(self, state):
            if state == BackendState.Done:
                # do things
                pass

     

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.9 stable released!
        Here comes Cura 5.9 and in this stable release we have lots of material and printer profiles for UltiMaker printers, including the newly released Sketch Sprint. Additionally, scarf seams have been introduced alongside even more print settings and improvements.  Check out the rest of this article to find out the details on all of that and more
          • Like
        • 5 replies
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Heart
          • Thanks
          • Like
        • 4 replies
    ×
    ×
    • Create New...