map_dwgbreakobj

Land Desktop Development ARX CPP SDK

Up a level
map_dwgbreakobj
 
 

Breaks linear objects where they cross boundaries.

int

map_dwgbreakobj(

ads_name sscut,

ads_name boundary,

short skiptopo,

short keepod,

ads_name ssreturn);

Returns RTNORM or RTERROR.

sscut Selection set of objects to cut.
boundary Object name of a single object or a selection set of multiple objects. Valid objects: line, polyline, circle, arc.
skiptopo Skip flag:
1 Skip objects referenced by a topology
0 Trim objects referenced by a topology
keepod Keep flag that sets whether to keep object data of clipped objects in result object:
1 Retain all object data on any clipped object
0 Drop object data on any clipped object
ssreturn A selection set of cut objects.

This function cuts linear objects, such as lines, polylines, circles, and arcs, that cross the selected boundary. Unlike the map_dwgtrimobj function, this function does not delete the parts of the object on either side of the boundary. For example, you could mark a boundary and divide one map into two section maps along this boundary.

The following sample creates a filtered selection set of objects to be cut, (broken) and a filtered selection set containing one object to be used as the cutting edge. Map_dwgBreakObj() is called with all required parameters and if the operation is successful, the number of objects retained is reported. Resbufs are released as required and selection sets are freed.

struct resbuf* pFilteredCutObjsRb = acutBuildList(
                                                RTDXF0, "LWPOLYLINE",
                                                8, "Landbase",
                                                0);
ads_name ssObjsToCut;
acedSSGet("_X", NULL, NULL, pFilteredCutObjsRb, ssObjsToCut);

struct resbuf* pFilteredObjsToCutRb = acutBuildList(
                                                RTDXF0, "LWPOLYLINE",
                                                8, "MapEdge",
                                                0);
ads_name boundaryObj;
acedSSGet("X", NULL, NULL, pFilteredObjsToCutRb, boundaryObj);

short skipTopoObjs = 1;     // Skip
short keepObjectData = 1;   // Retain
ads_name ssObjsAreCut;

int resultCode = map_dwgBreakObj(
                    ssObjsToCut,
                    boundaryObj,
                    skipTopoObjs,
                    keepObjectData,
                    ssObjsAreCut);

if (RTNORM == resultCode){
    long ssObjsAreCutLength;
    acedSSLength(ssObjsAreCut, &ssObjsAreCutLength;);
    acutPrintf(
    "\n%d objects have been retained."
    , ssObjsAreCutLength);
}
else {
    acutPrintf(
        "\nUnable to complete the boundary break.");
}
acutRelRb(pFilteredCutObjsRb);
acutRelRb(pFilteredObjsToCutRb);
resultCode = acedSSFree(boundaryObj);