Using Python with Tekla Structures

Tekla Structures
Not version-specific
Tekla Structures
python
nc file setup
nc file
create cnc
CNC
Environment
United States (Imperial)
United States (Metric)

Throughout the years, there has been considerable interest in coordinating Python with Tekla Structures. The sections below outline several adjustments that can enhance this interplay and potentially reduce inquiries from the shop floor.

 

Back to top

Advanced Options

Most of the settings we need to change will be in the advanced options, to get there you will need to go to Tools > Options > Advanced Options > then find the CNC section.

Image
Advanced options dialog in the CNC category with the Python specific settings to change

XS_DSTV_USE_REAL_DIMENSIONS_IN_HEADER

This setting controls the header information on output. When Tekla Structures outputs the NC file the header data will round the height down while the data in the AK block is in metric (viewer . 

Take the example of a beam with a total height of 1'-3" 5/32. With the value set to FALSE,  1'-3" 1/8 where the AK block information may display in a reader as 1'-3" 3/16. This will cause Python to receive an error even though it is a 0.01 mm difference in the actual file. Setting the option above to TRUE will force the header to display 1'-3" 3/16

XS_DSTV_USE_ONE_VERTEX_SHARP_INNER_CORNER

This setting affection how Tekla Structures exports additional vertex point in AK block. This sometimes causes duplicate points to be displayed in the AK block information and Python will reject the member if duplicates are found. We would want to set this option to TRUE.

Back to top

NC File settings

Now we move on to changing the actual NC file settings found under ☰ (File) > Export > Create NC Files. There are not any here that we really need to change but more so be aware of what they do and how Python reacts to them.

The default NC File settings are broken out by shapes. To edit the individual settings of each, highlight the row (for example DSTV for Profiles) and click the Edit button on the right hand side.

For a full description of the following options and other options including on all the NC File settings please click here.

Inner corners shape

When editing NC File Settings, proceed to the Holes and Cuts tab. Here you will find an option called Inner corners shape. This option determines how the copes will be handled when the NC file is created, the default option is set to "2" which will work correctly with Python. 

Image
NC File Settings dialog highlighting the Inner corners shapes that do and do not work with Python

If you set the option to "3" or "4" when Tekla Structures finds a cope that has a sharp inner corner it will automatically radius that sharp corner with the value you put in the "Radius" box on the "Holes and Cuts" tab.

Python cannot read this value because there is not a lead in or lead out created when this is used, it is simply a radius value. So you do not want to use these options but model your copes with the correct radius in the beginning. 

Distance from flange within which web is not cut

This value defines the height of the flange clearance area. There is no default value for Python but this does need to be addressed before you start fabricating to prevent damage to the CNC equipment.

Image
NC File Settings dialog highlighting the Distance from flange within which web is not cut
Back to top

Header Information

The DSTV file has lines at the top of the file that contains all the information about the part. The order of the lines of information is set to be in a specific order according to the DSTV Standard Format. The order the shop machine software reads these lines might be different than the default.

Tip:
When possible, it is recommended to change machine software settings. Changing the machine software settings reduces the possibility of separate NC files (and settings) for each machine.

To change the order of the header lines:

1.  ☰ (File) > Export > Create NC Files

2. Click the Header… Button.

Image
Screenshot showing the NC File dialog with an arrow pointing to the Header… button.

 

3. The NC File Header Information dialog will appear showing all the Elements being exported to the Header. Select the element for Piece identification.
4. Click the Move up button. This will move the Piece identification above the Phase identification basically swapping the two Elements.
Image
NC File Header Information dialog with Piece identification highlighted and an arrow pointing to the Move up button.

Tip:
You can continue swapping the elements around to get the order you need for the shop machine interface if needed. If you get the elements too for out of order you can click the Default button to reset back to the original order.

5. Click OK when finished to close the dialog box.
6. Create NC files as normal.

Back to top

Final topics

We have discussed everything that should be changed but now I will provide a few links on settings up Contour Mark, Pop Marks, and Hard Stamps within Tekla Structures that you might need when creating NC files. Be sure that you check with your fabricator or just check that your equipment can support these features before implementing them. 

For more information:

 

Back to top
Was this helpful?