Is there a way to specify which method you want to use when the method has the same name as another. I’m trying to create a filter rule with worksets equal x. It seems to me that I would use CreateEqualsRule(ElementId, ElementId) as linked below but I’m getting an error that it is expecting a string. When I change my code to worksetValue.Name the script works but no value is entered for the filter.
rule = (ParameterFilterRuleFactory.CreateEqualsRule(needCalloutid, 1),
ParameterFilterRuleFactory.CreateEqualsRule(worksetId, worksetValue.Name))
----------Below is the old issue that I have worked out--------------------
I’m trying to create a filter the uses one of my shared parameters and a workset. I’ve been able to get the shared parameter from ParameterFilterUtilities.GetFilterableParametersInCommon but it doesn’t seem to be getting the workset parameter. I believe it should be showing up as a common parameter. Below are the categories of the filter, I don’t see anything that would rule out workset.
# Create filter category
catbuiltinList = (BuiltInCategory.OST_CableTrayFitting,BuiltInCategory.OST_CommunicationDevices,
BuiltInCategory.OST_ConduitFitting,BuiltInCategory.OST_DataDevices,
BuiltInCategory.OST_DuctAccessory,BuiltInCategory.OST_DuctFitting,
BuiltInCategory.OST_DuctTerminal,BuiltInCategory.OST_ElectricalEquipment,
BuiltInCategory.OST_ElectricalFixtures,BuiltInCategory.OST_FireAlarmDevices,
BuiltInCategory.OST_LightingDevices,BuiltInCategory.OST_LightingFixtures,
BuiltInCategory.OST_MechanicalControlDevices,BuiltInCategory.OST_MechanicalEquipment,
BuiltInCategory.OST_NurseCallDevices,BuiltInCategory.OST_PipeAccessory,
BuiltInCategory.OST_PipeFitting,BuiltInCategory.OST_PlumbingEquipment,
BuiltInCategory.OST_PlumbingFixtures,BuiltInCategory.OST_SecurityDevices,
BuiltInCategory.OST_Sprinklers,BuiltInCategory.OST_TelephoneDevices)
catList = []
for c in catbuiltinList:
catList.append(Category.GetCategory(doc,c))
cat_ids = List[ElementId]([c.Id for c in catList])
filterCat = FilterCategoryRule(cat_ids)
# Get filter parameter
fparam_all = ParameterFilterUtilities.GetFilterableParametersInCommon(doc,cat_ids)
needCalloutid = []
for p in fparam_all:
pdef = Document.GetElement(doc,p)
if pdef:
if pdef.Name == "Com_NeedsCallout":
needCalloutid = p
else:
pass
else:
pass
worksetId = []
for p in fparam_all:
pdef = Document.GetElement(doc,p)
if pdef:
print(pdef.Name)
if pdef.Name == "Workset":
worksetId = p
else:
pass
else:
pass
print(worksetId)
rule = ParameterFilterRuleFactory.CreateEqualsRule(needCalloutid, 0)
elementFilter = ElementParameterFilter(rule)
I’ve now switched to the code below, but can’t seem to get the parameter’s Id.
worksetId = []
bip_all = ParameterUtils.GetAllBuiltInParameters()
for p in bip_all:
testpara = ParameterUtils.GetBuiltInParameter(p)
if str(testpara) == "ELEM_PARTITION_PARAM":
worksetId = p.Id
print(worksetId)
else:
pass
Just found ElementId() in plain sight. Will see if that works for creating a filter rule.
worksetId = []
bip_all = ParameterUtils.GetAllBuiltInParameters()
for p in bip_all:
testpara = ParameterUtils.GetBuiltInParameter(p)
if str(testpara) == "ELEM_PARTITION_PARAM":
worksetId = ElementId(testpara)
print(worksetId)
else:
pass