def RestoreBackups(): WarningMsg = "Warning:\n\nSelect only the files that you really want to keep, " \ "these files could be updated (new functionalities, fixed errors...).\n\n" \ "A new backup of the user files will be created before the replace, so if there are " \ "errors with some tools due an obsolete file, you should restore the newer file!" f.neoAlert(WarningMsg, 'neoCL', header='Restore Backed up User Files', exit=False) from rpw.ui.forms import select_file filespath = select_file(GetFilterBackedupFiles(), title='Select backup files to Restore!', multiple=True, restore_directory=True) if filespath: BackupMyUserFiles(True) # Backup before replace log = '' logOk = '' logError = '' mainFolder = f.neoCLFolderPath() files = BackupUserFilesDic(True) for src in filespath: fileName = os.path.basename(src) dst = os.path.join(mainFolder, files[fileName], fileName) try: copyfile(src, dst) logOk += ' -> ' + fileName + '\n' except: logError += ' -> ' + fileName + '\n' if logOk: log += "Files restored to neoCL folder :\n" + logOk if logError: log += "Error restoring these files to neoCL folder :\n" + logError log += '\nA new backup of the user files was created before the replace.' f.neoAlert(log, 'neoCL', header='Restore Backed up User Files', exit=False)
# from MF_ExcelOutput import * # MF_WriteToExcel("TextData.xlsx", "Tags", tagData) # MF_WriteToExcel("TextData.xlsx", "TextNotes", textNoteData) ################################# # Read from Excel from MF_ExcelInput import * from rpw.ui.forms import select_file file = select_file('Excel File (*.xlsx)|*.xlsx', 'Excel File (*.xlsm)|*.xlsm') #file = "C:\Users\e.green\Desktop\j6276 - Master View Template Settings2.xlsm" #inputData = MF_OpenExcelAndRead(file, None, 20 ) # limit to import 20 rows of data - to see what we are dealing with # user selects stuff - need to ask user to select column containing view template ids #pairs = MF_MultiMapParameters(inputData) inputData = MF_OpenExcelAndRead(file, None) # now read in all of the data.. importData = inputData #headerRow = importData[0]
sys.exit() ################################# # Read from Excel from rpw.ui.forms import select_file filepath = select_file('Excel File (*.xlsx)|*.xlsx') file = filepath inputData = MF_OpenExcelAndRead(file, None, 20 ) # limit to import 20 rows of data pairs = MF_MultiMapParameters(inputData) #################################### #sys.exit() # for row in inputData[0]: # print str(row)
def Importarbase(sender, e): global file file = select_file('csv separated by semicolon (*.csv)|*.csv') return (file)
from rpw import db from pyrevit import revit, DB, HOST_APP, UI, _HostApplication from rpw.ui.forms import FlexForm, Label, ComboBox, TextBox, TextBox, Separator, Button, SelectFromList, select_file from Helper import * import csv uidoc = __revit__.ActiveUIDocument doc = __revit__.ActiveUIDocument.Document hostapp = _HostApplication() print(hostapp.app.Language) if hostapp.app.Language.ToString() == "English_USA": ParameterName = LG_EUN() elif hostapp.app.Language.ToString() == "Chinese_Simplified": ParameterName = LG_CHS() LocationFile = select_file('CSV(*.csv)|*.csv') # 信息输入部分 GenericCategory = rpw.db.Collector(of_category='OST_GenericModel', is_type=True).get_elements(wrapped=False) Framing_type_options = {t.FamilyName: t for t in GenericCategory} Level_type = db.Collector(of_category='Levels', is_type=False).get_elements(wrapped=False) Level_type_options = {DB.Element.Name: t for t in Level_type} components = [ Label('构件名称'), ComboBox('FamilyName', Framing_type_options), Button('确定')
import revitron from rpw.ui.forms import TextInput from rpw.ui.forms import select_file host = select_file('Revit Model (*.rvt)|*.rvt') search = TextInput('Search') replace = TextInput('Replace') revitron.TransmissionData(host).replaceInPath(search, replace) print('Done')
return val elif fp.StorageType == StorageType.Integer: val = ft.AsInteger(fp) return val elif fp.StorageType == StorageType.String: val = ft.AsString(fp) return val elif fp.StorageType == StorageType.ElementId: val = ft.AsElementId(fp) return val else: val = ft.AsValueString(fp) return val files = select_file('Revit Family File (*.rfa)|*.rfa', multiple = True ) docPaths = files #doc = DocumentManager.Instance.CurrentDBDocument elementlist = list() familyList = [] paramList = [] paramLongList = [] paramList.append([ ("Family Index" ), ("Family Name" ),
i += 1 itemsChoosed = [] for i in index: itemsChoosed.append(itemsName[i]) return itemsChoosed #SharedParametersFile openning spfile = app.OpenSharedParameterFile() #Traduction of SharedParametersFile spGroups = spfile.Groups spGroupsDef = [g.Definitions for g in spGroups] filepath = select_file('(.txt)|*.txt', restore_directory=True, title="Select the mappage file (text file)") spParamNames = [] spParamNamesChoosed = [] catIfcNames = [ 'IfcAlarmType', 'IfcAnnotation', 'IfcAirTerminal', 'IfcBeam', 'IfcBuildingElementProxy', 'IfcBuildingStorey', 'IfcColumn', 'IfcCovering', 'IfcCurtainWall', 'IfcDoor', 'IfcDuctSegment', 'IfcDuctFitting', 'IfcFlowTerminal', 'IfcFooting', 'IfcFurniture', 'IfcLightFixtureType', 'IfcMember', 'IfcPile', 'IfcPipeFitting', 'IfcPlate', 'IfcRailing', 'IfcRamp', 'IfcRoof', 'IfcSlab', 'IfcSpace', 'IfcSite', 'IfcStair', 'IfcValveType', 'IfcWall', 'IfcWindow' ] catIfcNamesChoosed = [] commands = [