Trying to Get GUID for a Shared Parameter Definition


#1

I am passing a parameter definition (that I know is shared) into a node and trying to return the GUID from the parameter (not from External Definition).

implemented

I keep getting Null returned. Here is my code for the Get GUID node, can you please help?

import clr

Import RevitAPI

clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *

Import DocumentManager and TransactionManager

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

Import ToDSType(bool) extension method

clr.AddReference(“RevitNodes”)
import Revit
import System
from System import Guid

clr.ImportExtensions(Revit.Elements)
doc = DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Application

#The input to this node will be stored in the IN[0] variable.
elementz = IN[0]

parg = []
for i in elementz:
parg.append(i.GUID.ToString())

#Assign your output to the OUT variable
OUT = parg


#2

Hi Luke,

It looks to me like a non-shared parameter somehow managed to sneak up in there. There’s a built-in check that you can implement. Try something along the lines of this:

2015-08-06_12-20-38

Also the Guid is already in a string format, so I don’t think that you need that .ToString() method in there. If the above doesn’t help, are you getting any error messages in your python node? ( bring it out from the custom node first to see the error messages)


#3

Worked perfectly! Thanks Dimitar.