DFXMLExporter component

Contents

_images/icon27.png

DFXMLExporter component#

This component reads a DFAssembly object to export it to XML.

Inputs:

i_dump (bool ,item)

Button to export the xml.

i_export_dir (str ,item)

The folder where to export the xml.

i_assembly (ghdoc ,item)

The assembly object

Outputs:

o_xml

The string of xml to be exported.

Code:

#! python3



from ghpythonlib.componentbase import executingcomponent as component


class DFXMLExporter(component):
    def RunScript(self,
            i_dump: bool,
            i_export_dir,
            i_assembly):
        # dump the xml
        o_xml = None
        xml: str = i_assembly.to_xml()
        if i_dump:
            i_assembly.dump_xml(xml, i_export_dir)
        o_xml = xml

        return o_xml