Skip to content

Commit 8bb692c

Browse files
checkout status update
1 parent b39ecfd commit 8bb692c

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

Revit_Core_Engine/Modify/Checkout.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static List<Element> Checkout(this List<Element> elements)
4949

5050
foreach (Element element in elements)
5151
{
52-
switch (element.CheckoutStatus())
52+
switch (element.CheckoutStatus(out string owner))
5353
{
5454
case CheckoutStatus.NotOwned:
5555
elementsToCheckout.Add(element);

Revit_Core_Engine/Query/CheckoutStatus.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ public static partial class Query
4141
[Description("Returns element CheckoutStatus.")]
4242
[Input("element", "Revit element to query for its checkout status.")]
4343
[Output("checkoutStatus", "The worksharing ownership/CheckoutStatus of the element.")]
44-
public static CheckoutStatus? CheckoutStatus(this Element element)
44+
public static CheckoutStatus? CheckoutStatus(this Element element, out string owner)
4545
{
4646
if (element == null)
4747
{
4848
BH.Engine.Base.Compute.RecordError("Querying checkout status of element failed because the element provided was null.");
49+
owner = null;
4950
return null;
5051
}
51-
return WorksharingUtils.GetCheckoutStatus(element.Document, element.Id);
52+
53+
return WorksharingUtils.GetCheckoutStatus(element.Document, element.Id, out owner);
5254
}
5355
/***************************************************/
5456
}

Revit_Core_Engine/Query/ElementsOwnedByOtherUsers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static List<Element> ElementsOwnedByOtherUsers(this List<Element> element
4848
return null;
4949
}
5050

51-
return elements.Where(e => e.IsOwnedByOtherUser()).ToList();
51+
return elements.Where(e => e.IsOwnedByOtherUser(out string owner)).ToList();
5252
}
5353
/***************************************************/
5454
}

Revit_Core_Engine/Query/IsOwnedByCurrentUser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static bool IsOwnedByCurrentUser(this Element element)
4949
return false;
5050
}
5151

52-
return element.CheckoutStatus() == Autodesk.Revit.DB.CheckoutStatus.OwnedByCurrentUser;
52+
return element.CheckoutStatus(out string owner) == Autodesk.Revit.DB.CheckoutStatus.OwnedByCurrentUser;
5353
}
5454
/***************************************************/
5555
}

Revit_Core_Engine/Query/IsOwnedByNone.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static bool IsOwnedByNone(this Element element)
4949
return false;
5050
}
5151

52-
return element.CheckoutStatus() == Autodesk.Revit.DB.CheckoutStatus.NotOwned;
52+
return element.CheckoutStatus(out string owner) == Autodesk.Revit.DB.CheckoutStatus.NotOwned;
5353
}
5454
/***************************************************/
5555
}

Revit_Core_Engine/Query/IsOwnedByOtherUser.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ public static partial class Query
4141
[Description("Check if element is owned by another user.")]
4242
[Input("element", "Revit element to query for its checkout status.")]
4343
[Output("ownedByOtherUser", "True if the input Revit element is owned by another user, otherwise false.")]
44-
public static bool IsOwnedByOtherUser(this Element element)
44+
public static bool IsOwnedByOtherUser(this Element element, out string owner)
4545
{
4646
if (element == null)
4747
{
4848
BH.Engine.Base.Compute.RecordError("Querying checkout status of element for ownership by others failed because the element provided was null.");
49+
owner = null;
4950
return false;
5051
}
5152

52-
return element.CheckoutStatus() == Autodesk.Revit.DB.CheckoutStatus.OwnedByOtherUser;
53+
return element.CheckoutStatus(out owner) == Autodesk.Revit.DB.CheckoutStatus.OwnedByOtherUser;
5354
}
5455
/***************************************************/
5556
}

0 commit comments

Comments
 (0)