Hiii everyone,
Is there any way to use dynamo for automating the process of collaborate the Revit models via ACC or BIM360. , since I have more than 20 Revit models to perform this process on.
I’ve searched a lot of time for any automation to such repetitive task bit with no luck.
try this you have to modify it… i don`t know your settings and enviroment, let me know if it works
thats the part of the centralmodel
# Template
import clr
import sys
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
doc.EnableWorksharing("Grids","Workset")
#folder = "urn:adsk.wipprod:fs.folder:co.zRpZ2THTUm5gl29mngQ2"
saveOptions = SaveAsOptions()
saveOptions.MaximumBackups = 3
saveOptions.Compact = True
saveOptions.PreviewViewId = doc.ActiveView.Id
saveOptions.OverwriteExistingFile = True
worksharingOptions = WorksharingSaveAsOptions()
worksharingOptions.SaveAsCentral
worksharingOptions.OpenWorksetsDefault = SimpleWorksetConfiguration.AskUserToSpecify(worksharingOptions)
#if TransmissionData.IsDocumentTransmitted(modelpath)
rOptions = RelinquisOptions(False)
rOptions.StandardWorksets = True
rOptions.ViewWorksets = True
rOptions.FamilyWorksets = True
rOptions.UserWorksets = True
rOptions.CheckedOutElements = True
sOptions = SynchronizeWithCentralOptions()
sOptions.SetRelinquishOptions(rOptions)
sOptions.Comments = "central File create"
sOptions.Compact = True
sOptions.SaveLocalBefore = True
sOptions.SaveLocalAfter = True
tOptions = TransactionWithCentralOptions()
path = []
doc.SaveAs(doc.PathName, SaveOptions)
doc.SynchronizeWithCentral(tOptions, sOptions)
here the part for the cloudmodel
import clr
import sys
import System
from System import *
from System import Guid
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#folder = "urn:adsk.wipprod:fs.folder:co.zThrthUhggf"
rOptions = RelinqhishOptions(True)
sOptions = SynchronizeWithCentralOptions()
sOptions.SetRelinquishOptions(rOptions)
sOptions.Comments = "central File create"
sOptions.Compact = True
sOptions.SaveLocalBefore = True
sOptions.SaveLocalAfter = True
account = Guid("the link fd87fd- anything)
project = Guid("the link fd87fd- anything)
#folder = "urn:adsk.wipprod:fs.folder:co.zThrthUhggf"
modelName = "Central file"
doc.SaverAsCloudModel(acount, project, folder, modelName)
doc.EnableWorksharing()
doc.SynchronizeWihtCentral(tOptions, sOptions)
This may be relevant to your interests:
https://thebuildingcoder.typepad.com/blog/2021/04/revit-2022-migrates-bim360-team-to-docs.html
@Draxl_Andreas , thanks a lot for your quick reply, really appreciated, the part of the central model gives me a warning as shown below
I will try the code for the cloud model and let you my feedback
sadly i use Revit 2022 and also IronPython2, could be script will be changed in 2023/24
what should I write in those inputs?
I did some modifications it works perfect
Account ID - u can get that from acc - account admin - settings or just go to account admin and from browser address bar copy the part after accounts/
(account-admin/projects/accounts/*************************************)
project ID - once u click on the project in acc the project home page link (copy the part from b onwards)
(projects/b*****************************************)
Folder ID -
[?folderUrn=urn%3Aadsk.wipprod%3Afs.folder%3Aco.ojuRuV9PXsKqrcgtMf4XwA&viewModel=]
(replace every %3A with : )
import clr
import sys
import System
from System import *
from System import Guid
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference(‘RevitAPIUI’)
from Autodesk.Revit.UI import *
clr.AddReference(‘System’)
from System.Collections.Generic import List
clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
modelName = IN[0]
#folder = “urn:adsk.wipprod:fs.folder:co.zThrthUhggf”
rOptions = RelinquishOptions(True)
sOptions = SynchronizeWithCentralOptions()
sOptions.SetRelinquishOptions(rOptions)
sOptions.Comments = “central File create”
sOptions.Compact = True
sOptions.SaveLocalBefore = True
sOptions.SaveLocalAfter = True
account = Guid(“cdf78990-cf59-4a1c-9b10-b46eeaba7848”)
project = Guid(“b2460349-8781-4edd-ab18-89c7da4f2a73”)
folder = “urn:adsk.wipprod:fs.folder:co.lwb3ofMHQNSmbqSBBXpNlg”
modelName = modelName
doc.SaveAsCloudModel (account, project, folder, modelName)
doc.EnableWorksharing()
doc.SynchronizeWihtCentral(tOptions, sOptions)