How to extract dimensions from filenames and configuration names

You are here:

Lightning has a database to make searching lightning-fast. This database contains the dimensions and materials for all your fasteners.

To use Lightning, you need to fill this database once. This takes 15-60 minutes, depending on the number of files and the naming scheme you used.

We go through the setup process in this video and we explain each step in this article. Because software changes faster than video, the video is always a bit behind. So we’ll do our best to keep the Knowledge Base up to date.

Step 4 of the settings: add fastener dimensions

Table of contents

  1. Three ways of adding data
  2. Using XML files to automate this step
  3. How to enter data manually
  4. Extract data using ‘patterns’
    1. What is a pattern?
    2. How to build a pattern
    3. How to reuse previously created patterns
    4. How to store patterns in XML files

This is the interface for step 4 of the settings. It may look daunting at first but you’ll quickly get the hang of it.

Lightning settings step 4 manual input

View image in new tab

Color legend

  1. A green cell means that it contains data
  2. Orange cells still need data
  3. Blue cells are optional

1. Three ways of adding data

We want to help you avoid adding all fastener data manually. So we have three ways of filling in the required data in this step:

  1. Use XML files with data and patterns.
    • Adding these XML files to your fasteners folders can completely automate this step of the settings.
    • We include these when you purchase fasteners from our library.
  2. Create ‘patterns’ to extract data from filenames, configuration names or custom properties
    • If all filenames are built up in the same way, we can help you extract fastener sizes from file names.
  3. Enter data manually

2. Using XML files to automate this step

We explain how to do this in How to store patterns in text files. When you purchase our Fastener Models library, we always include these XML files to automate 99% of the Lightning settings.

3. How to enter data manually

You can always use this window to enter fastener data manually. We only save data for configurations, so you may have to expand rows to see the saved data. But if a cell turns green, it means there is data present.

To enter data manually:

  1. Select one or more rows in the tree view at the top.
    • You can select any combination of folders, files and configurations.
  2. Enter data in one of the text boxes at the bottom.
  3. Hit enter or tab to apply the data to all selected rows

4. Extract data using ‘patterns’

4.1. What is a pattern?

Say a file name is ISO4014-M6x20-8.8-zinc and all other files in the folder follow the same structure.

We replace every word or number that varies in that folder with a tag. For example <Diameter> or <Length>. The tags are not case-sensitive and there are no closing brackets like with HTML or XML.

You can type this pattern manually or click the ‘plus’ buttons (see below) to add a tag. Then you click Apply pattern to selection to apply the new pattern to all selected folders, files, parts or configurations.

Lightning pattern buttons

So for the filename above (ISO4014-M6x20-8.8-zinc), the pattern you need is:

<Standard>-M<Diameter>x<Length>-<Material>-<Coating>

If you enter this correctly, Lightning will read the standard as ISO4014, the diameter as 6, et cetera.

A few examples

FilenamePattern
ISO 4014 M4x20<Standard> <Standard> M<Diameter>x<Length>
DIN123 – 5h6x50<Standard> – <Diameter><Fit>x<Length>
Bolt ISO 5 M4<Ignore> <Standard> <Standard> M<Diameter>

4.2. How to build a pattern

Data sources

There are four data sources for fastener data:

  1. File names
  2. Configuration names
  3. File-level custom properties
  4. Configuration-level custom properties

Available tags

  • <Standard>
  • <Diameter>
  • <Pitch>
  • <Length>
  • <Fit>
  • <Material>
  • <Coating>
  • <Ignore>
  • <OptionalOpen>
  • <OptionalClose>

Using two identical tags

We combine the values found for identical tags. You can, for example, you use <Standard> <Standard>to recognize ISO 4014, with a space in between. Usually, you only need one tag, though, even when there is a space between two words.

<Ignore> tag

Sometimes there is text in your filename that Lightning does not need. To skip over that text, you can use the <Ignore> tag.

<OptionalOpen> and <OptionalClose> tags

Say your folder contains filenames with and without a pitch:

  • DIN929-M10-A2-50
  • DIN929-M10x1.25-A2-50

You can apply a single pattern for the entire folder by using <OptionalOpen> and <OptionalClose> tags. Everything in between these tags can be present but is not mandatory.

The pattern you need to recognize these two files is:

<standard>-M<diameter><OptionalOpen>x<Pitch><OptionalClose>-<material>

Lightning will find no value for the pitch for the first file and finds the pitch of 1.25 mm for the second file.

4.3. How to reuse previously created patterns

Chances are that many of your filenames follow the same pattern. That’s why we store the patterns you created in this session.

To find a pattern you created earlier, select the Reuse a previous pattern radio button for Data Source. Select one, then click Apply pattern to selection or Edit selected pattern.

Lightning settings step 4 reuse pattern

View image in new tab

4.4. How to store patterns in XML files

These patterns are the magic that makes our XML files work.

If you want to, you can create your own text files. There needs to be an XML file in each folder with part files. The text file tells Lightning:

  1. The fastener type
  2. The thread type
  3. The patterns for the file name and configuration name

You can read all about it in How to store patterns in text files.