BIMFACE平台提供了服务端“获取修改构件属性差异”API,其返回的结果也是一个列表,仅针对修改的构件(不包含新增、删除的构件),是指对于一个修改过的构件ID,其修改前后分别新增、删除了哪些属性,或是属性值发生了变化。

请求地址:GET https://api.bimface.com/data/v2/comparisons/{comparisonId}/elementChange

参数:

请求 path(示例):https://api.bimface.com/data/v2/comparisons/1136906400211168/elementChange?followingElementId=296524&followingFileId=1136893002033344&previousElementId=296524&previousFileId=1136239003943104

请求 header(示例):"Authorization: Bearer dc671840-bacc-4dc5-a134-97c1918d664b"

HTTP响应示例(200):

 {
"code" : "success",
"data" : {
"_A" : "string",
"_B" : "string",
"changeAttributes" : [ {
"_A" : {
"key" : "key",
"unit" : "unit",
"value" : "value"
},
"_B" : {
"key" : "key",
"unit" : "unit",
"value" : "value"
}
} ],
"changeQuantities" : [ {
"_A" : {
"code" : "code",
"desc" : "desc",
"name" : "name",
"qty" : ,
"unit" : "unit"
},
"_B" : {
"code" : "code",
"desc" : "desc",
"name" : "name",
"qty" : ,
"unit" : "unit"
}
} ],
"deleteAttributes" : [ {
"key" : "key",
"unit" : "unit",
"value" : "value"
} ],
"deleteQuantities" : [ {
"code" : "code",
"desc" : "desc",
"name" : "name",
"qty" : ,
"unit" : "unit"
} ],
"newAttributes" : [ {
"key" : "key",
"unit" : "unit",
"value" : "value"
} ],
"newQuantities" : [ {
"code" : "code",
"desc" : "desc",
"name" : "name",
"qty" : ,
"unit" : "unit"
} ]
},
"message" : ""
}

C#实现方法:

 /// <summary>
/// 获取模型构件对比差异
/// </summary>
/// <param name="accessToken">【必填】令牌</param>
/// <param name="compareId">【必填】对比ID</param>
/// <param name="followingFileId">【必填】变更后的文件ID</param>
/// <param name="followingElementId">【必填】变更后的文件的构件ID</param>
/// <param name="previousFileId">【必填】变更前的文件ID</param>
/// <param name="previousElementId">【必填】变更前的文件的构件ID</param>
/// <returns></returns>
public virtual ModelCompareChangeResponse GetModelCompareChange(string accessToken, long compareId,
long followingFileId, string followingElementId, long previousFileId, string previousElementId)
{
// GET https: //api.bimface.com/data/v2/comparisons/{comparisonId}/elementChange
string url = string.Format(BimfaceConstants.API_HOST + "/data/v2/comparisons/{0}/elementChange", compareId);
url += "?followingFileId=" + followingFileId;
url += "&followingElementId=" + followingElementId;
url += "&previousFileId=" + previousFileId;
url += "&previousElementId=" + previousElementId; BimFaceHttpHeaders headers = new BimFaceHttpHeaders();
headers.AddOAuth2Header(accessToken); try
{
ModelCompareChangeResponse response; HttpManager httpManager = new HttpManager(headers);
HttpResult httpResult = httpManager.Get(url);
if (httpResult.Status == HttpResult.STATUS_SUCCESS)
{
response = httpResult.Text.DeserializeJsonToObject<ModelCompareChangeResponse>();
}
else
{
response = new ModelCompareChangeResponse
{
Message = httpResult.RefText
};
} return response;
}
catch (Exception ex)
{
throw new Exception("[获取模型构件对比差异]发生异常!", ex);
}
}

代码中使用的 HttpManager 类请参考我的博客文章《C# HTTP系列 HttpWebRequest 与 HttpWebResponse》。

返回类型  ModelCompareChangeResponse 类如下:

 /// <summary>
