简体   繁体   English

如何使用api c#查找所有者以及上次更新Revit文件中对象的对象

[英]How to find the owner and who last update an object in Revit file with api c#

I am trying to make an application that can find out informaion a bout the objects in the model like the owner, last updated by, last updated date and so forth in worksharing file. 我正在尝试制作一个可以找出信息的应用程序,例如工作共享文件中的所有者,上次更新者,上次更新日期等模型中的对象。 I couldn't find any tutorial or example about that. 我找不到任何有关此内容的教程或示例。 Does anybody know? 有人知道吗 Thank you 谢谢

Download the Revit SDK from http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975 . http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975下载Revit SDK。

Do a search for WorksharingUtils class. 搜索WorksharingUtils类。 There is a code sample that shows you what info is available. 有一个代码示例向您显示可用的信息。

Hope this helps. 希望这可以帮助。

public void GetElementWorksharingInfo(Document doc, Element elem)
{
    String message = String.Empty;
    message += "Element Id: " + elem.Id;

    // The workset the element belongs to
    WorksetId worksetId = elem.WorksetId;
    message += ("\nWorkset Id : " + worksetId.ToString());

    // Model Updates Status of the element
    ModelUpdatesStatus updateStatus = WorksharingUtils.GetModelUpdatesStatus(doc, elem.Id);
    message += ("\nUpdate status : " + updateStatus.ToString());

    // Checkout Status of the element
    CheckoutStatus checkoutStatus = WorksharingUtils.GetCheckoutStatus(doc, elem.Id);
    message += ("\nCheckout status : " + checkoutStatus.ToString());

    // Getting WorksharingTooltipInfo of a given element Id
    WorksharingTooltipInfo tooltipInfo = WorksharingUtils.GetWorksharingTooltipInfo(doc, elem.Id);
    message += ("\nCreator : " + tooltipInfo.Creator);
    message += ("\nCurrent Owner : " + tooltipInfo.Owner);
    message += ("\nLast Changed by : " + tooltipInfo.LastChangedBy);

    Autodesk.Revit.UI.TaskDialog.Show("GetElementWorksharingInfo", message);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM