Initializes the cleanup model.
int
tpm_cleaninit(
ade_id clean_id,
ade_id var_id,
ads_name ss);
Returns RTNORM or an error code.
clean_id | The model ID returned by tpm_cleanalloc. |
var_id | The cleanup variables ID, which references a set of cleanup variables. This is the ID that is returned by tpm_varalloc. |
ss | The selection set or NULL. See note below about INCLUDEOBJS_AUTOSELECT. |
You can free the selection set after the cleanup model has been initialized.
For more information about the cleanup model, see Drawing Cleanup.
The function reads the cleanup settings and the selected entities into the cleanup model.
If the cleanup variable INCLUDEOBJS_AUTOSELECT is set to 1 (select all), all entities in the drawing will be included, regardless of the ss argument, in which case this argument can be NULL instead of a selection set, as the following code sample illustrates.
If the cleanup variable INCLUDEOBJS_LAYERS is set to "*" (all layers), all ss entities will be included. If it contains a list of layers, ss entities will be included only if they reside on those layers.
For an example that shows how you can use the cleanup functions, see tpm_cleanalloc.
The following sample shows outlines the steps leading up to the use of tpm_cleaninit(). Allocate memory for the cleanup model using tpm_cleanalloc(), then allocate a set of configuration variables using tpm_varalloc(). Define the cleanup variable "INCLUDEOBJS_AUTOSELECT", (which must be used with a filtered selection set), then call tpm_varset() to set it. Define a selection set of objects to clean and finally, combine the cleanup variables and the selection set of objects using tpm_cleaninit(). Release any resbufs as required and free the selection set.
ade_id cleanupModelId = tpm_cleanalloc(); ade_id cleanupVarId = tpm_varalloc(); char* pszConfigVarName = "INCLUDEOBJS_AUTOSELECT"; struct resbuf* pIncludeObjsVarValRb = acutBuildList( RTSHORT, 0, 0); int resultCode = tpm_varset( cleanupVarId, pszConfigVarName, pIncludeObjsVarValRb); acutRelRb(pIncludeObjsVarValRb); ads_name ssObjsForCleanup; acedSSGet("X", NULL, NULL, NULL, ssObjsForCleanup); resultCode = tpm_cleaninit( cleanupModelId, cleanupVarId, ssObjsForCleanup); resultCode = acedSSFree(ssObjsForCleanup);