ade_dwgsetof

Land Desktop Development ARX CPP SDK

Up a level
ade_dwgsetof
 
 

Identifies the drawings to which a given drawing is attached.

struct resbuf*

ade_dwgsetof(

ade_id dwg_id);

Returns a resbuf list or NULL.

dwg_id Drawing ID.

You must release the resbuf.

You cannot use this function to check if a drawing is attached to the current drawing. Use ade_dwgistoplevel instead. If a drawing is attached to both the current drawing and to other drawings, this function returns a list of the IDs of the other drawings only.

The following sample returns the project name to which a specific drawing is attached.

Ade_dwggetid() is used to obtain the drawing id of a file which is part of a drawing set, (BestRoute.dwg). A resbuf is populated with the name of the project which BestRoute.dwg is attached to using ade_dwgsetof(). If the operation is successful, (the resbuf is not NULL) then the contents of that resbuf are displayed. The resbuf is then released as required.

char* pszDwgPathName = "ADSRX_SAMPLE:\\BestRoute.dwg";
ade_id dwgId = ade_dwggetid(pszDwgPathName);
struct resbuf* pDwgAttachedToRb = ade_dwgsetof(dwgId);
if (NULL != pDwgAttachedToRb)
{
    struct resbuf* rb = pDwgAttachedToRb;
    while(rb != NULL)
    {
        char* pszDwgPath = ade_dwgactualpath(rb->resval.rreal);
        acutPrintf(
            "\nThe specified drawing \"%s\" is attached to: \n\n%s"
            , pszDwgPathName, pszDwgPath);
        rb = rb->rbnext;
    }
}
else
{
    acutPrintf(
        "\nThe specified drawing is attached to no project.");
}
acutRelRb(pDwgAttachedToRb);