C#开发BIMFACE系列35 服务端API之模型对比6:获取模型构建对比分类树
BIMFACE平台提供了服务端“获取模型对比构件分类树”API。目录树返回结果以树状层级关系显示了增删改的构件信息,里面无法区分哪些构建是新增、修改或者删除的,所以在实际项目中使用意义不大。
请求地址:GET https://api.bimface.com/data/v2/comparisons/{comparisonId}/tree
参数:
请求 path(示例):https://api.bimface.com/data/v2/comparisons/1136906400211168/tree
请求 header(示例):"Authorization: Bearer dc671840-bacc-4dc5-a134-97c1918d664b"
HTTP响应示例(200):
1 {
2 "code" : "success",
3 "data" : {
4 "items" : [ {
5 "actualName" : "actualName",
6 "data" : "object",
7 "elementCount" : 0,
8 "id" : "24507acf86734fcdafcfcc5b70497cd5",
9 "items" : [ {
10 "actualName" : "actualName",
11 "data" : "object",
12 "elementCount" : 0,
13 "id" : "24507acf86734fcdafcfcc5b70497cd5",
14 "items" : [ "..." ],
15 "name" : "name",
16 "type" : "type"
17 } ],
18 "name" : "name",
19 "type" : "type"
20 } ],
21 "root" : "specialty"
22 },
23 "message" : ""
24 }
C#实现方法:
1 /// <summary>
2 /// 获取模型对比构件分类树
3 /// </summary>
4 /// <param name="accessToken">【必填】令牌</param>
5 /// <param name="compareId">【必填】对比ID</param>
6 /// <returns></returns>
7 public virtual ModelCompareTreeResponse GetModelCompareTree(string accessToken, long compareId)
8 {
9 // GET https://api.bimface.com/data/v2/comparisons/{comparisonId}/tree
10 string url = string.Format(BimfaceConstants.API_HOST + "/data/v2/comparisons/{0}/tree", compareId);
11
12 BimFaceHttpHeaders headers = new BimFaceHttpHeaders();
13 headers.AddOAuth2Header(accessToken);
14
15 try
16 {
17 ModelCompareTreeResponse response;
18
19 HttpManager httpManager = new HttpManager(headers);
20 HttpResult httpResult = httpManager.Get(url);
21 if (httpResult.Status == HttpResult.STATUS_SUCCESS)
22 {
23 response = httpResult.Text.DeserializeJsonToObject<ModelCompareTreeResponse>();
24 }
25 else
26 {
27 response = new ModelCompareTreeResponse
28 {
29 Message = httpResult.RefText
30 };
31 }
32
33 return response;
34 }
35 catch (Exception ex)
36 {
37 throw new Exception("[获取模型构件对比差异]发生异常!", ex);
38 }
39 }
代码中使用的 HttpManager 类请参考我的博客文章《C# HTTP系列 HttpWebRequest 与 HttpWebResponse》。
返回类型 ModelCompareTreeResponse 类如下:
1 /// <summary>
2 /// 获取模型构件对比差异的响应类
3 /// </summary>
4 public class ModelCompareTreeResponse : GeneralResponse<Tree>
5 {
6 }
7
8 public class Tree
9 {
10 [JsonProperty("items", NullValueHandling = NullValueHandling.Ignore)]
11 public TreeNode[] Items { get; set; }
12
13 [JsonProperty("root", NullValueHandling = NullValueHandling.Ignore)]
14 public string Root { get; set; }
15 }
16
17 public class TreeNode
18 {
19 [JsonProperty("actualName", NullValueHandling = NullValueHandling.Ignore)]
20 public string ActualName { get; set; }
21
22 [JsonProperty("data", NullValueHandling = NullValueHandling.Ignore)]
23 public object Data { get; set; }
24
25 [JsonProperty("elementCount", NullValueHandling = NullValueHandling.Ignore)]
26 public int? ElementCount { get; set; }
27
28 [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
29 public string Id { get; set; }
30
31 [JsonProperty("items", NullValueHandling = NullValueHandling.Ignore)]
32 public TreeNode[] Items { get; set; }
33
34 [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
35 public string Name { get; set; }
36
37 [JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
38 public string Type { get; set; }
39 }
测试代码:
1 /// <summary>
2 /// 获取模型对比构件分类树
3 /// </summary>
4 protected void btnGetModelCompareTree_Click(object sender, EventArgs e)
5 {
6 txtResult.Text = string.Empty;
7
8 long compareId = txtCompareID.Text.ToLong();
9 IModelCompareApi api = new ModelCompareApi();
10 ModelCompareTreeResponse response = api.GetModelCompareTree(txtAccessToken.Text, compareId);
11
12 txtResult.Text = response.SerializeToJson(true);
13 }
测试结果:
完整结果为:
1 {
2 "code": "success",
3 "message": null,
4 "data": {
5 "items": [
6 {
7 "actualName": "墙",
8 "elementCount": 48,
9 "id": "-2000011",
10 "items": [
11 {
12 "actualName": "基本墙",
13 "elementCount": 48,
14 "items": [],
15 "name": "基本墙",
16 "type": "family"
17 }
18 ],
19 "name": "墙",
20 "type": "category"
21 },
22 {
23 "actualName": "楼板",
24 "elementCount": 2,
25 "id": "-2000032",
26 "items": [
27 {
28 "actualName": "楼板",
29 "elementCount": 2,
30 "items": [],
31 "name": "楼板",
32 "type": "family"
33 }
34 ],
35 "name": "楼板",
36 "type": "category"
37 },
38 {
39 "actualName": "家具",
40 "elementCount": 30,
41 "id": "-2000080",
42 "items": [
43 {
44 "actualName": "Bar Chair",
45 "elementCount": 6,
46 "items": [],
47 "name": "Bar Chair",
48 "type": "family"
49 },
50 {
51 "actualName": "Cabinet 1",
52 "elementCount": 1,
53 "items": [],
54 "name": "Cabinet 1",
55 "type": "family"
56 },
57 {
58 "actualName": "Dining Chair (3)",
59 "elementCount": 8,
60 "items": [],
61 "name": "Dining Chair (3)",
62 "type": "family"
63 },
64 {
65 "actualName": "M_TV - Flat Screen",
66 "elementCount": 1,
67 "items": [],
68 "name": "M_TV - Flat Screen",
69 "type": "family"
70 },
71 {
72 "actualName": "Seat - Single with Island",
73 "elementCount": 1,
74 "items": [],
75 "name": "Seat - Single with Island",
76 "type": "family"
77 },
78 {
79 "actualName": "Seating - Artemis - Lounge chair",
80 "elementCount": 2,
81 "items": [],
82 "name": "Seating - Artemis - Lounge chair",
83 "type": "family"
84 },
85 {
86 "actualName": "Side Table 2 (2)",
87 "elementCount": 2,
88 "items": [],
89 "name": "Side Table 2 (2)",
90 "type": "family"
91 },
92 {
93 "actualName": "Sofa - Ottoman",
94 "elementCount": 7,
95 "items": [],
96 "name": "Sofa - Ottoman",
97 "type": "family"
98 },
99 {
100 "actualName": "Table-Dining 01 (M)",
101 "elementCount": 2,
102 "items": [],
103 "name": "Table-Dining 01 (M)",
104 "type": "family"
105 }
106 ],
107 "name": "家具",
108 "type": "category"
109 },
110 {
111 "actualName": "楼梯",
112 "elementCount": 3,
113 "id": "-2000120",
114 "items": [
115 {
116 "actualName": "组合楼梯",
117 "elementCount": 1,
118 "items": [],
119 "name": "组合楼梯",
120 "type": "family"
121 },
122 {
123 "actualName": "预浇注楼梯",
124 "elementCount": 2,
125 "items": [],
126 "name": "预浇注楼梯",
127 "type": "family"
128 }
129 ],
130 "name": "楼梯",
131 "type": "category"
132 },
133 {
134 "actualName": "栏杆扶手",
135 "elementCount": 10,
136 "id": "-2000126",
137 "items": [
138 {
139 "actualName": "栏杆扶手",
140 "elementCount": 10,
141 "items": [],
142 "name": "栏杆扶手",
143 "type": "family"
144 }
145 ],
146 "name": "栏杆扶手",
147 "type": "category"
148 },
149 {
150 "actualName": "常规模型",
151 "elementCount": 26,
152 "id": "-2000151",
153 "items": [
154 {
155 "actualName": "Miele Built-under Dishwasher G 4101 U CS",
156 "elementCount": 1,
157 "items": [],
158 "name": "Miele Built-under Dishwasher G 4101 U CS",
159 "type": "family"
160 },
161 {
162 "actualName": "Miele Induction Cooktop KM 6350 LPT",
163 "elementCount": 1,
164 "items": [],
165 "name": "Miele Induction Cooktop KM 6350 LPT",
166 "type": "family"
167 },
168 {
169 "actualName": "Miele Washing Machine W 5820 WPS",
170 "elementCount": 1,
171 "items": [],
172 "name": "Miele Washing Machine W 5820 WPS",
173 "type": "family"
174 },
175 {
176 "actualName": "Walvit_Hung Bowl_604118 W",
177 "elementCount": 4,
178 "items": [],
179 "name": "Walvit_Hung Bowl_604118 W",
180 "type": "family"
181 },
182 {
183 "actualName": "Water Glass",
184 "elementCount": 8,
185 "items": [],
186 "name": "Water Glass",
187 "type": "family"
188 },
189 {
190 "actualName": "White Porcelain Plate",
191 "elementCount": 8,
192 "items": [],
193 "name": "White Porcelain Plate",
194 "type": "family"
195 },
196 {
197 "actualName": "aalto vase - tall",
198 "elementCount": 1,
199 "items": [],
200 "name": "aalto vase - tall",
201 "type": "family"
202 },
203 {
204 "actualName": "fire place hang",
205 "elementCount": 1,
206 "items": [],
207 "name": "fire place hang",
208 "type": "family"
209 },
210 {
211 "actualName": "宣传画",
212 "elementCount": 1,
213 "items": [],
214 "name": "宣传画",
215 "type": "family"
216 }
217 ],
218 "name": "常规模型",
219 "type": "category"
220 },
221 {
222 "actualName": "橱柜",
223 "elementCount": 2,
224 "id": "-2001000",
225 "items": [
226 {
227 "actualName": "4500_Kitchen Island",
228 "elementCount": 1,
229 "items": [],
230 "name": "4500_Kitchen Island",
231 "type": "family"
232 },
233 {
234 "actualName": "4500_Kitchen Island_DW",
235 "elementCount": 1,
236 "items": [],
237 "name": "4500_Kitchen Island_DW",
238 "type": "family"
239 }
240 ],
241 "name": "橱柜",
242 "type": "category"
243 },
244 {
245 "actualName": "电气设备",
246 "elementCount": 12,
247 "id": "-2001040",
248 "items": [
249 {
250 "actualName": "Photovoltaic-Panel-SolarWorld-SunModule-(235-240)",
251 "elementCount": 12,
252 "items": [],
253 "name": "Photovoltaic-Panel-SolarWorld-SunModule-(235-240)",
254 "type": "family"
255 }
256 ],
257 "name": "电气设备",
258 "type": "category"
259 },
260 {
261 "actualName": "照明设备",
262 "elementCount": 8,
263 "id": "-2001120",
264 "items": [
265 {
266 "actualName": "Trck_BswySystms_Cooper_RSA_Profile Series_AR111 Closed Back Integral Xfmr",
267 "elementCount": 8,
268 "items": [],
269 "name": "Trck_BswySystms_Cooper_RSA_Profile Series_AR111 Closed Back Integral Xfmr",
270 "type": "family"
271 }
272 ],
273 "name": "照明设备",
274 "type": "category"
275 },
276 {
277 "actualName": "卫浴装置",
278 "elementCount": 6,
279 "id": "-2001160",
280 "items": [
281 {
282 "actualName": "DC_Tankworks_PLM_5000L",
283 "elementCount": 2,
284 "items": [],
285 "name": "DC_Tankworks_PLM_5000L",
286 "type": "family"
287 },
288 {
289 "actualName": "Lavatory-TOTO-Luminist_Rectangle_Vessel_LLT151",
290 "elementCount": 4,
291 "items": [],
292 "name": "Lavatory-TOTO-Luminist_Rectangle_Vessel_LLT151",
293 "type": "family"
294 }
295 ],
296 "name": "卫浴装置",
297 "type": "category"
298 },
299 {
300 "actualName": "场地",
301 "elementCount": 3,
302 "id": "-2001260",
303 "items": [
304 {
305 "actualName": "M_Wind Power Generator",
306 "elementCount": 3,
307 "items": [],
308 "name": "M_Wind Power Generator",
309 "type": "family"
310 }
311 ],
312 "name": "场地",
313 "type": "category"
314 },
315 {
316 "actualName": "建筑地坪",
317 "elementCount": 1,
318 "id": "-2001263",
319 "items": [
320 {
321 "actualName": "建筑地坪",
322 "elementCount": 1,
323 "items": [],
324 "name": "建筑地坪",
325 "type": "family"
326 }
327 ],
328 "name": "建筑地坪",
329 "type": "category"
330 },
331 {
332 "actualName": "结构基础",
333 "elementCount": 22,
334 "id": "-2001300",
335 "items": [
336 {
337 "actualName": "M_Pile Cap-600 Pile",
338 "elementCount": 11,
339 "items": [],
340 "name": "M_Pile Cap-600 Pile",
341 "type": "family"
342 },
343 {
344 "actualName": "M_Pile-Steel Pipe",
345 "elementCount": 11,
346 "items": [],
347 "name": "M_Pile-Steel Pipe",
348 "type": "family"
349 }
350 ],
351 "name": "结构基础",
352 "type": "category"
353 },
354 {
355 "actualName": "结构柱",
356 "elementCount": 1,
357 "id": "-2001330",
358 "items": [
359 {
360 "actualName": "M_Concrete-Round-Column with Drop Caps",
361 "elementCount": 1,
362 "items": [],
363 "name": "M_Concrete-Round-Column with Drop Caps",
364 "type": "family"
365 }
366 ],
367 "name": "结构柱",
368 "type": "category"
369 },
370 {
371 "actualName": "专用设备",
372 "elementCount": 7,
373 "id": "-2001350",
374 "items": [
375 {
376 "actualName": "Miele Built-in Microwave M 8260-2",
377 "elementCount": 1,
378 "items": [],
379 "name": "Miele Built-in Microwave M 8260-2",
380 "type": "family"
381 },
382 {
383 "actualName": "Miele Built-in Rangehood DA 2210",
384 "elementCount": 1,
385 "items": [],
386 "name": "Miele Built-in Rangehood DA 2210",
387 "type": "family"
388 },
389 {
390 "actualName": "Miele MasterCool KF 1911 Vi",
391 "elementCount": 1,
392 "items": [],
393 "name": "Miele MasterCool KF 1911 Vi",
394 "type": "family"
395 },
396 {
397 "actualName": "Miele Oven H 5681 BP",
398 "elementCount": 1,
399 "items": [],
400 "name": "Miele Oven H 5681 BP",
401 "type": "family"
402 },
403 {
404 "actualName": "Miele Tumble Dryer T 7944 C",
405 "elementCount": 1,
406 "items": [],
407 "name": "Miele Tumble Dryer T 7944 C",
408 "type": "family"
409 },
410 {
411 "actualName": "Vase (3)-with Flower",
412 "elementCount": 1,
413 "items": [],
414 "name": "Vase (3)-with Flower",
415 "type": "family"
416 },
417 {
418 "actualName": "Wine Bottles",
419 "elementCount": 1,
420 "items": [],
421 "name": "Wine Bottles",
422 "type": "family"
423 }
424 ],
425 "name": "专用设备",
426 "type": "category"
427 },
428 {
429 "actualName": "植物",
430 "elementCount": 16,
431 "id": "-2001360",
432 "items": [
433 {
434 "actualName": "RPC Tree - Deciduous",
435 "elementCount": 16,
436 "items": [],
437 "name": "RPC Tree - Deciduous",
438 "type": "family"
439 }
440 ],
441 "name": "植物",
442 "type": "category"
443 },
444 {
445 "actualName": "环境",
446 "elementCount": 5,
447 "id": "-2001370",
448 "items": [
449 {
450 "actualName": "M_RPC Beetle",
451 "elementCount": 1,
452 "items": [],
453 "name": "M_RPC Beetle",
454 "type": "family"
455 },
456 {
457 "actualName": "RPC Female",
458 "elementCount": 3,
459 "items": [],
460 "name": "RPC Female",
461 "type": "family"
462 },
463 {
464 "actualName": "RPC Male",
465 "elementCount": 1,
466 "items": [],
467 "name": "RPC Male",
468 "type": "family"
469 }
470 ],
471 "name": "环境",
472 "type": "category"
473 }
474 ],
475 "root": "category"
476 }
477 }
C#开发BIMFACE系列35 服务端API之模型对比6:获取模型构建对比分类树的更多相关文章
- C#开发BIMFACE系列40 服务端API之模型集成
BIMFACE二次开发系列目录 [已更新最新开发文章,点击查看详细] 随着建筑信息化模型技术的发展,越来越多的人选择在云端浏览建筑模型.现阶段的云端模型浏览大多是基于文件级别,一次只可以浏览一 ...
- C#开发BIMFACE系列41 服务端API之模型对比
BIMFACE二次开发系列目录 [已更新最新开发文章,点击查看详细] 在建筑施工图审查系统中,设计单位提交设计完成的模型/图纸,审查专家审查模型/图纸.审查过程中如果发现不符合规范的地方,则流 ...
- C#开发BIMFACE系列42 服务端API之图纸对比
BIMFACE二次开发系列目录 [已更新最新开发文章,点击查看详细] 在我的前一篇博客<C#开发BIMFACE系列42 服务端API之图纸对比>中详细介绍了BIMFACE服务端接口 ...
- C#开发BIMFACE系列43 服务端API之图纸拆分
BIMFACE二次开发系列目录 [已更新最新开发文章,点击查看详细] 在上一篇博客<C#开发BIMFACE系列42 服务端API之图纸对比>的最后留了一个问题,在常规业务场景下,一 ...
- C#开发BIMFACE系列44 服务端API之计算图纸对比差异项来源自哪个图框
BIMFACE二次开发系列目录 [已更新最新开发文章,点击查看详细] 在前两篇博客<C#开发BIMFACE系列42 服务端API之图纸对比>.<C#开发BIMFACE系列43 ...
- C#开发BIMFACE系列46 服务端API之离线数据包下载及结构详解
BIMFACE二次开发系列目录 [已更新最新开发文章,点击查看详细] 在前一篇博客<C#开发BIMFACE系列45 服务端API之创建离线数据包>中通过调用接口成功的创建一个离线数 ...
- C#开发BIMFACE系列6 服务端API之获取文件信息
在<C#开发BIMFACE系列4 服务端API之源上传文件>.<C#开发BIMFACE系列5 服务端API之文件直传>两篇文章中详细介绍了如何将本地文件上传到BIMFACE服务 ...
- C#开发BIMFACE系列4 服务端API之源上传文件
在注册成为BIMFACE的应用开发者后,要能在浏览器里浏览你的模型或者获取你模型内的BIM数据, 首先需要把你的模型文件上传到BIMFACE.根据不同场景,BIMFACE提供了丰富的文件相关的接口. ...
- C#开发BIMFACE系列3 服务端API之获取应用访问凭证AccessToken
系列目录 [已更新最新开发文章,点击查看详细] BIMFACE 平台为开发者提供了大量的服务器端 API 与 JavaScript API,用于二次开发 BIM 的相关应用. BIMFACE ...
随机推荐
- Python:装饰器是如何调用的
应用举例:(1)装饰器 # 装饰器的调用: # 一旦用上装饰器会: # 第一步:调outer函数 # 第二步:被装饰的函数play_game会被当作参数fn给outer # 第三步:最后调用play_ ...
- woj1005-holding animals-01pack woj1006-Language of animals-BFS
title: woj1005-holding animals-01pack date: 2020-03-05 categories: acm tags: [acm,woj,pack] 01背包.中等题 ...
- bzoj5312 冒险(吉司机线段树)题解
题意: 已知\(n\)个数字,进行以下操作: \(1.\)区间\([L,R]\) 按位与\(x\) \(2.\)区间\([L,R]\) 按位或\(x\) \(3.\)区间\([L,R]\) 询问最大值 ...
- 设计模式六大原则 All In one
设计模式六大原则 All In one 开闭原则: 对扩展开放,对修改关闭; 设计模式的六大原则: 0.总原则-开闭原则 对扩展开放, 对修改封闭; 在程序需要进行拓展的时候, 不能去修改原有的代码, ...
- Node.js Learning Paths
Node.js Learning Paths Node.js in Action Node.js Expert situations / scenario Restful API OAuth 2.0 ...
- web effects collection
web effects collection typewriter effect js 打字机效果 http://www.mattboldt.com/demos/typed-js/ https://g ...
- Flutter: 设置简单的启动屏
更多代码参考 有短暂的白屏时间 import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter ...
- js 截取固定长度字符串但不打断单词
适用地方:英文网站中,比如面包屑导航处新闻标题过长.用css截取文本简介时将单词打断 // 使用方法 // 1.复制下面函数 // 2.调用 // 3.填参数 sliceString(targe ...
- NGK钱包真的安全吗?
对于数字资产持有者而言,资产的安全永远是首要的,因而数字钱包的安全性显得尤为重要.数字钱包分为冷钱包和热钱包两种.热钱包叫做在线钱包,而冷钱包被称为离线钱包,也叫硬件钱包.数字钱包一旦被盗,被追回的概 ...
- re模块之简单计算器的实现
本节大纲: 表达式的输入及检查.格式化 怎么样进行匹配最里面的括号以及操作数的匹配 如何实现表达式的四则运算 完整代码展示 在我们学习re模块之后,通常的练习就是利用所学相关知识来写一个计算器 那么, ...