Categories
Uncategorized

C # development BIMFACE 19 series server API data acquisition model of 4: Get the common attributes of multiple components

系列目录     【已更新最新开发文章,点击查看详细】

It describes a 3D file / model contains multiple constructs, each construct in turn composed of a variety of materials, each construct has a lot of properties in the previous few blog. Different constructs may also contain the same attributes.

1 can see the figure above and Construction 2 Construction 2 have the same properties, Construction and Building 2 n 1 have the same properties.

This article describes how to obtain the common attributes of multiple construction.

Request Address: GET https://api.bimface.com/data/v2/files/{fileId}/commonElementProperties

Note: If the incoming elementId more than one of these elementId common property is returned, common definitions are: key attribute and value are equal.

A plurality of support members after the rewritten query model attributes common attribute value of true to set the request parameters includeOverrides.

parameter:

Request path (example): string //api.bimface.com/data/v2/files/1211223382064960/commonElementProperties elementIds =: https?

When querying common attribute member rewritten request exemplified https://api.bimface.com/data/v2/files/1211223382064960/commonElementProperties?elementIds=string&includeOverrides=true


elementIds 后面的 string 是多个构建Id,多个elementId之间用英文状态下的半角逗号分隔。

例如:elementId1,elementId2,elementId3,elementId4

Request header (Example): “Authorization: Bearer dc671840-bacc-4dc5-a134-97c1918d664b”

Example HTTP response (200):

{
  "code" : "success",
  "data" : {
    "boundingBox" : {
      "max" : {
        "x" : -4938.068482562385,
        "y" : -3201.59397858169,
        "z" : 0.0
      },
      "min" : {
        "x" : -4938.068482562385,
        "y" : -3201.59397858169,
        "z" : 0.0
      }
    },
    "elementId" : "313052",
    "familyGuid" : "000222",
    "guid" : "79d547c1-5dbf-4e6a-811d-951cf37b29da-0004c6dc",
    "name" : "norm - 150mm",
    "properties" : [ {
      "group" : "dimension",
      "items" : [ {
        "code" : "perimeter",
        "extension" : "object",
        "key" : "perimeter",
        "orderNumber" : 0,
        "unit" : "mm",
        "value" : 17200,
        "valueType" : 2
      } ]
    } ]
  },
  "message" : ""
}

C # implementation:

 1 /// 
 2 ///  获取单个模型的多个构件的共同属性
 3 /// 
 4 /// 

Token

5 ///

[Required] on behalf of the single model file ID

6 ///

[Required] ID list on behalf of members of the single model

7 ///

[Optional] query whether the modified property

8 /// 9 public virtual SingleModelMultipleElementsCommonProperties GetSingleModelMultipleElementsCommonProperties(string accessToken, long fileId, string[] elementIds, bool? includeOverrides = null) 10 { 11 if (elementIds == null && elementIds.Length == 0) 12 { 13 throw new ArgumentException("

ElementIds parameter can not be null and must contain the elements!

"); 14 } 15 16 // GET https://api.bimface.com/data/v2/files/{fileId}/commonElementProperties?elementIds={string} 17 string url = string.Format(BimfaceConstants.API_HOST + "/data/v2/files/{0}/commonElementProperties?elementIds={1}", fileId, elementIds.ToStringWith(",")); 18 if (includeOverrides != null) 19 { 20 url = url + "&includeOverrides=" + includeOverrides; 21 } 22 23 BimFaceHttpHeaders headers = new BimFaceHttpHeaders(); 24 headers.AddOAuth2Header(accessToken); 25 26 try 27 { 28 SingleModelMultipleElementsCommonProperties response; 29 30 HttpManager httpManager = new HttpManager(headers); 31 HttpResult httpResult = httpManager.Get(url); 32 if (httpResult.Status == HttpResult.STATUS_SUCCESS) 33 { 34 response = httpResult.Text.DeserializeJsonToObject(); 35 } 36 else 37 { 38 response = new SingleModelMultipleElementsCommonProperties 39 { 40 Message = httpResult.RefText 41 }; 42 } 43 44 return response; 45 } 46 catch (Exception ex) 47 { 48 throw new Exception("

