---
# System prepended metadata

title: '# 0621 IFC Analysis'
tags: [BIM]

---

:::info
實作目標 : 商業棟3FL.ifc的某部分指向N3-1.ifc
方法 : 比較商業棟3FL.ifc及N3-1.ifc
:::
![](https://hackmd.io/_uploads/rk36Qzldh.png)


利用[ifcViewer](https://joyce-ifcjs.com/IfcViewer/index_web.html)查看商業棟3FL.ifc得到點擊的物件中的ifcType名稱為N3-1，藉此利用ifcType:N3-1去對應同為N3-1名稱的IFC檔案。
![](https://hackmd.io/_uploads/HJyjWmeO3.png)

但這樣會根據{ifcType_name}.ifc去對應，**但命名方式可能會根據設計者或是軟體不同而不同**。
![](https://hackmd.io/_uploads/H1DQX5Ud3.png)

`expressID:370406`在此對應到的是`ifcName`為`3F-N011`
![](https://hackmd.io/_uploads/rkfvHkdd2.png)

`expressID:352546`在此對應到的是`ifcType`為`N3-1`
![](https://hackmd.io/_uploads/ByYFHkudn.png)

程式碼
```javascript=
async function pick(event) {
  const found = cast(event)[0];
  if (found) {
    const index = found.faceIndex;
    const geometry = found.object.geometry;
    const ifc = ifcLoader.ifcManager;
    const id = ifc.getExpressId(geometry, index);
    const modelID = 0;
    const props = await ifc.getPropertySets(modelID,id)
    const ifctype = props[0].HasProperties
    console.log(ifctype)
    for(var i=0;i<ifctype.length;i++){
      var type=[]
      type.push(ifctype[i])
      //console.log(type[0].value)
      var a = new Promise(function(resolve, reject){
        resolve(ifc.getItemProperties(0,type[0].value));
      })
      a.then(function(value){
        console.log(value.NominalValue.value);
      })
      
    }
  }
}
```

下一步?
相同的協定?
> reference : [IFC-.js](https://ifcjs.github.io/info/docs/Guide/web-ifc-viewer/Tutorials/Picking)