Overview

The STEP-NC API is a library of functions for intelligent machining. The value of the STEP-NC API is that it integrates Geometric Dimension and Tolerance (GD&T) information as defined by CAD systems, with cutting tool path and machining process information as defined CAM systems. It does this using a new standard formally known as ISO 10303-238 but also called AP-238 or STEP-NC. Because the data is integrated, machining applications can compare the quality of a machining process against its design requirements and use this information to make parts more intelligently, quickly and accurately. Because the data is defined by an ISO standard the parts described by the data can be machined and measured on a wide variety of machiness under a wide variety of conditions.

The functions in the STEP-NC API can be called from many different programming languages. Some typical example applications include:

The STEP-NC API is divided into objects that provide groupings of similar functionality. Each object consists of a series of related functions and is described in the following sections.

Introductory Examples

The syntax of a STEP-NC API application depends on the programming language. In all the languages a prelude is necessary to connect programming objects to one or more of the API objects. The examples below assume all the objects in the STEP-NC API have been connected to one programming object called “Step". This is uncommon because most programming languages require each API object to be connected to a different programming object.

First we give two simple examples of how to make toolpaths. The script below creates and saves a STEP-NC AP-238 file with one RAPID tool movement and a single cutting tool.

Step->PartNo (test part);
Step->DefineTool (0.25, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0);
Step->LoadTool (1);
Step->Rapid ();
Step->GoToXYZ (point001, 1.0, 12.0, 0.0);          
Step->GoToXYZ (point002, 1.0, 14.0, 0.0);
Step->SaveAsModules (test);

The next script sets the feed and spindle speed before machining a line and an arc.

Step->PartNo (test part);
Step->DefineTool (0.25, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0);
Step->LoadTool (1);
Step->SpindleSpeed (2000);   
Step->Feedrate (100);        
Step->CoolantOn();           
Step->GoToXYZ (point001, 1.0, 12.0, 0.0);
Step->GoToXYZ (point002, 1.0, 14.0, 0.0);
Step->Arc (arc001, 3., 12., 0., 1., 12., 0., 2., false);
Step->SaveAsPart21 (test2);

The third script reads a STEP-NC program and partially decodes its main workplan. A STEP-NC program is divided into workingsteps that contain toolpaths. The working steps are grouped into workplans. A workplan known as the "Main Workplan" defines the root of the program. In addition to workingsteps, a workplan may contain other workplans, NC functions, Selectives and probing workingsteps. Workingsteps perform machining operations. NC functions perform operations that do not require tool movements. A selective is similar to a workplan except only one of the executables is to be executed at run time. A probing workingstep is a special type of workingstep that contains probing operations.

Step->Open238(test4);

int wp_id = Step->GetMainWorkplan ();
int count = Step->GetNestedExecutableCount (wp_id);

for (i = 0; i < count; i++) {
     int exe_id = Step->GetNestedExecutableNext (wp_id, i);

     if (Step->IsWorkingstep (exe_id))
          printf (Item at %d is a Workingstep\n, i);
          continue;
     }

     if (Step->IsWorkplan (exe_id))
          printf (Item %d is a nested workplan\n, i);
          continue;
     }

     if (Step->IsNcFunction (exe_id))
          printf (Item %d is an NC function\n, i);
          continue;
     }

     if (Step->IsSelective (exe_id))
          printf (Item %d is a Selective\n, i);
          continue;
     }

     if (Step->IsProbingWorkingstep (exe_id))
          printf (Item %d is a probing workinstep\n, i);
          continue;
     }
}

Further examples of how to decode the data, including examples of how to decode tool path data, are given in the Finder object documentation.

The fourth script reads three CAD geometry files and places them in the coordinate system of the CAM data. The program is assumed to know the required coordinates and uses the three placement functions to set those coordinates. The workpiece geometry describes the final part being made by the STEP-NC program. The rawpiece geometry defines the stock, and the fixture geometry describes the fixtures. Putting the geometries into a STEP-NC file allows an on-machine simulator to check the validity of a STEP-NC program, optimize the speeds and feeds, and compute tool path displacements for tools that are smaller or large than the ones assumed by the path.

Step->PartNo (fish_head);
Step->ReadCatiaAPTclfile (fishhead.clfile);
Step->Workpiece (Fish_Final.stp);
Step->WorkpiecePlacement (0, 0, 0, 0, 0, 1, 0, -1, 0);    
Step->Rawpiece (Fish_Stock.stp);
Step->RawpiecePlacement (0, 0, 0, 0, 0, 1, 0, -1, 0);     
Step->Fixture (Fish_Fixture.stp);
Step->FixturePlacement (10, 20, 0, 0, 0, 1, 0, -1, 0);
Step->SaveAsModules (Fish_machining.stpnc);

The placements given in the above script rotate the parts around the Z axis to make the X axis programmed in the geometry align with the negative Y axis of the toolpaths. In addition for the fixture the geometry origin is moved to (10, 20, 0) after the rotation has been completed.

The geometry used for the workpiece, rawpiece and fixture can come from any STEP file. It may be defined as a single part or as an assembly. The former is more common for the workpiece and rawpiece and the latter is more common for the fixture. The most common source for the data is a STEP AP-203 or AP-214 (CAD geometry) file. However, the API does not care provided the STEP file has geometry is harmonized with AP-203. In paraticular the STEP-NC API may be used with the new AP-242 STEP files that include geometric dimensions and tolerances.

The definition of Geometric Tolerances and Dimensions is critical for intelligent machining because with this information the control can determine the quality of the machining process and make adjustments as necessary. Consequently the STEP-NC API has functions that allow for the direct definition of tolerances when the required information is not otherwise available in a STEP file. Our last script illustrates this property of the API.

The script reads the same part geometry as the previous script. It then establishes the A, B and C datum’s for the data by picking faces in the geometry. Two of the faces are found using functions and one of them is found using a face name which is presumed to have been set by a CAD system. A third way is to ask the user to pick the face in the STEP-NC Explorer but this method is more complex.

After the datums’ have been defined a probing operation is applied to the hole and two tolerance constraints are defined for the hole. The first constraint requires the perpendicularity of the hole to not deviate within a tolerance of 0.25 millimeters The second constraint requires the diameter of the hole to be 37.44 millimeters with an upper limit of 0.05 (37.94) millimeters and a lowerlimit of 0.1 (37.34) millimeters.

Step->PartNo (fish_head);
Step->Workpiece (Fish_Final.stp);

int wp_id = Step->GetMainWorkplan();

int top_id = Step->GetFaceTop ();
Step->PutDatumA (top_id);

int hole_id = Step->GetFaceUsingName (Hole1);
Step->PutMaxDatumB (hole_id);

int back_id = Step->GetFaceBack ();
Step->PutDatumC (back_id);

fea_id = tol->PlanCylinderProbing (wp_id, 0, , hole_id, 2, 5);
tol->AddTolerancePerpendicularity (fea_id, 0.25, 1);
tol->AddToleranceDiameterSizeValueUpperLower (fea_id, 37.44, 0.05, 0.1);