Example of a Clip Macro
- Last UpdatedFeb 06, 2023
- 6 minute read
|
! |
**************************************************************** |
|
|
! |
NAME: |
|
|
! |
clip_1 - Calculate Clip contour |
|
|
! |
PURPOSE: |
|
|
! |
||
|
! |
clip type |
101 |
|
! |
cutout type |
101 |
|
! |
profile type |
10,20,30,31,35,36,40,43 |
|
! |
DECLARATION: |
|
|
! |
VERSION2 |
"Version" parameter. |
|
! |
PROF_TYPE |
Profile type |
|
! |
PROF_PARAM1..6 |
The meaning of the profile parameters is dependent of the profile type. |
|
! |
V2 |
2D Vector along the flange. |
|
! |
V3 |
2D Vector along the contour in the direction of the flange. |
|
! |
V4 |
2D Vector along the contour in the opposite direction. |
|
! |
WEB_FACTOR |
Scaling factor along the web. |
|
! |
FLANGE_FACTOR |
Scaling factor along the flange (along V2). |
|
! |
PLATE_THICKNESS |
Plate thickness. |
|
! |
CLIP_LOC |
1. On mould line side. |
|
! |
CUT_TYPE |
Cutout type code. |
|
! |
PARAM1 |
Parameter 1 of the clip (0 when undefined). |
|
! |
PARAM2 |
Parameter 2 of the clip (0 when undefined). |
|
! |
GAP_M |
Gap on mould line side (0 when undefined). |
|
! |
GAP_N |
Gap on non-mould line side (0 when undefined). |
|
! |
GAP_T |
Gap on top side (0 when undefined). |
|
! |
C_MEAS |
Cutout "c-measure" |
|
! |
INPUT/OUTPUT: |
|
|
! |
Parameters: |
|
|
! |
CLIP_THICKNESS |
Thickness of the clip. |
|
! |
SURFACE |
Surface treatment |
|
! |
QUALITY |
Material quality |
|
! |
EXCESS |
Excess against "shell" plate. |
|
! |
RESULT: |
|
|
! |
Parameters: |
|
|
! |
CLIP_CONTOUR |
The contour defining the clip. |
|
! |
______________________________________________________________ |
|
|
! |
The following parameters are optional in the sense that they need only be assigned a value if this is relevant. |
|
|
! |
However they are always required in the macro head and should thus always be declared as output parameters. |
|
|
! |
______________________________________________________________ |
|
|
! |
INTERVALS |
List of 2D point intervals for which weld and/or bevel information is of interest. If C0, C1, C2 are 2D points on the clip contour then C0, C1 and C1, C2 define two valid intervals. |
|
! |
INTERVAL_TYPES |
String containing a comma separated list of interval types for the previously defined intervals. INTERVAL_TYPES = '10,40' means that interval type 10 is attached to the first interval and interval type 40 is attached to the second interval. |
|
! |
WELD |
General weld size. If not otherwise specified this is used for all welds. |
|
! |
WCLIP |
Weld size for welding clip to clip. |
|
! |
WPROF |
Size of weld against profile. |
|
! |
WSHELL |
Size of weld against shell. |
|
! |
Bevel types when: |
|
|
! |
BCLIP |
Two clips are welded together. |
|
! |
BWEB |
The clip is welded against the web of the profile. |
|
! |
BCWEB |
The clip is welded against the web of the profile where it is coinciding with the plate contour. |
|
! |
BFLA |
The clip is welded against the flange. |
|
! |
BCFLA |
The clip is welded against the flange where it is coinciding with the plate contour. |
|
! |
BSHELL |
The clip is welded against the plate that is carrying the profile. |
|
! |
BCSHELL |
The clip is welded against the plate that is carrying the profile where it is coinciding with the plate contour. |
|
! |
POS_CODE |
= 0 Should not be position- numbered. = 1 Should be position-numbered |
|
! |
DESIGNATION |
Clip designation. |
|
! |
POS |
Position number of the clip |
|
! |
DESTINATION |
Destination |
|
! |
INSERT_CODE |
= 0 Overlapping clip |
|
! |
ASSEMBLY |
Assembly string |
|
! |
RESULT |
Result code. 0 = Clip contour was generated successfully. 1 = Clip was generated but with warnings, warning message in MESSAGE. -1 = Failed to generate the clip, error message in MESSAGE. |
|
! |
MESSAGE |
Message string. Will be output to screen if RESULT = 1 or -1. |
|
! |
************************************************************** |
|
MACRO, 'clip_1',
VERSION2,
PROF_TYPE,
PROF_PARAM1,
PROF_PARAM2,
PROF_PARAM3,
PROF_PARAM4,
PROF_PARAM5,
PROF_PARAM6,
V2,
V3,
V4,
WEB_FACTOR,
FLANGE_FACTOR,
PLATE_THICKNESS,
CLIP_LOC,
CUT_TYPE,
PARAM1,
PARAM2,
GAP_M,
GAP_N,
GAP_T,
C_MEAS,
CLIP_THICKNESS,
SURFACE,
QUALITY,
EXCESS,
CLIP_CONTOUR,
INTERVALS,
INTERVAL_TYPES,
WELD,
WCLIP,
WPROF,
WSHELL,
BCLIP,
BWEB,
BCWEB,
BFLA,
BCFLA,
BSHELL,
BCSHELL,
POS_CODE,
DESIGNATION,
POS,
DESTINATION,
INSERT_CODE,
ASSEMBLY,
RESULT,
MESSAGE;
!
|
DECLARE,VERSION2, |
INTEGER; |
||||
|
DECLARE, PROF_TYPE, |
INTEGER; |
||||
|
DECLARE, PROF_PARAM1, |
DECIMAL; |
||||
|
DECLARE, PROF_PARAM2, |
DECIMAL; |
||||
|
DECLARE, PROF_PARAM3, |
DECIMAL; |
||||
|
DECLARE, PROF_PARAM4, |
DECIMAL; |
||||
|
DECLARE, PROF_PARAM5, |
DECIMAL; |
||||
|
DECLARE, PROF_PARAM6, |
DECIMAL; |
||||
|
DECLARE, V2, |
VECTOR_2D; |
||||
|
DECLARE, V3, |
VECTOR_2D; |
||||
|
DECLARE, V4, |
VECTOR_2D; |
||||
|
DECLARE, WEB_FACTOR, |
DECIMAL; |
||||
|
DECLARE, FLANGE_FACTOR, |
DECIMAL; |
||||
|
DECLARE, PLATE_THICKNESS, |
DECIMAL; |
||||
|
DECLARE, CLIP_LOC, |
INTEGER; |
||||
|
DECLARE, CUT_TYPE, |
INTEGER; |
||||
|
DECLARE, PARAM1, |
DECIMAL; |
||||
|
DECLARE, PARAM2, |
DECIMAL; |
||||
|
DECLARE, GAP_M, |
DECIMAL; |
||||
|
DECLARE, GAP_N, |
DECIMAL; |
||||
|
DECLARE, GAP_T, |
DECIMAL; |
||||
|
DECLARE, C_MEAS, |
DECIMAL; |
||||
|
DECLARE, CLIP_THICKNESS, |
DECIMAL; |
||||
|
DECLARE, SURFACE, |
STRING; |
||||
|
DECLARE, QUALITY, |
STRING; |
||||
|
DECLARE, EXCESS, |
DECIMAL; |
||||
|
DECLARE, CLIP_CONTOUR, |
CONTOUR_2D; |
||||
|
DECLARE, INTERVALS, |
INTERVALLIST_2D; |
||||
|
DECLARE, INTERVAL_TYPES, |
STRING; |
||||
|
DECLARE, WELD, |
DECIMAL; |
||||
|
DECLARE, WCLIP, |
DECIMAL; |
||||
|
DECLARE, WPROF, |
DECIMAL; |
||||
|
DECLARE, WSHELL, |
DECIMAL; |
||||
|
DECLARE, BCLIP, |
DECIMAL; |
||||
|
DECLARE, BWEB, |
DECIMAL; |
||||
|
DECLARE, BCWEB, |
DECIMAL; |
||||
|
DECLARE, BFLA, |
DECIMAL; |
||||
|
DECLARE, BCFLA, |
DECIMAL; |
||||
|
DECLARE, BSHELL, |
DECIMAL; |
||||
|
DECLARE, BCSHELL, |
DECIMAL; |
||||
|
DECLARE, POS_CODE, |
INTEGER; |
||||
|
DECLARE, DESIGNATION, |
STRING; |
||||
|
DECLARE, POS, |
INTEGER; |
||||
|
DECLARE, DESTINATION, |
STRING; |
||||
|
DECLARE, INSERT_CODE, |
INTEGER; |
||||
|
DECLARE, ASSEMBLY, |
STRING; |
||||
|
DECLARE, RESULT, |
INTEGER; |
||||
|
DECLARE, MESSAGE, |
STRING; |
||||
|
! |
Local declarations |
||||
|
! |
V2 is the normalized 2d vector along the flange |
||||
|
DECLARE, V2_X, |
DECIMAL; |
||||
|
DECLARE, V2_Y, |
DECIMAL; |
||||
|
! |
C0 - C5 define the node points of the clip contour. |
||||
|
! |
|||||
|
DECLARE, C0, |
POINT_2D; |
||||
|
DECLARE, C1, |
POINT_2D; |
||||
|
DECLARE, C2, |
POINT_2D; |
||||
|
DECLARE, C3, |
POINT_2D; |
||||
|
DECLARE, C4, |
POINT_2D; |
||||
|
DECLARE, C5, |
POINT_2D; |
||||
|
! |
|||||
|
! |
Some additional variables |
||||
|
DECLARE, DIST1, |
DECIMAL; |
||||
|
DECLARE, DIST2, |
DECIMAL; |
||||
|
DECLARE, DIST3, |
DECIMAL; |
||||
|
DECLARE, FIXED_R1, |
DECIMAL; |
||||
|
DECLARE, OVERLAP, |
DECIMAL; |
||||
|
DECLARE, Q0, |
POINT_2D; |
||||
|
DECLARE, RES, |
INTEGER; |
||||
|
DECLARE, V1, |
VECTOR_2D; |
||||
|
DECLARE, V2_NEG, |
VECTOR_2D; |
||||
|
DECLARE, WB1, |
POINT_2D; |
||||
|
DECLARE, WB2, |
POINT_2D; |
||||
|
DECLARE, X0, |
DECIMAL; |
||||
|
DECLARE, Y0, |
DECIMAL; |
||||
|
! |
************************************************************** |
||||
|
! |
Main procedure of clip_1 |
||||
|
! |
************************************************************** |
||||
|
! |
Assign treatment code. |
||||
|
ASSIGN, POS_CODE, 1; |
|||||
|
! |
FIXED_R1 is the corner radius (15 mm). |
||||
|
ASSIGN, FIXED_R1, 15.0; |
|||||
|
! |
DIST1 is the gap between the bottom side of the clip and the plate carrying the profile. |
||||
|
! |
DIST2 is the width of the clip. It depends on the clip side, so it will be calculated later. |
||||
|
! |
DIST3 is the gap between the top side of the clip and the (top side) of the flange. |
||||
|
ASSIGN, DIST1, 50.0; ASSIGN, DIST3, 50.0; ASSIGN, OVERLAP, 50.0; GET/STRUCTURE = ( V2_X, V2, 'VEC', 'X'); GET/STRUCTURE = ( V2_Y, V2, 'VEC', 'Y'); |
|||||
|
! |
V1 is a vector along the web of the profile cross section, that means, along the V-axis of the local clip coordinate system. |
||||
|
VECTOR_2D, V1, 0.0, 1.0; |
|||||
|
! |
Vector in the negative direction of V1. |
||||
|
VECTOR_2D, V1_NEG, 0.0, -1.0; |
|||||
|
! |
Vector in the negative direction of V2. |
||||
|
VECTOR_2D, V2_NEG, -V2_X, -V2_Y; |
|||||
|
! |
--------------------------------------------------------------- |
||||
|
! |
Define clip contour node points on mould line side |
||||
|
! |
--------------------------------------------------------------- |
||||
|
IF, CLIP_LOC == 1; |
|||||
|
! |
Set DIST2. It may depend on the clip side. |
||||
|
ASSIGN, DIST2, GAP_M + OVERLAP; |
|||||
|
! |
C0 is located DIST1 from the bottom of the web |
||||
|
POINT_2D, C0, 0.0, DIST1; |
|||||
|
! |
C1 is located DIST3 from the top of the profile. |
||||
|
POINT_2D, C1, 0.0, WEB_FACTOR * PROF_PARAM1 - DIST3; |
|||||
|
! |
Let Q0 be a point on distance "DIST2" from C1, in the negative direction of V2. |
||||
|
CALL, 'move_point_2d', C1, V2_NEG, DIST2, Q0; |
|||||
|
! |
C2 C3 defines the starting and ending point on the upper arc segment with radius FIXED_R1. |
||||
|
CALL, 'fillet_radius_2d', |
|||||
|
! |
C4 C5 defines the starting and ending point on the lower arc segment with radius FIXED_R1 |
||||
|
CALL, 'fillet_radius_2d', |
|||||
|
! |
Calculate the start and the end point of the bevel/welding interval that overlaps the penetrated plate. |
||||
|
CALL, 'move_point_2d', C1, V2_NEG, GAP_M, WB1; |
|||||
|
! |
--------------------------------------------------------------- |
||||
|
! |
Define clip contour node points on non-mould line side |
||||
|
! |
--------------------------------------------------------------- |
||||
|
IF, CLIP_LOC == 2; |
|||||
|
! |
Set DIST2 |
||||
|
ASSIGN, DIST2, GAP_N + OVERLAP; |
|||||
|
! |
C0 is located DIST3 from the top of the profile. |
||||
|
POINT_2D, C0, X0, Y0 + WEB_FACTOR * PROF_PARAM1 - DIST3; |
|||||
|
! |
C1 is located DIST1 from the bottom of the web |
||||
|
POINT_2D, C1, X0, Y0 + DIST1; |
|||||
|
! |
Let Q0 be a point on distance "DIST2" from C1, in the direction of V2. |
||||
|
CALL, 'move_point_2d', C1, V2, DIST2, Q0; |
|||||
|
! |
C2 C3 defines the starting and ending point on the lower arc segment with radius FIXED_R1 |
||||
|
CALL, 'fillet_radius_2d', |
|||||
|
! |
C4 C5 defines the starting and ending point on the upper arc segment with radius FIXED_R1 |
||||
|
CALL, 'fillet_radius_2d', |
|||||
|
! |
Calculate the start and the end point of the bevel/welding interval that overlaps the penetrated plate. |
||||
|
CALL, 'move_point_2d', C1, V2, GAP_N, WB1; |
|||||
|
! |
Define the clips contour. |
||||
|
! |
|||||
|
CONTOUR, CLIP_CONTOUR, C0 |
|||||
|
! |
Define weld/bevel intervals. |
||||
|
INTERVALLIST_2D, INTERVALS |
|||||
|
! |
|||||
|
! |
Set weld/bevel interval types. |
||||
|
ASSIGN, INTERVAL_TYPES, '10,40'; |
|||||