Trims linear objects inside or outside of a specified boundary.
int
map_dwgtrimobj(
ads_name ssclip,
ads_name boundary,
int inorout,
int skiptopo,
int keepod,
int bitflag,
ads_name ssreturn);
Returns RTNORM or RTERROR.
| ssclip | Selection set of objects to trim. |
| boundary | Entity name of a boundary object. Valid objects: a single circle or a single closed 2D polyline. |
| inorout | Trim flag: 1 Trim outside boundary 0 Trim inside boundary |
| 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 trimmed objects in result object: 1 Drop object data from all trimmed objects 0 Retain object data on all trimmed objects |
| bitflag | Bit flag that sets the way to handle objects that cannot be trimmed: 0 Delete these objects within or on trim boundary 1 Ignore these objects within or on trim boundary 2 Reference the insertion point of any of these objects within or on trim boundary |
| ssreturn | A selection set of trimmed objects. |
The following example prompts you to select an object to trim and make choices about the trim operation. It includes error reporting.
ads_name sscut, boundary, result;
ads_point point;
int ret, nb, i, skiptopo, keepod, inorout, bitflag;
char kword[50];
ads_printf ("\nSelect objects to trim : ");
if (ads_ssget (NULL, NULL, NULL, NULL, sscut) != RTNORM)
return;
if (ads_entsel ("\nSelect boundary object : ", boundary, point) != RTNORM) {
ads_ssfree (sscut);
return;
}
ads_initget (0, "Yes No");
ret = ads_getkword ("\nSkip objects referenced by a topology Yes/No <Yes> : ", kword);
if (ret != RTNORM && ret != RTNONE) {
ads_ssfree (sscut);
return;
}
if (ret == RTNONE || kword[0] == 'Y')
skiptopo = 1;
else
skiptopo = 0;
ads_initget (0, "Yes No");
ret = ads_getkword ("\nRetain object data Yes/No <Yes> : ", kword);
if (ret != RTNORM && ret != RTNONE) {
ads_ssfree (sscut);
return;
}
if (ret == RTNONE || kword[0] == 'Y')
keepod = 0;
else
keepod = 1;
ads_initget (RSG_NONULL, "Inside Outside");
ret = ads_getkword ("\nTrim Inside or Outside : ", kword);
if (ret != RTNORM) {
ads_ssfree (sscut);
return;
}
if (kword[0] == 'I')
inorout = 0;
else
inorout = 1;
ads_initget (0, "Delete Ignore insertionPoint");
ret = ads_getkword ("\nObjects that cannot be trimmed Delete/Ignore/insertionPoint : ", kword);
if (ret != RTNORM && ret != RTNONE) {
ads_ssfree (sscut);
return;
}
if (ret == RTNONE || kword[0] == 'P')
bitflag = 2;
else if (kword[0] == 'I')
bitflag = 1;
else
bitflag = 0;
ret = map_dwgtrimobj (sscut, boundary, inorout, skiptopo, keepod, bitflag, result);
if (ret == RTNORM) {
ads_printf ("\nObject(s) successfully trimmed.");
ads_ssfree (result);
}
else {
nb = ade_errqty ();
for (i = 0; i < nb; i ++)
ads_printf ("\nError %d of %d : %s", i + 1, nb, ade_errmsg (i));
}
ads_ssfree (sscut);


