NX Keyway: The Short Version
An NX keyway on an existing shaft can be built three ways: by hand from a tangent datum plane and an Extrude subtract, as a parametric UDF that looks up DIN 6885-1 sizes by diameter, or by an AI assistant that builds it via NXOpen once you confirm. inteliScience builds the third, always as an editable feature.
The Problem: “Put a Keyway in This Shaft” Is Three Requests in One
When an NX customer’s design team recently ranked what they wanted from AI inside NX, one concrete example was a keyway on an existing shaft, next to parametric feature groups and complex functions on existing bodies. Design support inside NX came first because it pays off fastest.
The wish is old. In an April 2012 Eng-Tips thread, an NX 6 user asked for exactly this: select the shaft diameter, choose the keyway. A Siemens engineer answered with an Extrude or a Slot on datum planes and, for repeated use: “Create a UDF (User Defined Feature) and add it to the Reuse library” (Eng-Tips, 24 April 2012).
Those are still the first two answers. The third is new: an assistant that reads the shaft, picks the row from your key table and builds the feature. The keyway request is already the action item in our six-question acceptance test for NX assistants; here we cover the modeling side.
The techniques hold across releases, including the June 2026 release (23 June 2026) that renamed Designcenter NX to Designcenter, and Designcenter 2612, in early access from 31 August to 25 September 2026 (Siemens blog, Siemens EAP).
What DIN 6885-1 Fixes Before You Open NX
The standard decides width, depth and fit; NX only decides how the feature is built. The current edition is DIN 6885-1:2021-11, “Drive type fastenings without taper action, parallel keys, keyways – Deep pattern – Part 1: Dimensions, tolerances, mass”, replacing the 2021-06 edition and the 1968 text (DIN Media).
ISO/R 773:1969 covered the same keys but was withdrawn in 1998 (ISO); we would not cite it on a new drawing. Inch shafts follow ASME B17.1, Keys and Keyseats (ASME): keep them in a separate table.
The excerpt below is cross-checked between two supplier extracts (Elesa+Ganter, Fasten.it); the licensed text remains the reference:
| Shaft diameter d (mm) | Key b x h (mm) | Shaft depth t1 (mm) | Hub depth t2 (mm) | Depth tolerance |
|---|---|---|---|---|
| over 12 to 17 | 5 x 5 | 3.0 | 2.3 | +0.1 |
| over 17 to 22 | 6 x 6 | 3.5 | 2.8 | +0.1 |
| over 22 to 30 | 8 x 7 | 4.0 | 3.3 | +0.2 |
| over 30 to 38 | 10 x 8 | 5.0 | 3.3 | +0.2 |
| over 38 to 44 | 12 x 8 | 5.0 | 3.3 | +0.2 |
| over 44 to 50 | 14 x 9 | 5.5 | 3.8 | +0.2 |
Cross-checking is not pedantry: a key table typed into an expression or a spreadsheet inherits every transcription error of its source, and the range boundaries (over 38 to 44, over 44 to 50) are where a lookup most easily picks the wrong row.
The key is made to h9; the keyway width tolerance sets the fit (antriebstechnik.shop, matching the Ganter DIN 6885-1 extract):
| Fit | Shaft keyway width | Hub keyway width | Used for |
|---|---|---|---|
| Tight | P9 | P9 | Shock and reversing loads, no play |
| Normal | N9 | JS9 | Standard fixed hubs |
| Sliding | H9 | D10 | Hubs that must slide axially |
End shape is the last input. Form A has round ends and sits in an end-milled keyway; form B has straight ends and sits in a run-out keyway cut with a disc cutter. In NX that is a different profile, so it belongs in the request, not in a default.
Way 1: Model the NX Keyway by Hand With Native Features
For a single shaft, the manual route is quick. The Siemens answer in the 2012 thread was a model showing “two different approaches to creating a keyway in a shaft, one using an Extrude and the other using a Slot feature”, both positioned with datum planes.
We recommend the Extrude. Slot, like Pocket, Pad and Boss, has been a legacy command since NX 11, hidden until you add it through Customize or the Command Finder (Swoosh Technologies, 2019), and it asks for a planar placement face (Eng-Tips) that a shaft does not have.
The Extrude route on an existing shaft:
- Create a datum plane tangent to the cylindrical face that carries the key, at your angular reference (datum planes can sit tangentially on curved faces, LearnNX).
- Sketch the outline on it: a slot shape (width b, length l) for form A, a rectangle for form B, dimensioned from the shoulder your drawing uses. For a form B disc cutter run-out, sketch the side profile on a plane through the axis and extrude it symmetrically to width b.
- Extrude into the shaft by t1 with Boolean Subtract.
- Rename the driving expressions instead of keeping p-numbers.
- Measure d minus t1 across the shaft, the check dimension many key tables print next to t1.
Step 5 catches the expensive mistake. DIN measures the shaft depth from the outer diameter, so a tangent datum plus t1 is correct. The Machinery’s Handbook approach quoted in the 2012 thread assumes “the ‘sidewall’ of the slot, NOT the center, will be half the height of the key”. The gap is the chordal height, R minus the square root of (R squared minus (b/2) squared): 0.92 mm for a 12 mm keyway in a 40 mm shaft, over four times the +0.2 mm depth tolerance. Pick one convention per key table.
Way 2: Make It Parametric With Expressions, a Key Table and a UDF
The parametric route turns the table into NX logic: a diameter that follows the model, a lookup inside the part, a reusable container. A diameter change then drives width and depth instead of a designer.
Take the diameter from an associative measurement: “If your model changes, the measurement expression updates automatically” (JIVE Engineering).
NX expressions can hold the key table itself. List expressions exist since NX 8.5, NX 11 added table-style editing, and a Siemens engineer posted a loop lookup with nth() on Eng-Tips in August 2016 (Eng-Tips). Adapted to keyways:
kw_table = {
{12, 17, 5, 3.0},
{17, 22, 6, 3.5},
{22, 30, 8, 4.0},
{30, 38, 10, 5.0},
{38, 44, 12, 5.0},
{44, 50, 14, 5.5}
}
kw_b = loop {
for $row in kw_table;
If ( ( shaft_d > nth(1,$row) ) && ( shaft_d <= nth(2,$row) ) ) Return nth(3,$row);
Return is 0;
}
kw_t1 = loop {
for $row in kw_table;
If ( ( shaft_d > nth(1,$row) ) && ( shaft_d <= nth(2,$row) ) ) Return nth(4,$row);
Return is 0;
}
shaft_d is the measurement; kw_b and kw_t1 drive sketch width and extrude depth. The fallback of 0 is deliberate: a shaft outside the table should fail on update, not get a plausible wrong keyway. Use Extended Text Entry mode for the loops, as the original post advises.
NX can also read Excel from expressions (ug_cell_read, ug_cell_vlookup, ug_excel_read, NX Journaling). We would advise against it for keyways: a part that depends on a workbook path breaks the day the share moves.
The reusable container is the User Defined Feature. Siemens describes UDFs as features plus controlling expressions in a library that “behave as a single feature” once inserted, with sizes “restricted within an acceptable range or to the selection of explicit choices” and libraries manageable in Teamcenter (Siemens NX UDF fact sheet). A keyway UDF with the shaft face, length, position, form and fit as inputs, and width and depth from the lookup, is the cleanest manual standard we know. Test it on three diameters before it enters the shared library.
Feature group or UDF: what the designers asked for
The team asked for “parametric feature groups”, and the term needs a follow-up question. An NX feature group organizes features that already exist: it can be named, modified and copied (LearnNX), nested, and set to hide (embed) its members, exposed in NXOpen through UF_MODL set-of-feature functions (NX Journaling). It has no input rules or lookup of its own.
“A parametric feature group I can drop on any body” is therefore, in NX terms, a UDF, optionally placed in a feature group. At inteliScience we settle this in the first workshop hour; the two differ a lot in effort.
Way 3: An AI Assistant That Reads the Shaft and Builds Behind a Gate
The assistant route does what the 2012 user asked for: the designer selects the shaft face, the assistant reads the diameter, looks up the company key table, asks for what is missing and builds the NX keyway after confirmation, as an editable feature, not a dumb body.
Siemens ships AI too: an Industrial Copilot that Siemens says is powered by Microsoft Phi-3 and can “even make design changes” (Siemens). Any assistant knows your key table only if you connect it.
The read half is plain NXOpen. This journal lists each cylindrical face with its diameter and table row, and changes nothing.
' NX journal (VB.NET): keyway proposal per cylindrical face, read-only.
' Assumes a metric (mm) part. Replace Rows with your company key table.
Imports System
Imports NXOpen
Imports NXOpen.UF
Module KeywayProposal
' d over, d up to, b, h, t1 (shaft), t2 (hub): DIN 6885-1 excerpt
Private ReadOnly Rows As Double(,) = {
{12, 17, 5, 5, 3.0, 2.3}, {17, 22, 6, 6, 3.5, 2.8},
{22, 30, 8, 7, 4.0, 3.3}, {30, 38, 10, 8, 5.0, 3.3},
{38, 44, 12, 8, 5.0, 3.3}, {44, 50, 14, 9, 5.5, 3.8}}
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim faceType As Integer
Dim facePt(2) As Double
Dim faceDir(2) As Double
Dim bbox(5) As Double
Dim faceRadius As Double
Dim faceRadData As Double
Dim normDirection As Integer
For Each solid As Body In workPart.Bodies
For Each f As Face In solid.GetFaces()
If f.SolidFaceType <> Face.FaceType.Cylindrical Then Continue For
ufs.Modl.AskFaceData(f.Tag, faceType, facePt, faceDir, bbox, _
faceRadius, faceRadData, normDirection)
Dim d As Double = 2 * faceRadius
Dim hit As Integer = -1
For i As Integer = 0 To Rows.GetUpperBound(0)
If d > Rows(i, 0) AndAlso d <= Rows(i, 1) Then hit = i
Next
If hit < 0 Then
lw.WriteLine(String.Format("d = {0:0.###}: outside table, ask", d))
Else
lw.WriteLine(String.Format("d = {0:0.###}: key {1} x {2}, t1 {3}, t2 {4}, norm_dir {5}", _
d, Rows(hit, 2), Rows(hit, 3), Rows(hit, 4), Rows(hit, 5), normDirection))
End If
Next
Next
End Sub
End Module
AskFaceData returns a cylindrical face’s radius; SolidFaceType against Face.FaceType.Cylindrical filters the faces (NX Journaling). Bores show up too; check the printed norm_dir on a test part.
The write half builds only after the engineer confirms. What each tool call must carry, including the source of every value, is in our requirements whitepaper for NX AI assistants.
inteliScience demonstrated the underlying capability to that team: an AI application connected to the running NX session through several NX tools, reading the work state, creating sketches and building geometry step by step, each step an editable feature in the Part Navigator. It need not be a chat window; the same logic runs as a ribbon button.
This runs as a POC. What’s missing for production: your key table as a maintained source, hosting in the EU, in Germany or on-premise, SSO, audit log, and a preview-and-confirm gate in front of every NXOpen write. We close the gap from “runs on my machine” to “runs in the design department” with the Geometry Creation Assistant for Siemens NX.
Failure Modes We Check Before Accepting a Keyway
Most keyway errors are reference and convention errors that survive until the shaft meets its hub. We check these whichever route built the keyway.
| Failure mode | What goes wrong | Check |
|---|---|---|
| Stepped shaft | Lookup uses the wrong diameter; the keyway runs into a shoulder fillet or undercut | Diameter read from the face that carries the hub; clearance to the shoulder |
| Datum tangent to a face that later changes | Datum flips or fails when the diameter or face is edited | Prefer a datum built from the shaft axis with an offset of d/2 |
| Depth convention mixed | Floor off by the chordal height (0.92 mm at d = 40, b = 12) | Measure d – t1 across the shaft |
| Wrong end form | Form A pocket where the shop cuts form B with a disc cutter | Form stated in the request and on the drawing |
| Fit not documented | Keyway modeled at nominal width, tolerance lost on the drawing | P9, N9 or H9 in PMI or the drawing note |
| Wrong part of the standard | DIN 6885-2 (machine tools) depths used for a DIN 6885-1 key | Standard and part named in the key table |
On the last row: DIN 6885-1 and DIN 6885-2 differ mainly in the radial position of the key, according to the Ganter extract.
What Your Company Key Standard File Must Contain
An assistant is only as good as the table it reads, and so is a UDF. The customer team keeps its design guidelines in a wiki; we connect such sources through their APIs, so an NX keyway assistant queries the current page, not a stale copy. The file needs (the same file belongs on the list for an NX AI workshop):
- Standard, part and edition (for example DIN 6885-1:2021-11), plus the depth convention used.
- One row per diameter range: b, h, t1, t2 and depth tolerances, checked once against the licensed text.
- The default fit and when to deviate (normal N9/JS9, tight P9/P9, sliding H9/D10).
- The default end form (A or B) per machining route in your shop.
- Preferred key lengths and the minimum distance to shoulders and undercuts.
- The drawing convention: t1 or d – t1, and where the width tolerance goes.
- The NX side: UDF name and revision, expression names, feature group name.
To change the table, the assistant needs write access; without it, it produces an edited copy for the owner to transfer. For a standards table, we would keep it that way.
Frequently Asked Questions
How do I create a keyway in Siemens NX?
Create a datum plane tangent to the shaft face, sketch the keyway on it and Extrude it into the shaft by t1 with Boolean Subtract, taking width and depth from DIN 6885-1 for the diameter. For repeated use, wrap the features and a table lookup in a User Defined Feature.
Slot vs. Extrude for an NX keyway: which one should we use?
Extrude. Slot still works but has been a legacy command since NX 11, hidden by default, and it needs a planar placement face, so on a shaft it depends on a datum plane anyway. A named sketch plus Extrude is also easier to reuse in a UDF.
What is the difference between a feature group and a UDF in NX?
A feature group organizes existing features in one part: named, nestable, with members optionally hidden. A UDF is a reusable parametric definition in a library, inserted as a single feature with restricted inputs. “Parametric feature groups” for any body usually means UDFs.
How much does it cost to automate keyways in NX?
The UDF route costs admin time to build and test the feature and table, plus a check that your license bundle covers UDF creation. The assistant route starts as a fixed-scope proof of concept on one part class; the entry offer is on our geometry creation service page and is creditable against a rollout.
Can the assistant use our own key table instead of the public DIN values?
It should. The assistant reads your table through a tool or retrieval, cites the row it used and asks when a shaft falls outside it. That is what “training the AI on our data” means in practice: retrieval plus tool access, not fine-tuning.
Next Step
Send us one shaft from your portfolio and your key table as it exists today. We show the keyway built as an editable feature in your NX, with the table row cited and the confirm step in front of it.
Related Topics
- Geometry Creation Assistant for Siemens NX
- Parametric part and variant generation from master templates
- Part families, WAVE or NXOpen for parametric reuse
References
- DIN Media, DIN 6885-1:2021-11, “Drive type fastenings without taper action, parallel keys, keyways – Deep pattern – Part 1: Dimensions, tolerances, mass”: https://www.dinmedia.de/en/standard/din-6885-1/346315269 (retrieved 2026-09-29)
- ISO, ISO/R 773:1969, “Rectangular or square parallel keys and their corresponding keyways” (withdrawn 1998): https://www.iso.org/standard/5056.html (retrieved 2026-09-29)
- ASME, B17.1 Keys and Keyseats: https://www.asme.org/codes-standards/find-codes-standards/b17-1-keys-keyseats (retrieved 2026-09-29)
- Elesa+Ganter, Technical data, DIN 6885/1 keyways: https://www.elesa-ganter.com/static/technicaldata/files/DIN6885_Keyways_EN.pdf (retrieved 2026-09-29)
- Fasten.it, DIN 6885-1 parallel keys, dimensions: https://www.fasten.it/en/norms/norm/din_6885-1 (retrieved 2026-09-29)
- Ganter, Service standards, DIN 6885-1 extract (keyway widths, depths, fits, DIN 6885-1 vs 6885-2): https://live-katalog.ganternorm.com/pdf/ganter/de/6885-1.pdf?dispositiontype=attachment (retrieved 2026-09-29)
- antriebstechnik.shop, parallel key dimensions and table (forms A and B, fits, key width h9): https://www.antriebstechnik.shop/Informationen/Ratgeber/Passfeder-Masse-Tabelle/ (retrieved 2026-09-29)
- Eng-Tips, “keywey function” (Extrude and Slot approaches, sidewall convention, UDF in the Reuse Library, 24 April 2012): https://www.eng-tips.com/threads/keywey-function.320723/ (retrieved 2026-09-29)
- Eng-Tips, “NX7.5 Slot” (planar placement face): https://www.eng-tips.com/threads/nx7-5-slot.364456/ (retrieved 2026-09-29)
- Eng-Tips, “NX conditional logic statements” (list expressions and loop lookup, August 2016): https://www.eng-tips.com/threads/nx-conditional-logic-statements.412524/ (retrieved 2026-09-29)
- Swoosh Technologies, “Retirement v Living the Legacy: NX CAD Commands” (17 January 2019): https://www.swooshtech.com/2019/01/17/retirement-v-living-the-legacy-nx-cad-commands/ (retrieved 2026-09-29)
- LearnNX, Datum planes: https://alt.learnnx.com/course-modeling/m8/ (retrieved 2026-09-29)
- LearnNX, Feature groups: https://learnnx.com/lesson/siemens-nx-modeling-group-your-features/ (retrieved 2026-09-29)
- JIVE Engineering, “Siemens NX Measure Tool Tutorial” (associative measurements): https://www.jiveengineering.com/nxblog/nx-measure-tool-tutorial-in-depth-guide (retrieved 2026-09-29)
- Siemens PLM Software, “NX User Defined Features” fact sheet: https://www.plm.automation.siemens.com/es_es/Images/nx_user_defined_features_fsW1_tcm52-8682.pdf (retrieved 2026-09-29)
- NX Journaling, “Creating new feature group”: https://www.nxjournaling.com/content/creating-new-feature-group (retrieved 2026-09-29)
- NX Journaling, “Change Excel file expression references”: https://www.nxjournaling.com/content/change-excel-file-expression-references (retrieved 2026-09-29)
- NX Journaling, “Accessing surface information from a face” (AskFaceData, SolidFaceType): https://nxjournaling.com/content/accessing-surface-information-face (retrieved 2026-09-29)
- Siemens, NXOpen .NET Reference Guide, NXOpen.Session (SetUndoMark, UndoToMark): https://docs.sw.siemens.com/documentation/external/PL20191127135844554/en-US/nx_api_sc/nx/1926/nx_api_sc/en_US/nxopen_net/a07788.html (retrieved 2026-09-29)
- Siemens, “AI-enabled CAD capabilities in Designcenter CAD” (Industrial Copilot powered by Microsoft Phi-3): https://www.siemens.com/en-us/products/designcenter/cad-software/ai/ (retrieved 2026-09-29)
- Siemens Designcenter blog, “Designcenter is for everyone, June 2026 release” (23 June 2026): https://blogs.sw.siemens.com/designcenter/designcenter-is-for-everyone-june-2026-release/ (retrieved 2026-09-29)
- Siemens, “Welcome to the September 2026 Early Access Program for Designcenter” (Designcenter 2612): https://resources.sw.siemens.com/en-US/presentation-welcome-to-designcenter-early-access-program/ (retrieved 2026-09-29)

