Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cura-specific settings in xmlmaterials #2333

Merged

Conversation

fieldOfView
Copy link
Collaborator

This PR adds functionality to include any Cura setting in an xml fdm material file. These Cura-specific settings are namespaced to not conflict with the fdm material xml spec.

A followup to this PR could enable the user to add settings to the material profile on the materials pane of the preferences. This UI is not part of this PR.

A material with a namespaced cura setting would look like this (note the namespace declaration at the top, and the <cura.setting> tag:

<?xml version="1.0" encoding="UTF-8"?>
<fdmmaterial xmlns="http://www.ultimaker.com/material" xmlns:cura="http://www.ultimaker.com/cura" version="1.3">
    <metadata>
        <name>
            <brand>Test</brand>
            <material>PLA</material>
            <color>Test Color</color>
        </name>
        <GUID>30a578af-5661-4149-8fbf-c82d8153a697</GUID>
        <version>1</version>
        <color_code>#ffc924</color_code>
        <description></description>
        <adhesion_info></adhesion_info>
    </metadata>
    <properties>
        <density>1.24</density>
        <diameter>2.85</diameter>
    </properties>
    <settings>
        <setting key="print temperature">200</setting>
        <setting key="heated bed temperature">60</setting>
        <setting key="standby temperature">175</setting>

        <cura:setting key="infill_sparse_density">13</cura:setting>

        <machine>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker 2+"/>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker 2 Extended+"/>

            <hotend id="0.25 mm" />
            <hotend id="0.4 mm" />
            <hotend id="0.6 mm" />
            <hotend id="0.8 mm" />
        </machine>

        <machine>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker 2"/>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker 2 Go"/>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker 2 Extended"/>
            <setting key="standby temperature">150</setting>
            <setting key="processing temperature graph">
                <point flow="2" temperature="180"/>
                <point flow="10" temperature="230"/>
            </setting>
        </machine>

        <machine>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker Original"/>
            <setting key="standby temperature">150</setting>
            <cura:setting key="infill_sparse_density">14</cura:setting>
        </machine>

        <machine>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker 3"/>
            <machine_identifier manufacturer="Ultimaker B.V." product="Ultimaker 3 Extended"/>
            <setting key="print cooling">100</setting>
            <hotend id="BB 0.4" />
            <hotend id="BB 0.8" />
            <hotend id="AA 0.25">
                <setting key="hardware compatible">yes</setting>
            </hotend>
            <hotend id="AA 0.4">
                <setting key="hardware compatible">yes</setting>
            </hotend>
            <hotend id="AA 0.8">
                <setting key="hardware compatible">yes</setting>
            </hotend>
        </machine>

    </settings>
</fdmmaterial>

@nallath
Copy link
Member

nallath commented Aug 29, 2017

CURA-4253

@maukcc
Copy link
Contributor

maukcc commented Sep 5, 2017

Please make it so that it can be added under the machine specific details also, and not only as a general setting

@fieldOfView
Copy link
Collaborator Author

@maukcc, that should already work. Doesn't it?

@maukcc
Copy link
Contributor

maukcc commented Sep 5, 2017

I do not know, I have not tested it.
I was just looking at the example, and saw it being used in the general settings.

@fieldOfView
Copy link
Collaborator Author

Out of curiosity, is CURA-4253 in this sprint or in a future sprint?

In other words: bump

@nallath
Copy link
Member

nallath commented Sep 19, 2017

Yeah it's in there, but it's a bit of a mess as to if it's something that we should add. The whole material profiles are a bit of a mess.

@fieldOfView
Copy link
Collaborator Author

The whole material profiles are a bit of a mess.

And this could be a first step towards making it more consistent with the rest of the profiles system. Unless you want to drop the xml profiles all the way.

@maukcc
Copy link
Contributor

maukcc commented Sep 19, 2017

+1 for dropping them.

@nallath
Copy link
Member

nallath commented Sep 19, 2017

Well, we're not going to drop them all together as far as I know. I will try to get some concensus regarding this. The current implementation of Cura is bloated. A lot of the slowness in Cura is caused by the current material system.

@Ghostkeeper
Copy link
Collaborator

I don't see us dropping the XML format any time soon. There's lots of plans for the near future for the material files. It's not going to become simpler either...

I see this sort of change as the only real solution that would make everybody happy, but some people see this as pollution of the files so apparently it doesn't.

@fieldOfView
Copy link
Collaborator Author

Does it make sense if I keep this PR updated? If it stands no chance of being merged anyway, I would rather just close the PR.

@ChrisTerBeke
Copy link

There is still a discussion about whether this should be supported. XML spec clearly states that it's extendable thus this could be added, but not everyone agrees...

@fieldOfView
Copy link
Collaborator Author

Ok, I'll fix the conflict then...

# Conflicts:
#	plugins/XmlMaterialProfile/XmlMaterialProfile.py
@fieldOfView
Copy link
Collaborator Author

For reference: #1141 (comment)

@Ghostkeeper
Copy link
Collaborator

It's about to get a conflict with #2867 as well. You might want to leave it for a while.

I think it's best to just plan a meeting in person with a few firmware guys about this. I'm sure @daid or @MarcoTvM has a good opinion too.

@ChrisTerBeke
Copy link

I just did a quick unit test and the firmware breaks when adding Cura specific settings to an XML file. This means that we can't add this functionality until the firmware supports it.

@fieldOfView
Copy link
Collaborator Author

So the firmware has an XML parser that does not understand namespaces? That's strange...

@nallath
Copy link
Member

nallath commented Dec 5, 2017

Woah. That's weird...

@daid
Copy link
Contributor

daid commented Dec 5, 2017

Surprising, the code was written to ignore anything unknown. What exception is it throwing? (Element-tree xml is a bit annoying to use with namespaces)

# Conflicts:
#	plugins/XmlMaterialProfile/XmlMaterialProfile.py
@fieldOfView
Copy link
Collaborator Author

Fixed conflicts with master

# Conflicts:
#	plugins/XmlMaterialProfile/XmlMaterialProfile.py
@fieldOfView
Copy link
Collaborator Author

Fixed conflicts with master

@Appesteijn
Copy link
Contributor

To be clear, we need changes in the firmware for this PR and that is not likely to happen in the upcoming 4-6 months.

@fieldOfView
Copy link
Collaborator Author

@Appesteijn, understood. I've set a reminder for a birthday party on august 29. There will be cake.

@Ghostkeeper
Copy link
Collaborator

@Appesteijn Robin and I tested this a month ago in preparation for the model assistant issue. The firmware accepts this since version 4.0 apparently. So it's long been in there.

@ianpaschal
Copy link
Contributor

Ok. I've been testing this. Number values seem to work like gravy but boolean (yes/no) values don't seem to have any effect. I've tried a few to try and make sure that it's not that they're being overwritten somehow but no luck.

Have you gotten this to work, @fieldOfView?

@fieldOfView
Copy link
Collaborator Author

fieldOfView commented Mar 21, 2018

I had not tested anything but numeric values, but adding a bool setting works for me. I added the following line to generic_pla, and it successfully turned off retraction for the materials.

<cura:setting key="retraction_enable">False</cura:setting>

@fieldOfView
Copy link
Collaborator Author

Godmode plugin is a good way to inspect if the internal material profiles get created in the way you expect:
https://github.com/sedwards2009/cura-god-mode-plugin

@ianpaschal
Copy link
Contributor

I had not tested anything but numeric values, but adding a bool setting works for me. I added the following line to generic_pla, and it successfully turned off retraction for the materials.

<cura:setting key="retraction_enable">False</cura:setting>

Not here unfortunately. Also, regardless, this should implement the same same boolean syntax as existing attributes which is yes/no

@fieldOfView
Copy link
Collaborator Author

I have fixed reading and writing yes/no as boolean values. True/False still work for reading, but they are always written as yes/no.

If this still does not work, please check with GodMode plugin if the value gets overwritten by another profile higher up the stack.

@ianpaschal
Copy link
Contributor

Yeah I was using GodMode. I've tested again it seems to work. I'm not sure why I was having troubles yesterday.


# Use the previously found center of the group bounding box as the new location of the group
group_node.setPosition(group_node.getBoundingBox().center)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes don't seem to be related to material loading, but maybe I'm missing something. Can you explain why they're in the PR?

@ianpaschal
Copy link
Contributor

I think there's several files in this branch which need to have master pulled in.

@fieldOfView
Copy link
Collaborator Author

Something went wrong merging in master. Just a minute...

@fieldOfView
Copy link
Collaborator Author

Fixed the merge/master issue.

@ianpaschal
Copy link
Contributor

Great! In this case, merging!

@ianpaschal ianpaschal merged commit 76b837e into Ultimaker:master Mar 23, 2018
@fieldOfView
Copy link
Collaborator Author

@Appestein, scrap that cake in august. The birthdayparty is off... I’m having a beer instead now.

@Appesteijn
Copy link
Contributor

Appesteijn commented Mar 23, 2018

Nooooo, @ianpaschal what did you do!!!! 😄

@filipgoc
Copy link
Contributor

Loving this! Is this gonna make it into Cura 3.3 ?!

@fieldOfView
Copy link
Collaborator Author

It’s in. Note that there is no UI for it whatsoever, but you can edit values into the xml files now

@filipgoc
Copy link
Contributor

filipgoc commented Apr 16, 2018

Nice! This is a major improvement that I've not even hoped for anymore!

Now I can finally create functional material profiles (and not a strange conglomeration of materials and quality with hopes it falls in place.)

PS: don't care about GUI crazy much even though it will be nice one of these days. More than happy to fire up the notepad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants