RevitLinkOptionsGetWorksetConfiguration Method |
Gets the set of worksets to open when creating the link.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic WorksetConfiguration GetWorksetConfiguration()
Public Function GetWorksetConfiguration As WorksetConfiguration
public:
WorksetConfiguration^ GetWorksetConfiguration()
member GetWorksetConfiguration : unit -> WorksetConfiguration
Return Value
WorksetConfiguration
Examplepublic bool CreateRevitLinkWithOneWorksetOpen(Document doc, string pathName, string worksetName)
{
FilePath path = new FilePath(pathName);
RevitLinkOptions options = new RevitLinkOptions(true);
IList<WorksetPreview> worksets = WorksharingUtils.GetUserWorksetInfo(path);
IList<WorksetId> worksetIds = new List<WorksetId>();
foreach (WorksetPreview worksetPrev in worksets)
{
if (worksetPrev.Name.CompareTo(worksetName) == 0)
{
worksetIds.Add(worksetPrev.Id);
break;
}
}
WorksetConfiguration worksetConfig = new WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets);
if (worksetIds.Count > 0)
{
worksetConfig.Open(worksetIds);
}
options.SetWorksetConfiguration(worksetConfig);
LinkLoadResult result = RevitLinkType.Create(doc, path, options);
RevitLinkType type = doc.GetElement(result.ElementId) as RevitLinkType;
return (result.LoadResult == LinkLoadResultType.LinkLoaded);
}
Public Function CreateRevitLinkWithOneWorksetOpen(doc As Document, pathName As String, worksetName As String) As Boolean
Dim path As New FilePath(pathName)
Dim options As New RevitLinkOptions(True)
Dim worksets As IList(Of WorksetPreview) = WorksharingUtils.GetUserWorksetInfo(path)
Dim worksetIds As IList(Of WorksetId) = New List(Of WorksetId)()
For Each worksetPrev As WorksetPreview In worksets
If worksetPrev.Name.CompareTo(worksetName) = 0 Then
worksetIds.Add(worksetPrev.Id)
Exit For
End If
Next
Dim worksetConfig As New WorksetConfiguration(WorksetConfigurationOption.CloseAllWorksets)
If worksetIds.Count > 0 Then
worksetConfig.Open(worksetIds)
End If
options.SetWorksetConfiguration(worksetConfig)
Dim result As LinkLoadResult = RevitLinkType.Create(doc, path, options)
Dim type As RevitLinkType = TryCast(doc.GetElement(result.ElementId), RevitLinkType)
Return (result.LoadResult = LinkLoadResultType.LinkLoaded)
End Function
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also