Friday, July 7, 2017

Set Assembly Code file - Dynamo

Set Assembly Code file - Dynamo:

# Default imports import clr clr.AddReference("RevitAPI") clr.AddReference("RevitNodes") from Autodesk.Revit.DB import * ################################# import Revit ################################# clr.ImportExtensions(Revit.GeometryConversion) ################################# clr.ImportExtensions(Revit.Elements) ################################# # Import DocumentManager and TransactionManager################################## clr.AddReference('RevitServices') ################################# import RevitServices ################################# from RevitServices.Persistence import DocumentManager ######################### from RevitServices.Transactions import TransactionManager ##################### doc = DocumentManager.Instance.CurrentDBDocument ############################# elements = IN[0] ##Elements in the model ##EXPECTS STRINGS FROM EXCEL TO START headers = IN[1] ##Headers for reference data = IN[2] ##Data ###Initialize out=[] outMain=[] outSub=[] found=0 ##Find "MARK" Position from headers for markPos, mark in enumerate(headers): if mark=='Mark': ##Found mark in headers proceed found=1 break ##BREAK loop with current header index if found==1: ##Consider adding additional parameters to key-in on other than mark for element in elements: emark=element.GetParameterValueByName('Mark') for dat in data: if dat[markPos]==emark: outMain=[] for hI, param in enumerate(headers): ##hI count based on header to corresponding data For parameters that are headers in the file outSub=[] try: outSub.append(param) ###ADD PARAMS TO Output list outSub.append(dat[hI]) ###ADD TABS + Data to output list if param == 'ASSET_CONDITION': ###NEED TO LOOK AT TARGET PARAMETERS IN REVIT AND RESET THE TYPE ACCORDING TO THE TARGET PARAMETER DATA TYPE, INT, TXT, etc. element.SetParameterByName(param,int(dat[hI])) ###Attempt set data header/param name, dat[i] corresponding data at index outSub.insert(0,"Success!(INT)") ###If it succeedes report it else: element.SetParameterByName(param,dat[hI]) ###Attempt set data header/param name, dat[i] corresponding data at index outSub.insert(0,"Success!(TXT)") ###If it succeedes report it except: ### If if failed...################################################ if param == "Assembly Code": ##SPECIAL ODD-BALL CASE for SYSTEM TYPE PARAM (Assembly Code)#### try: ##################################Assembly Code = Unifromat scan ele=UnwrapElement(element) ########## #Get the type ###################### (UNIFORMAT TYPE param) elementType = doc.GetElement(ele.GetTypeId()) ###################### # Get the parameter################### parameter = elementType.get_Parameter(BuiltInParameter.UNIFORMAT_CODE) #Set the parameter in a Transaction### TransactionManager.Instance.EnsureInTransaction(doc) parameter.Set(str(dat[hI])) ##FROM THE current DAT line of DATA return the data from the hI Index position in the list #Set the parameter end Transaction### TransactionManager.Instance.TransactionTaskDone() outSub.insert(0,"Success!(UNI)") except: outSub.insert(0,"Failed! (ALL)") outMain.append(outSub) ##Append Parameters success/fail out.append(outMain) out.insert(0,[["****Tab must be 'Sheet1'***************\n****'Mark' in row 1 must be defined****"]]) OUT=out

Python Script node for Notepad.exe. Possible? - Developers - Dynamo

Python Script node for Notepad.exe. Possible? - Developers - Dynamo:




import clr clr.AddReference("RevitAPIUI") from Autodesk.Revit.UI import TaskDialog ##Import task dialog ##from datetime import datetime ##Formatting date time strings for files import time ##Time as in NOW or tiem string format functions import sys ##Validate thie is here and avaiable######### sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib') import subprocess ##Launching asynchronus processess like notepad import os ##Operating system - CASE SENSITIVE msg=IN[0] ##DAta in 0 ##msgbox=TaskDialog ##Task Dialog astr="" ##STR for formatting for i in msg: ##BIG MESSAGE LIST sstr="" ##SUB STRING for j in i: for k in j: sstr=sstr + str(k) + "\t" ##ADD TAB SEPARATORS sstr=sstr + "\n" ##ADD CARRIAGE RETURN to substring astr=astr + sstr + "\n" ##ADD substring to main and spacer carriage return ##Set file name using date-time in C:\TEMP#### fn="C:\\temp\\DynamoError-" + time.strftime("%Y-%m-%dt%H%M%Z") + ".txt" f= open (fn, "w+") ##Open file wor Write f.write(astr) ##Write out ASTR subprocess.Popen('notepad {}'.format(fn)) ##Open the file in Notepad Asynchronously ##msgbox.Show("Message", astr ) ##Will show message dialog in revit - WARNING - Synchronus- script will have to wait. OUT=astr ##Pass formatted string out

Monday, July 3, 2017

TOF Cameras

So I have been thinking for a while- if I had a motion picture or multiple pictures and a special light and a special FILM or CMOS to capture that light- I could measure the reflection of the special light to get an approximation of depth.



Thinking about LIDAR and  fixed sensors - I realized this could be taken a step further- capturing the TOF (Time of flight) of light at different intervals using a MOSFET or similar super-fast action capture device.



Apparently there are similar items on the web called TOF Cameras...



https://www.baslerweb.com/en/support/



Support | Basler:



'via Blog this'