REvit Dynamo Python PY.TextNote+View+GUID.PY


# Simplified version by Ron.Allen to just text in views - Apsis0215@gmail.com 2019-01-02 # Deduced from from Konrad K Sobon @arch_laboratory, http://archi-lab.net Get function 2015 # Derived from Jeremy Tammick's bip function work in C# import clr # Import Element wrapper extension methods clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import * import System ##IN[0] for elements if isinstance(IN[0], list): objList = [] for i in IN[0]: objList.append(UnwrapElement(i)) else: objList = IN[0] elements = [] for i in objList: elements.append(UnwrapElement(i)) ##Export values of objects - the TEXT_TEXT built in parameter is the VALUE of the instance of text. OUT=[] for obj in objList: ## SNUM="" SNAME="" VID= None VName="nil" PVAL="" ##View ID and Name if hasattr(obj, "OwnerViewId"): #Get object View ID VID=obj.Document.GetElement(obj.OwnerViewId) #Get Object View Name Vname=VID.Name SNUM=VID.get_Parameter(BuiltInParameter.SHEET_NUMBER) #SNAME=objView ##.get_Parameter(BuiltInParameter.SHEET_NAME).AsString() ##String Valiue of note from BuiltInParameter PVAL=obj.get_Parameter(BuiltInParameter.TEXT_TEXT).AsString() #Get GUID objGUID=obj.UniqueId ##Append values to list #OUT.append((SNUM,SNAME,VID,Vname,PVAL)) OUT.append((VID,Vname,PVAL, objGUID)) OUT = map(None, *OUT) #Get by ID: #obj = doc.GetElement(objGUID);

Comments

Popular posts from this blog

Revit area plans adding new types and references (Gross and rentable)

Powerpoint countdown and current time in slides VBA

Revit 2019 and up tab colorizer