Пример #1
0
def SaveCloudModelandChangeName(document, filePath, Name):
    worksharingOptions = WorksharingSaveAsOptions()
    worksharingOptions.SaveAsCentral = True
    saveOpt = SaveAsOptions()
    saveOpt.SetWorksharingOptions(worksharingOptions)
    saveOpt.OverwriteExistingFile = True
    saveOpt.Compact = True
    document.SaveAs(filePath + Name + ".rvt", saveOpt)
    document.Close()
        if filtered_params:
            trans = Transaction(family_doc, 'ChangeGroup')
            trans.Start()
            fam_report = []
            fam_report.append(family_doc.Title)

            for i in range(len(filtered_params)):
                parse_pg = parse_to_builtInParameterGroup(param_groups[i])
                MoveParameterToGroup(family_doc, filtered_params[i], parse_pg,
                                     "temp{}".format(i))
                fam_report.append("ОК. {} изменен".format(
                    filtered_params[i].Definition.Name))

            report.append(fam_report)
            trans.Commit()
            trans.Dispose()
        else:
            report.append("Нет таких параметров. Файл {}".format(
                family_doc.Title))

        optS = SaveAsOptions()
        optS.OverwriteExistingFile = True
        optS.Compact = True
        optS.MaximumBackups = 1
        family_doc.SaveAs(filepath, optS)
        family_doc.Close(False)

    OUT = report
else:
    OUT = "Нет такой директории"