Skip to main content

Appendixes

Here you will find additional information about the RxSDK objects and their usage.

Appendix A: HRESULT

COM allows an interface member function to return an OLE error code in the form of an HRESULT. This is a 32-bit data type with the following layout:

FieldSize
Severity1 bit
Reserved4 bits
Facility11 bits
Code16 bits
  • Severity (1 bit): Can be 0 for success or 1 for error. This bit determines if the method call succeeded, with varying "levels of success" possible when combined with other fields.
  • Reserved (4 bits): Must be zero and not used.
  • Facility (11 bits): Pre-assigned to groups of related codes. The only freely usable facility without Microsoft coordination is FACILITY_ITF (Interface), allowing interface-specific error codes.
  • Code (16 bits): COM defines codes from 0x0000 to 0x01FF, leaving 0x0200 to 0xFFFF for application programmers.

All RxSDK interface methods return an HRESULT encoded as described above. The following macros are available in Visual C++ to decompose the HRESULT:

  • HRESULT_SEVERITY(hResult): Returns the severity bit.
  • HRESULT_FACILITY(hResult): Returns the facility code.
  • HRESULT_CODE(hResult): Returns the error code part.

See Appendix B for a list of values returned by RxSDK interfaces.


Appendix B: Return Values

The COM objects expose one or more interfaces, and all methods defined by these interfaces return an HRESULT status value to inform the client about the success or failure of the requested operation.

Currently, the RxSDK objects return the following standard HRESULT values:

NameDescriptionValue
S_OKOperation successful0x00000000
S_FALSEOperation successful, but may have been void0x00000001
E_UNEXPECTEDUnexpected failure0x8000FFFF
E_NOTIMPLNot implemented0x80004001
E_OUTOFMEMORYFailed to allocate necessary memory0x8007000E
E_INVALIDARGOne or more arguments are invalid0x80070057
E_NOINTERFACENo such interface supported0x80004002
E_POINTERInvalid pointer0x80004003
E_HANDLEInvalid handle0x80070006
E_ABORTOperation aborted0x80004004
E_FAILUnspecified failure0x80004005
E_ACCESSDENIEDGeneral access denied error0x80070005

More information about these values can be found in the Microsoft Platform SDK or at http://msdn.microsoft.com.


Appendix C: Entity Information Points

The EntityInfoPnts and EntityInformationEx methods return world coordinate entity points in a SafeArray. To access the information, see the example below. Note that all values in the array are of type double (VT_R8).

VARIANT vp;
long lPrimitiveType, lLayer, lDrawColor, lFillColor, lPen, lStyle, lWidth;

HRESULT hr = m_pDoc->raw_EntityInformationPnts(dPosX, dPosY, lTolerance, &lPrimitiveType, &lLayer, &lDrawColor, &lFillColor, &lPen, &lStyle, &lWidth, &vp);
if (SUCCEEDED(hr))
{
if (vp.vt & VT_ARRAY)
{
double *pdDestArray;
if (SUCCEEDED(SafeArrayAccessData(vp.parray, (void **) &pdDestArray)))
{
// Access points using double array

// Close safe array
SafeArrayUnaccessData(vp.parray);
}
VariantClear(&vp); // Free the SafeArray
}
}

The usage of each double value depends on the entity type being accessed. Some entities (e.g., Polyline, Polygon, PolyPolyline, PolyPolygon) contain a variable number of points. To find the number of points, use:

long lPoints = SafeArrayGetElemsize(vp.parray) / 2;

See the table below for a list of elements and the contents of the double array for each:

