IFCsvr ActiveX Object Reference


Sample 4

[IFCsvr Home ]
Previous Chapter: Sample 3
Next Chapter: Sample 5


Adding an object into Aggregation

This example works on Excel VBA module. When adding an object into an aggregation, AddItem function is used. This code makes a IFC data file that contains 4 IfcSpace objects and 3 IfcSpaceBoudary objects.

Public Sub test_Attribute()
  Dim objEntities As Object
  Dim objEntity As Object
  Dim objAttribute As Object
  Dim str1 As String
  Dim i As Long

  str1 = "BoundedBy"          ' Attribute name of IfcUnitAssignment
  
  ' ============================================================
  Set objIFCsvr = CreateObject("IFCsvr.R200")
  Set objDesign = objIFCsvr.newDesign("test.ifc")
  objDesign.FileDirectory ThisWorkbook.Path
  
  Set objEntity = getIfcSpace()
  Set objAttribute = objEntity.Attributes(str1)
  
  With objEntity
     .Attributes(str1).AddItem getIfcSpaceBoundary()
     .Attributes(str1).AddItem getIfcSpaceBoundary()
     .Attributes(str1).AddItem getIfcSpaceBoundary()
  End With

  Set objDesign = Nothing
  Set objIFCsvr = Nothing
End Sub

Private Function getIfcSpace() As Object
  Set getIfcSpace = objDesign.Add("IfcSpace")
End Function

Private Function getIfcSpaceBoundary() As Object
  Set getIfcSpaceBoundary = objDesign.Add("IfcSpaceBoundary")
End Function


| IFCsvr Home | Previous Chapter | Next Chapter |


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