DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Create BIM exchange files

API method: ILDXSheetFrame5.CreateBIMExchangeZip

Treename: Sheets.LdvSheet1.LdvFrame2.

9 code examples follow.

Example 1: Create BIM exchange file (plain)

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example BIM.ldbim"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create BIM exchange file (plain)")>
 Public Shared Sub CreateBIMExchangeFiles(ByRef ldxDocument As DigiPara.LDX.LDXDocument, BIMZipFilePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     ' LDBIM exports contain RFA prototype families. This document property determines which Revit version they are compatible with. The minimum
     ' is Revit 2018.
     ldxDocument.DocumentBIMSettings.TARGET_REVIT_VERSION = 2018

     frame.CreateBIMExchangeZipEx(BIMZipFilePath, "", "", DigiPara.LDX.CreateBIMExchangeFileModes.cbefmNone)

 End Sub

Example 2: Create BIM exchange files from a specific root object

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example BIM Only LDXCar.ldbim"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create BIM exchange files from a specific root object")>
 Public Shared Sub CreateBIMExchangeFilesFromRoot(ByRef ldxDocument As DigiPara.LDX.LDXDocument, BIMZipFilePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     frame.CreateBIMExchangeZipEx(BIMZipFilePath, "Shaft0.Car.", "", DigiPara.LDX.CreateBIMExchangeFileModes.cbefmNone)

 End Sub

Example 3: Create BIM exchange file with class filters

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example BIM ClassFilter.ldbim"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create BIM exchange file with class filters")>
 Public Shared Sub CreateBIMExchangeFilesWithFilter(ByRef ldxDocument As DigiPara.LDX.LDXDocument, BIMZipFilePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     frame.CreateBIMExchangeZipEx(BIMZipFilePath, "", "+LDXCar, +LDXDoor, -", DigiPara.LDX.CreateBIMExchangeFileModes.cbefmNone)

 End Sub

Example 4: Create BIM exchange file with combined components

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example BIM Combine.ldbim"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create BIM exchange file with combined components")>
 Public Shared Sub CreateBIMExchangeCombineObjects(ByRef ldxDocument As DigiPara.LDX.LDXDocument, BIMZipFilePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     ' class filter like above, but also combine the geometry according to BIM settings, this creates fewer .DWG files.
     ' By default, this would export everything as a single shaft.dwg, we at least want the car (together with its door)
     ' in its own .dwg, so we add the bemExportAsSingleObject export mode flag to it.
     Dim car = ldxDocument.GetLDXObject("Shaft0.Car.")
     car.BIMExportMode = (car.BIMExportMode And Not DigiPara.LDX.BIMExportModes.bemExportPropertiesMask) Or DigiPara.LDX.BIMExportModes.bemExportPropertiesEnabled
     Dim shaft = ldxDocument.GetLDXObject("Shaft0.")
     shaft.BIMExportMode = (shaft.BIMExportMode And Not DigiPara.LDX.BIMExportModes.bemExportPropertiesMask) Or DigiPara.LDX.BIMExportModes.bemExportPropertiesEnabled

     frame.CreateBIMExchangeZipEx(BIMZipFilePath, "", "+LDXCar, +LDXDoor, -", DigiPara.LDX.CreateBIMExchangeFileModes.cbefmUseBIMExportModes)

 End Sub

Example 5: Create BIM exchange file with car ghosts

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example BIM Ghost.ldbim"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create BIM exchange file with car ghosts")>
 Public Shared Sub CreateBIMExchangeFilesWithGhosts(ByRef ldxDocument As DigiPara.LDX.LDXDocument, BIMZipFilePath As String)

     ' this sample exports the active frame
     Dim frame As DigiPara.LDX.LDXSheetFrame = ldxDocument.Sheets?.ActiveSheet?.ActiveSheetFrame

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     ' to keep the export small, we can choose to only export car and ghost here with class filters
     ' frame.ClassFilters = "+LDXCar, +LDXSymbol, -LDXObject"

     ' switch frame to 3D mode
     frame.Reset(DigiPara.LDX.SheetFrameViewType.shfvt3D, DigiPara.LDX.SheetFrameViewDirections.shfvdToFrontWall, DigiPara.LDX.SheetFrameResetOptions.shfrrstInitText)
     ' and BIM export mode
     frame.FrameMasqueradeMode = DigiPara.LDX.SheetFrameMasqueradeModes.shfrmmTypeBIMExport
     ' if you export without the cbefmKeepViewFrameSettings flag below, both have no effect and can be removed; with cbefmKeepViewFrameSettings, however, 
     ' you have better control over the output.

     ' remove overwrites that hide the ghosts
     ' this is only required because we call frame.Reset with SheetFrameResetOptions other than shfrrstNone AND
     ' we pass cbefmKeepViewFrameSettings to the BIM export below.
     frame.SheetFrameOverwrites.DeleteKey("Shaft*.Car.Components.Symbol5.", DigiPara.LDX.SheetFrameOverwriteType.sfoLOD)
     frame.SheetFrameOverwrites.DeleteKey("Shaft*.CW.Components.Symbol5.", DigiPara.LDX.SheetFrameOverwriteType.sfoLOD)

     If False Then
         ' activate separate BIM properties for all symbols, causing them to be exported as individual objects
         ' the disadvantage of this method is that it will not persist, the ClassBIMSettings get culled if
         ' they are not enabled via    LDX_TYPE_ASSIGNABLE in the database.
         Dim settings As DigiPara.LDX.LDXIndividualBIMSettings = ldxDocument.DocumentBIMSettings.ClassBIMSettingsByObjectId(DigiPara.LDX.ObjectId.idSymbol).IndividualBIMSettings
         settings.BIMExportMode = settings.BIMExportMode Or DigiPara.LDX.BIMExportModes.bemExportPropertiesEnabled
         ' Actually, the settings should be pruned away already before the BIM export (as of LD 2024.0.065), so no idea how this even worked
     Else
         ' we need the frame to be built at least once for the ghosts to exist (just to be safe; this should do nothing)
         frame.CalculateModelBarrierAcquire()

         ' alternatively, one can activate the same flag on specific LDXObjects (only one of the two is required, we just have both active here for instructional purposes)
         For Each shaft As DigiPara.LDX.LDXShaft In ldxDocument.Shafts
             Dim ghost As DigiPara.LDX.LDXObject = shaft.Car.Object.GetObjectByRelativeName("Components.Symbol5.")
             ghost.BIMExportMode = ghost.BIMExportMode Or DigiPara.LDX.BIMExportModes.bemExportPropertiesEnabled

             ' while we are here, we can give the ghost a better family name in Revit by setting the DigiPara/DigiPara.RevitTargetName property 
             ' (see Example_LDXBIMProperties.vb for documentation on LDXBIMPropertyValue
             Dim targetName As DigiPara.LDX.LDXBIMPropertyValue = ghost.ForceObjectBIMSettings.Values.ValueByBP_ID("6e2d61d4-0747-4f75-99f6-4a0350c74166")
             targetName.EvaluationEnabled = False
             targetName.Value = "CarGhost"

             ' same for the CW ghost
             ghost = shaft.CWConsole.Object.GetObjectByRelativeName("Components.Symbol5.")
             ghost.BIMExportMode = ghost.BIMExportMode Or DigiPara.LDX.BIMExportModes.bemExportPropertiesEnabled

             targetName = ghost.ForceObjectBIMSettings.Values.ValueByBP_ID("6e2d61d4-0747-4f75-99f6-4a0350c74166")
             targetName.EvaluationEnabled = False
             targetName.Value = "CWGhost"
         Next
     End If

     ' pass an extra +LDXSymbol class filter to the bim export to make sure the symbols get exported
     frame.CreateBIMExchangeZipEx(BIMZipFilePath, "", "+LDXSymbol", DigiPara.LDX.CreateBIMExchangeFileModes.cbefmKeepViewFrameSettings)

 End Sub

