[CONNECT C++] How to programatically retrieve a list of 2d constraints applied to elements using native C++

I am using:

MicroStation CONNECT Edition
10.14.0.109

MicroStation CONNECT Edition SDK
10.14.00.111

For a selected element I am looking for a native C++ API that will return a list of 2d constraints that have been applied to that element.  Brien Bastings suggested that constraints are applied to topological entities of the element and not the element itself.  However if you select an element from MicroStation the associated constraints are displayed in a highlight color.  So it appears MicroStation knows how to retrieve this information for a selected element.

  • Provide a simple code as below:

    WCharCP getContraint2dTypeName(Constraint2dType cType)
    {
    	switch (cType)
    	{
    	case Constraint2dType::Distance:				return L"Distance";
    	case Constraint2dType::Angle:					return L"Angle";
    	case Constraint2dType::Concentric:				return L"Concentric";
    	case Constraint2dType::Radius:					return L"Radius";
    	case Constraint2dType::Parallel:				return L"Parallel";
    	case Constraint2dType::Perpendicular:			return L"Perpendicular";
    	case Constraint2dType::Coincident:				return L"Coincident";
    	case Constraint2dType::Tangent:					return L"Tangent";
    	case Constraint2dType::Identical:				return L"Identical";
    	case Constraint2dType::Symmetric:				return L"Symmetric";
    	case Constraint2dType::Major_Radius:			return L"Major_Radius";
    	case Constraint2dType::Minor_Radius:			return L"Minor_Radius";
    	case Constraint2dType::Equal_Radius:			return L"Equal_Radius";
    	case Constraint2dType::Equal_Distance:			return L"Equal_Distance";
    	case Constraint2dType::Midpoint:				return L"Midpoint";
    	case Constraint2dType::Dependence:				return L"Dependence";
    	case Constraint2dType::Patterned:				return L"Patterned";
    	case Constraint2dType::Equal_Parameter:			return L"Equal_Parameter";
    	case Constraint2dType::Normal:					return L"Normal";
    	case Constraint2dType::Equal_Direction:			return L"Equal_Direction";
    	case Constraint2dType::Equal_Curvature:			return L"Equal_Curvature";
    	case Constraint2dType::Equal_First_Derivative:	return L"Equal_First_Derivative";
    	case Constraint2dType::Equal_Second_Derivative:	return L"Equal_Second_Derivative";
    	case Constraint2dType::Offset:					return L"Offset";
    	case Constraint2dType::Simple_Dependence:		return L"Simple_Dependence";
    	case Constraint2dType::Curve_Length:			return L"Curve_Length";
    	case Constraint2dType::Patterned_2d:			return L"Patterned_2d";
    	case Constraint2dType::Pattern_Value:			return L"Pattern_Value";
    	case Constraint2dType::Pattern_2d_value_1:		return L"Pattern_2d_value_1";
    	case Constraint2dType::Pattern_2d_value_2:		return L"Pattern_2d_value_2";
    	case Constraint2dType::Equal_Relative_Transform:return L"Equal_Relative_Transform";
    	case Constraint2dType::Arc_length:				return L"Arc_length";
    	case Constraint2dType::Offset_Dimension:		return L"Offset_Dimension";
    	case Constraint2dType::Area:					return L"Area";
    	case Constraint2dType::Perimeter:				return L"Perimeter";
    	case Constraint2dType::Fix:						return L"Fix";
    	case Constraint2dType::Horizontal:				return L"Horizontal";
    	case Constraint2dType::Vertical:				return L"Vertical";
    	case Constraint2dType::Equal:					return L"Equal";
    	case Constraint2dType::Planar_Distance:			return L"Planar_Distance";
    	case Constraint2dType::Dummy:					return L"Dummy";
    	default:                                        return L"UNKNOWN";
    	}
    }
    void listConstraints()
    {
    	ElementHandle eh(2948L, ACTIVEMODEL);
    	Constraint2dSolverData solverData;
    	Constraint2dManager::GetSolverData(solverData, eh);
    	for (Constraint2dData constraint2dData : solverData.m_constraints)
    	{
    		Constraint2dType constraint2dType = constraint2dData.GetConstraintType();
    		mdlDialog_dmsgsPrint(getContraint2dTypeName(constraint2dType));
    	}
    }

    Test result here: