acedSSGet will not work with AutoCAD OEM Object Enabler DBX file

Just recently I stumbled upon a strange behaviour exhibited by AutoCAD OEM.

Let’s say you have created a custom object or custom entity (see AutoCAD 2023 Documentation or ArxDummies).

When using custm objects and/or entities, you are creating an ObjectDBX Library which has, per definition, the DBX file extension. This file is also called an object enabler.

You may want to call from the custom object/entity class the acedSSGet function to get, for example, all entities in a drawing:

 void MyCustomObjectClass::SSgetA(
	 AcDbObjectIdArray &oIdArr
 )
 {
	 /* ErrorStatus */
	 Acad::ErrorStatus	asErr = Acad::eNotApplicable;

	 /* */
	 ads_name SelSet;

	 /* err loop */
	 do
	 {
		 int iRetVal = acedSSGet(_T("_A"), NULL, NULL, NULL, SelSet);
		 if (iRetVal != RTNORM)
			 break;

		 Adesk::Int32 i, length = 0l;
		 ads_name eName;
		 if (RTNORM != (iRetVal = acedSSLength(SelSet, &length)))
			 break;

		 AcDbObjectId oId;
		 for (i = 0; i < length; i++)
		 {
			 if (RTNORM != (iRetVal = acedSSName(SelSet, i, eName)))
				 break;

			 if (Acad::eOk != (asErr = acdbGetObjectId(oId, eName)))
			 {
				 acutPrintf(_T("\nFailed to acdbGetObjectId(%s)!"), ASF, acadErrorStatusText(asErr));
				 break;
			 }

			 oIdArr.append(oId);
		 }

		 /* done */
		 break;

	 } while (true);

	 /* Housekeeping */
	 acedSSFree(SelSet);

 } // END

This will work with a regular vanilla AutoCAD.

This will NOT work with AutoCAD OEM!


When calling `acedSSGet ` from a dbx file, AutoCAD OEM will always return the error code RTREJ (AutoCAD rejected request -- invalid).

I have tested this with the German language version of AutoCAD OEM 2023 and 2024. I assume that this will be the same for all other languages and prior versions.

Workaround

The easy solution for this is to create a separate library arx solution, where the business logic of the acedSSGet function call is located.

The object enabler includes the the headers, links the .lib file and calls the functions from the library arx file.

The library arx file has to be build first, followed by the object enabler.

The library arx file MUST NOT include headers from the object enabler.

Even while this is a fix for the AutoCAD OEM ecosystem, you may have to think about how you distribute the object enabler with the library file to other vanilla AutoCAD users, if the need arises (Developing an Object Enabler).

3 Likes

Thanks for sharing your work around Jens!