コード例 #1
0
    def fileStreamAction():
        textWriter = stream_io_util.GetStreamWriter(fileStream)

        def textWriterAction():
            textWriter.Write(text)
            return

        stream_io_util.UsingStream(textWriter, textWriterAction)
        return
コード例 #2
0
    def fileStreamAction():
        textWriter = stream_io_util.GetStreamWriter(fileStream)

        def textWriterAction():
            for line in lines:
                textWriter.WriteLine(line)
            return

        stream_io_util.UsingStream(textWriter, textWriterAction)
        return
コード例 #3
0
        def outputStreamAction():
            outputStreamWriter = stream_io_util.GetStreamWriter(outputStream)

            def outputStreamWriterAction():
                revit_script_util.SetOutputFunction(
                    stream_io_util.GetSafeWriteLine(outputStreamWriter))
                result = script_host_error.WithErrorHandling(
                    lambda: DoRevitSessionProcessing(
                        scriptFilePath, scriptDataFilePath, progressNumber,
                        batchRvtProcessUniqueId, revit_script_util.Output),
                    "ERROR: An error occurred while executing the script host! Operation aborted.",
                    output=revit_script_util.Output,
                    showErrorMessageBox=False)
                return result

            stream_io_util.UsingStream(outputStreamWriter,
                                       outputStreamWriterAction)
            return