/// 获取模型构件对比差异的响应类
/// </summary>
public class ModelCompareChangeResponse : GeneralResponse<ModelCompareChange>
{ } /// <summary>
/// 模型构件对比差异类
/// </summary>
public class ModelCompareChange
{
/// <summary>
/// 变化图元前一个版本的ID
/// </summary>
[JsonProperty("_A", NullValueHandling = NullValueHandling.Ignore)]
public string A { get; set; } /// <summary>
/// 变化图元后一个版本的ID
/// </summary>
[JsonProperty("_B", NullValueHandling = NullValueHandling.Ignore)]
public string B { get; set; } /// <summary>
/// 变更的构建属性集合
/// </summary> [JsonProperty("changeAttributes", NullValueHandling = NullValueHandling.Ignore)]
public ChangeAttributes[] ChangeAttributes { get; set; } /// <summary>
/// 变更的工程量集合
/// </summary> [JsonProperty("changeQuantities", NullValueHandling = NullValueHandling.Ignore)]
public ChangeQuantities[] ChangeQuantities { get; set; } /// <summary>
/// 删除的构建属性集合
/// </summary> [JsonProperty("deleteAttributes", NullValueHandling = NullValueHandling.Ignore)]
public Attribute[] DeleteAttributes { get; set; } /// <summary>
/// 删除的工程量集合
/// </summary> [JsonProperty("deleteQuantities", NullValueHandling = NullValueHandling.Ignore)]
public Quantity[] DeleteQuantities { get; set; } /// <summary>
/// 新增的构建属性集合
/// </summary> [JsonProperty("newAttributes", NullValueHandling = NullValueHandling.Ignore)]
public Attribute[] NewAttributes { get; set; } /// <summary>
/// 新增的工程量集合
/// </summary> [JsonProperty("newQuantities", NullValueHandling = NullValueHandling.Ignore)]
public Quantity[] NewQuantities { get; set; }
} /// <summary>
/// 变更的构建属性
/// </summary>
public class ChangeAttributes
{
/// <summary>
/// 前一个版本
/// </summary>
[JsonProperty("_A", NullValueHandling = NullValueHandling.Ignore)]
public Attribute A { get; set; } /// <summary>
/// 后一个版本
/// </summary>
[JsonProperty("_B", NullValueHandling = NullValueHandling.Ignore)]
public Attribute B { get; set; }
} /// <summary>
/// 变更的工程量
/// </summary>
public class ChangeQuantities
{
/// <summary>
/// 前一个版本
/// </summary>
[JsonProperty("_A", NullValueHandling = NullValueHandling.Ignore)]
public Quantity A { get; set; } /// <summary>
/// 后一个版本
/// </summary>
[JsonProperty("_B", NullValueHandling = NullValueHandling.Ignore)]
public Quantity B { get; set; }
} /// <summary>
/// 构建属性
/// </summary>
public class Attribute
{
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
public string Key { get; set; } [JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)]
public string Value { get; set; } [JsonProperty("unit", NullValueHandling = NullValueHandling.Ignore)]
public string Unit { get; set; }
} /// <summary>
/// 工程量
/// </summary>
public class Quantity
{
[JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)]
public string Code { get; set; } [JsonProperty("desc", NullValueHandling = NullValueHandling.Ignore)]
public string Desc { get; set; } [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; } [JsonProperty("qty", NullValueHandling = NullValueHandling.Ignore)]
public string Qty { get; set; } [JsonProperty("unit", NullValueHandling = NullValueHandling.Ignore)]
public string Unit { get; set; }
}

最新文章

  1. jsp内置对象
  2. Mysql zip包在Windows上安装配置
  3. 矩阵乘法&amp;矩阵快速幂&amp;矩阵快速幂解决线性递推式
  4. 使用Spring容器
  5. 理解Cookie和Session机制
  6. C语言基础--while循环
  7. 教程-Delphi编译就报毒
  8. Let&#39;s Encrypt+Apache+Tomcat实现免费HTTPS
  9. DotNet 资源大全(Awesome最新版)
  10. SVN初体验
  11. wordpress chronus主题 显示文章阅读数
  12. C++_数字时钟软件实现设计
  13. org.apache.maven.archiver.mavenarchiver.getmanifest怎么解决
  14. Android Spinner 绑定键值对
  15. Typescript 学习笔记四:回忆ES5 中的类
  16. webapi框架搭建-webapi异常处理
  17. [ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project SSMMavenPro: configfile D:\java\PermissionPro\src\main\resources\generatorCo
  18. Android 打造完美的侧滑菜单/侧滑View控件
  19. Java反射中method.isBridge() 桥接方法
  20. windows和linux-JDK环境变量设置

热门文章

  1. 10行Python代码计算汽车数量
  2. 开发一个基础的npm包
  3. 三层架构——ATM + 购物车
  4. 创建Windows10无人值守(自动应答文件)教程
  5. 监控一哥Prometheus你可认识?
  6. 想读Spring源码?先从这篇「 极简教程」开始吧...
  7. Fetch+SpringBoot跨域请求设置
  8. 用命令在本地创建github仓库
  9. js 实现浏览器全屏效果
  10. Docket 容器引擎