Posts

Showing posts from April, 2018

py.RegExp.py

importre##Import for re or Regular Expressions###INPUTS (Two Inputs- 0 and 1- ad inputs to python node to correspond with th [+] button)StrList=IN[0]##Simple list of items to matchregexExp=IN[1]##Regexp string to match ##see https://docs.python.org/3.3/howto/regex.html "Regular expressions in dynamo" and ##https://regex101.com for regular expressions 101 testing##OUTPUTOutlist=[]##Outlist TRUE if match is find for each item in list###Initialize RegexpRegex=re.compile(regexExp,re.IGNORECASE)###The actual RegExp compare for each item in the listforiteminStrList:## For each item in the list run a match Outlist.append(Regex.match(item)isnotNone)##If match is not NONE then it is a match (true) - else (false)- append that to the list for each itemOUT=Outlist##Set output to results

PY.RegExp.sub.py

importre##Import for re or Regular Expressions###INPUTS (Two Inputs- 0 and 1- ad inputs to python node to correspond with th [+] button)StrList=IN[0]##Simple list of items to matchregexExp=IN[1]##Regexp string to match ##see https://docs.python.org/3.3/howto/regex.html "Regular expressions in dynamo" and ##https://regex101.com for regular expressions 101 testingRegExpSub=IN[2]##Regexp substitution from IN[2]##OUTPUTOutlist=[]##Outlist TRUE if match is find for each item in list###Initialize Regexp###The actual RegExp compare for each item in the listforiteminStrList:## For each item in the list run a match result=re.sub(regexExp,RegExpSub,item,1)Outlist.append(result)##If match is not NONE then it is a match (true) - else (false)- append that to the list for each itemOUT=Outlist##Set output to results

REvit CAche parser for C4R files to ID Revit Files

PublicfsoAsNewFileSystemObjectPublicoUsrFolderAsFolderPublicoRvtFolderAsFolderPublicrversAsIntegerPublicifpAsStringPublicsfpPublicGUID_FILESAsArrayListSubLinkToJournalFiles()SetGUID_FILES=CreateObject("System.Collections.ArrayList")'array list to manage file path, file name & CSLID pairs Setfso=CreateObject("Scripting.FileSystemObject")''Current user (Or all users?) ForEachoUsrFolderInfso.GetFolder("C:\users").subfolders''Scan for versions of Revit ifp=oUsrFolder.Path&"\AppData\Local\Autodesk\revit"Iffso.FolderExists(ifp)ThenForEachoRvtFolderInfso.GetFolder(ifp).subfoldersSetsfp=regexp(oRvtFolder.Path,".*\\(Autodesk Revit .*)\\{0,1}")Ifsfp.count>0ThenParseRevitFolder(oRvtFolder)NextEndIfNextoUsrFolder''''''''''' ''GUID_FILES is a list of strings of filepath > GUID > and corresponding actual filename SubParseRevitFolder(RevitFolder)FilePath=RevitFol…