DigiPara Liftdesigner LDX API
Loading...
Searching...
No Matches
Usage of BIM Property helper functions to copy/paste

API method: ILDXDocument5.DocumentBIMSettings

Treename: Document.

5 code examples follow.

Example 1: BIM Property Helpers: Disable All

 ' from Samples/Src/LDXAPIExamples/Example_LDXBIMProperties.vb


 ' for the samples: Mark that we're done with the BIM properties
 Private Shared Sub FinalizeDocumentBIMSettings(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
     ' have unneeded properties and standards removed
     ldxDocument.DocumentBIMSettings.Prune()

     ' notify of change. As of 22.0, this is a NOP, but may become important later. It costs nothing now.
     ldxDocument.DocumentBIMSettings.Object.SendChangeNotification("", "")

     ' enable BIM properties on document to make changes visible in the object BIM property window
     ldxDocument.Object.BIMExportMode = (ldxDocument.Object.BIMExportMode And Not DigiPara.LDX.BIMExportModes.bemExportPropertiesMask) Or DigiPara.LDX.BIMExportModes.bemExportPropertiesEnabled
 End Sub


 <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Document.", "LDXDocument~DocumentBIMSettings", "BIM Property Helpers: Disable All")>
 Public Shared Sub DisableAllBIMProperties_Sample(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
     InitializeDocumentBIMSettings(ldxDocument)

     DisableAllBIMProperties(ldxDocument)

     FinalizeDocumentBIMSettings(ldxDocument)
 End Sub

Example 2: BIM Property Helpers: Enable Standard Group

 ' from Samples/Src/LDXAPIExamples/Example_LDXBIMProperties.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Document.", "LDXDocument~DocumentBIMSettings", "BIM Property Helpers: Enable Standard Group")>
 Public Shared Sub SetAllBIMPropertyStandardsByGroup_Sample(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
     InitializeDocumentBIMSettings(ldxDocument)

     DisableAllBIMProperties(ldxDocument)

     ' enable all COBie properties
     SetAllBIMPropertyStandardsByGroup(ldxDocument, 5, True)

     FinalizeDocumentBIMSettings(ldxDocument)
 End Sub

Example 3: BIM Property Helpers: Enable By BP_RID List

 ' from Samples/Src/LDXAPIExamples/Example_LDXBIMProperties.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Document.", "LDXDocument~DocumentBIMSettings", "BIM Property Helpers: Enable By BP_RID List")>
 Public Shared Sub SetBIMPropertiesByBP_RID_Sample(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
     InitializeDocumentBIMSettings(ldxDocument)

     DisableAllBIMProperties(ldxDocument)

     ' activate some BIMobject SEEK properties
     Dim BP_RIDs As List(Of Long) = New List(Of Long)
     BP_RIDs.Add(400300078)
     BP_RIDs.Add(400300075)
     BP_RIDs.Add(400300068)
     SetBIMProperties(ldxDocument, BP_RIDs, True)

     FinalizeDocumentBIMSettings(ldxDocument)
 End Sub

Example 4: BIM Property Helpers: Enable By BP_ID List

 ' from Samples/Src/LDXAPIExamples/Example_LDXBIMProperties.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "Document.", "LDXDocument~DocumentBIMSettings", "BIM Property Helpers: Enable By BP_ID List")>
 Public Shared Sub SetBIMPropertiesByBP_ID_Sample(ByRef ldxDocument As DigiPara.LDX.LDXDocument)
     InitializeDocumentBIMSettings(ldxDocument)

     DisableAllBIMProperties(ldxDocument)

     ' activate some BIMobject SEEK properties (the same as in SetBIMPropertiesByBP_RID_Sample)
     Dim BP_IDs As List(Of String) = New List(Of String)
     BP_IDs.Add("ccdbb4ed-d5eb-4ef1-9ce0-3ac7118d7a75")
     BP_IDs.Add("f350c474-b8d3-4a38-9ae4-435328b0f38e")
     BP_IDs.Add("c2c6aec5-3bfe-4068-828a-32b159fd1e49")
     SetBIMProperties(ldxDocument, BP_IDs, True)

     ' get list of BP_IDs of active properties. The list will be longer than BP_IDs because we have a set of properties that cannot be turned off.
     Dim ActiveBP_IDs As List(Of String) = GetActiveBP_IDs(ldxDocument)

     FinalizeDocumentBIMSettings(ldxDocument)
 End Sub

Example 5: Modify Document BIM Properties

 ' from Samples/Src/LDXAPIExamples/Example_LDXBIMProperties.vb

    <APIHelpAttribute(APIHelpModes.FireCalcModel Or APIHelpModes.LoadLD3File, {APIHelpModes.InputParaLDXDoc}, "DocumentBIMSettings.", "LDXDocument~DocumentBIMSettings", "Modify Document BIM Properties")>
 Public Shared Sub DocumentBIMSettings(ByRef ldxDocument As DigiPara.LDX.LDXDocument)

     InitializeDocumentBIMSettings(ldxDocument)

     ' fetch the document wide BIM properties
     Dim documentBIMSettings As DigiPara.LDX.LDXDocumentBIMSettings = ldxDocument.DocumentBIMSettings
     Dim BIMSettings As DigiPara.LDX.LDXBIMSettings = documentBIMSettings.BIMSettings

     ' set all standards to default export mode
     documentBIMSettings.Set_All_BPS_MODE(DigiPara.LDX.BIMPropertyStandardModes.bpsmExportFromDocument, DigiPara.LDX.BIMPropertyStandardModes.bpsmExportMask)

     Dim documentBIMPropertyStandard As DigiPara.LDX.LDXBIMPropertyStandard

     ' fetch some standard
     documentBIMPropertyStandard = documentBIMSettings.Item(0)

     ' mark it as active
     documentBIMPropertyStandard.RetainInDocument = True
     ' The property is named "RetainInDocument" because as soon as you set it to true, the standard will not be culled away later in documentBIMSettings.Prune()
     ' Retained standards and properties are exported by default. Non-retained ones are no longer there at export time and are therefore not exported.

     ' fetch some other standard
     documentBIMPropertyStandard = documentBIMSettings.Item(1)

     ' mark it to be not retained
     documentBIMPropertyStandard.RetainInDocument = False

     ' property standards can be added
     documentBIMPropertyStandard = documentBIMSettings.Add()
     ' and removed
     documentBIMSettings.Remove(documentBIMPropertyStandard)
     ' standards added this way are considered project specific; we do not save them back to the database
     ' and do not remove them on updates from the database or during pruning.
     ' They also do not appear in the UI.

     ' the generic remove method also works
     documentBIMPropertyStandard = documentBIMSettings.Add()
     documentBIMPropertyStandard.Object.RemoveMe()

     ' add another custom BIM proprety standard, this time for keeping it
     documentBIMPropertyStandard = documentBIMSettings.Add()

     ' these are marked as project specific in their mode flags
     System.Diagnostics.Debug.Assert((documentBIMPropertyStandard.BPS_MODE And DigiPara.LDX.BIMPropertyStandardModes.bpsmProjectSpecific) = DigiPara.LDX.BIMPropertyStandardModes.bpsmProjectSpecific)

     ' give it some metadata
     With documentBIMPropertyStandard
         .BPS_NAME = "My Custom Standard"
         .BPS_DESC = "Project specific"
         .BPS_COMMENT = "Added by VB Sample " + NameOf(documentBIMSettings)
         .BPS_GRP_DESC = "My Custom Group"
         .BPS_GRP_IX = 9753

         ' activate export
         .BPS_MODE = (.BPS_MODE And Not DigiPara.LDX.BIMPropertyStandardModes.bpsmExportMask) Or DigiPara.LDX.BIMPropertyStandardModes.bpsmExportEnabled
     End With

     Dim documentBIMProperty As DigiPara.LDX.LDXBIMProperty

     ' add a custom property
     documentBIMProperty = documentBIMPropertyStandard.Add()
     With documentBIMProperty
         ' standard metadata
         .BP_NAME = "Custom Property for all Objects"
         .BP_DESC = "Project specific"
         .BP_COMMENT = "Added by VB Sample " + NameOf(documentBIMSettings)

         ' the rule gets evaluated every time someone requests .Value (on object properties)
         .BPR_RULE = "LDS(""Me.DisplayValue"")"

         ' mark this property as non-exported
         .BP_MODE = (.BP_MODE And Not DigiPara.LDX.BIMPropertyModes.bpmExportMask) Or DigiPara.LDX.BIMPropertyModes.bpmExportDisabled
     End With
     ' as with the project specific BIM standards, properties added this way are considered project specific
     ' and will be kept on updates from the database, unless of course you added them to a standard from the database
     ' that has been deleted since.

     documentBIMProperty = documentBIMPropertyStandard.Add()
     With documentBIMProperty
         .BP_NAME = "Property just for LDXCar and LDXCarFrame"

         ' this property gets a filter set so it only applies to specific object classes
         .BPR_LDXTYPES = "LDXCar, LDXCarFrame"

         ' this rule evaluates to a length 
         .BPR_RULE = "LD(""Me.DIM101"")"
         .BP_TYPE = DigiPara.LDX.BIMPropertyType.bptFloat

         ' A length has a unit we need to property define; see L_UnitTab for possibilities.
         ' Here, the rule just evaluates to whatever the project length units are (mm or inch), so the very first unit is
         ' appropriate.
         .BP_U_RID = 400300000

         ' mark this property as exported (is already the default)
         .BP_MODE = (.BP_MODE And Not DigiPara.LDX.BIMPropertyModes.bpmExportMask) Or DigiPara.LDX.BIMPropertyModes.bpmExportEnabled
     End With

     documentBIMProperty = documentBIMPropertyStandard.Add()
     With documentBIMProperty
         .BP_NAME = "Property just for the landing doors"

         ' this property gets a filter set so it only applies to objects with treename ending in "ShaftDoor."
         .BPR_TREENAME_FILTER = "Shaft*.Entries*.E*.ShaftDoor."

         ' this property is a generic integer (some count)
         .BPR_RULE = "7"
         .BP_TYPE = DigiPara.LDX.BIMPropertyType.bptInteger
         ' when exporting to IFC, we can explicitly specify the value type to use here:
         .BP_IFC_TYPE = "IfcQuantityCount"
     End With

     documentBIMProperty = documentBIMPropertyStandard.Add()
     With documentBIMProperty
         .BP_NAME = "Property just for IFC 4.0"
         .BP_COMMENT = "Via BP_FILTER_FLAGS"

         ' set flags; there are also .BPS_FILTER_FLAGS at the BIMPropertyStandard level to control export of entire Standards (or PSETs on the IFC side) in the same way
         .BP_FILTER_FLAGS = (.BP_FILTER_FLAGS And Not DigiPara.LDX.BIMFilterFlags.bffIFCMask) Or DigiPara.LDX.BIMFilterFlags.bffIFC_4_0

         .BPR_RULE = """Only IFC 4.0"""
         .BP_TYPE = DigiPara.LDX.BIMPropertyType.bptText
     End With

     documentBIMProperty = documentBIMPropertyStandard.Add()
     With documentBIMProperty
         .BP_NAME = "Property only for higher LOD document levels"
         .BP_COMMENT = "Via BP_FILTER_FLAGS"

         ' set flags
         .BP_FILTER_FLAGS = (.BP_FILTER_FLAGS And Not DigiPara.LDX.BIMFilterFlags.bffLodMask) Or DigiPara.LDX.BIMFilterFlags.bffLod400 Or DigiPara.LDX.BIMFilterFlags.bffLod500

         .BPR_RULE = """Only LOD 400 and up"""
         .BP_TYPE = DigiPara.LDX.BIMPropertyType.bptText
     End With

     ' so far, all properties had only one rule and they were either active and inactive; as of LD 2025, it is possible to add multiple rules and the matching one with the lowest BPR_IX gets applied
     documentBIMProperty = documentBIMPropertyStandard.Add()
     With documentBIMProperty
         .BP_NAME = "Property with multiple rules"
         .BP_TYPE = DigiPara.LDX.BIMPropertyType.bptText

         ' add one rule for the car
         With .AddRule
             .BPR_IX = 1000
             .BPR_LDXTYPES = "LDXCar"
             .BPR_RULE = """I am a car"""
         End With

         ' add another rule for the shaft
         With .AddRule
             .BPR_IX = 1001
             .BPR_LDXTYPES = "LDXShaft"
             .BPR_RULE = """I am a shaft"""
         End With

         ' add another rule, disabling the property for the car frame
         With .AddRule
             .BPR_IX = 1002
             .BPR_LDXTYPES = "LDXCarFrame"
             .BPR_MODE = DigiPara.LDX.BIMPropertyRuleModes.bprmExportDisabled
         End With
         ' Note: the filters above are mutually exlcusive, so setting .BPR_IX is not really required for proper operation; 
         ' however, it Is good practice to do so anyway so it Is Not forgotten in the few cases where it does matter

         ' fallback rule is always the rule with no type or treename filters; if none exists, one is created with a high BPR_IX (9999)
         With .FallbackRule
             .BPR_RULE = """I don't know what I am"""
         End With

         ' after changing the rules, one should always sort them by IX
         .SortRules()
     End With

     ' add another custom BIM proprety standard, only for specific IFC types
     documentBIMPropertyStandard = documentBIMSettings.Add()

     ' give it some metadata
     With documentBIMPropertyStandard
         .BPS_NAME = "Only for IfcTransportElement"
         .BPS_COMMENT = "Added by VB Sample " + NameOf(documentBIMSettings)
         .BPS_GRP_DESC = "My Custom Group"
         .BPS_GRP_IX = 9753

         ' This can be a comma separated list of different IFC class names; only if the "DigiPara.IfcExportAs" property matches one in here (or a subtype), the standard is exported.
         ' This is mostly useful for PSETS that are only allowed on certain IFC classes.
         .BPS_VALID_IFC_TYPES = "IfcTransportElement"

         ' activate export
         .BPS_MODE = (.BPS_MODE And Not DigiPara.LDX.BIMPropertyStandardModes.bpsmExportMask) Or DigiPara.LDX.BIMPropertyStandardModes.bpsmExportEnabled

         ' add one generic property
         documentBIMProperty = .Add()
         With documentBIMProperty
             .BP_NAME = "Property Only for IfcTransportElement"
             .BP_COMMENT = "Added by VB Sample " + NameOf(documentBIMSettings)
             .BPR_RULE = "LDS(""Me.DisplayValue"")"
         End With

     End With



     ' A default document specific standard that *is* shown in the UI is predefined as this:
     documentBIMPropertyStandard = documentBIMSettings.ProjectSpecificStandard
     ' activate its export
     documentBIMPropertyStandard.BPS_MODE = (documentBIMPropertyStandard.BPS_MODE And Not DigiPara.LDX.BIMPropertyStandardModes.bpsmExportMask) Or DigiPara.LDX.BIMPropertyStandardModes.bpsmExportEnabled

     documentBIMProperty = documentBIMPropertyStandard.Add()
     With documentBIMProperty
         .BP_NAME = "CustomProperty"

         ' bptText is already the default, we set it here anyway
         .BP_TYPE = DigiPara.LDX.BIMPropertyType.bptText
         .DefaultValue = "DefaultValue"
     End With

     ' in the database, every property can have multiple L_BIMPropertyRuleTab entries associated with it,
     ' then for each object, the first rule with matching BPR_LDXTYPES and BPR_TREENAME_FILTER gets activated.
     ' The project specific properties defined here only have one rule, so there all properties with matching 
     ' filters get applied, those without matching filters are ignored.

     ' as with BIM standards, you can remove individual properties in two ways
     documentBIMProperty = documentBIMPropertyStandard.Add()
     documentBIMPropertyStandard.Remove(documentBIMProperty)

     documentBIMProperty = documentBIMPropertyStandard.Add()
     documentBIMProperty.Object.RemoveMe()

     ' You can retain a standard, but still not export it:
     documentBIMPropertyStandard.ExportEnabled = False
     ' however, there is no button in the UI to undo this, it's completely invisible to the user. So better don't.
     documentBIMPropertyStandard.ExportEnabled = True

     ' and finally, you can trigger the deletion of unused standards and properties by calling Prune().
     documentBIMSettings.Prune()

     ' notify of change.
     documentBIMSettings.Object.SendChangeNotification("", "")
     ' This syncs the document BIM properties to all object BIM properties the project may already have.
 End Sub