Created
August 17, 2021 06:24
-
-
Save raspberrypisig/74e774ae2f3e5b5c544b3aab82219e7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import easygui | |
import xml.etree.ElementTree as ET | |
import sys | |
easygui.msgbox('Welcome. Click OK to select a DAE file to fix', 'DAE fix units') | |
inputfile = easygui.fileopenbox() | |
ET.register_namespace('', "http://www.collada.org/2005/11/COLLADASchema") | |
tree = ET.parse(inputfile) | |
root = tree.getroot() | |
assetTag = root[0] | |
#print(assetTag) | |
''' | |
Want to append this to the asset tag as child element | |
<unit name="millimeters" meter="0.001"/> | |
''' | |
unitTag = ET.Element('unit') | |
unitTag.set('name', 'millimeters') | |
unitTag.set('meter', '0.001') | |
assetTag.append(unitTag) | |
newfile = inputfile.replace('.dae', '') + '-converted.dae' | |
tree.write(newfile) | |
easygui.msgbox("Fix successful. New file created: " + newfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment