We seem to be having an issue with AutoCAD OEM when trying to convert an AcadSelectionSet object into an AcadEntity object, an issue that we’re not seeing in full AutoCAD.
The line that fails is:
objEntity = CType(objSelectionSet(0), AcadEntity)
where objEntity is an AcadEntity object and objSelectionSet is a collection of just one selected AcadSelectionSet object.
In full AutoCAD, the line is executed without issue and the conversion happens without incident. In OEM, the line above causes an error to be thrown “hresult e_fail has been returned from a call to a com component”.
Can anyone help or explain why there’d be a difference between full AutoCAD and OEM?
TryCast doesn’t even complete successfully as it should return a null (Nothing) object if it fails but it can’t even manage that, instead still throwing the E_FAIL COM error.