Table of Contents

Workflow: Basic Machining Simulation

This workflow walks through setting up and running a machining simulation from scratch, including project configuration, option tuning, NC execution, and result inspection.

flowchart TD
    Equipment["Set machine tool &<br>controller brand/type"]
    Job["Set workpiece, fixture,<br>tool house, NC files,<br>controller offsets"]
    Option["Tune simulation options<br>(resolution, physics, etc.)"]
    Run["Run simulation"]
    View["View results"]

    Equipment --> Job --> Option --> Run --> View

1. Set Machine Tool and Controller

The machine tool and controller are fixed equipment that define the physical simulation environment.

Machine Tool

The machine tool (.mt file) provides the kinematic model and STL bodies. Once selected it rarely changes between simulations.

Controller

Select the controller brand and type (e.g., Fanuc, Heidenhain, Siemens). This determines how NC code is interpreted. See Heidenhain Support and General NC Code Support for details.

GUI Operation

Open or create a project in the HiNC application and configure machine tool and controller through the corresponding panels before setting up the job.


2. Set Job Components

With equipment fixed, configure the job-specific components that change between simulations.

Job Components

Component Description
Workpiece Geometry (STL or parametric), material, and coordinate frame
Fixture (optional) Fixture geometry that participates in collision detection
Tool House One or more cutting tools with geometry and flute definitions
NC Files The NC programs to simulate
Controller Offsets Tool offset tables, work offset tables, and other controller-specific presets
Tip

All file paths used in script commands are relative to the project directory unless an absolute path is given.

Script Access

The workpiece and fixture objects are available through Workpiece(API) and Fixture(API).

var workpiece = Workpiece;
var fixture = Fixture;

GUI Operation

Configure each component through the corresponding panels (Workpiece, Fixture, Tool House windows).


3. Tune Simulation Options

Simulation options control the trade-off between accuracy and speed.

3.1 Workpiece Entity Resolution

MachiningResolution_mm(API) sets the smallest cube width of the workpiece mesh.

MachiningResolution_mm = 0.125;

Valid values are powers of 2 (e.g., 4, 2, 1, 0.5, 0.25, 0.125). If you supply a non-power-of-2 value the system rounds to the nearest power of 2.

Warning

Each halving of mesh width can increase computation time and RAM by up to 8x. Start with a coarser resolution and refine only when needed.

3.2 Display Cache

DispCache_Mb = 260;

The display resolution depends on the cache size. Recommended value should not exceed 1000 Mb.

3.3 Machining Motion Resolution

Machining motion resolution determines the interval of each simulation step. Options:

Mode Command Description
Feed Per Cycle MachiningMotionResolution = FeedPerCycle; One step per spindle revolution
Scaled Feed Per Cycle MachiningMotionResolution = ScaledFeedPerCycle(0.5); One step per revolution × scale factor
Feed Per Tooth MachiningMotionResolution = FeedPerTooth; One step per tooth revolution (default)
Fixed Pace MachiningMotionResolution = FixedPace(1, 15); Fixed linear (mm) and rotary (deg) resolution
Warning

Do not use scaled model dimensions as a substitute for adjusting mesh width. Scaling model dimensions causes internal algorithm thresholds (minimum cuttable amount, floating-point-to-fraction range) to become invalid, producing irregular geometry artifacts. Adjust resolution settings instead.

3.4 XML Configuration

Resolution can also be set in the .hincproj file or changed mid-simulation via NC code comments:

T01 M06 (;@MachiningResolution_mm=0.03125;)

4. Run Simulation

There are three ways to drive the simulation.

4.1 PlayNcFile — Execute from a File

PlayNcFile(API) reads and executes an NC file.

PlayNcFile("NC/file1.nc");

4.2 PlayNc — Execute from a String

PlayNc(API) executes NC code directly from a string, useful for programmatic or dynamically generated commands.

double x = 10.0;
PlayNc($"G01 X{x} Y20 F100", "Generated Command");

4.3 PlayCsvFile — Drive from CSV Data

PlayCsvFile(API) drives the simulation from a CSV file containing axis positions, spindle speed, and feed rate.

PlayCsvFile("Data/file1.csv");

Required CSV columns (default headers): MC.X, MC.Y, MC.Z, ToolId, SpindleSpeed_rpm, Feedrate_mmdmin. Optional: MC.A, MC.B, MC.C, ActualTime, StepDuration.

Tip

CSV files exported by WriteStepFiles(API) can be directly read back with PlayCsvFile(API).

4.4 Player Control

Command Purpose
Pace()(API) Insert a pausable checkpoint
Pause()(API) Pause execution
Reset()(API) Reset player state
PlayNcFile("NC/file1.nc");
if (someCondition)
    Pause();

5. View Results

5.1 Runtime Geometry

After simulation the workpiece geometry is a Runtime Geometry (cubic mesh). You can save and reload it to avoid re-computing the initial shape:

WriteRuntimeGeom("Cache/file1.wct");
WriteRuntimeGeomToStl("Output/file1.stl");

To reload a saved geometry for a subsequent run:

ReadRuntimeGeom("Cache/init.wct");
PlayNcFile("NC/file1.nc");

5.2 Step Data Inspection

Each simulation step carries rich data (force, torque, power, thermal, wear). Access individual steps:

var step = GetMillingStep(100);
Message($"ToolId={step.ToolId}, Force={step.MaxAbsForce_N} N");

Total step count:

var total = StepCount;
Message($"Total steps: {total}");

5.3 Export Data

Export step-level CSV:

WriteStepFiles("Output/[NcName].step.csv");

Export waveform (shot) CSV:

WriteShotFiles("Output/[NcName].shot.csv", 1);

5.4 Messages

Use messages to log and track simulation progress:

Message("Simulation complete");
AppendMessagesToFile("Output/messages.txt");

Troubleshooting

Symptom Likely Cause Fix
Very slow simulation Resolution too fine Increase MachiningResolution_mm
Irregular bumps on geometry Scaled model dimensions instead of resolution Use resolution settings only; see warning above
Display lag DispCache_Mb too large Reduce display cache (< 1000 Mb recommended)
Empty step data Simulation not run or tool not engaging workpiece Verify tool path intersects the workpiece

See Also