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(
    groove_type="VGroove",
    workpiece_thickness="1 cm",  # (note the use of 'cm')
    groove_angle="55 deg",
    root_gap="2 mm",
    root_face="1 mm",
)

display(v_groove)
print(str(v_groove))
VGroove(t=<Quantity(1, 'centimeter')>, alpha=<Quantity(55, 'degree')>, c=<Quantity(1, 'millimeter')>, b=<Quantity(2, 'millimeter')>, code_number=['1.3', '1.5'])
../_images/4ad11aee6de367167b1c99ef40fc69b76f16f310563ead23d0d7612c4bfa755f.png

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()
print(v_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

print(v_groove.cross_sect_area)
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).

v_groove.plot()
../_images/4ad11aee6de367167b1c99ef40fc69b76f16f310563ead23d0d7612c4bfa755f.png

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.10/site-packages/weldx/geometry.py:1459: 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)
../_images/cc5ab22c58217ca74db8d4716622648a9b04975c64791c1d3e28df791a286e95.png

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:

file.header()
#ASDF 1.0.0
#ASDF_STANDARD 1.5.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}
history:
  extensions:
  - !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.dev24+g2bceb68.d20240312}
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)
data["test_v_groove"]
../_images/4ad11aee6de367167b1c99ef40fc69b76f16f310563ead23d0d7612c4bfa755f.png

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():
    v[0].plot(line_style="-")
../_images/f884b519c8575849785199e81c18c87effb4a44e0a2d19fe65fa8114afee1f0d.png ../_images/0bda4190445d5c67ea03029c9a79a72fc47baf407402d07cfa03b48e5f175551.png ../_images/1a03189baa85189fffbf41f4a2da77c96b557e01ccb99cbbe48b495be1c84802.png ../_images/5767fce0009ff5ae906cb15ce4c504b03c40a05407ec33dce9a91e89dbbfa70e.png ../_images/b81c76b556a435bf44b6062c5ed020fd46ae1987607b63ac90ff40644912a336.png ../_images/f7f527d8b81ca3e003d19d0256522e1c83700a0f341aac3c76f3c1ea9fcf1d09.png ../_images/d5b6e945a2873bf6f2083becf47984439423fe1e1e83e018a3fb0e18cd3f21f3.png ../_images/982c3ea408739b04a913d1c2b45734bd9c57fc06e98c072e13499f88fbf86198.png ../_images/6e7abb9fff30e0ac679807d991db9d30af3b7ea64bc346d2cffb7db481fdf2bc.png ../_images/16edbcc56ace2750c485cdf9c80edfec09d5fc5946ff26c1c3cf141d5bc671a9.png ../_images/d57130231064eb0b0591fff67dc547a0d9083737c2e6729c3625af168c7c1b98.png ../_images/80e62866bb9193d3e7d86f003ef7f60eb7cf7cd67b59b4258fd113ef02a849ad.png ../_images/8416274d536c71cf5d17bfadaacd29a4b973d58953aeb8c13389b7e719ff3449.png ../_images/07f6e09c1285f0accfaf251f646e30901a12e7ed634fc4ee5235d56b1b13c5ea.png ../_images/dab7a779b4b50baa8672985104963a8ccce7c71bab5c0d1d82fb59779fa28536.png ../_images/f0f1ccff91169c1ae7555cba0078f6abd734c3ebf37da7c4cc60b9eb99c58a54.png ../_images/7bf8bf2863cbc8268e50f3b57bc1350b4a033cf1211a86c50c188edcf61844b6.png