sdaiGetAttrBN
Table 1 – Required value buffer depending on valueType (on the example of sdaiGetAttrBN but valid for all get-functions)
valueType C/C++ C#
sdaiINTEGER int_t val; int_t val;
sdaiGetAttrBN (inst, "attrName", sdaiINTEGER, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiINTEGER, out val);
sdaiREAL or sdaiNUMBER double val; double val;
sdaiGetAttrBN (inst, "attrName", sdaiREAL, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiREAL, out val);
sdaiBOOLEAN bool val; bool val;
sdaiGetAttrBN (inst, "attrName", sdaiBOOLEAN, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiBOOLEAN, out val);
sdaiLOGICAL const TCHAR* val; string val;
sdaiGetAttrBN (inst, "attrName", sdaiLOGICAL, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiLOGICAL, out val);
sdaiENUM const TCHAR* val; string val;
sdaiGetAttrBN (inst, "attrName", sdaiENUM, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiENUM, out val);
sdaiBINARY const TCHAR* val; string val;
sdaiGetAttrBN (inst, "attrName", sdaiBINARY, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiBINARY, out val);
sdaiSTRING const char* val; string val;
sdaiGetAttrBN (inst, "attrName", sdaiSTRING, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiSTRING, out val);
sdaiUNICODE const wchar_t* val; string val;
sdaiGetAttrBN (inst, "attrName", sdaiUNICODE, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiUNICODE, out val);
sdaiEXPRESSSTRING const char* val; string val;
sdaiGetAttrBN (inst, "attrName", sdaiEXPRESSSTRING, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiEXPRESSSTRING, out val);
sdaiINSTANCE SdaiInstance val; int_t val;
sdaiGetAttrBN (inst, "attrName", sdaiINSTANCE, &val); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiINSTANCE, out val);
sdaiAGGR SdaiAggr aggr; int_t aggr;
sdaiGetAttrBN (inst, "attrName", sdaiAGGR, &aggr); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiAGGR, out aggr);
sdaiADB SdaiADB adb = sdaiCreateEmptyADB(); int_t adb = 0; // it is important to initialize
sdaiGetAttrBN (inst, "attrName", sdaiADB, adb); ifcengine.sdaiGetAttrBN (inst, "attrName", ifcengine.sdaiADB, out adb);
sdaiDeleteADB (adb);
SdaiADB adb = nullptr; // it is important to initialize
sdaiGetAttrBN (inst, "attrName", sdaiADB, &adb);
TCHAR is “char” or “wchar_t” depending on setStringUnicode.
(Non-standard behavior) sdaiLOGICAL behaves differently from ISO 10303-24-2001: it expects char* while standard declares int_t
(Non-standard extension) sdiADB in C++ has an option to work without sdaiCreateEmptyADB and sdaiDeleteADB as shown in the table
Table 2 - valueType can be requested depending on actual model data.
valueType Works for following values in the model
integer real .T. or .F. .U. other enum binary string instance list $ (empty)
sdaiINTEGER Yes Yes * . . . . . . . .
sdaiREAL Yes Yes . . . . . . . .
sdaiNUMBER Yes Yes . . . . . . . .
sdaiBOOLEAN . . Yes . . . . . . .
sdaiLOGICAL . . Yes Yes . . . . . .
sdaiENUM . . Yes Yes Yes . . . . .
sdaiBINARY . . . . . Yes . . . .
sdaiSTRING Yes Yes Yes Yes Yes Yes Yes . . .
sdaiUNICODE Yes Yes Yes Yes Yes Yes Yes . . .
sdaiEXPRESSSTRING Yes Yes Yes Yes Yes Yes Yes . . .
sdaiINSTANCE . . . . . . . Yes . .
sdaiAGGR . . . . . . . . Yes .
sdaiADB Yes Yes Yes Yes Yes Yes Yes Yes Yes .
Note: sdaiGetAttr, stdaiGetAttrBN, engiGetElement will success with any model data, except non-set($)
(Non-standard extensions) sdaiGetADBValue: sdaiADB is allowed and will success when sdaiGetADBTypePath is not NULL, returning ABD value has type path element removed.
Technically sdaiGetAttrBN will transform into the following call
sdaiGetAttr(
instance,
sdaiGetAttrDefinition(
sdaiGetInstanceType(
instance
),
attributeName
),
valueType,
value
);
Syntax
public const string ifcenginedll = @"ifcengine.dll"; [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, string attributeName, int_t valueType, out bool value); [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, string attributeName, int_t valueType, out int_t value); [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, string attributeName, int_t valueType, out double value); [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, string attributeName, int_t valueType, out IntPtr value); [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, byte[] attributeName, int_t valueType, out bool value); [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, byte[] attributeName, int_t valueType, out int_t value); [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, byte[] attributeName, int_t valueType, out double value); [DllImport(IFCEngineDLL, EntryPoint = "sdaiGetAttrBN")] public static extern Int64 sdaiGetAttrBN(int_t instance, byte[] attributeName, int_t valueType, out IntPtr value); public static Int64 sdaiGetAttrBN(int_t instance, string attrName, int_t valueType, out string value) { value = null; valueType = getStringType(valueType); if (valueType != 0) { IntPtr ptr = IntPtr.Zero; var ret = sdaiGetAttrBN(instance, attrName, valueType, out ptr); if (ret != 0 && ptr != IntPtr.Zero) { value = marshalPtrToString(valueType, ptr); return ret; } } return 0; }
Property instance
Size: 64 bit / 8 byte (value)Property attributeName
Size: 64 bit / 8 byte (reference)Property valueType
Size: 64 bit / 8 byte (value)Property value
Size: 64 bit / 8 byte (reference)
Example (based on pure API calls)
Here you can find code snippits that show how the API call sdaiGetAttrBN can be used.
using RDF; // include at least engine.cs within your solution void GetColumns(Int64 model) { Int64 ifcColumnInstances = IfcEngine.x64.sdaiGetEntityExtentBN(model, System.Text.Encoding.UTF8.GetBytes("IFCCOLUMN")), noIfcColumnInstances = IfcEngine.x64.sdaiGetMemberCount(ifcColumnInstances); if (noIfcColumnInstances != 0) { for (Int64 i = 0; i < noIfcColumnInstances; i++) { Int64 ifcColumnInstance = 0; IfcEngine.x64.sdaiGetAggrByIndex(ifcColumnInstances, i, IfcEngine.x64.sdaiINSTANCE, out ifcColumnInstance); IntPtr globalIdPtr = IntPtr.Zero; IfcEngine.x64.sdaiGetAttrBN(ifcColumnInstance, System.Text.Encoding.UTF8.GetBytes("GlobalId"), IfcEngine.x64.sdaiUNICODE, out globalIdPtr); string globalId = Marshal.PtrToStringUni(globalIdPtr); IntPtr namePtr = IntPtr.Zero; IfcEngine.x64.sdaiGetAttrBN(ifcColumnInstance, System.Text.Encoding.UTF8.GetBytes("Name"), IfcEngine.x64.sdaiUNICODE, out namePtr); string name = Marshal.PtrToStringUni(namePtr); IntPtr descriptionPtr = IntPtr.Zero; IfcEngine.x64.sdaiGetAttrBN(ifcColumnInstance, System.Text.Encoding.UTF8.GetBytes("Description"), IfcEngine.x64.sdaiUNICODE, out descriptionPtr); string description = Marshal.PtrToStringUni(descriptionPtr); } } }