Element IDElement DescriptionDouble Array Contents
1Point[0] – [1]: point x and y
2Line[0] – [1]: start point x and y, [2] – [3]: end point x and y
3Polyline[0] – [1]: first point x and y, [n] – [n+1]: end point x and y
4PolyPolyline[0] – [1]: first point x and y, [n] – [n+1]: end point x and y
5Polygon[0] – [1]: first point x and y, [n] – [n+1]: end point x and y
6PolyPolygon[0] – [1]: first point x and y, [n] – [n+1]: end point x and y
7Arc[0] – [1]: center point x and y, [2]: radius x, [3]: radius y, [4]: start angle, [5]: arc sweep, [6]: rotation
8Ellipse[0] – [1]: center point x and y, [2]: radius x, [3]: radius y, [4]: rotation
9Circle[0] – [1]: center point x and y, [2]: radius
10Rectangle[0] – [1]: upper left corner, [2] – [3]: lower right corner
11Rounded Rectangle[0] – [1]: upper left corner, [2] – [3]: lower right corner, [4]: horizontal radius of corner rounds, [5]: vertical radius of corner rounds
12Raster DIB[0] – [1]: upper left corner, [2] – [3]: lower right corner
13Filled Ellipse[0] – [1]: center point x and y, [2]: radius x, [3]: radius y, [4]: rotation
14Filled Circle[0] – [1]: center point x and y, [2]: radius
15Filled Rectangle[0] – [1]: upper left corner, [2] – [3]: lower right corner

Note: n = number of points - 1.


Appendix D: Entity Information Structure

The EntityInformationEx method returns the following information structure:

typedef struct tagENTITYINFOPACKET
{
long lVersion;
long lPrimitiveType;
long lEntityType;
long lHandleLow;
long lHandleHigh;
long lActualSnap;
double dSnapX;
double dSnapY;
long lLayer;
long lDrawColor;
long lFillColor;
long lPen;
long lStyle;
double dWidth;
long lWeight;
long lBlock;
long lPolygons;
long lPointsFirst;
} ENTITYINFOPACKET, *LPENTITYINFOPACKET;

Note: The structure must be defined using word packing. In Visual C++, use #pragma pack(2).

Information Structure Members

MemberDescription
lVersionVersion of the information structure. Currently 2.
lPrimitiveTypePrimitive type index (e.g., Point, Line, Polyline, etc.; see list below).
lEntityTypeFilter-defined entity type. -1 if not defined for this format.
lHandleLowLower 32 bits of the 64-bit entity handle.
lHandleHighUpper 32 bits of the 64-bit entity handle.
lActualSnapDefined only if used for snap operations.
dSnapXDefined only if used for snap operations.
dSnapYDefined only if used for snap operations.
lLayerLayer index. -1 if the entity is not part of a layer.
lDrawColorDraw color in Windows RGB format.
lFillColorFill color in Windows RGB format.
lPenPen index.
lStyleLine style.
dWidthLine width.
lWeightLine weight.
lBlockBlock index for this entity. -1 if not part of a block.
lPolygonsFor PolyPolygon only; indicates the number of sub-polygons it contains.
lPointsFirstFor PolyPolygon only; indicates the number of points in the first polygon.

lPrimitiveType Values: Point, Line, Polyline, PolyPolyline, Polygon, PolyPolygon, Arc, Ellipse, Circle, Rectangle, Rounded Rectangle, Raster DIB, Filled Ellipse, Filled Circle, Filled Rectangle.


Appendix E: IFC Element Types

You can retrieve the IFC element type for a block using the GetBlockIFCType method. See the table below for a list of IFC elements and their identifiers:

IFC IDIFC Element Type
0ifcBeam
1ifcBuildingElementComponent
2ifcBuildingElementPart
3ifcBuildingElementProxy
4ifcColumn
5ifcCovering
6ifcCurtainWall
7ifcDiscreteAccessory
8ifcDistributionControlElement
9ifcDistributionFlowElement
10ifcDoor
11ifcElectricityDistributionPoint
12ifcElementAssembly
13ifcEnergyConversionDevice
14ifcFastener
15ifcFlowSegment
16ifcFlowController
17ifcFlowMovingDevice
18ifcFlowFitting
19ifcFlowTerminal
20ifcFooting
21ifcFurnishingElement
22ifcMechanicalFastener
23ifcMember
24ifcPile
25ifcPipeSegment
26ifcPlate
27ifcRailing
28ifcRamp
29ifcRampFlight
30ifcReinforcingBar
31ifcRoof
32ifcSite
33ifcSlab
34ifcSpace
35ifcStair
36ifcStairFlight
37ifcStructuralCurveMember
38ifcTransportElement
39ifcWall
40ifcWallStandardCase
41ifcWindow
42ifcProject
43ifcBuilding
44ifcBuildingStorey
45ifcAnnotation
46Unknown element (should never occur)