Posts

Showing posts from April, 2018

py.RegExp.py

import re ##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 match regexExp = 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 ##OUTPUT Outlist = [] ##Outlist TRUE if match is find for each item in list ###Initialize Regexp Regex = re . compile ( regexExp , re . IGNORECASE ) ###The actual RegExp compare for each item in the list for item in StrList : ## For each item in the list run a match Outlist . append ( Regex . match ( item ) is not None ) ##If match is not NONE then it is a match (true) - else (false)- append that to the list for each item OUT = Outlist ##Set output to results

PY.RegExp.sub.py

import re ##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 match regexExp = 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 RegExpSub = IN [ 2 ] ##Regexp substitution from IN[2] ##OUTPUT Outlist = [] ##Outlist TRUE if match is find for each item in list ###Initialize Regexp ###The actual RegExp compare for each item in the list for item in StrList : ## 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 item OUT = Outlist ##Set output to r...

REvit CAche parser for C4R files to ID Revit Files

Public fso As New FileSystemObject Public oUsrFolder As Folder Public oRvtFolder As Folder Public rvers As Integer Public ifp As String Public sfp Public GUID_FILES As ArrayList Sub LinkToJournalFiles () Set GUID_FILES = CreateObject ( "System.Collections.ArrayList" ) 'array list to manage file path, file name & CSLID pairs Set fso = CreateObject ( "Scripting.FileSystemObject" ) ''Current user (Or all users?) For Each oUsrFolder In fso.GetFolder ( "C:\users" ). subfolders ''Scan for versions of Revit ifp = oUsrFolder.Path & "\AppData\Local\Autodesk\revit" If fso.FolderExists ( ifp ) Then For Each oRvtFolder In fso.GetFolder ( ifp ). subfolders Set sfp = regexp ( oRvtFolder.Path , ".*\\(Autodesk Revit .*)\\{0,1}" ) If sfp.co...