[VBA] Need help with MDL Wrapper Function for mdlSheetDef_setBorderAttachmentId

The documentation when followed generates the following error message:

Bad DLL calling convention (Error 49)

While this error has a help page, it does not explain any specific corrective action that can be done.

The Wrapper statement, from the MDL help is:

Declare Function mdlSheetDef_getBorderAttachmentId Lib "stdmdlbltin.dll" ( ByVal sheetDefIn As Long , ByRef borderAttachmentIdOut As DLong ) As Long

There is also a property in the VBA SheetDefinition object named MdlSheetDef that, according to its help "Retrieves the associated SheetDef pointer that a program can use as an argument to MDL mdlSheetDef functions."

With no example, we cannot determine how to use this or even if this is the way to use the subject wrapper function.

We seem to have hit a brick wall on this and need help from a Bentley Programmer.

Parents
  • Jon - I will file a bug report on mdlSheetDef_setBorderAttachmentId, thank you for pointing this out.

    Charles - Although you could call mdlSheetDef_setBorderAttachmentId with CExpression similar to Item 1 below, your original question was on mdlSheetDef_getBorderAttachmentId.  Once you had the Sheet ID, what were you going to do with it after?  The reason I ask is if your end goal is to get/set the ModelReference Sheet Properties, than you could do so using the ModelReference Object directly, or via the Properties of the ModelReference Object via CreatePropertyHander using the current MdlSheetDef.  See Item 2 below.

    Thank you,
    Bob

    1. This is a sample setting a border attachment id:

      Dim theAddr As Long
      Dim id As DLong
      id.Low = 1111
      expr = "mdlSheetDef_setBorderAttachmentId((void*)" & theAddr & ", " & DLongToString(id) & ")"
      GetCExpressionValue expr
    2. This is a sample of SheetDefinition properties that you can get/set using - ModelRef Object and Properties

      ModelReference Object:
          Model Name: ModelSheetName
          Model Type: msdModelTypeSheet
          MasterUnit.Base: 1
          MasterUnit.Label: in
          MasterUnit.System: msdMeasurementSystemEnglish
          MasterUnit.UnitsPerBaseDenominator: 254
          MasterUnit.UnitsPerBaseNumerator: 10000
          StorageUnit.Base: 1
          StorageUnit.Label:
          StorageUnit.System: msdMeasurementSystemEnglish
          StorageUnit.UnitsPerBaseDenominator: 254
          StorageUnit.UnitsPerBaseNumerator: 10000
          SubUnit.Base: 1
          SubUnit.Label: th
          SubUnit.System: msdMeasurementSystemEnglish
          SubUnit.UnitsPerBaseDenominator: 254
          SubUnit.UnitsPerBaseNumerator: 100000
          UORsPerMasterUnit: 1000000
          UORsPerStorageUnit: 1000000
          UORsPerSubUnit: 100000
          ================================================================================
      ModelReference Object Properties:
          [ModelReference] object id (N/A) has (17) defined properties:
          [1] Name: ModelSheetName
          [2] Type: 1
          [3] IsActive: True
          [4] Is3D: False
          [5] TreatAs3D: False
          [6] CellType: 0
          [7] Description: ModelSheetDescr
          [8] DefaultRefLogical: ModelSheetLogicalName
          [9] PropagateAnnotationScale: True
          [10] AnnotationScale: 6000
          [11] IsEnabled: True
          [12] SheetOrigin: 10.0000in, 10.0000in
          [13] SheetWidth: 11
          [14] SheetHeight: 8.5
          [15] SheetRotation: 0.785398163397448
          [16] SheetNumber: 10
          [17] SheetName: PropertiesSheetName



Reply
  • Jon - I will file a bug report on mdlSheetDef_setBorderAttachmentId, thank you for pointing this out.

    Charles - Although you could call mdlSheetDef_setBorderAttachmentId with CExpression similar to Item 1 below, your original question was on mdlSheetDef_getBorderAttachmentId.  Once you had the Sheet ID, what were you going to do with it after?  The reason I ask is if your end goal is to get/set the ModelReference Sheet Properties, than you could do so using the ModelReference Object directly, or via the Properties of the ModelReference Object via CreatePropertyHander using the current MdlSheetDef.  See Item 2 below.

    Thank you,
    Bob

    1. This is a sample setting a border attachment id:

      Dim theAddr As Long
      Dim id As DLong
      id.Low = 1111
      expr = "mdlSheetDef_setBorderAttachmentId((void*)" & theAddr & ", " & DLongToString(id) & ")"
      GetCExpressionValue expr
    2. This is a sample of SheetDefinition properties that you can get/set using - ModelRef Object and Properties

      ModelReference Object:
          Model Name: ModelSheetName
          Model Type: msdModelTypeSheet
          MasterUnit.Base: 1
          MasterUnit.Label: in
          MasterUnit.System: msdMeasurementSystemEnglish
          MasterUnit.UnitsPerBaseDenominator: 254
          MasterUnit.UnitsPerBaseNumerator: 10000
          StorageUnit.Base: 1
          StorageUnit.Label:
          StorageUnit.System: msdMeasurementSystemEnglish
          StorageUnit.UnitsPerBaseDenominator: 254
          StorageUnit.UnitsPerBaseNumerator: 10000
          SubUnit.Base: 1
          SubUnit.Label: th
          SubUnit.System: msdMeasurementSystemEnglish
          SubUnit.UnitsPerBaseDenominator: 254
          SubUnit.UnitsPerBaseNumerator: 100000
          UORsPerMasterUnit: 1000000
          UORsPerStorageUnit: 1000000
          UORsPerSubUnit: 100000
          ================================================================================
      ModelReference Object Properties:
          [ModelReference] object id (N/A) has (17) defined properties:
          [1] Name: ModelSheetName
          [2] Type: 1
          [3] IsActive: True
          [4] Is3D: False
          [5] TreatAs3D: False
          [6] CellType: 0
          [7] Description: ModelSheetDescr
          [8] DefaultRefLogical: ModelSheetLogicalName
          [9] PropagateAnnotationScale: True
          [10] AnnotationScale: 6000
          [11] IsEnabled: True
          [12] SheetOrigin: 10.0000in, 10.0000in
          [13] SheetWidth: 11
          [14] SheetHeight: 8.5
          [15] SheetRotation: 0.785398163397448
          [16] SheetNumber: 10
          [17] SheetName: PropertiesSheetName



Children
No Data