IFCsvr ActiveX Object Reference

Sample 5

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

Adding an object into  SELECT TYPE aggregation

This example works on Excel VBA module. This code makes a IFC data file that contains 2 IfcUnitAssignment objects and 3 IfcSiUnit objects.

Public Sub test_ByVal()
  Dim objEntities As Object
  Dim str4 As String
  Dim str5 As String
  Dim i As Long

  str4 = "IfcNamedUnit"     ' TYPE name of IfcUnit SELECT TYPE (IfcNamedUnit, IfcDerivedUnit)
  str5 = "Units"            ' Attribute name of IfcUnitAssignment
  ' ============================================================
  Set objIFCsvr = CreateObject("IFCsvr.R200")
  Set objDesign = objIFCsvr.newDesign("test.ifc")
  objDesign.FileDirectory ThisWorkbook.Path
  With getIfcUnitAssignment()
     .Attributes(str5).AddSelectItem getIfcSiUnit(), str4
     .Attributes(str5).AddSelectItem getIfcSiUnit(), str4
     .Attributes(str5).AddSelectItem getIfcSiUnit(), str4
  End With
  Set objEntities = objDesign.FindObjects("IfcSiUnit")
  For i = 1 To objEntities.Count
    With getIfcUnitAssignment()
      .Attributes(str5).AddSelectItem objEntities.Item(i), str4
    End With
  Next i

  Set objDesign = Nothing
  Set objIFCsvr = Nothing
End Sub

Private Function getIfcUnitAssignment() As Object
  Set getIfcUnitAssignment = objDesign.Add("IfcUnitAssignment")
End Function

Private Function getIfcSiUnit() As Object
  Set getIfcSiUnit = objDesign.Add("IfcSiUnit")
End Function

| IFCsvr Home | Previous Chapter | Next Chapter |

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