IFCsvr ActiveX Object Reference

Template 1

[IFCsvr Home ]
Previous Chapter: IFCsvr.Attribute Object
Next Chapter: Sample 1

Read IFC Object model data from a file

This function template loads an IFC file into the IFCsvr component.

Public Function readFromFile() As Boolean


'Declare variables for the IFCsvr server
Dim objIFCsvr As IFCsvr.R200
Dim objDesign As IFCsvr.Design

'Declare the file system object
Dim objFileSystem As Scripting.FileSystemObject

'Declare a variable for the file name
Dim sFilename As String


'Get file name
'NOTE: This only works in VB enviroment
sFilename = Application.GetOpenFilename("IFC file (*.ifc),*.ifc")

'Create the file system object
Set objFileSystem = New Scripting.FileSystemObject

'Check is file exists
If objFileSystem.FileExists(sFilename) Then

'Check if the file is an IFC file
If UCase(Right(sFilename, 4)) = ".IFC" Then

'Create the server object : New IFCsvr.R200
Set objIFCsvr = New IFCsvr.R200

'Read in the file : OpenDesign(Filename)
Set objDesign = objIFCsvr.OpenDesign(sFilename)

'<Code to analyze the data in the IFC file>
'<that is now stored in the IFCsvr server >

'Report success to user
MsgBox (sFilename & " successfully analyzed")

'Report success to calling procedure
readFromFile = True


'Report failure to user
MsgBox (sFilename & " is not an IFC file")

'Report failure to the calling procedure
readFromFile = False

End If '...is an .IFC file


'Report failure to user
MsgBox ("File " & sFilename & " does not exist")

'Report failure to the calling procedure
readFromFile = False

End If '...file exists

'Clean up

Set objIFCsvr = Nothing
Set objDesign = Nothing
Set objFileSystem = Nothing

End Function

| IFCsvr Home | Previous Chapter | Next Chapter |

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