Returning Values to AutoLISP Functions

ObjectARX provides a set of functions that enables an external function to return values to AutoLISP. These value-return functions have no AutoLISP counterparts. The following table summarizes these functions.

Value-return function summary 

 

Function Name

Returns

acedRetInt

An integer value

acedRetReal

A real value

acedRetPoint

A 3D point

acedRetStr

A string

acedRetVal

A value passed “generically” in a result buffer

acedRetName

An entity (RTENAME) or selection set (RTPICKS) name (see Selection Set and Entity Names for more information on selection sets and entities)

acedRetT

The AutoLISP value t (true)

acedRetNil

The AutoLISP value nil

acedRetVoid

A blank value: AutoCAD doesn't display the result

acedRetList

A list of result buffers returned to AutoLISP

The following example shows the scheme of a function called when the application receives a kInvkSubrMsg request. It returns a real value to AutoLISP.

int dofun() 
{ 
    ads_real x;
    // Check the arguments and input conditions here.
    // Calculate the value of x.
    acedRetReal(x); 
    return GOOD; 
}
Note: An external function can make more than one call to value-return functions upon a single kInvkSubrMsg request, but the AutoLISP function returns only the value passed it by the last value-return function invoked.