[Acquiring a plurality of members of common attributes] abnormal!

", ex); 49 } 50 }

Which calls to httpManager.Get () method, please refer to “C # HTTP Series”

Responsive results corresponding entity class SingleModelMultipleElementsCommonProperties, the package is as follows:

/// 
///  获取多个构件的共同属性返回的结果类
/// 
public class SingleModelMultipleElementsCommonProperties : SingleModelSingleElementProperty
{

}

SingleModelMultipleElementsCommonProperties and Class “C # developers BIMFACE Series server 18 acquires the model 3 of the API Data: property acquiring means” structural class returns SingleModelSingleElementProperty identical.

Derived an overloaded method:

/// 
///  获取单个模型的多个构件的共同属性
/// 
/// 

Token

///

[Required] on behalf of the single model file ID

///

[Required] ID list on behalf of members of the single model

///

[Optional] query whether the modified property

/// public virtual SingleModelMultipleElementsCommonProperties GetSingleModelMultipleElementsCommonProperties(string accessToken, long fileId, List<string> elementIds, bool? includeOverrides = null) { return GetSingleModelMultipleElementsCommonProperties(accessToken, fileId, elementIds.ToArray(), includeOverrides); } 
测试

In BIMFACE console can see a list of files we uploaded a total of 2 files. Model states are successful conversion.

To “01_BIMFACE sample files -Revit model .rvt” example to test.

 

This test queries the 300067,282979,283330 build three common attributes. Complete list of properties as follows:

success
elementId:300067,282979,283330

SingleModelSingleElementEntity: 
[boundingBox=, 
 elementId=, 
 familyGuid=, 
 Guid=, 
 name=, 
 Properties=[group=基本属性, 
             items=[code=, extension=, key=specialty, orderNumber=,unit=,value=,valueType=]
                   [code=, extension=, key=familyId, orderNumber=,unit=,value=,valueType=]
                   [code=, extension=, key=systemType, orderNumber=,unit=,value=,valueType=]
                   [code=, extension=, key=building, orderNumber=,unit=,value=,valueType=]
            ]
            [group=标识数据, 
             items=[code=, extension=, key=OmniClass 标题, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=OmniClass 编号, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=URL, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=代码名称, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=制造商, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=图像, orderNumber=,unit=,value=,valueType=4]
                   [code=, extension=, key=型号, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=成本, orderNumber=,unit=,value=,valueType=2]
                   [code=, extension=, key=标记, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=注释, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=注释记号, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=类型图像, orderNumber=,unit=,value=,valueType=4]
                   [code=, extension=, key=类型标记, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=类型注释, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=说明, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=部件代码, orderNumber=,unit=,value=,valueType=3]
                   [code=, extension=, key=部件说明, orderNumber=,unit=,value=,valueType=3]
            ]
            [group=阶段化, 
             items=[code=, extension=, key=创建的阶段, orderNumber=,unit=,value=新构造,valueType=4]
                   [code=, extension=, key=拆除的阶段, orderNumber=,unit=,value=无,valueType=4]
            ]
            [group=限制条件, 
             items=[code=, extension=, key=偏移量, orderNumber=,unit=mm,value=0,valueType=2]
            ]
]

Test code is as follows:

//

Obtaining a plurality of members of common attributes

protected void btnGetSingleModelMultipleElementsCommonProperties_Click(object sender, EventArgs e) { FileConvertApi api = new FileConvertApi(); string[] elementIds = txtMultipleElementIds.Text.Split(","); var response = api.GetSingleModelMultipleElementsCommonProperties(txtAccessToken.Text, txtFileID.Text.ToLong(), elementIds, chkIncludeOverrides.Checked); txtResult.Text = response.Code.ToString2() + Environment.NewLine + "elementId:" + txtMultipleElementIds.Text + Environment.NewLine + response.Message.ToString2() + Environment.NewLine + response.Data.ToString(); }

 

系列目录     【已更新最新开发文章,点击查看详细】
 

Leave a Reply