3. Welding groove types and definitions#

3.1. Introduction#

This tutorial is about generating different groove types and using the groove methods. The methods are seperatable in X parts:

  • Creating a groove with get_groove

  • Converting a groove to a profile

  • Using plot on a profile constructed by a groove

  • All possible groove types as plot

  • Saving and loading grooves to/from weldx files

First starting with the imports needed for this tutorial:

from IPython.display import display

from weldx import WeldxFile, get_groove

3.2. Creating a groove#

Each groove type has different input variables, which must be passed along with it. For this we need the Groove Type as string and the attributes that describe this Groove Type. All attributes are used with pint quantity, we recommend to use the quantity class created by us.

Here an Example with a V-Groove. Note that groove_type="VGroove" and the required attributes are workpiece_thickness, groove_angle, root_gap and root_face.

v_groove = get_groove(
    workpiece_thickness="1 cm",  # (note the use of 'cm')
    groove_angle="55 deg",
    root_gap="2 mm",
    root_face="1 mm",

VGroove(t=<Quantity(1, 'centimeter')>, alpha=<Quantity(55, 'degree')>, c=<Quantity(1, 'millimeter')>, b=<Quantity(2, 'millimeter')>, code_number=['1.3', '1.5'])

As shown above you pass the groove_type along with the attributes and get your Groove class. Function get_groove has a detailed description for all Groove Types and their Attributes.

Note: All classes can also be created separately with the classes, but this is not recommended.

from weldx.welding.groove.iso_9692_1 import VGroove

v_groove = VGroove(t, alpha, c, b)

3.3. Converting a groove to a profile#

Each groove class can be converted into a Profile by calling its to_profile function. To learn more about the Profile class and its uses look into geometry_01_profiles.ipynb. Profiles created this way consist of one shape per mating part. For the V-Groove each mating part is made up of four basic lines.

v_profile = v_groove.to_profile()
Profile with 2 shape(s)
Shape 0:
Line: [-7.69 0.00] millimeter -> [-1.00 0.00] millimeter
Line: [-1.00 0.00] millimeter -> [-1.00 1.00] millimeter
Line: [-1.00 1.00] millimeter -> [-5.69 10.00] millimeter
Line: [-5.69 10.00] millimeter -> [-7.69 10.00] millimeter

Shape 1:
Line: [7.69 0.00] millimeter -> [1.00 0.00] millimeter
Line: [1.00 0.00] millimeter -> [1.00 1.00] millimeter
Line: [1.00 1.00] millimeter -> [5.69 10.00] millimeter
Line: [5.69 10.00] millimeter -> [7.69 10.00] millimeter

3.3.1. calculating groove cross sectional area#

An approximation of the groove cross sectional area can be calculated via the cross_sect_area property

62.165931094691445 mm ** 2

3.4. Using plot on a profile constructed by a groove#

We can visualize the profile by simply calling the plot() function of the groove object. Carefully note the labeling (yz) and orientation of the axis. The plot shows the groove as seen along the negative x-axis (against the welding direction).


As explained above you see that this V-groove has two halves and a V-Groove layout. The plot scaling is always in millimeter.

The plot method has the following attributes:

  • title

    Setting from matplotlib. Default: None

  • raster_width

    Is the ratio of the rasterized points between each joint.

  • axis

    Setting from matplotlib. Default: equal

  • grid

    Setting from matplotlib. Default: True

  • line_style

    Setting from matplotlib. Default: '.'

  • ax

    Setting from matplotlib. Default: None

Here is the same plot with different options:

v_profile.plot(title="V-Groove", raster_width="0.5mm", grid=False, line_style="rx")
/home/docs/checkouts/readthedocs.org/user_builds/weldx/conda/latest/lib/python3.9/site-packages/weldx/geometry.py:1458: UserWarning: color is redundantly defined by the 'color' keyword argument and the fmt string "rx" (-> color='r'). The keyword argument will take precedence.
  ax.plot(segment[0], segment[1], line_style, label=label, color=c)

3.5. using ASDF#

All groove types can be saved to weldx-files.

Here we demonstrate the writing of the groove data into a buffer (in-memory file):

tree = dict(test_v_groove=v_groove)
file = WeldxFile(tree=tree, mode="rw")

We can show the file header with all groove metadata:

#ASDF 1.0.0
%YAML 1.1
%TAG ! tag:stsci.edu:asdf/
%TAG !weldx! asdf://weldx.bam.de/weldx/tags/
--- !core/asdf-1.1.0
asdf_library: !core/software-1.0.0 {author: The ASDF Developers, homepage: 'http://github.com/asdf-format/asdf',
  name: asdf, version: 2.15.1}
  - !core/extension_metadata-1.0.0
    extension_class: asdf.extension.BuiltinExtension
    software: !core/software-1.0.0 {name: asdf, version: 2.15.1}
  - !core/extension_metadata-1.0.0
    extension_class: weldx.asdf.extension.WeldxExtension
    extension_uri: asdf://weldx.bam.de/weldx/extensions/weldx-0.1.2
    software: !core/software-1.0.0 {name: weldx, version: 0.6.8.dev5+g3bef3e0.d20230911}
test_v_groove: !weldx!groove/iso_9692_1_2013_12/VGroove-0.1.0
  t: !weldx!units/quantity-0.1.0 {value: 1, units: !weldx!units/units-0.1.0 centimeter}
  alpha: !weldx!units/quantity-0.1.0 {value: 55, units: !weldx!units/units-0.1.0 degree}
  b: !weldx!units/quantity-0.1.0 {value: 2, units: !weldx!units/units-0.1.0 millimeter}
  c: !weldx!units/quantity-0.1.0 {value: 1, units: !weldx!units/units-0.1.0 millimeter}
  code_number: ['1.3', '1.5']

Now we are taking a copy of the first file by calling WeldxFile.write_to. Then we read the file contents again and validating the extracted groove:

file_copy = file.write_to()
data = WeldxFile(file_copy)

3.6. Examples of all possible Groove Types#

An overview of all possible groove types:

# generate test grooves
from weldx.welding.groove.iso_9692_1 import _create_test_grooves

groove_dict = _create_test_grooves()
for k in ["dv_groove2", "dv_groove3", "du_groove2", "du_groove3", "du_groove4"]:
    groove_dict.pop(k, None)

for _k, v in groove_dict.items():
../_images/1011ef1b9020fc0f3c60c5615f38cb01e68ac8b956799e722d699bbbd5390df1.png ../_images/d5377d6f98df51955aebb0678fb7a965f8e04f9713bb43a455dd93e21e0bfdc3.png ../_images/3077e60a64cd18c7013c739bc15cf89ae79d086615381b1540ab582ada2e3fc5.png ../_images/7b4f1f1ceccdc16d31458308c80174306a0b0d3919ec6bf146e5fe9bf5370c1e.png ../_images/f9f29cd9eea5481c25c976656c8ff1d61a573b135b43af9fbf460c8966c3ec5a.png ../_images/748bd3504e95b1c34ef1d8ced8480e97f92c1b376df1ced843c955542d3015e6.png ../_images/251c7d6f983ad58dc95fb3d5a7129c7c051512035d04c7030420147fbcca719c.png ../_images/7a08ffbf1c6f5bc633cc551a5052ad5f1b0642ff9e739d54423016716a501586.png ../_images/2fc854e411540c6779539401168fd201bde4620817717ca5d23c79f9583990c1.png ../_images/525ccfc68e3d7a81ff05baeba7052e5a0c71f00063614b054d7b0bd4f89c6091.png ../_images/b30e0ac1a51bbdb567d6d7a90ea42cba8b493288c12c60275cedb82e3a965811.png ../_images/77361830291d52002634bf70541741f51707be3316653e403ce715d939dd0098.png ../_images/75f3a44750be1388035dc11e4d140a40d5d61fd4e1d707e8811a63abccd114c2.png ../_images/a9df601424d811336da64631049f91387e05763cd247733e16732d0e24068340.png ../_images/1985d5f0721b02746df88844fd40f2b1d76b793cf8f6b3499e81d906cc325588.png ../_images/66d7aef0572c24b3dc1f756725013f2373c39fc28bd8948b17f3d740ef692b5a.png ../_images/e90c54a54d0db596d5e5f9ab2ee5e53c956031b3c3050656b084dc311740fa00.png