How do I retrieve the Shared Site parameter for a Link Instance

Hi,

I am trying to get the name of the shared site for each instance of a linked model. I have tried to use the GetParameterValueByName node and used “Shared Site” as the parameter name. I have also used the below Python code snippet to try and retrieve the shared site, but it returns that it has no value:

parameters.append(element.LookupParameter("Shared Site").HasValue)

The image below shows that the links indeed have a shared site assigned to them:

image

Here is the dynamo script I created that just returns empty-handed:

Shared%20Site%20Retrieval

Any help will be much appreciated. I feel as if I’m missing something right in font of me.

Can you show the python code?

Hi @charl.pretorius,

This parameter value is accessible by the linkInstance name.
shared%20site

In python :

import clr
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

names=[]
rvtLinkCollector = FilteredElementCollector(doc).OfClass(RevitLinkInstance).ToElements()
for rvt in rvtLinkCollector:
	names.append(Element.Name.GetValue(rvt))
		
OUT = names

shared

1 Like

@Alban_de_Chasteigner,

Thanks for the solution! I would never have thought that the name property also exposes the shared site. I have trawled through the API docs and nowhere is that made clear.

It’s a pity that it’s just a string combined with everything, but luckily it’s trivial just to trim everything off before the location.

@Nick_Boyts,

The gist of the code is in my original post, but below is the entire snippet for reference, also changed to get the parameter value as a string, which just returns empty strings:

# Import RevitAPI
import clr
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

elements =[UnwrapElement(link) for link in IN[0]]

sites = [element.LookupParameter("Shared Site").AsValueString() for element in elements]

#Assign your output to the OUT variable.
OUT = sites