Create Shared Site

I need dynamo to automate this process, unfortunately I’m not to good a using python and the API just yet…

I think I found one of the methods in the API that I will have to leverage
Duplicate Project position: https://www.revitapidocs.com/2018.1/18ada300-7084-2281-63c8-13c40e14e5b7.htm

Here’s what I have so far: UpdateSharedSite.dyn (15.1 KB)

I’m open to any suggestions

-Thanks

I have made decent progress today, I think I’m slowly getting the hang of this i have hit a snag though.

I have been able to make a function to duplicate the project location in the current document but I can’t get it to work on linked documents.

By now I’ve tried probably 95+ iterations to no avail. (transaction issues, sublist issues, various other issues that are still over my head)
image

# 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
doc = DocumentManager.Instance.CurrentDBDocument

input = UnwrapElement(IN[0])

linkDoc = []
for x in input:
	linkDoc.append(x.GetLinkDocument())

def DupeLocation(loc):
	TransactionManager.Instance.EnsureInTransaction(doc)
	name = loc.Name
	newPos = loc.Duplicate(name +"Dupe1")
	pos = newPos.ProjectPosition[XYZ(0,0,0)]
	angle = pos.Angle
	ew = pos.EastWest
	e = pos.Elevation
	ns = pos.NorthSouth
	TransactionManager.Instance.TransactionTaskDone()
	return [ newPos, angle, ew, ns, e]

#locations = doc.ProjectLocations
linkLocations = linkDoc.ProjectLocations

#Assign your output to the OUT variable.
#OUT = [GetValues(x) for x in locations]
#OUT = [DupeLocation(x) for x in locations]
OUT = [DupeLocation(x) for x in linkLocations]
#OUT = [input, linkDoc]

-Thanks

The development of this script continued on these threads.


It is coming together nicely. :grinning:

1 Like