IFCsvr ActiveX Object Reference


Sample 3

[IFCsvr Home ]
Previous Chapter: Sample 2
Next Chapter: Sample 4


Printing IFC Object attributes

This example works on Excel VBA module. This code prints attribute values of all IfcDoor obects in a model.

Sub TEST_BrowseObjects()

On Error Resume Next

  Dim r1 As Excel.Range
  Dim str1 As String

  Dim objIFCsvr As Object
  Dim objDesign As Object
  Dim objEntity As Object
  Dim objEntities As Object
  Dim objAtt As Object
  Dim vTemp As Variant
    
  Set r1 = ActiveSheet.Range("A8")
  
  Set objIFCsvr = CreateObject("IFCsvr.R200")
  Set objDesign = objIFCsvr.OpenDesign(ActiveSheet.Range("D3").Text)
  objDesign.FileDirectory ThisWorkbook.Path

  str1 = "IfcDoor"

  Set objEntities = objDesign.FindObjects(str1)
  r1.Value = "Object Count = " & objEntities.Count
  Set r1 = r1.Offset(1, 0)
  
  For Each objEntity In objDesign.FindObjects(str1)
    r1.Value = objEntity.Type
    r1.Offset(0, 1).Value = objEntity.GUID
    Set r1 = r1.Offset(1, 0)
   
    For Each  objAtt In objEntity.Attributes
      r1.Offset(0, 1).Value = objAtt.Name
       
      Select Case(objAtt.NodeType)
      Case 5 '  STR
        r1.Offset(0, 2).Value = objAtt.Value
      Case 7 ' REAL
        r1.Offset(0, 2).Value = objAtt.Value
      Case 16    ' ENUM
        r1.Offset(0, 2).Value = bjAtt.Value
      Case 18 '   STRUCT (ENTITY)
        r1.Offset(0, 2).Value = objAtt.Value.Type
      Case 19   ' UNION (SELECT)
        r1.Offset(0, 2).Value = objAtt.Value
      Case 20 ' AGGREGATE (ENTITIES)
        vTemp = objAtt.Value
        r1.Offset(0, 2).Value = UBound(objAtt.Value)
        If UBound(vTemp) > = 0 Then
          r1.Offset(0, 3).Value = vTemp(0).Type
        End If
      End Select
      
      Set r1 = r1.Offset(1, 0)
    Next objAtt
  Next objEntity
  
  Set objDesign = Nothing
  Set objIFCsvr = Nothing

End Sub

| IFCsvr Home | Previous Chapter | Next Chapter |


Copyright (c) 1999 SECOM Co., Ltd. Intelligent Systems Lab. All Rights Reserved.