當前位置:首頁 > IT技術 > Windows編程 > 正文

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框
      2021-10-18 17:40:05


      BIMFACE二次開發(fā)系列目錄???? ??【已更新最新開發(fā)文章,點擊查看詳細】??


      ?


      在前兩篇博客??《C#開發(fā)BIMFACE系列42 服務端API之圖紙對比》??、??《C#開發(fā)BIMFACE系列43 服務端API之圖紙拆分》??中介紹了單文件多圖框的拆分與對比

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_sql

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_json_02

      本文將詳細講解如何計算圖紙對比差異項來源自哪個圖框。

      以控制臺中的2張圖紙【建筑圖紙1-已拆分.dwg】 與 【建筑圖紙2-已拆分-已變更.dwg】為例

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_.net_03

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_.net_04

      對比結果參考上面第2個動態(tài)圖。


      獲取圖紙對比結果API


      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_服務端_05

      調(diào)用BIMFACE服務端接口



      1     /// <summary>
      2 /// 分頁獲取二維圖紙對比結果。結果中包含 Type 為 Model 與 Layer 的兩種結果對比,所以可能有重復的構建ID,需要手動過濾。
      3 /// </summary>
      4 /// <param name="accessToken">【必填】令牌</param>
      5 /// <param name="compareId">【必填】對比ID</param>
      6 /// <param name="page">頁碼(提示:私有云部署不支持分頁查詢)。如果不傳參數(shù),則默認為1</param>
      7 /// <param name="pageSize">每頁記錄數(shù)(提示:私有云部署不支持分頁查詢)。如果不傳參數(shù),則默認為50</param>
      8 /// <returns></returns>
      9 public virtual DrawingCompareDiffResponse GetDrawingCompareDiff(string accessToken, long compareId, int? page = null, int? pageSize = null)
      10 {
      11 // GET https://api.bimface.com/data/v2/comparisons/{comparisonId}/diff
      12 string url = string.Format(BIMFaceConstants.API_HOST + "/data/v2/comparisons/{0}/drawingdiff?v=1", compareId);
      13 if (page.HasValue)
      14 {
      15 if (page.Value <= 1)
      16 {
      17 page = 1;
      18 }
      19
      20 url += "&page=" + page;
      21 }
      22
      23 if (pageSize.HasValue)
      24 {
      25 if (pageSize.Value <= 0)
      26 {
      27 pageSize = 50;
      28 }
      29
      30 url += "&pageSize=" + pageSize;
      31 }
      32
      33 BIMFaceHttpHeaders headers = new BIMFaceHttpHeaders();
      34 headers.AddOAuth2Header(accessToken);
      35
      36 try
      37 {
      38 DrawingCompareDiffResponse response;
      39
      40 HttpManager httpManager = new HttpManager(headers);
      41 HttpResult httpResult = httpManager.Get(url);
      42 if (httpResult.Status == HttpResult.STATUS_SUCCESS)
      43 {
      44 response = httpResult.Text.DeserializeJsonToObject<DrawingCompareDiffResponse>();
      45 }
      46 else
      47 {
      48 response = new DrawingCompareDiffResponse
      49 {
      50 Message = httpResult.RefText
      51 };
      52 }
      53
      54 return response;
      55 }
      56 catch (Exception ex)
      57 {
      58 throw new BIMFaceException("[分頁獲取圖紙對比結果]發(fā)生異常!", ex);
      59 }
      60 }


      完整的對比差異項紀錄信息如下:


      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_sql_06C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_服務端_07


      1 {
      2 "code": "success",
      3 "message": null,
      4 "data": {
      5 "data": [
      6 {
      7 "diffType": "NEW",
      8 "id": "1946877",
      9 "layer": "D1",
      10 "sheetId": "0",
      11 "sheetName": "Model",
      12 "type": "Model"
      13 },
      14 {
      15 "diffType": "NEW",
      16 "id": "1946878",
      17 "layer": "D1",
      18 "sheetId": "0",
      19 "sheetName": "Model",
      20 "type": "Model"
      21 },
      22 {
      23 "diffType": "DELETE",
      24 "id": "122566",
      25 "layer": "D1",
      26 "sheetId": "0",
      27 "sheetName": "Model",
      28 "type": "Model"
      29 },
      30 {
      31 "diffType": "CHANGE",
      32 "id": "104778",
      33 "layer": "0",
      34 "sheetId": "0",
      35 "sheetName": "Model",
      36 "type": "Model"
      37 },
      38 {
      39 "diffType": "CHANGE",
      40 "id": "104779",
      41 "layer": "0",
      42 "sheetId": "0",
      43 "sheetName": "Model",
      44 "type": "Model"
      45 },
      46 {
      47 "diffType": "CHANGE",
      48 "id": "104780",
      49 "layer": "0",
      50 "sheetId": "0",
      51 "sheetName": "Model",
      52 "type": "Model"
      53 },
      54 {
      55 "diffType": "CHANGE",
      56 "id": "104781",
      57 "layer": "0",
      58 "sheetId": "0",
      59 "sheetName": "Model",
      60 "type": "Model"
      61 },
      62 {
      63 "diffType": "CHANGE",
      64 "id": "104782",
      65 "layer": "0",
      66 "sheetId": "0",
      67 "sheetName": "Model",
      68 "type": "Model"
      69 },
      70 {
      71 "diffType": "CHANGE",
      72 "id": "104783",
      73 "layer": "0",
      74 "sheetId": "0",
      75 "sheetName": "Model",
      76 "type": "Model"
      77 },
      78 {
      79 "diffType": "CHANGE",
      80 "id": "104784",
      81 "layer": "0",
      82 "sheetId": "0",
      83 "sheetName": "Model",
      84 "type": "Model"
      85 },
      86 {
      87 "diffType": "CHANGE",
      88 "id": "104785",
      89 "layer": "0",
      90 "sheetId": "0",
      91 "sheetName": "Model",
      92 "type": "Model"
      93 },
      94 {
      95 "diffType": "CHANGE",
      96 "id": "104786",
      97 "layer": "0",
      98 "sheetId": "0",
      99 "sheetName": "Model",
      100 "type": "Model"
      101 },
      102 {
      103 "diffType": "CHANGE",
      104 "id": "104787",
      105 "layer": "0",
      106 "sheetId": "0",
      107 "sheetName": "Model",
      108 "type": "Model"
      109 },
      110 {
      111 "diffType": "CHANGE",
      112 "id": "96095",
      113 "layer": "0",
      114 "sheetId": "0",
      115 "sheetName": "Model",
      116 "type": "Model"
      117 },
      118 {
      119 "diffType": "CHANGE",
      120 "id": "96096",
      121 "layer": "0",
      122 "sheetId": "0",
      123 "sheetName": "Model",
      124 "type": "Model"
      125 },
      126 {
      127 "diffType": "CHANGE",
      128 "id": "96097",
      129 "layer": "0",
      130 "sheetId": "0",
      131 "sheetName": "Model",
      132 "type": "Model"
      133 },
      134 {
      135 "diffType": "CHANGE",
      136 "id": "96098",
      137 "layer": "0",
      138 "sheetId": "0",
      139 "sheetName": "Model",
      140 "type": "Model"
      141 },
      142 {
      143 "diffType": "CHANGE",
      144 "id": "96099",
      145 "layer": "0",
      146 "sheetId": "0",
      147 "sheetName": "Model",
      148 "type": "Model"
      149 },
      150 {
      151 "diffType": "CHANGE",
      152 "id": "96100",
      153 "layer": "0",
      154 "sheetId": "0",
      155 "sheetName": "Model",
      156 "type": "Model"
      157 },
      158 {
      159 "diffType": "CHANGE",
      160 "id": "96101",
      161 "layer": "0",
      162 "sheetId": "0",
      163 "sheetName": "Model",
      164 "type": "Model"
      165 },
      166 {
      167 "diffType": "CHANGE",
      168 "id": "96102",
      169 "layer": "0",
      170 "sheetId": "0",
      171 "sheetName": "Model",
      172 "type": "Model"
      173 },
      174 {
      175 "diffType": "CHANGE",
      176 "id": "96103",
      177 "layer": "0",
      178 "sheetId": "0",
      179 "sheetName": "Model",
      180 "type": "Model"
      181 },
      182 {
      183 "diffType": "CHANGE",
      184 "id": "96104",
      185 "layer": "0",
      186 "sheetId": "0",
      187 "sheetName": "Model",
      188 "type": "Model"
      189 },
      190 {
      191 "diffType": "CHANGE",
      192 "id": "22307",
      193 "layer": "AXIS",
      194 "sheetId": "0",
      195 "sheetName": "Model",
      196 "type": "Model"
      197 },
      198 {
      199 "diffType": "CHANGE",
      200 "id": "22314",
      201 "layer": "AXIS",
      202 "sheetId": "0",
      203 "sheetName": "Model",
      204 "type": "Model"
      205 },
      206 {
      207 "diffType": "CHANGE",
      208 "id": "22315",
      209 "layer": "AXIS",
      210 "sheetId": "0",
      211 "sheetName": "Model",
      212 "type": "Model"
      213 },
      214 {
      215 "diffType": "CHANGE",
      216 "id": "53351",
      217 "layer": "D1",
      218 "sheetId": "0",
      219 "sheetName": "Model",
      220 "type": "Model"
      221 },
      222 {
      223 "diffType": "CHANGE",
      224 "id": "53352",
      225 "layer": "D1",
      226 "sheetId": "0",
      227 "sheetName": "Model",
      228 "type": "Model"
      229 },
      230 {
      231 "diffType": "CHANGE",
      232 "id": "53355",
      233 "layer": "D1",
      234 "sheetId": "0",
      235 "sheetName": "Model",
      236 "type": "Model"
      237 },
      238 {
      239 "diffType": "CHANGE",
      240 "id": "53356",
      241 "layer": "D1",
      242 "sheetId": "0",
      243 "sheetName": "Model",
      244 "type": "Model"
      245 },
      246 {
      247 "diffType": "CHANGE",
      248 "id": "53357",
      249 "layer": "D1",
      250 "sheetId": "0",
      251 "sheetName": "Model",
      252 "type": "Model"
      253 },
      254 {
      255 "diffType": "CHANGE",
      256 "id": "53358",
      257 "layer": "D1",
      258 "sheetId": "0",
      259 "sheetName": "Model",
      260 "type": "Model"
      261 },
      262 {
      263 "diffType": "CHANGE",
      264 "id": "53359",
      265 "layer": "D1",
      266 "sheetId": "0",
      267 "sheetName": "Model",
      268 "type": "Model"
      269 },
      270 {
      271 "diffType": "CHANGE",
      272 "id": "53361",
      273 "layer": "D1",
      274 "sheetId": "0",
      275 "sheetName": "Model",
      276 "type": "Model"
      277 },
      278 {
      279 "diffType": "CHANGE",
      280 "id": "53362",
      281 "layer": "D1",
      282 "sheetId": "0",
      283 "sheetName": "Model",
      284 "type": "Model"
      285 },
      286 {
      287 "diffType": "CHANGE",
      288 "id": "53363",
      289 "layer": "D1",
      290 "sheetId": "0",
      291 "sheetName": "Model",
      292 "type": "Model"
      293 },
      294 {
      295 "diffType": "CHANGE",
      296 "id": "53364",
      297 "layer": "D1",
      298 "sheetId": "0",
      299 "sheetName": "Model",
      300 "type": "Model"
      301 },
      302 {
      303 "diffType": "CHANGE",
      304 "id": "53365",
      305 "layer": "D1",
      306 "sheetId": "0",
      307 "sheetName": "Model",
      308 "type": "Model"
      309 },
      310 {
      311 "diffType": "CHANGE",
      312 "id": "53366",
      313 "layer": "D1",
      314 "sheetId": "0",
      315 "sheetName": "Model",
      316 "type": "Model"
      317 },
      318 {
      319 "diffType": "CHANGE",
      320 "id": "53367",
      321 "layer": "D1",
      322 "sheetId": "0",
      323 "sheetName": "Model",
      324 "type": "Model"
      325 },
      326 {
      327 "diffType": "CHANGE",
      328 "id": "53368",
      329 "layer": "D1",
      330 "sheetId": "0",
      331 "sheetName": "Model",
      332 "type": "Model"
      333 },
      334 {
      335 "diffType": "CHANGE",
      336 "id": "53369",
      337 "layer": "D1",
      338 "sheetId": "0",
      339 "sheetName": "Model",
      340 "type": "Model"
      341 },
      342 {
      343 "diffType": "CHANGE",
      344 "id": "53370",
      345 "layer": "D1",
      346 "sheetId": "0",
      347 "sheetName": "Model",
      348 "type": "Model"
      349 },
      350 {
      351 "diffType": "CHANGE",
      352 "id": "53371",
      353 "layer": "D1",
      354 "sheetId": "0",
      355 "sheetName": "Model",
      356 "type": "Model"
      357 },
      358 {
      359 "diffType": "CHANGE",
      360 "id": "53372",
      361 "layer": "D1",
      362 "sheetId": "0",
      363 "sheetName": "Model",
      364 "type": "Model"
      365 },
      366 {
      367 "diffType": "CHANGE",
      368 "id": "53373",
      369 "layer": "D1",
      370 "sheetId": "0",
      371 "sheetName": "Model",
      372 "type": "Model"
      373 },
      374 {
      375 "diffType": "CHANGE",
      376 "id": "53374",
      377 "layer": "D1",
      378 "sheetId": "0",
      379 "sheetName": "Model",
      380 "type": "Model"
      381 },
      382 {
      383 "diffType": "CHANGE",
      384 "id": "53375",
      385 "layer": "D1",
      386 "sheetId": "0",
      387 "sheetName": "Model",
      388 "type": "Model"
      389 },
      390 {
      391 "diffType": "CHANGE",
      392 "id": "53376",
      393 "layer": "D1",
      394 "sheetId": "0",
      395 "sheetName": "Model",
      396 "type": "Model"
      397 },
      398 {
      399 "diffType": "CHANGE",
      400 "id": "53377",
      401 "layer": "D1",
      402 "sheetId": "0",
      403 "sheetName": "Model",
      404 "type": "Model"
      405 },
      406 {
      407 "diffType": "CHANGE",
      408 "id": "53378",
      409 "layer": "D1",
      410 "sheetId": "0",
      411 "sheetName": "Model",
      412 "type": "Model"
      413 },
      414 {
      415 "diffType": "CHANGE",
      416 "id": "53381",
      417 "layer": "D1",
      418 "sheetId": "0",
      419 "sheetName": "Model",
      420 "type": "Model"
      421 },
      422 {
      423 "diffType": "CHANGE",
      424 "id": "53383",
      425 "layer": "D1",
      426 "sheetId": "0",
      427 "sheetName": "Model",
      428 "type": "Model"
      429 },
      430 {
      431 "diffType": "CHANGE",
      432 "id": "53384",
      433 "layer": "D1",
      434 "sheetId": "0",
      435 "sheetName": "Model",
      436 "type": "Model"
      437 },
      438 {
      439 "diffType": "CHANGE",
      440 "id": "53385",
      441 "layer": "D1",
      442 "sheetId": "0",
      443 "sheetName": "Model",
      444 "type": "Model"
      445 },
      446 {
      447 "diffType": "CHANGE",
      448 "id": "53386",
      449 "layer": "D1",
      450 "sheetId": "0",
      451 "sheetName": "Model",
      452 "type": "Model"
      453 },
      454 {
      455 "diffType": "CHANGE",
      456 "id": "53387",
      457 "layer": "D1",
      458 "sheetId": "0",
      459 "sheetName": "Model",
      460 "type": "Model"
      461 },
      462 {
      463 "diffType": "CHANGE",
      464 "id": "53389",
      465 "layer": "D1",
      466 "sheetId": "0",
      467 "sheetName": "Model",
      468 "type": "Model"
      469 },
      470 {
      471 "diffType": "CHANGE",
      472 "id": "53390",
      473 "layer": "D1",
      474 "sheetId": "0",
      475 "sheetName": "Model",
      476 "type": "Model"
      477 },
      478 {
      479 "diffType": "CHANGE",
      480 "id": "53391",
      481 "layer": "D1",
      482 "sheetId": "0",
      483 "sheetName": "Model",
      484 "type": "Model"
      485 },
      486 {
      487 "diffType": "CHANGE",
      488 "id": "53392",
      489 "layer": "D1",
      490 "sheetId": "0",
      491 "sheetName": "Model",
      492 "type": "Model"
      493 },
      494 {
      495 "diffType": "CHANGE",
      496 "id": "53395",
      497 "layer": "D1",
      498 "sheetId": "0",
      499 "sheetName": "Model",
      500 "type": "Model"
      501 },
      502 {
      503 "diffType": "CHANGE",
      504 "id": "53396",
      505 "layer": "D1",
      506 "sheetId": "0",
      507 "sheetName": "Model",
      508 "type": "Model"
      509 },
      510 {
      511 "diffType": "CHANGE",
      512 "id": "53397",
      513 "layer": "D1",
      514 "sheetId": "0",
      515 "sheetName": "Model",
      516 "type": "Model"
      517 },
      518 {
      519 "diffType": "CHANGE",
      520 "id": "53400",
      521 "layer": "D1",
      522 "sheetId": "0",
      523 "sheetName": "Model",
      524 "type": "Model"
      525 },
      526 {
      527 "diffType": "CHANGE",
      528 "id": "53401",
      529 "layer": "D1",
      530 "sheetId": "0",
      531 "sheetName": "Model",
      532 "type": "Model"
      533 },
      534 {
      535 "diffType": "CHANGE",
      536 "id": "53403",
      537 "layer": "D1",
      538 "sheetId": "0",
      539 "sheetName": "Model",
      540 "type": "Model"
      541 },
      542 {
      543 "diffType": "CHANGE",
      544 "id": "53404",
      545 "layer": "D1",
      546 "sheetId": "0",
      547 "sheetName": "Model",
      548 "type": "Model"
      549 },
      550 {
      551 "diffType": "CHANGE",
      552 "id": "53405",
      553 "layer": "D1",
      554 "sheetId": "0",
      555 "sheetName": "Model",
      556 "type": "Model"
      557 },
      558 {
      559 "diffType": "CHANGE",
      560 "id": "53406",
      561 "layer": "D1",
      562 "sheetId": "0",
      563 "sheetName": "Model",
      564 "type": "Model"
      565 },
      566 {
      567 "diffType": "CHANGE",
      568 "id": "53407",
      569 "layer": "D1",
      570 "sheetId": "0",
      571 "sheetName": "Model",
      572 "type": "Model"
      573 },
      574 {
      575 "diffType": "CHANGE",
      576 "id": "53408",
      577 "layer": "D1",
      578 "sheetId": "0",
      579 "sheetName": "Model",
      580 "type": "Model"
      581 },
      582 {
      583 "diffType": "CHANGE",
      584 "id": "53409",
      585 "layer": "D1",
      586 "sheetId": "0",
      587 "sheetName": "Model",
      588 "type": "Model"
      589 },
      590 {
      591 "diffType": "CHANGE",
      592 "id": "53410",
      593 "layer": "D1",
      594 "sheetId": "0",
      595 "sheetName": "Model",
      596 "type": "Model"
      597 },
      598 {
      599 "diffType": "CHANGE",
      600 "id": "53411",
      601 "layer": "D1",
      602 "sheetId": "0",
      603 "sheetName": "Model",
      604 "type": "Model"
      605 }
      606 ],
      607 "page": 1,
      608 "total": 75
      609 }
      610 }

      View Code

      參數(shù)說明

      (1)diffType:圖元變更類型。NEW 表示新增的圖元、DELETE 表示刪除的圖元、CHANGE 表示修改的圖元。

      (2)id:變更的圖元的唯一編號。

      (3)layer:變更的圖元所在的圖層名稱。

      (4)sheetId:未知

      (5)sheetName:未知

      (6)type:變更的圖元所在的圖紙展示類型(Model 與Layer )

      從上述Json結果中只能看出圖元的變更類型與編號,并不知道其所屬的圖框,需要通過解析圖紙對比的數(shù)據(jù)包信息才能計算出來。


      獲取圖紙對比數(shù)據(jù)包信息API


      測試程序如下:


      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_json_08

      ?調(diào)用BIMFACE服務端接口如下:



      1     /// <summary>
      2 /// 【官方非正式接口】根據(jù) CompareId 獲取圖紙對比的數(shù)據(jù)包信息
      3 /// </summary>
      4 /// <param name="compareId">對比記錄的ID</param>
      5 /// <returns></returns>
      6 public DrawingCompareDatabagResponse GetDrawingCompareDatabage(string accessToken, long compareId)
      7 {
      8 IBasicApi api = new BasicApi();
      9
      10 ViewTokenResponse viewTokenResponse = api.GetViewTokenByCompareId(accessToken, compareId);
      11 if (viewTokenResponse != null && viewTokenResponse.Code == "success" && viewTokenResponse.Data != null)
      12 {
      13 return GetDrawingCompareDatabageByCompareViewToken(viewTokenResponse.Data);
      14 }
      15
      16 return null;
      17 }
      18
      19
      20 /// <summary>
      21 /// 【官方非正式接口】根據(jù)對比記錄的 ViewToken 獲取圖紙對比的數(shù)據(jù)包信息
      22 /// </summary>
      23 /// <param name="compareViewToken">對比記錄的ViewToken</param>
      24 /// <returns></returns>
      25 public DrawingCompareDatabagResponse GetDrawingCompareDatabageByCompareViewToken(string compareViewToken)
      26 {
      27 //GET https://api.bimface.com/inside/databag?viewToken=b80412dcba2a47b0860eeff8f2c578a9
      28
      29 string url = string.Format(BIMFaceConstants.API_HOST + "/inside/databag?viewToken={0}", compareViewToken);
      30 try
      31 {
      32 DrawingCompareDatabagResponse response;
      33
      34 HttpManager httpManager = new HttpManager();
      35 HttpResult httpResult = httpManager.Get(url);
      36 if (httpResult.Status == HttpResult.STATUS_SUCCESS)
      37 {
      38 response = httpResult.Text.DeserializeJsonToObject<DrawingCompareDatabagResponse>();
      39 }
      40 else
      41 {
      42 response = new DrawingCompareDatabagResponse
      43 {
      44 Message = httpResult.RefText
      45 };
      46 }
      47
      48 return response;
      49 }
      50 catch (Exception ex)
      51 {
      52 throw new BIMFaceException("[獲取圖紙對比的數(shù)據(jù)包信息]發(fā)生異常!", ex);
      53 }
      54 }
      55


      接口返回的完整信息如下:



      1 {
      2 "code": "success",
      3 "message": null,
      4 "data": {
      5 "databagId": "76d256b09416830a8079914ab7d40fdf",
      6 "isSupportComponentProperty": false,
      7 "isSupportDrawing": false,
      8 "isSupportFamilyTypeList": false,
      9 "isSupportMaterialProperty": false,
      10 "isSupportMiniMap": false,
      11 "isSupportModelTree": false,
      12 "isSupportRoomArea": false,
      13 "isSupportWalk": true,
      14 "jsSDKVersion": "3.6.159",
      15 "modelId": 2230429779838240,
      16 "modelType": "compareModel",
      17 "name": "202110121516-對比",
      18 "renderType": "drawingView",
      19 "renderVersion": "3.0",
      20 "subRenders": [
      21 {
      22 "isSupportComponentProperty": false,
      23 "isSupportFamilyTypeList": false,
      24 "isSupportMiniMap": false,
      25 "isSupportModelTree": false,
      26 "jsSDKVersion": "3.6.159",
      27 "renderType": "bimView",
      28 "renderVersion": "3.0"
      29 },
      30 {
      31 "isSupportComponentProperty": false,
      32 "isSupportFamilyTypeList": false,
      33 "isSupportMiniMap": false,
      34 "isSupportModelTree": false,
      35 "jsSDKVersion": "Drawing@1.6.95",
      36 "renderType": "drawingView",
      37 "renderVersion": "1.0"
      38 }
      39 ],
      40 "type": 3,
      41 "workerType": "drawing-compare"
      42 }
      43 }


      該接口主要獲取 databagId,供下面的接口使用。


      獲取圖紙對比數(shù)據(jù)包差異結果API


      測試程序如下:

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_BIM  BIMFACE_09

      調(diào)用BIMFACE服務端接口如下:



      1     /// <summary>
      2 /// 【官方非正式接口】根據(jù)圖紙對比的數(shù)據(jù)包Id,獲取圖紙對比差異數(shù)據(jù)包結果
      3 /// </summary>
      4 /// <param name="databagId">圖紙對比的數(shù)據(jù)包Id,</param>
      5 /// <returns></returns>
      6 public DrawingCompareDatabagDiffResult GetDrawingCompareDatabageDiffResult(string databagId)
      7 {
      8 //GET https://m.bimface.com/{databagId}/result.json
      9
      10 string url = string.Format("https://m.bimface.com/{0}/result.json", databagId);
      11 try
      12 {
      13 DrawingCompareDatabagDiffResult response = null;
      14
      15 HttpManager httpManager = new HttpManager();
      16 HttpResult httpResult = httpManager.Get(url);
      17 if (httpResult.Status == HttpResult.STATUS_SUCCESS)
      18 {
      19 response = httpResult.Text.DeserializeJsonToObject<DrawingCompareDatabagDiffResult>();
      20 }
      21
      22 return response;
      23 }
      24 catch (Exception ex)
      25 {
      26 throw new BIMFaceException("[獲取圖紙對比的數(shù)據(jù)包信息]發(fā)生異常!", ex);
      27 }
      28 }


      接口返回的完整信息如下:


      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_sql_06C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_服務端_07


      1 {
      2 "ver": "4.0",
      3 "model": {
      4 "id": "0",
      5 "name": "Model",
      6 "additions": [
      7 {
      8 "layer": "D1",
      9 "id": "1946878",
      10 "frame": {
      11 "id": "6",
      12 "name": "基礎接地平面",
      13 "number": "電施05"
      14 }
      15 },
      16 {
      17 "layer": "D1",
      18 "id": "1946877",
      19 "frame": {
      20 "id": "5",
      21 "name": "屋頂防雷平面",
      22 "number": "電施04"
      23 }
      24 }
      25 ],
      26 "deletions": [
      27 {
      28 "layer": "D1",
      29 "id": "122566",
      30 "frame": {
      31 "id": "3",
      32 "name": "一層電氣平面(一)",
      33 "number": "電施02"
      34 }
      35 }
      36 ],
      37 "modifications": [
      38 {
      39 "previousLayer": "0",
      40 "currentLayer": "0",
      41 "id": "96103",
      42 "previousFrame": {
      43 "id": "2",
      44 "name": "電氣抗震設計專篇",
      45 "number": "電施01"
      46 },
      47 "currentFrame": {
      48 "id": "2",
      49 "name": "電氣抗震設計專篇",
      50 "number": "電施01"
      51 }
      52 },
      53 {
      54 "previousLayer": "D1",
      55 "currentLayer": "D1",
      56 "id": "53383",
      57 "previousFrame": {
      58 "id": "3",
      59 "name": "一層電氣平面(一)",
      60 "number": "電施02"
      61 },
      62 "currentFrame": {
      63 "id": "3",
      64 "name": "一層電氣平面(一)",
      65 "number": "電施02"
      66 }
      67 },
      68 {
      69 "previousLayer": "D1",
      70 "currentLayer": "D1",
      71 "id": "53351",
      72 "previousFrame": {
      73 "id": "3",
      74 "name": "一層電氣平面(一)",
      75 "number": "電施02"
      76 },
      77 "currentFrame": {
      78 "id": "3",
      79 "name": "一層電氣平面(一)",
      80 "number": "電施02"
      81 }
      82 },
      83 {
      84 "previousLayer": "0",
      85 "currentLayer": "0",
      86 "id": "96099",
      87 "previousFrame": {
      88 "id": "2",
      89 "name": "電氣抗震設計專篇",
      90 "number": "電施01"
      91 },
      92 "currentFrame": {
      93 "id": "2",
      94 "name": "電氣抗震設計專篇",
      95 "number": "電施01"
      96 }
      97 },
      98 {
      99 "previousLayer": "0",
      100 "currentLayer": "0",
      101 "id": "104785",
      102 "previousFrame": {
      103 "id": "2",
      104 "name": "電氣抗震設計專篇",
      105 "number": "電施01"
      106 },
      107 "currentFrame": {
      108 "id": "2",
      109 "name": "電氣抗震設計專篇",
      110 "number": "電施01"
      111 }
      112 },
      113 {
      114 "previousLayer": "D1",
      115 "currentLayer": "D1",
      116 "id": "53403",
      117 "previousFrame": {
      118 "id": "3",
      119 "name": "一層電氣平面(一)",
      120 "number": "電施02"
      121 },
      122 "currentFrame": {
      123 "id": "3",
      124 "name": "一層電氣平面(一)",
      125 "number": "電施02"
      126 }
      127 },
      128 {
      129 "previousLayer": "D1",
      130 "currentLayer": "D1",
      131 "id": "53395",
      132 "previousFrame": {
      133 "id": "3",
      134 "name": "一層電氣平面(一)",
      135 "number": "電施02"
      136 },
      137 "currentFrame": {
      138 "id": "3",
      139 "name": "一層電氣平面(一)",
      140 "number": "電施02"
      141 }
      142 },
      143 {
      144 "previousLayer": "AXIS",
      145 "currentLayer": "AXIS",
      146 "id": "22315",
      147 "previousFrame": {
      148 "id": "5",
      149 "name": "屋頂防雷平面",
      150 "number": "電施04"
      151 },
      152 "currentFrame": {
      153 "id": "5",
      154 "name": "屋頂防雷平面",
      155 "number": "電施04"
      156 }
      157 },
      158 {
      159 "previousLayer": "0",
      160 "currentLayer": "0",
      161 "id": "104786",
      162 "previousFrame": {
      163 "id": "2",
      164 "name": "電氣抗震設計專篇",
      165 "number": "電施01"
      166 },
      167 "currentFrame": {
      168 "id": "2",
      169 "name": "電氣抗震設計專篇",
      170 "number": "電施01"
      171 }
      172 },
      173 {
      174 "previousLayer": "D1",
      175 "currentLayer": "D1",
      176 "id": "53384",
      177 "previousFrame": {
      178 "id": "3",
      179 "name": "一層電氣平面(一)",
      180 "number": "電施02"
      181 },
      182 "currentFrame": {
      183 "id": "3",
      184 "name": "一層電氣平面(一)",
      185 "number": "電施02"
      186 }
      187 },
      188 {
      189 "previousLayer": "D1",
      190 "currentLayer": "D1",
      191 "id": "53352",
      192 "previousFrame": {
      193 "id": "3",
      194 "name": "一層電氣平面(一)",
      195 "number": "電施02"
      196 },
      197 "currentFrame": {
      198 "id": "3",
      199 "name": "一層電氣平面(一)",
      200 "number": "電施02"
      201 }
      202 },
      203 {
      204 "previousLayer": "D1",
      205 "currentLayer": "D1",
      206 "id": "53400",
      207 "previousFrame": {
      208 "id": "3",
      209 "name": "一層電氣平面(一)",
      210 "number": "電施02"
      211 },
      212 "currentFrame": {
      213 "id": "3",
      214 "name": "一層電氣平面(一)",
      215 "number": "電施02"
      216 }
      217 },
      218 {
      219 "previousLayer": "D1",
      220 "currentLayer": "D1",
      221 "id": "53368",
      222 "previousFrame": {
      223 "id": "3",
      224 "name": "一層電氣平面(一)",
      225 "number": "電施02"
      226 },
      227 "currentFrame": {
      228 "id": "3",
      229 "name": "一層電氣平面(一)",
      230 "number": "電施02"
      231 }
      232 },
      233 {
      234 "previousLayer": "AXIS",
      235 "currentLayer": "AXIS",
      236 "id": "22307",
      237 "previousFrame": {
      238 "id": "5",
      239 "name": "屋頂防雷平面",
      240 "number": "電施04"
      241 },
      242 "currentFrame": {
      243 "id": "5",
      244 "name": "屋頂防雷平面",
      245 "number": "電施04"
      246 }
      247 },
      248 {
      249 "previousLayer": "D1",
      250 "currentLayer": "D1",
      251 "id": "53371",
      252 "previousFrame": {
      253 "id": "3",
      254 "name": "一層電氣平面(一)",
      255 "number": "電施02"
      256 },
      257 "currentFrame": {
      258 "id": "3",
      259 "name": "一層電氣平面(一)",
      260 "number": "電施02"
      261 }
      262 },
      263 {
      264 "previousLayer": "AXIS",
      265 "currentLayer": "AXIS",
      266 "id": "22314",
      267 "previousFrame": {
      268 "id": "5",
      269 "name": "屋頂防雷平面",
      270 "number": "電施04"
      271 },
      272 "currentFrame": {
      273 "id": "5",
      274 "name": "屋頂防雷平面",
      275 "number": "電施04"
      276 }
      277 },
      278 {
      279 "previousLayer": "0",
      280 "currentLayer": "0",
      281 "id": "96098",
      282 "previousFrame": {
      283 "id": "2",
      284 "name": "電氣抗震設計專篇",
      285 "number": "電施01"
      286 },
      287 "currentFrame": {
      288 "id": "2",
      289 "name": "電氣抗震設計專篇",
      290 "number": "電施01"
      291 }
      292 },
      293 {
      294 "previousLayer": "D1",
      295 "currentLayer": "D1",
      296 "id": "53386",
      297 "previousFrame": {
      298 "id": "3",
      299 "name": "一層電氣平面(一)",
      300 "number": "電施02"
      301 },
      302 "currentFrame": {
      303 "id": "3",
      304 "name": "一層電氣平面(一)",
      305 "number": "電施02"
      306 }
      307 },
      308 {
      309 "previousLayer": "0",
      310 "currentLayer": "0",
      311 "id": "96097",
      312 "previousFrame": {
      313 "id": "2",
      314 "name": "電氣抗震設計專篇",
      315 "number": "電施01"
      316 },
      317 "currentFrame": {
      318 "id": "2",
      319 "name": "電氣抗震設計專篇",
      320 "number": "電施01"
      321 }
      322 },
      323 {
      324 "previousLayer": "D1",
      325 "currentLayer": "D1",
      326 "id": "53397",
      327 "previousFrame": {
      328 "id": "3",
      329 "name": "一層電氣平面(一)",
      330 "number": "電施02"
      331 },
      332 "currentFrame": {
      333 "id": "3",
      334 "name": "一層電氣平面(一)",
      335 "number": "電施02"
      336 }
      337 },
      338 {
      339 "previousLayer": "0",
      340 "currentLayer": "0",
      341 "id": "104783",
      342 "previousFrame": {
      343 "id": "2",
      344 "name": "電氣抗震設計專篇",
      345 "number": "電施01"
      346 },
      347 "currentFrame": {
      348 "id": "2",
      349 "name": "電氣抗震設計專篇",
      350 "number": "電施01"
      351 }
      352 },
      353 {
      354 "previousLayer": "D1",
      355 "currentLayer": "D1",
      356 "id": "53405",
      357 "previousFrame": {
      358 "id": "3",
      359 "name": "一層電氣平面(一)",
      360 "number": "電施02"
      361 },
      362 "currentFrame": {
      363 "id": "3",
      364 "name": "一層電氣平面(一)",
      365 "number": "電施02"
      366 }
      367 },
      368 {
      369 "previousLayer": "0",
      370 "currentLayer": "0",
      371 "id": "104779",
      372 "previousFrame": {
      373 "id": "2",
      374 "name": "電氣抗震設計專篇",
      375 "number": "電施01"
      376 },
      377 "currentFrame": {
      378 "id": "2",
      379 "name": "電氣抗震設計專篇",
      380 "number": "電施01"
      381 }
      382 },
      383 {
      384 "previousLayer": "0",
      385 "currentLayer": "0",
      386 "id": "96095",
      387 "previousFrame": {
      388 "id": "2",
      389 "name": "電氣抗震設計專篇",
      390 "number": "電施01"
      391 },
      392 "currentFrame": {
      393 "id": "2",
      394 "name": "電氣抗震設計專篇",
      395 "number": "電施01"
      396 }
      397 },
      398 {
      399 "previousLayer": "D1",
      400 "currentLayer": "D1",
      401 "id": "53375",
      402 "previousFrame": {
      403 "id": "3",
      404 "name": "一層電氣平面(一)",
      405 "number": "電施02"
      406 },
      407 "currentFrame": {
      408 "id": "3",
      409 "name": "一層電氣平面(一)",
      410 "number": "電施02"
      411 }
      412 },
      413 {
      414 "previousLayer": "D1",
      415 "currentLayer": "D1",
      416 "id": "53355",
      417 "previousFrame": {
      418 "id": "3",
      419 "name": "一層電氣平面(一)",
      420 "number": "電施02"
      421 },
      422 "currentFrame": {
      423 "id": "3",
      424 "name": "一層電氣平面(一)",
      425 "number": "電施02"
      426 }
      427 },
      428 {
      429 "previousLayer": "0",
      430 "currentLayer": "0",
      431 "id": "96104",
      432 "previousFrame": {
      433 "id": "2",
      434 "name": "電氣抗震設計專篇",
      435 "number": "電施01"
      436 },
      437 "currentFrame": {
      438 "id": "2",
      439 "name": "電氣抗震設計專篇",
      440 "number": "電施01"
      441 }
      442 },
      443 {
      444 "previousLayer": "D1",
      445 "currentLayer": "D1",
      446 "id": "53356",
      447 "previousFrame": {
      448 "id": "3",
      449 "name": "一層電氣平面(一)",
      450 "number": "電施02"
      451 },
      452 "currentFrame": {
      453 "id": "3",
      454 "name": "一層電氣平面(一)",
      455 "number": "電施02"
      456 }
      457 },
      458 {
      459 "previousLayer": "D1",
      460 "currentLayer": "D1",
      461 "id": "53357",
      462 "previousFrame": {
      463 "id": "3",
      464 "name": "一層電氣平面(一)",
      465 "number": "電施02"
      466 },
      467 "currentFrame": {
      468 "id": "3",
      469 "name": "一層電氣平面(一)",
      470 "number": "電施02"
      471 }
      472 },
      473 {
      474 "previousLayer": "D1",
      475 "currentLayer": "D1",
      476 "id": "53358",
      477 "previousFrame": {
      478 "id": "3",
      479 "name": "一層電氣平面(一)",
      480 "number": "電施02"
      481 },
      482 "currentFrame": {
      483 "id": "3",
      484 "name": "一層電氣平面(一)",
      485 "number": "電施02"
      486 }
      487 },
      488 {
      489 "previousLayer": "D1",
      490 "currentLayer": "D1",
      491 "id": "53359",
      492 "previousFrame": {
      493 "id": "3",
      494 "name": "一層電氣平面(一)",
      495 "number": "電施02"
      496 },
      497 "currentFrame": {
      498 "id": "3",
      499 "name": "一層電氣平面(一)",
      500 "number": "電施02"
      501 }
      502 },
      503 {
      504 "previousLayer": "D1",
      505 "currentLayer": "D1",
      506 "id": "53361",
      507 "previousFrame": {
      508 "id": "3",
      509 "name": "一層電氣平面(一)",
      510 "number": "電施02"
      511 },
      512 "currentFrame": {
      513 "id": "3",
      514 "name": "一層電氣平面(一)",
      515 "number": "電施02"
      516 }
      517 },
      518 {
      519 "previousLayer": "D1",
      520 "currentLayer": "D1",
      521 "id": "53362",
      522 "previousFrame": {
      523 "id": "3",
      524 "name": "一層電氣平面(一)",
      525 "number": "電施02"
      526 },
      527 "currentFrame": {
      528 "id": "3",
      529 "name": "一層電氣平面(一)",
      530 "number": "電施02"
      531 }
      532 },
      533 {
      534 "previousLayer": "D1",
      535 "currentLayer": "D1",
      536 "id": "53363",
      537 "previousFrame": {
      538 "id": "3",
      539 "name": "一層電氣平面(一)",
      540 "number": "電施02"
      541 },
      542 "currentFrame": {
      543 "id": "3",
      544 "name": "一層電氣平面(一)",
      545 "number": "電施02"
      546 }
      547 },
      548 {
      549 "previousLayer": "D1",
      550 "currentLayer": "D1",
      551 "id": "53364",
      552 "previousFrame": {
      553 "id": "3",
      554 "name": "一層電氣平面(一)",
      555 "number": "電施02"
      556 },
      557 "currentFrame": {
      558 "id": "3",
      559 "name": "一層電氣平面(一)",
      560 "number": "電施02"
      561 }
      562 },
      563 {
      564 "previousLayer": "D1",
      565 "currentLayer": "D1",
      566 "id": "53365",
      567 "previousFrame": {
      568 "id": "3",
      569 "name": "一層電氣平面(一)",
      570 "number": "電施02"
      571 },
      572 "currentFrame": {
      573 "id": "3",
      574 "name": "一層電氣平面(一)",
      575 "number": "電施02"
      576 }
      577 },
      578 {
      579 "previousLayer": "D1",
      580 "currentLayer": "D1",
      581 "id": "53366",
      582 "previousFrame": {
      583 "id": "3",
      584 "name": "一層電氣平面(一)",
      585 "number": "電施02"
      586 },
      587 "currentFrame": {
      588 "id": "3",
      589 "name": "一層電氣平面(一)",
      590 "number": "電施02"
      591 }
      592 },
      593 {
      594 "previousLayer": "D1",
      595 "currentLayer": "D1",
      596 "id": "53367",
      597 "previousFrame": {
      598 "id": "3",
      599 "name": "一層電氣平面(一)",
      600 "number": "電施02"
      601 },
      602 "currentFrame": {
      603 "id": "3",
      604 "name": "一層電氣平面(一)",
      605 "number": "電施02"
      606 }
      607 },
      608 {
      609 "previousLayer": "D1",
      610 "currentLayer": "D1",
      611 "id": "53369",
      612 "previousFrame": {
      613 "id": "3",
      614 "name": "一層電氣平面(一)",
      615 "number": "電施02"
      616 },
      617 "currentFrame": {
      618 "id": "3",
      619 "name": "一層電氣平面(一)",
      620 "number": "電施02"
      621 }
      622 },
      623 {
      624 "previousLayer": "D1",
      625 "currentLayer": "D1",
      626 "id": "53370",
      627 "previousFrame": {
      628 "id": "3",
      629 "name": "一層電氣平面(一)",
      630 "number": "電施02"
      631 },
      632 "currentFrame": {
      633 "id": "3",
      634 "name": "一層電氣平面(一)",
      635 "number": "電施02"
      636 }
      637 },
      638 {
      639 "previousLayer": "D1",
      640 "currentLayer": "D1",
      641 "id": "53372",
      642 "previousFrame": {
      643 "id": "3",
      644 "name": "一層電氣平面(一)",
      645 "number": "電施02"
      646 },
      647 "currentFrame": {
      648 "id": "3",
      649 "name": "一層電氣平面(一)",
      650 "number": "電施02"
      651 }
      652 },
      653 {
      654 "previousLayer": "D1",
      655 "currentLayer": "D1",
      656 "id": "53373",
      657 "previousFrame": {
      658 "id": "3",
      659 "name": "一層電氣平面(一)",
      660 "number": "電施02"
      661 },
      662 "currentFrame": {
      663 "id": "3",
      664 "name": "一層電氣平面(一)",
      665 "number": "電施02"
      666 }
      667 },
      668 {
      669 "previousLayer": "D1",
      670 "currentLayer": "D1",
      671 "id": "53374",
      672 "previousFrame": {
      673 "id": "3",
      674 "name": "一層電氣平面(一)",
      675 "number": "電施02"
      676 },
      677 "currentFrame": {
      678 "id": "3",
      679 "name": "一層電氣平面(一)",
      680 "number": "電施02"
      681 }
      682 },
      683 {
      684 "previousLayer": "D1",
      685 "currentLayer": "D1",
      686 "id": "53376",
      687 "previousFrame": {
      688 "id": "3",
      689 "name": "一層電氣平面(一)",
      690 "number": "電施02"
      691 },
      692 "currentFrame": {
      693 "id": "3",
      694 "name": "一層電氣平面(一)",
      695 "number": "電施02"
      696 }
      697 },
      698 {
      699 "previousLayer": "0",
      700 "currentLayer": "0",
      701 "id": "96101",
      702 "previousFrame": {
      703 "id": "2",
      704 "name": "電氣抗震設計專篇",
      705 "number": "電施01"
      706 },
      707 "currentFrame": {
      708 "id": "2",
      709 "name": "電氣抗震設計專篇",
      710 "number": "電施01"
      711 }
      712 },
      713 {
      714 "previousLayer": "D1",
      715 "currentLayer": "D1",
      716 "id": "53377",
      717 "previousFrame": {
      718 "id": "3",
      719 "name": "一層電氣平面(一)",
      720 "number": "電施02"
      721 },
      722 "currentFrame": {
      723 "id": "3",
      724 "name": "一層電氣平面(一)",
      725 "number": "電施02"
      726 }
      727 },
      728 {
      729 "previousLayer": "D1",
      730 "currentLayer": "D1",
      731 "id": "53378",
      732 "previousFrame": {
      733 "id": "3",
      734 "name": "一層電氣平面(一)",
      735 "number": "電施02"
      736 },
      737 "currentFrame": {
      738 "id": "3",
      739 "name": "一層電氣平面(一)",
      740 "number": "電施02"
      741 }
      742 },
      743 {
      744 "previousLayer": "D1",
      745 "currentLayer": "D1",
      746 "id": "53381",
      747 "previousFrame": {
      748 "id": "3",
      749 "name": "一層電氣平面(一)",
      750 "number": "電施02"
      751 },
      752 "currentFrame": {
      753 "id": "3",
      754 "name": "一層電氣平面(一)",
      755 "number": "電施02"
      756 }
      757 },
      758 {
      759 "previousLayer": "D1",
      760 "currentLayer": "D1",
      761 "id": "53385",
      762 "previousFrame": {
      763 "id": "3",
      764 "name": "一層電氣平面(一)",
      765 "number": "電施02"
      766 },
      767 "currentFrame": {
      768 "id": "3",
      769 "name": "一層電氣平面(一)",
      770 "number": "電施02"
      771 }
      772 },
      773 {
      774 "previousLayer": "D1",
      775 "currentLayer": "D1",
      776 "id": "53387",
      777 "previousFrame": {
      778 "id": "3",
      779 "name": "一層電氣平面(一)",
      780 "number": "電施02"
      781 },
      782 "currentFrame": {
      783 "id": "3",
      784 "name": "一層電氣平面(一)",
      785 "number": "電施02"
      786 }
      787 },
      788 {
      789 "previousLayer": "D1",
      790 "currentLayer": "D1",
      791 "id": "53389",
      792 "previousFrame": {
      793 "id": "3",
      794 "name": "一層電氣平面(一)",
      795 "number": "電施02"
      796 },
      797 "currentFrame": {
      798 "id": "3",
      799 "name": "一層電氣平面(一)",
      800 "number": "電施02"
      801 }
      802 },
      803 {
      804 "previousLayer": "D1",
      805 "currentLayer": "D1",
      806 "id": "53390",
      807 "previousFrame": {
      808 "id": "3",
      809 "name": "一層電氣平面(一)",
      810 "number": "電施02"
      811 },
      812 "currentFrame": {
      813 "id": "3",
      814 "name": "一層電氣平面(一)",
      815 "number": "電施02"
      816 }
      817 },
      818 {
      819 "previousLayer": "D1",
      820 "currentLayer": "D1",
      821 "id": "53392",
      822 "previousFrame": {
      823 "id": "3",
      824 "name": "一層電氣平面(一)",
      825 "number": "電施02"
      826 },
      827 "currentFrame": {
      828 "id": "3",
      829 "name": "一層電氣平面(一)",
      830 "number": "電施02"
      831 }
      832 },
      833 {
      834 "previousLayer": "D1",
      835 "currentLayer": "D1",
      836 "id": "53391",
      837 "previousFrame": {
      838 "id": "3",
      839 "name": "一層電氣平面(一)",
      840 "number": "電施02"
      841 },
      842 "currentFrame": {
      843 "id": "3",
      844 "name": "一層電氣平面(一)",
      845 "number": "電施02"
      846 }
      847 },
      848 {
      849 "previousLayer": "D1",
      850 "currentLayer": "D1",
      851 "id": "53396",
      852 "previousFrame": {
      853 "id": "3",
      854 "name": "一層電氣平面(一)",
      855 "number": "電施02"
      856 },
      857 "currentFrame": {
      858 "id": "3",
      859 "name": "一層電氣平面(一)",
      860 "number": "電施02"
      861 }
      862 },
      863 {
      864 "previousLayer": "D1",
      865 "currentLayer": "D1",
      866 "id": "53401",
      867 "previousFrame": {
      868 "id": "3",
      869 "name": "一層電氣平面(一)",
      870 "number": "電施02"
      871 },
      872 "currentFrame": {
      873 "id": "3",
      874 "name": "一層電氣平面(一)",
      875 "number": "電施02"
      876 }
      877 },
      878 {
      879 "previousLayer": "D1",
      880 "currentLayer": "D1",
      881 "id": "53404",
      882 "previousFrame": {
      883 "id": "3",
      884 "name": "一層電氣平面(一)",
      885 "number": "電施02"
      886 },
      887 "currentFrame": {
      888 "id": "3",
      889 "name": "一層電氣平面(一)",
      890 "number": "電施02"
      891 }
      892 },
      893 {
      894 "previousLayer": "D1",
      895 "currentLayer": "D1",
      896 "id": "53406",
      897 "previousFrame": {
      898 "id": "3",
      899 "name": "一層電氣平面(一)",
      900 "number": "電施02"
      901 },
      902 "currentFrame": {
      903 "id": "3",
      904 "name": "一層電氣平面(一)",
      905 "number": "電施02"
      906 }
      907 },
      908 {
      909 "previousLayer": "D1",
      910 "currentLayer": "D1",
      911 "id": "53407",
      912 "previousFrame": {
      913 "id": "3",
      914 "name": "一層電氣平面(一)",
      915 "number": "電施02"
      916 },
      917 "currentFrame": {
      918 "id": "3",
      919 "name": "一層電氣平面(一)",
      920 "number": "電施02"
      921 }
      922 },
      923 {
      924 "previousLayer": "D1",
      925 "currentLayer": "D1",
      926 "id": "53408",
      927 "previousFrame": {
      928 "id": "3",
      929 "name": "一層電氣平面(一)",
      930 "number": "電施02"
      931 },
      932 "currentFrame": {
      933 "id": "3",
      934 "name": "一層電氣平面(一)",
      935 "number": "電施02"
      936 }
      937 },
      938 {
      939 "previousLayer": "D1",
      940 "currentLayer": "D1",
      941 "id": "53409",
      942 "previousFrame": {
      943 "id": "3",
      944 "name": "一層電氣平面(一)",
      945 "number": "電施02"
      946 },
      947 "currentFrame": {
      948 "id": "3",
      949 "name": "一層電氣平面(一)",
      950 "number": "電施02"
      951 }
      952 },
      953 {
      954 "previousLayer": "D1",
      955 "currentLayer": "D1",
      956 "id": "53410",
      957 "previousFrame": {
      958 "id": "3",
      959 "name": "一層電氣平面(一)",
      960 "number": "電施02"
      961 },
      962 "currentFrame": {
      963 "id": "3",
      964 "name": "一層電氣平面(一)",
      965 "number": "電施02"
      966 }
      967 },
      968 {
      969 "previousLayer": "D1",
      970 "currentLayer": "D1",
      971 "id": "53411",
      972 "previousFrame": {
      973 "id": "3",
      974 "name": "一層電氣平面(一)",
      975 "number": "電施02"
      976 },
      977 "currentFrame": {
      978 "id": "3",
      979 "name": "一層電氣平面(一)",
      980 "number": "電施02"
      981 }
      982 },
      983 {
      984 "previousLayer": "0",
      985 "currentLayer": "0",
      986 "id": "104782",
      987 "previousFrame": {
      988 "id": "2",
      989 "name": "電氣抗震設計專篇",
      990 "number": "電施01"
      991 },
      992 "currentFrame": {
      993 "id": "2",
      994 "name": "電氣抗震設計專篇",
      995 "number": "電施01"
      996 }
      997 },
      998 {
      999 "previousLayer": "0",
      1000 "currentLayer": "0",
      1001 "id": "96096",
      1002 "previousFrame": {
      1003 "id": "2",
      1004 "name": "電氣抗震設計專篇",
      1005 "number": "電施01"
      1006 },
      1007 "currentFrame": {
      1008 "id": "2",
      1009 "name": "電氣抗震設計專篇",
      1010 "number": "電施01"
      1011 }
      1012 },
      1013 {
      1014 "previousLayer": "0",
      1015 "currentLayer": "0",
      1016 "id": "104778",
      1017 "previousFrame": {
      1018 "id": "2",
      1019 "name": "電氣抗震設計專篇",
      1020 "number": "電施01"
      1021 },
      1022 "currentFrame": {
      1023 "id": "2",
      1024 "name": "電氣抗震設計專篇",
      1025 "number": "電施01"
      1026 }
      1027 },
      1028 {
      1029 "previousLayer": "0",
      1030 "currentLayer": "0",
      1031 "id": "96100",
      1032 "previousFrame": {
      1033 "id": "2",
      1034 "name": "電氣抗震設計專篇",
      1035 "number": "電施01"
      1036 },
      1037 "currentFrame": {
      1038 "id": "2",
      1039 "name": "電氣抗震設計專篇",
      1040 "number": "電施01"
      1041 }
      1042 },
      1043 {
      1044 "previousLayer": "0",
      1045 "currentLayer": "0",
      1046 "id": "96102",
      1047 "previousFrame": {
      1048 "id": "2",
      1049 "name": "電氣抗震設計專篇",
      1050 "number": "電施01"
      1051 },
      1052 "currentFrame": {
      1053 "id": "2",
      1054 "name": "電氣抗震設計專篇",
      1055 "number": "電施01"
      1056 }
      1057 },
      1058 {
      1059 "previousLayer": "0",
      1060 "currentLayer": "0",
      1061 "id": "104780",
      1062 "previousFrame": {
      1063 "id": "2",
      1064 "name": "電氣抗震設計專篇",
      1065 "number": "電施01"
      1066 },
      1067 "currentFrame": {
      1068 "id": "2",
      1069 "name": "電氣抗震設計專篇",
      1070 "number": "電施01"
      1071 }
      1072 },
      1073 {
      1074 "previousLayer": "0",
      1075 "currentLayer": "0",
      1076 "id": "104781",
      1077 "previousFrame": {
      1078 "id": "2",
      1079 "name": "電氣抗震設計專篇",
      1080 "number": "電施01"
      1081 },
      1082 "currentFrame": {
      1083 "id": "2",
      1084 "name": "電氣抗震設計專篇",
      1085 "number": "電施01"
      1086 }
      1087 },
      1088 {
      1089 "previousLayer": "0",
      1090 "currentLayer": "0",
      1091 "id": "104784",
      1092 "previousFrame": {
      1093 "id": "2",
      1094 "name": "電氣抗震設計專篇",
      1095 "number": "電施01"
      1096 },
      1097 "currentFrame": {
      1098 "id": "2",
      1099 "name": "電氣抗震設計專篇",
      1100 "number": "電施01"
      1101 }
      1102 },
      1103 {
      1104 "previousLayer": "0",
      1105 "currentLayer": "0",
      1106 "id": "104787",
      1107 "previousFrame": {
      1108 "id": "2",
      1109 "name": "電氣抗震設計專篇",
      1110 "number": "電施01"
      1111 },
      1112 "currentFrame": {
      1113 "id": "2",
      1114 "name": "電氣抗震設計專篇",
      1115 "number": "電施01"
      1116 }
      1117 }
      1118 ]
      1119 }
      1120 }

      View Code

      參數(shù)說明

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_sql_12


      計算差異來自哪個圖框


      通過?GetDrawingCompareDiff() 接口獲取的結果中包含的差異類型 diffType 、id 與?GetDrawingCompareDatabageDiffResult()接口獲取的結果中的 additions、deletions、modifications 對象以及對象屬性ID 對比,即可知道變更項來自哪個圖框。關聯(lián)關系如下圖:

      C#開發(fā)BIMFACE系列44 服務端API之計算圖紙對比差異項來源自哪個圖框_json_13

      參考下面的計算邏輯



      1     /// <summary>
      2 /// 計算對比結果中差異項來自的圖框信息
      3 /// </summary>
      4 /// <param name="node_Child">圖紙節(jié)點</param>
      5 /// <param name="compareId">對比ID</param>
      6 /// <param name="diffResult">對比差異結果</param>
      7 private void CalcaDiffTK(Node node_Child, long compareId, string diffResult)
      8 {
      9 DrawingCompareDiffResponse diffResponse =
      10 BIMFace.SDK.CSharp.Common.Extensions.CommonExtension.DeserializeJsonToObject<DrawingCompareDiffResponse>(diffResult);//arrCompare[0]["DiffResult"].ToString2()
      11 if (diffResponse != null)
      12 {
      13 if (diffResponse.Code == "success" && diffResponse.Data != null)
      14 {
      15 List<BIMCompareDiffDetail> diffNews = new List<BIMCompareDiffDetail>();
      16 List<BIMCompareDiffDetail> diffChanges = new List<BIMCompareDiffDetail>();
      17 List<BIMCompareDiffDetail> diffDeletes = new List<BIMCompareDiffDetail>();
      18 DrawingCompareDiff[] diffData = diffResponse.Data.Data;
      19 if (diffData != null && diffData.Length > 0)
      20 {
      21 // diffData 中有重復的數(shù)據(jù)(包含模型、布局),需要 DistinctBy() 去重
      22 diffNews =
      23 diffData.Where(x => x.DiffType == ModelCompareDiffType.NEW.ToString())
      24 .Select(x => new BIMCompareDiffDetail
      25 {
      26 categoryName = "",
      27 elementId = x.Id,
      28 elementName = ""
      29 }).DistinctBy(x => x.elementId).ToList();
      30
      31 diffChanges =
      32 diffData.Where(x => x.DiffType == ModelCompareDiffType.CHANGE.ToString())
      33 .Select(x => new BIMCompareDiffDetail
      34 {
      35 categoryName = "",
      36 elementId = x.Id,
      37 elementName = ""
      38 }).DistinctBy(x => x.elementId).ToList();
      39
      40 diffDeletes =
      41 diffData.Where(x => x.DiffType == ModelCompareDiffType.DELETE.ToString())
      42 .Select(x => new BIMCompareDiffDetail
      43 {
      44 categoryName = "",
      45 elementId = x.Id,
      46 elementName = ""
      47 }).DistinctBy(x => x.elementId).ToList();
      48
      49 SimpleResult<string> compareDatabagDiffResult = new WebServiceDAL().GetDrawingCompareDatabagDiffResult(compareId);// arrCompare[0]["CompareId"].ToInt64()
      50 if (compareDatabagDiffResult.ResultCode)
      51 {
      52 if (string.IsNullOrWhiteSpace(compareDatabagDiffResult.ResultObject) == false)
      53 {
      54 DrawingCompareDatabagDiffResult objCompareDatabagDiffResult =
      55 BIMFace.SDK.CSharp.Common.Extensions.CommonExtension.DeserializeJsonToObject<DrawingCompareDatabagDiffResult>(compareDatabagDiffResult.ResultObject);
      56 if (objCompareDatabagDiffResult.Model != null)
      57 {
      58 if (objCompareDatabagDiffResult.Model.Additions != null &&
      59 objCompareDatabagDiffResult.Model.Additions.Count > 0)
      60 {
      61 foreach (var item in diffNews)
      62 {
      63 var addition = objCompareDatabagDiffResult.Model.Additions.Where(x => x.Id == item.elementId).FirstOrDefault();
      64 if (addition != null)
      65 {
      66 string diffItemFromTK = "【新增構建】" + addition.Frame ?? string.Empty;//圖框名稱
      67
      68 // 其他業(yè)務邏輯
      69 }
      70 }
      71 }
      72
      73 if (objCompareDatabagDiffResult.Model.Modifications != null &&
      74 objCompareDatabagDiffResult.Model.Modifications.Count > 0)
      75 {
      76 foreach (var item in diffChanges)
      77 {
      78 var modifications = objCompareDatabagDiffResult.Model.Modifications.Where(x => x.Id == item.elementId).FirstOrDefault();
      79 if (modifications != null)
      80 {
      81 string diffItemFromTK = "【修改構建】" + addition.Frame ?? string.Empty;//圖框名稱
      82
      83 // 其他業(yè)務邏輯
      84 }
      85 }
      86 }
      87
      88
      89 if (objCompareDatabagDiffResult.Model.Deletions != null &&
      90 objCompareDatabagDiffResult.Model.Deletions.Count > 0)
      91 {
      92 foreach (var item in diffDeletes)
      93 {
      94 var deletions = objCompareDatabagDiffResult.Model.Deletions.Where(x => x.Id == item.elementId).FirstOrDefault();
      95 if (deletions != null)
      96 {
      97 string diffItemFromTK = "【刪除構建】" + addition.Frame ?? string.Empty;//圖框名稱
      98
      99 // 其他業(yè)務邏輯
      100 }
      101 }
      102 }
      103 }
      104 }
      105 }
      106 }
      107 }
      108 }
      109 }



      1     public class BIMCompareDiffDetail
      2 {
      3 /// <summary>
      4 /// 對比差異構件所屬類別名稱。樣例 : "framework"
      5 /// </summary>
      6 public string categoryName { get; set; }
      7
      8 /// <summary>
      9 /// 對比差異構件ID。樣例 : "296524"
      10 /// </summary>
      11 public string elementId { get; set; }
      12
      13 /// <summary>
      14 /// 對比差異構件名稱
      15 /// </summary>
      16 public string elementName { get; set; }
      17 }


      ?

      上述測試程序使用了 《BIMFace.SDK.CSharp》開源SDK。歡迎大家下載使用。

      ?


      ?

      ? ?

      ?1、Visual Studio、.C#/.NET、.NET Core、MVC、Web API、RESTful API、gRPC、SignalR、Python

      ?2、jQuery、Vue.js、Bootstrap

      ?3、數(shù)據(jù)庫:SQLServer、MySQL、PostgreSQL、Oracle、SQLite、Redis、MongoDB、ElasticSearch、TiDB、達夢DM、人大金倉、 神通、南大通用 GBase、華為 GaussDB 、騰訊 TDSQL 、阿里 PolarDB、螞蟻金服 OceanBase、東軟 OpenBASE、浪潮云溪數(shù)據(jù)庫 ZNBase

      ?4、ORM:Dapper、Entity Framework、FreeSql、SqlSugar、分庫分表、讀寫分離

      ?5、架構:領域驅(qū)動設計 DDD、ABP

      ?6、環(huán)境:跨平臺、Windows、Linux(CentOS、麒麟、統(tǒng)信UOS、深度Linux)、maxOS、IIS、Nginx、Apach

      ?7、移動App:Android、IOS、HarmonyOS、微信、小程序、快應用、Xamarin、uni-app、MUI、Flutter、Framework7、Cordova、Ionic、React Native、Taro、NutUI、Smobiler

      ? ?

      ?云原生、微服務、Docker、CI/CD、DevOps、K8S;

      ?Dapr、RabbitMQ、Kafka、分布式、大數(shù)據(jù)、高并發(fā)、負載均衡、中間件、RPC、ELK;

      ?.NET + Docker + jenkins + Github + Harbor + K8S;


      ?

      作者:張傳寧 ??微軟MCP、系統(tǒng)架構設計師、系統(tǒng)集成項目管理工程師、科技部創(chuàng)新工程師。

      ??????????專注于微軟.NET技術(.NET Core、Web、MVC、WinForm、WPF)、通用權限管理系統(tǒng)、工作流引擎、自動化項目(代碼)生成器、SOA 、DDD、 云原生(Docker、微服務、DevOps、CI/CD);PDF、CAD、BIM 審圖等研究與應用。

      ??????????多次參與電子政務、圖書教育、生產(chǎn)制造等企業(yè)級大型項目研發(fā)與管理工作。

      ??????????熟悉中小企業(yè)軟件開發(fā)過程:需求分析、架構設計、編碼測試、實施部署、項目管理。通過技術與管理幫助中小企業(yè)快速化實現(xiàn)互聯(lián)網(wǎng)技術全流程解決方案。

      ?????????



      ?

      本文摘自 :https://blog.51cto.com/u

      開通會員,享受整站包年服務立即開通 >