I'm using the RAM DataAccess API and not sure if I am using IModelGeometry1 in the VBA macro correctly. I ultimately want to populate a table with the Support type and Support ID for every beam, for both start and end joints. I initialized interfaces and followed with a loop for each beam. But I'm getting a compile error. Any help to correct the VBA below is much appreciated.
Dim IModelGeometry1 As RAMDATAACCESSLib.IModelGeometry1
Set IModelGeometry1 = RAMDataAcc1.GetDispInterfacePointerByEnum(IModelGeometry_INT)
R = 14 'start on this row
lNumBeams = IBeams.GetCount For lBeam = 0 To lNumBeams - 1 Set IBeam = IBeams.GetAt(lBeam) lUID = IBeam.lUID Cells(R, 2) = strStoryID Cells(R, 3) = IBeam.lLabel Cells(R, 4) = IBeam.strSectionLabel IModelGeometry1.GetBeamSupportInfo peSupportTypeStart, plSupportIDStart Cells(R, 5) = peSupportTypeStart Cells(R, 6) = plSupportIDStart R = R + 1 Next 'Beam
It appears that your call to IModelGeometry1.GetBeamSupportInfo is missing a few arguments. There should be five arguments. Here's a snipped from the DA manual.
GetBeamSupportInfo ([in] long IBeamID, [out] EUniqueMemberTypeID* peSupportTypeStart, [out] long* plSupportIDStart, [out] EUniqueMemberTypeID* peSupportTypeEnd, [out] long* plSupportIDEnd)
Answer Verified By: Chiang Ng
I just tried with five arguments and change that line as follows:
IModelGeometry1.GetBeamSupportInfo eTypeAll, peSupportTypeStart, plSupportIDStart, peSupportTypeEnd, plSupportIDEnd
Now I get this error message:
runtime error 2147497259 (80004005)
Method 'LoadDataBase' of Object 'IDBIO1' fail
The first argument should be the unique ID of the beam you are getting support information for. You are showing eTypeAll which is likely an enum and the method is expecting a long. However, this will not cause the error that you are seeing. Make sure the model you are trying to access is not open in RAM Structural System.If you are new to DA, I suggest looking at a few of the examples that exist on Be Communities. The DA Section Replace example is a good place to start. I'd recommend trying to modify it to get the support info rather than creating something from scratch.
https://communities.bentley.com/products/ram-staad/m/structural_analysis_and_design_gallery/141900
Answer Verified By: Seth Guthrie
Replacing the eTypeAll with the unique ID worked. Thank you.