I think my issue is quit for dummies’’ so sorry in advance##
i have a cod that part of his operation is to load a title block to the revit file.
the same with a shared parameter txt file’ that loads the sp to the project file.
so far so good now, both files located in a kind of helpers modules, located inside the pyrevit extensions,
i call this files using the path of my machine as -
ttblock_file = r"C:\Users\Dotan\Desktop\MyExtension\ListGen_master.lib\revit\ListGen_TitleBlock.rfa"
now, how can i set this path’s so that they will fit in my client’s machine ?
try’s with os module and got lost…
I’m adding my code
help will be highly appreciated
> ttblock_file = r"C:\Users\Dotan\Desktop\MyExtension\ListGen_master.lib\revit\ListGen_TitleBlock.rfa" def LoadTTblockIfMissing(titleBlcName, wasRun = False): TBCollector = FilteredElementCollector(doc).OfClass(FamilySymbol) TBCollector.OfCategory(BuiltInCategory.OST_TitleBlocks).ToElements() TBElementList = TBCollector.ToElements() #list of elements #get defult title block for tb in TBElementList: tbName = [tb.FamilyName for tb in TBElementList] #list of elements names if titleBlcName not in tbName: transaction = Transaction(doc, "load family") transaction.Start() ttbfile = doc.LoadFamily(ttblock_file) transaction.Commit() wasRun == True else: wasRun = 'File Exsist' return wasRun #=========== STARTS CODE ================================ # Exmple ====================================================== stb = LoadTTblockIfMissing('ListGen_TitleBlock', wasRun = False) try: # open up the sp file from disc at given path - must have in order to open in revit path = r"C:\Users\Dotan\Desktop\MyExtension\ListGen_master.lib\proced\ListGen_SharedParameter.txt" fileExist = System.IO.File.Exists(path) openRead = System.IO.File.OpenRead(path) df = DefinitionFile def df(application, fileName): application.SharedParametersFilename = fileName return application.OpenSharedParameterFile() spf = df(app, path) exp = sp.IsSharedParamExist(spf) indxList = exp spParamList = exp # in case of runing the code again with difrent category indx = [idx for idx, value in enumerate(exp)] splist = exp asp = sp.AddSharedParamToProject(indx, splist) except: pass