1. 根据模型解析数据创建物项
根据模型解析数据创建物项。
请求方式:POST
请求地址:/bosdesignservice/{appKey}/tags/model-copy
1.1. 请求参数:
Headers:
参数名 | 类型 | 示例 | 是否必填 | 参数含义 |
---|---|---|---|---|
Authorization | string | c4570cb9ca324bc8ba7dd9d1967710ea | 是 | access_token |
PathParas:
参数名 | 类型 | 示例 | 是否必填 | 参数含义 |
---|---|---|---|---|
appKey | string | xb05cd3a35614caa85c0f8f86c58fcc1 | 是 | 应用Key |
SearchParas:
参数名 | 类型 | 示例 | 是否必填 | 参数含义 |
---|---|---|---|---|
transactionCode | string | tag-001 | 否 | 业务事务编码 |
Body:
application/json:
{
"bosclass": "tags",
"modelKey": " #3D模型key",
"modelDB": " #模型所在3D库,登陆接口成功后返回的modelDB",
"componentQuery": {
"nestOr": [
{
"field": "attribute['其他']['类别'] #存放在模型构件attribute中的构件属性",
"operator": "like #匹配规则 精确查询,模糊查询等等",
"value": "zhao # 值",
"number": "false #比较时将内容转化为数字后再比较"
},
{
"nestAnd": [
{
"field": "name #存放在模型构件attribute中的构件属性",
"operator": "== # 匹配规则 精确查询,模糊查询等等",
"value": "三通 # 值",
"number": "false"
},
{
"...": "...."
}
]
}
]
}
}
1.2. 参数说明:
参数名 | 类型 | 示例 | 是否必填 | 参数含义 |
---|---|---|---|---|
configFile | file | 无 | 是 | 具体映射关系配置文件 |
1.3. 正确返回:
Http Status Code:200
{
"code": "SUCCESS",
"message": "请求处理成功",
"data": "{taskId}"
}
#taskId为模型拷贝任务Id
1.4. 状态码:
状态码 | code | message | data | 原因 |
---|---|---|---|---|
200 | ENTITY_BOSCLASS_NOTFOUND | 实体类{entity}不存在 | NULL | 当传入bosclass不存在时 |
200 | ENTITY_BOSCLASS_INVALID | 实体类{entity}值无效 | NULL | 当传入bosclass非tags类或其子孙类时 |
200 | ENTITY_QUERY_NUMBER | number为true、operator为非数字运算符{operator} | NULL | 如nestAnd/nestOr参数中number值为true,但operator值为like |
200 | ENTITY_QUERY_NUMBER | value参数值{value }非数字 | NULL | 如nestAnd/nestOr参数中number值为true,但value值无法转换为数字 |
200 | ENTITY_QUERY_NUMBER | number参数值{number}无效 | NULL | 如nestAnd/nestOr参数中number值为true、false、空以外的其他值 |
200 | CONFIGFILE_REQUIRED | 映射关系配置文件缺失 | NULL | 如configFile未提供 |
200 | CONFIGFILE_FORMAT_WRONG | 映射关系配置文件格式错误 | NULL | configFile文件格式错误 |
200 | OBJECT_REQUIREDFIELD_EMPTY | XXX属性必填 | NULL | 如创建Tag时缺少必填字段 |
200 | ENTITY_NAME_INVALID | 实体对象name属性值无效 | NULL | 当tags对象的name包含※时 |
200 | MODEL_NOT_FOUND | 模型({modelKey})不存在 | NULL | 当modelKey对应的模型在3D库中不存在时 |
200 | PARSE_NOT_FINISHED | 模型({modelKey})尚在解析中 | NULL | 当modelKey对应的模型尚未完成解析时 |
200 | PARSE_FAILED | 模型({modelKey})解析失败 | NULL | 当modelKey对应的模型解析失败时 |
200 | DATABASE_NOT_FOUND | 3D库({modelDB})不存在 | NULL | 当modelDB对应的3D库不存在时 |
1.5. 注意事项:
1.5.1. tags与模型解析数据属性映射规则
导入文件使用xmlData标签包围映射规则,内部使用标签
<attribute sourceAttribute="att1" targetAttribute="att2" defaultValue="aaa" disabled=" true "/>
sourceAttribute属性值可以通过函数来配置
函数 | 说明 |
---|---|
SPLITONE(att1,’/’,2) | 表示对源属性att1,以"/"字符为分隔符进行分割,并返回第2个值 |
CONCAT(att1,att2,att3) | 表示拼接源属性att1、att2、att3的值,拼接结果:{att1}{att2}{att3} |
CONCAT_SEPARATOR(’sep’,att1,att2,att3) | 表示拼接源属性att1、att2、att3的值,属性之间使用分隔符sep连接,拼接结果:{att1}sep{att2}sep{att3} |
<attribute sourceAttribute="SPLITONE(att1,’/’,2)" targetAttribute="att2" defaultValue="aaa" disabled="true"/>
示例如下:
<?xml version="1.0" encoding="utf-8"?>
<xmlData bosclass="tags" primaryKey="code" updateType="replace">
<!-- bosclass表示抽取的对象,可以是任意实体类或关系类,attribute为实体类的属性。当没有配置bosclass时,默认抽取为tags,且创建tagModelRels关系 -->
<!-- primaryKey是实体的主键,用来判断是否重复,如已存在,则更新,多个属性用英文逗号,隔开 -->
<!-- updateType是当实体重复时,指定更新类型,update(更新新的属性,旧的属性不变)或replace(完全替换旧的属性)或ignore(忽略,不作更新或替换),默认update -->
<attribute sourceAttribute="key" targetAttribute="componentKey" />
<attribute sourceAttribute="model" targetAttribute="modelKey" />
<attribute sourceAttribute="attribute[文字][构件名称]" targetAttribute="name" />
<!-- attribute为object类型数据,可以定位到指定的属性,用[]表示具体属性 -->
<attribute sourceAttribute="attribute[限制条件]" targetAttribute="basicAttribute[限制条件]" />
<!-- object类型数据可只抽取部分属性,如上所示,可以指定到任意层 -->
<attribute sourceAttribute="attribute['约束']['底部约束']" targetAttribute="elevation" />
<attribute sourceAttribute="attribute['约束']['标高']" targetAttribute="elevation" />
<!-- 一个target属性可以有多个sourceAttribute来源,配置多个时,以第一个不为空的值为准,如上,当构件有attribute['约束']['底部约束']时,elevation值为attribute['约束']['底部约束'],当没有attribute['约束']['底部约束']属性时,elevation值为attribute['约束']['标高'] -->
<!-- 以下为抽取实体的同时,配置关联关系,有两种配置方式,以locations举例 -->
<!-- 方式一:通过配置一个或多个属性,查找要关联的对象,并建立关联关系 -->
<locations relation="irLocationTag" relationType="from" attr1="type" attr2="name">
<!-- locations为抽取实体要关联的对象;relation表示关联关系;relationType为关联对象的类型,为from或to。当通过关联对象可以确定关联关系时,relation或relationType可省略;当关联关系需要保存除bosclass(bosclass为relation的值)之外的其他属性时,配置在relation和relationType之后,如上所示,值为对应的配置属性 -->
<attribute name="name" />
<attribute code="'xxxxxxx'" /><!--通过指定关键字段code查询locations,查询结果与tags关联,值可为attribute定义的targetAtttibute,也可以为常量,用英文单引号引起来-->
</locations>
<!-- 方式二:根据构件类型,配置作为code的属性,查找locations,并建立关联关系;这种方式适用于构件的类型不同时,code取值不同的模型 -->
<locations> <!-- 此处配置与方式一相同 -->
<attribute type="房间" attribute="basicAttribute['限制条件']['标高']" value="SPLITONE('_',1)"/>
<!-- 表示当tags的type(此时type需要配置为抽取属性)为"房间"时,取tags的attribute['限制条件']['标高']的值,用下划线隔开,取第一个值作为locations的code,查找到locations并建立关联关系;当属性不需要分割时value可不配置 -->
<attribute type="IfcMember" attribute="basicAttribute['限制条件']['底部标高']" value="SPLITONE('_',1)"/>
</locations>
<!-- 使用第二种方式时,需要把构件的所有类型都配置出来,否则没有配置的类型将不创建关联关系 -->
</xmlData>
示例:
三维构件部分数据:
{
"BuildInCategory": "OST_Rooms",
"attribute": {
"标识数据": {
"编号": "1821",
"名称": "房间",
"图像": "<无>"
},
"限制条件": {
"标高": "F20_77.000",
"上限": "F20_77.000",
"高度偏移": "3800",
"底部偏移": "0"
},
"尺寸标注": {
"面积": "1.70",
"周长": "6252",
"房间标示高度": "3800",
"体积": "0.00",
"计算高度": "0"
},
"阶段化": {
"相位": "新构造"
},
"文字": {
"构件编码": "F20_土建",
"房间编码": "BG-F20-032"
}
},
"geoFilePath": "Z3JvdXAxLE0wMC9ENC82OS93S2dIQmwzRkNMYUFKcDhQQUFBSE9tUDFGT3cyOS5qc29u",
"guid": "12855221207869",
"materials": [
"d5221d0e4162499eacdf890c82a91fba"
],
"matrix": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
"maxBoundary": {
"x": -29327,
"y": -17879,
"z": 80800
},
"minBoundary": {
"x": -31752,
"y": -18580,
"z": 77000
},
"model": "M1573193906599",
"name": "房间 1821",
"originalId": 0,
"parentId": 0,
"primitives": 12,
"type": "房间",
"version": 0
}
映射文件配置:
<?xml version="1.0" encoding="utf-8"?>
<xmlData bosclass="tags" primaryKey="component_guid">
<!-- primaryKey配置为component_guid,当匹配到tag的component_guid相同时,将当前抽取属性更新至该tag-->
<attribute sourceAttribute="key" targetAttribute="componentKey" />
<attribute sourceAttribute="model" targetAttribute="modelKey" />
<attribute sourceAttribute="name" targetAttribute="name" />
<attribute sourceAttribute="guid" targetAttribute="component_guid" />
<attribute sourceAttribute="type" targetAttribute="type"/>
<attribute sourceAttribute="attribute[尺寸标注][面积]" targetAttribute="area" />
<attribute sourceAttribute="attribute[限制条件][标高]" targetAttribute="elevation" />
<attribute sourceAttribute="SPLITONE(attribute[限制条件][标高],'_',1)" targetAttribute="floor" />
<attribute sourceAttribute="attribute" targetAttribute="basicAttribute" />
<!-- 以下为抽取实体的同时,配置关联关系,有两种配置方式,以locations举例,二者根据情况选择一种配置即可 -->
<!-- 方式一:通过配置一个或多个属性,查找要关联的对象,并建立关联关系 -->
<locations> <!-- locations和tags只有一个关联关系时,relation和relationType可不配置-->
<attribute code="floor" /> <!--查找code值为attribute配置的floor值的locations实体,将查询结果与tags关联-->
</locations>
<!-- 方式二:根据构件类型,配置作为code的属性,查找locations,并建立关联关系,需要配置type属性 -->
<locations>
<attribute type="房间" attribute="basicAttribute[限制条件][标高]" value="SPLITONE('_',1)"/>
<!-- 当tags的type为"房间"时,取tags的basicAttribute[限制条件][标高]的值,用下划线隔开,取第一个值作为locations的code属性,查找到locations实体并建立关联关系 -->
<attribute type="结构框架" attribute="basicAttribute[限制条件][参照标高]" value="SPLITONE('_',1)"/><!-- 当tags的type为"结构框架"时,取tags的basicAttribute[限制条件][参照标高]的值,用下划线隔开,取第一个值作为locations的code属性,查找到locations实体并建立关联关系 -->
</locations>
</xmlData>