Description

A STEP model can contain entity instances which are redundant or irrelevant to the data set being represented. For example, a file may contain duplicate unit definitions, or even entire geometric definitions which are never connected to the product structure in the model. The stepclean utility takes such a STEP model and eliminates the superfluous entity instances while keeping the data content of the file intact.

Command Line

stepclean <data-file> [options]

If no options are selected, the tool will perform all constraint checks. If options are provided, the tool will only perform the requested checks. The options accepted by stepclean are:

-help
Print this list of options and exit.
-summary
give a summary report indicating the total number of instances that were factored, garbage collected, and left for each entity type.
-verbose
give detailed messages indicating what instances are removed by the garbage collection and factoring processes.
-config <file>
"use the configuration file specified for the options instead of the default configuration.
-overwrite
overwrite the input file, rather than appending a _clean suffix to the filename.
-o <file>
Specify the output filename. By default, the clean file is saved with the original name, but with _clean appended.
-noconfig
do not use any configuration file. This option can be used to disable the default configuration that is normally used, if no configuration is provided on the command line.
-factor type [type ...]
specify one or more entity types which are merged when they have the same attribute values
-nofactor type ...
specify one or more entity types which are not merged.
-ignore type.attribute ...
specify an attribute that is ignored when comparing two instances. Two instances are still considered equal even if the values of this attribute differ.
-factor-all
factor all entity types not overridden by the -nofactor option
-factor-none
factor no entity types except those overridden by the by the -factor option
-gcroot type ...
specify a root type from which garbage collection begin
-gcinverse entity.attribute ...
specify an attribute which is traversed in reverse when determining reachability for garbage collection purposes.

Windows Control Panel

The STEP File Cleaner Windows control panel is shown below. Run this by selecting STEP File Cleaner from the Start Menu. The following sections describe the fields and setting on this control panel and show how to perform various tasks with the checker.

STEP File Cleaner Control Panel
STEP File Cleaner Control Panel

At the top of the control panel is a text field for the STEP files that you would like to check. You can open the file dialog using Ctrl+O or the [...] button to the right. You can also drag and drop files from the Windows Explorer. Click the Clean button to start checking.

Factoring and Garbage Collection

The stepclean utility searches the model for entity instances that have the same attributes values. When it finds two or more instances with the same values, it deletes all but one of the instances, and replaces any references to the deleted instances to the other instance. This process is called factoring. You can specify the types to be included or excluded from the factoring operations. You can also specify attributes which the tool ignores when comparing two instances.

After the stepclean tool factors the model, it then performs an optional garbage collection pass over the model. During this process, it deletes any instance that is not accessible from a set of root objects. An object is accessible if it is referenced by a root or another accessible object, or if it references a root or another accessible object through an attribute that has been declared as inverse for the garbage collector.

You must declare one or more root types for the garbage collector to function. If you run stepclean without specifying at least one root type either in the control file, or on the command line, the garbage collection operation is not performed.

Configuration File

The behavior of the cleaner can be controlled using the Options dialog, command-line flags, or by collecting the options into a configuratioin file. The Use config file field or -config command line option give the name of the file.

If no configuration file is specified on the command line, the tool will look for one in lib/stepclean/{schema}.stc under the STEP Tools installation (replace {schema} with the name of the schema). This behavior can be overridden with the -noconfig option. So the configuration file for AP203 is lib/stepclean/config_control_design.stc.

STEP File Cleaner Options
STEP File Cleaner Options

The configuration file is a text file. Comments are introduced with a # character, and continue to the end of the line. Each line of the control file consists of a keyword followed by a set of parameters.

The following is an example of a configuration file:

    #  Specify the entity types to factor
    factor date_and_time person_and_organization organization person

    # Set up garbage collection
    gcroot product
    gcinverse alternate_product_relationship.alternate alternate_product_relationship.base
    gcinverse PRODUCT_RELATED_PRODUCT_CATEGORY.products
    gcinverse CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT.items
    gcinverse PRODUCT_DEFINITION_FORMATION.of_product
    gcinverse CC_DESIGN_APPROVAL.items
    gcinverse CC_DESIGN_SECURITY_CLASSIFICATION.items
    gcinverse CC_DESIGN_DATE_AND_TIME_ASSIGNMENT.items
    gcinverse product_definition.formation
    gcinverse property_definition.definition
    gcinverse property_definition_representation.definition
    gcinverse APPROVAL_PERSON_ORGANIZATION.authorized_approval
    gcinverse application_protocol_definition.application
    gcinverse approval_date_time.dated_approval

The file can contain the following commands:

factor-default
Set the default to factor entity types that are not otherwise specified. Also controlled by the -factor-all or Do not merge | only these flags.
nofactor-default
Set the default to not factor any entities except those specified. Also controlled by the -factor-none or Merge these types | only these flags.
factor [-exact] type ...
Specify one or more types to be factored. If the -exact flag is given, the type much match exactly, otherwise, the type specified can be a supertype. Also controlled by the -factor flag or Merge these types field.
nofactor [-exact] type ...
Specify one or more types not to be factored. If the -exact flag is given, the type much match exactly, otherwise, the type specified can be a supertype. Also controlled by the -nofactor flag or Do not merge field.
ignore ent.att ...
Specify one or more attributes to be ignored when comparing instances for factoring. Also controlled by the -ignore flag or Ignore attribute(s) field.
gcroot type ...
Specify one or more root types for the garbage collector. At least one type must be specified as a root to enable the garbage collector to run. Also controlled by the -gcroot flag or Garbage collection | Root type(s) field.
gcinverse ent.att ...
Specify one or more attributes that are inverted for the purposes for garbage collection. When an instance references a live instance via such an attribute, that instance is also live. Also controlled by the -gcinverse flag or Garbage collection | Inverse attribute(s) field.

When options conflict, the last option specified in the configaration file takes priority.