Jump to content

Platform model duplicated when moved


DaBrain0815
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.4 stable released
        The full stable release of UltiMaker Cura 5.4 is here and it makes it easier than ever to remove brims and supports from your finished prints. UltiMaker S series users can also look forward to print profiles for our newest UltiMaker PET CF composite material!
          • Like
        • 58 replies
    ×
    ×
    • Create New...