Example 6: Create BIM exchange file with combined components, car only

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example BIM Combine Car Only.ldbim"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create BIM exchange file with combined components, car only")>
 Public Shared Sub CreateBIMExchangeCombineObjectsCarOnly(ByRef ldxDocument As DigiPara.LDX.LDXDocument, BIMZipFilePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     ' see what happens if you combine a root object with object merging
     Dim car = ldxDocument.GetLDXObject("Shaft0.Car.")
     car.BIMExportMode = (car.BIMExportMode And Not DigiPara.LDX.BIMExportModes.bemExportPropertiesMask) Or DigiPara.LDX.BIMExportModes.bemExportPropertiesDisabled
     frame.CreateBIMExchangeZipEx(BIMZipFilePath, "Shaft0.Car.", "", DigiPara.LDX.CreateBIMExchangeFileModes.cbefmUseBIMExportModes)

     ' object merging wins, the entire document gets exported. Fine enough.
 End Sub

Example 7: Create Revit Family

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example.rfa"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create Revit Family")>
 Public Shared Sub CreateRFA(ByRef ldxDocument As DigiPara.LDX.LDXDocument, filePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     ' function of mode bits is identical to the similarly named bits for ldBIM exports.
     Dim modes As DigiPara.LDX.SheetsCreateFileOptions = DigiPara.LDX.SheetsCreateFileOptions.shcfopNone
     ' shcfopExportBIMProperties activates BIM property export.
     modes = modes Or DigiPara.LDX.SheetsCreateFileOptions.shcfopExportBIMProperties
     ' shcfopKeepViewFrameSettings leaves the geometry as displayed, including shaft blocks. This is not usually wanted.
     ' modes = modes or DigiPara.LDX.SheetsCreateFileOptions.shcfopKeepViewFrameSettings

     frame.CreateFileEx(DigiPara.LDX.DocumentCreateFileType.cfRFA, filePath, modes)
 End Sub

Example 8: Create IFC Export

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example.ifc"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create IFC Export")>
 Public Shared Sub CreateIFC(ByRef ldxDocument As DigiPara.LDX.LDXDocument, filePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     ' function of mode bits is identical to the similarly named bits for ldBIM exports.
     Dim modes As DigiPara.LDX.SheetsCreateFileOptions = DigiPara.LDX.SheetsCreateFileOptions.shcfopNone
     ' shcfopExportBIMProperties activates BIM property export.
     modes = modes Or DigiPara.LDX.SheetsCreateFileOptions.shcfopExportBIMProperties
     ' shcfopKeepViewFrameSettings leaves the geometry as displayed, including shaft blocks. This is not usually wanted.
     ' modes = modes or DigiPara.LDX.SheetsCreateFileOptions.shcfopKeepViewFrameSettings

     frame.CreateFileEx(DigiPara.LDX.DocumentCreateFileType.cfIFC4, filePath, modes)
 End Sub

Example 9: Create IFCZip Export

 ' from Samples/Src/LDXAPIExamples/Example_LDXSheetFrame.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc, APIHelpModes.InputParaDesktopWithOtherFileName, "API Example.ifczip"}, "Sheets.LdvSheet1.LdvFrame2.", "LDXSheetFrame~CreateBIMExchangeZip", "Create IFCZip Export")>
 Public Shared Sub CreateIFCZip(ByRef ldxDocument As DigiPara.LDX.LDXDocument, filePath As String)

     Dim frame As DigiPara.LDX.LDXSheetFrame = FindBIMExportFrame(ldxDocument)

     If frame Is Nothing Then
         MsgBox("No suitable frame found!")
         Exit Sub
     End If

     ' function of mode bits is identical to the similarly named bits for ldBIM exports.
     Dim modes As DigiPara.LDX.SheetsCreateFileOptions = DigiPara.LDX.SheetsCreateFileOptions.shcfopNone
     ' shcfopExportBIMProperties activates BIM property export.
     modes = modes Or DigiPara.LDX.SheetsCreateFileOptions.shcfopExportBIMProperties
     ' shcfopKeepViewFrameSettings leaves the geometry as displayed, including shaft blocks. This is not usually wanted.
     ' modes = modes or DigiPara.LDX.SheetsCreateFileOptions.shcfopKeepViewFrameSettings

     ' shcfopIFCZip wraps the exported IFC file into a zip archive, conforming to the IFCZip standard that most importers understand seamlessly.
     modes = modes Or DigiPara.LDX.SheetsCreateFileOptions.shcfopIFCZip

     frame.CreateFileEx(DigiPara.LDX.DocumentCreateFileType.cfIFC4, filePath, modes)
 End Sub