Jump to content

Platform model duplicated when moved


Go to solution Solved by DaBrain0815,

Recommended Posts

Posted (edited) · Platform model duplicated when moved

Hi all,

I hope this is the right forum here for my topic.
My Cura plugin moves the platform model/STL via SetPosition:

setPosition(Vector(offset[0], offset[1], offset[2]))

However the movement results in an additional platform at the new coordinates instead of just moving the original one:

image.thumb.png.c42ed51b757b95a706f855a1361e17cd.png
 

This happens under Cura 4.13.1 and 5.4.
When iterating through the nodes using BreadthFirstIterator it seems to create new platform nodes during the movement process.
I already tried setting the visibility to False for a platform but this is not really working or sets the wrong platform to be invisible.

 

Is there any advice available or code example on how to get this done?

Thanks in advance,

Brian

Edited by DaBrain0815
  • Link to post
    Share on other sites

    Posted (edited) · Platform model duplicated when moved

    BreadthFirstIterator You mean DepthFirstIterator ?

     

    Is you use DepthFirstIterator you must check if the node "isSliceable"

     

    Me = CuraApplication.getInstance()
    for node in DepthFirstIterator(Me.getController().getScene().getRoot()):
          if node.callDecoration("isSliceable"):
                node.setPosition(Vector(position.x(), position.y(), position.z()))

     

    Note : setPosition should only "Move" the node so if you also copy there is something else in your code

    Edited by Cuq
  • Link to post
    Share on other sites

    • Solution
    Posted (edited) · Platform model duplicated when moved

    Thank you for your feedback.

    There is BreadthFirstIterator and DepthFirstIterator, see: https://github.com/Ultimaker/Cura/wiki/Cura-Scene-Graph#accessing-scenenodes-in-the-scene

    Why should the printer platform itself be sliceable?
    Not that you mistake me: I talk about the platform that represents the printer itself in Cura as seen in my screenshot.

    Currently I'm iterating through the nodes and save the seemingly right on in a variable to later process it to save time and resources, maybe this somehow copies the platform.

    Will check this.

     

    EDIT:

    With separate iterator-loops where I move all platform nodes it is working like a charm and does not seem to produce some memory leaks.
    That is some good news in the morning. 😄

    Edited by DaBrain0815
  • 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...