Working in Family Editor:
How can you detect the family/element that you are working in. So then you can Set its parameter by name for example, in Family Editor.
@Kulkul @Konrad_K_Sobon @Mostafa_El_Ayoubi
Thanks in advance.
Working in Family Editor:
How can you detect the family/element that you are working in. So then you can Set its parameter by name for example, in Family Editor.
@Kulkul @Konrad_K_Sobon @Mostafa_El_Ayoubi
Thanks in advance.
Hi @Raul.Galdran ,
there’s a node in Data-Shapes packages to set parameters in the active family document :
All the credit for this node goes to Dimitar Venkov !
Thanks a lot @Mostafa_El_Ayoubi, i’m checking this just right now!!!
A way to get and set parameter values in the Family Editor would be very useful.
Unfortunately this is no longer working in 1.2
Any idea what needs updating?
The code references LibGNet.dll which doesnt seem to exist
The python code from the old node is as follows;
"
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
import Autodesk
from Autodesk.Revit.DB import *
import sys
path = r'C:\Autodesk\Dynamo\Core'
exec_path = r'C:\Autodesk\Dynamo\Core\dll'
sys.path.append(path)
sys.path.append(exec_path)
clr.AddReference('LibGNet')
from Autodesk.LibG import *
app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document
paramName = str(IN[0])
paramValue = IN[1]
def setParameter(paramName,paramValue):
#define parameter variable
parameter = [a for a in doc.FamilyManager.Parameters if a.Definition.Name==paramName ][0]
#set parameter
doc.FamilyManager.Set(parameter, paramValue)
setParameter(paramName,paramValue)
OUT = paramValue
";
I had the exact same issue some time ago
the “Set Active Family Parameter By Name” node in data-shapes package was created from Dimitar’s answer.
here’s the code :
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
param_name = IN[0]
param_value = IN[1]
param_list = doc.FamilyManager.GetParameters()
names = [p.Definition.Name for p in param_list]
par1 = None
if param_name in names:
par1 = param_list[names.index(param_name)]
if par1 != None:
TransactionManager.Instance.EnsureInTransaction(doc)
try :
doc.FamilyManager.Set(par1,param_value)
OUT = 'Success'
except:
OUT = 'Check parameter type.'
TransactionManager.Instance.TransactionTaskDone()
else :
OUT = 'No parameter found by that name'
Thanks!
i’m checking this today’s afternoon!! i was also working in another solution, but i’ll check both!! Thanks