Forge Docs

Examples

Concrete examples of the shipped `itk-batch` scope: realistic requests, selected patterns, output shape, and what still needs engineering review.

Back to docs

Examples

Concrete examples of what Forge currently produces in its shipped scope.

Current product scope is one artifact type: itk-batch.

These examples are intentionally partial. They show realistic requests, selected patterns, output shape, and validation expectations without exposing full internal scaffolds or proprietary generation logic.

What To Look For

Across examples, the useful questions are:

  • does Forge pick the right pattern for the task?
  • does the output package shape match an engineer's workflow?
  • do the generated files include the expected Teamcenter and build artifacts?
  • what should still be reviewed before production use?

Example 1: Export Released Item Revisions To CSV

Problem

An engineer needs a batch that queries released parts in a project and exports selected fields to CSV.

Sample request

Query all released Parts in project HAWK and export item_id, description, and owner to CSV with progress logging.

Selected pattern

  • query-export

Typical generated package

  • src/HAWK_export_released_parts.cxx
  • build.sh
  • build.bat
  • build-manifest.json

Representative code shape

tag_t queryTag = NULLTAG;
rStatus = QRY_find2("Item Revision...", &queryTag);
rStatus = QRY_execute(queryTag, entryCount, entries, values, &nResults, &resultsList);

ofstream csvFile(outputFilePath);
csvFile << "item_id,description,owner\n";

What to validate

  • query name and entries match the target Teamcenter configuration
  • exported properties exist and are readable in the target release
  • CSV headers and delimiter expectations match downstream consumers
  • result volume and progress behavior are acceptable for the expected dataset

Example 2: Import From CSV With Duplicate Check

Problem

A team wants to import Parts from a delimited file, skip duplicates, and keep per-row error handling.

Sample request

Batch that imports Parts from a CSV file with columns PartNumber, Description, UOM. Use tilde separator. Skip duplicates. Log errors per line.

Selected pattern

  • file-input-mutate

Typical generated package

  • src/HAWK_import_parts.cxx
  • build.sh
  • build.bat
  • build-manifest.json

Representative code shape

rStatus = POM_place_markpoint(&markId);

if (dryRun)
{
    // validate and log without committing changes
}

rStatus = ITEM_find_item(partNumber.c_str(), &itemTag);

What to validate

  • input column order and separator handling match the real file format
  • duplicate detection logic matches business rules
  • dry-run behavior is adequate for pre-flight checks
  • rollback boundaries are appropriate for batch size and failure tolerance

Example 3: Query-Based Bulk Update

Problem

An administrator wants to query unreleased revisions and apply a controlled status change under business constraints.

Sample request

Query unreleased item revisions in project HAWK and set them to Released when the owning user belongs to the engineering group. Keep progress and audit logging.

Selected pattern

  • query-update

Typical generated package

  • src/HAWK_release_unreleased_revisions.cxx
  • build.sh
  • build.bat
  • build-manifest.json

Representative code shape

rStatus = QRY_execute(queryTag, entryCount, entries, values, &nResults, &resultsList);
rStatus = POM_place_markpoint(&markId);
rStatus = AOM_set_value_string(targetRevision, "release_status", "Released");

What to validate

  • status value and property names are correct in the target schema
  • query criteria do not over-select objects
  • per-object rollback behavior matches operational expectations
  • authorization and workflow implications are understood before use

Example 4: Simple Operation Batch

Problem

A team needs a small operational tool that performs one focused Teamcenter action with audit logging and predictable packaging.

Sample request

Create a batch that finds a single Item Revision by ID and revision, validates that it exists, prints key metadata, and exits with clear audit logging.

Selected pattern

  • simple-operation

Typical generated package

  • src/HAWK_inspect_revision.cxx
  • build.sh
  • build.bat
  • build-manifest.json

Representative code shape

tag_t revision = NULLTAG;
rStatus = ITEM_find_rev(itemId.c_str(), revId.c_str(), &revision);

if (revision == NULLTAG)
{
    throw IFail(GENERIC_ERROR, "Requested revision was not found");
}

What to validate

  • command-line inputs match the intended operator workflow
  • missing-object handling is explicit and acceptable
  • logged metadata is appropriate for the environment
  • the batch remains narrow and does not drift into a broader mutate workflow

Output Expectations

In the current shipped scope, Forge normally returns:

  • one primary .cxx source file
  • build.sh
  • build.bat
  • diagnostics metadata
  • a build manifest when emitted by the artifact definition

Before Using Generated Output

Forge output is a starting point for engineering review, not production approval.

Before deployment or customer delivery:

  • review the generated code
  • validate Teamcenter API calls and property names in the target release
  • compile in the target toolchain
  • test against the intended environment and data shape
  • confirm rollback, logging, and operational safety assumptions