iLogic to sum total weld length fails on Groove Welds

iLogic to sum total weld length fails on Groove Welds

steveh5
Advisor Advisor
732 Views
4 Replies
Message 1 of 5

iLogic to sum total weld length fails on Groove Welds

steveh5
Advisor
Advisor

Gang...

I have created some iLogic which creates a parameter call Weld_Sum_Length if it doesn't exist, and then sums  all the weld lengths into one value.

All works fine with Fillet welds, but as soon as I add a Groove weld into the mix it causes the iLogic to bug out.

The Bead Report calculates it, but  the iLogic doesn't.

Here's the code and the error is attached....

'This has been added to Weld iLogic "Set Weldment View Reps(4)


' Creates parameter if "Weld_Length_Sum" doesn't exist
oMyParameter = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
Try
'Change value of param
Parameter("Weld_Length_Sum") = 0
Catch
'Create Param as it doesn't exist
oParameter=oMyParameter.AddByValue("Weld_Length_Sum", 0, kInchLengthUnits)
End Try 



Dim oDoc As AssemblyDocument
oDoc = ThisDoc.Document

Dim oComdef As WeldmentComponentDefinition
oComdef = oDoc.ComponentDefinition

'Parameter("Weld_Length_Sum") = 0
Dim oWeldBead As WeldBead
Dim oWeld As Weld
For Each oWeld In oComdef.Welds


	If oWeld.Type = ObjectTypeEnum.kWeldBeadObject Then
	oWeldBead = oWeld
	Logger.Info("some info about the stuff that just happened...")
	'Logger.Info(oWeldBead.BeadLength)
	'MessageBox.Show((oWeldBead.BeadLength), "weld")
	Parameter("Weld_Length_Sum") = Parameter("Weld_Length_Sum") + (oWeldBead.BeadLength)
	End If
Next
Parameter("Weld_Length_Sum") = Round((Parameter("Weld_Length_Sum") / 2.54), 1)
iProperties.Value("Custom", "Weld_Length") = Parameter("Weld_Length_Sum")
'MessageBox.Show(Parameter("Weld_Length_Sum"), "Total Length of All Welds")
MessageBox.Show(iProperties.Value("Custom", "Weld_Length"), "Custom iProp: Total Length of All Welds")

 Thank you in advance 🙂

Steve Hilvers
Inventor Certified User / Vault Professional Influencer
0 Likes
Accepted solutions (2)
733 Views
4 Replies
Replies (4)
Message 2 of 5

daltonNYAW9
Advocate
Advocate
Accepted solution

The 'BeadLength' for the groove weld was empty and it shows up 'N/A' when I create a report. What info for the groove weld are you wanting to get?

 

Bit slow today so I wanted to try and make a rule that mimicked the bead report. I couldnt get the 'WeldInfo' to work, so I used the weld's surface body to get face info for volume, mass, area.

 

Dim oDoc As AssemblyDocument
oDoc = ThisDoc.Document

Dim oCompdef As WeldmentComponentDefinition
oCompdef = oDoc.ComponentDefinition

Dim oWeldOccurrence As ComponentOccurrence = oCompdef.Occurrences.ItemByName("_Weldbead:1")

Dim dictionary As New Dictionary(Of String, List(Of FaceShell))

For Each oWeldBead As WeldBead In oCompdef.Welds.WeldBeads
	'add dictionary key
	dictionary.Add(oWeldBead.Name, New List(Of FaceShell))
	'check if faceshell is part of weld bead faces'
	For Each oFaceShell As FaceShell In oWeldOccurrence.SurfaceBodies(1).FaceShells
		Dim templist As List(Of FaceShell) = dictionary.Item(oWeldBead.Name)
		templist.Add(oFaceShell)
		Dim oWeldBeadFaces As New List(Of Face)
		For Each oFace In oWeldBead.BeadFaces
			oWeldBeadFaces.Add(oFace)
		Next
		For Each oFace In oFaceShell.Faces
			If oWeldBeadFaces.Contains(oFace.NativeObject) = False
				templist.Remove(oFaceShell)
				Exit For
			End If
		Next
		'add faceshell to dictionary list
		dictionary.Item(oWeldBead.Name) = templist
	Next
Next

For i = 0 To dictionary.Keys.Count - 1
	'type
	Dim strType As String = dictionary.Keys(i).tostring.split(" ")(0)

	'length
	Dim beadlength = Nothing
	Try
		beadlength = oCompdef.Welds.WeldBeads.Item(dictionary.Keys(i)).BeadLength / 2.54
	Catch
		beadlength = "N/A"
	End Try
	
	'volume
	Dim beadvolume As Double = Nothing
	For Each oFaceShell As FaceShell In dictionary.Item(dictionary.Keys(i))
		
		beadvolume = beadvolume + oFaceShell.Volume(1) / (2.54*2.54*2.54)
	Next
	
	'area
	Dim beadarea As Double = Nothing
	For Each oFaceShell As FaceShell In dictionary.Item(dictionary.Keys(i))
		For Each oFace As Face In oFaceShell.Faces

			beadarea = beadarea + (oFace.Evaluator.Area / (2.54*2.54))
		Next
	Next
	
	'mass
	beadmass = beadvolume * oWeldOccurrence.MassProperties.Mass / oWeldOccurrence.MassProperties.Volume * 2.54^3 * 2.205
	
	MessageBox.Show(strType & vbLf & beadlength & vbLf & beadmass & vbLf & beadarea & vbLf & beadvolume, dictionary.Keys(i))
Next
0 Likes
Message 3 of 5

steveh5
Advisor
Advisor

I'm looking for the length of a groove weld.

I over-looked that the in the Bead Report it is NA as you have stated.

So, that is the problem why the iLogic is failing.

 

What we are looking for is a nominal total length of all welds to get a ball park figure for cost estimation. Don't want to manually calculate it. It just shows up as a iprop in Inventor that we can push all they way thru Vault and into our ERP system.

 

Not sure how to conquer this and make it automated.

Looking at possibly using volume of the welds as you have shown above.

 

Not ideal, but can probably make it work.

 

I will be out all of next week, but will try when I get back.

I will give you solution credit once I have time to test it 🙂

 

Thanks for the help!

Steve Hilvers
Inventor Certified User / Vault Professional Influencer
0 Likes
Message 4 of 5

swalton
Mentor
Mentor

Steve,

 

I'm in a similar boat. 

 

I'd like to make it easy for our engineering team to define the welds, easy for the drafting team to make the prints, and the production team to understand the rough time it takes to meet the drawing specs.

 

There seem to be several pain points in the process of documenting larger weldments.  I have a "small" weldment that has about 250 feet of 1/4" fillet and 45 bead features.  I'm not sure anyone has spent the time to figure out how much weld is in a large (65,000 lb) weldment.

 

I used the cosmetic welds rather than the 3d welds on the small weldment.  Its ok, but showing the different model-based weld callouts on the drawing is rough, especially as I need lots of views to show all the details.  Add the fact that cosmetic weld can't create automatic caterpillars, it takes a few hours to make the print. 

 

Sometimes I feel like it takes more engineering/drafting hours to document the welds than it takes the production folks to produce them on a one-off.

 

Cosmetic welds show up in the bead report.  If you set the x-section area to match the expected deposit, you should get the correct weld bead volume without the 3d model.

 

Maybe it is better to get a rough weld length for all weld types than trying to automate the weld bead report.  See my fumbling here: https://forums.autodesk.com/t5/inventor-programming-ilogic/weld-bead-report-automation/td-p/13214298  or here: https://forums.autodesk.com/t5/inventor-programming-ilogic/weld-feature-names/td-p/13230789 or here: https://forums.autodesk.com/t5/inventor-forum/inventor-2024-weld-symbols-using-3d-annotation/td-p/12...

 

Any tips for larger weldments? 

 

Or do I need to visit Novi?  😉

Steve Walton
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Inventor 2025
Vault Professional 2025
0 Likes
Message 5 of 5

steveh5
Advisor
Advisor
Accepted solution

So, what I ended up doing is back-figuring the weld length from the mass of the welds. I could sum the total mass of groove welds and fillets w/o erroring the ilogic.

Since we are only going for a ball-park figure on weld length we used our average fillet weld size which is 0.25x0.25 inches and then I then back figured from the density of A-36 mild steel and the weld size area to determine the length.

Again...this is only a ball park figure and should be good enough for our use.

THANK ALL!

 

'This section totals mass of all welds and then determines a total weld length based on an average weld size of 1/4 x 1/4 fillet. 

Dim oDoc As AssemblyDocument
oDoc = ThisDoc.Document
oOccs = oDoc.ComponentDefinition.Occurrences
'This is the total mass of all welds
WELD_MASS = Round(oOccs.ItemByName("_WeldBead:1").MassProperties.Mass, 3)

'This takes the mass (kg) and converts it to lbs 
WELD_MASS_LB = (WELD_MASS * 2.205)

'This takes the total mass of the welds (lbs) and divides it by the density of A-36 mild steel (.282 lb/in3) and then the area of a 0.25x0.25 weld [--> (mass / 0.282) / 0.03125] rounded to one decimal place
WELD_LENGTH = Round(((WELD_MASS_LB / .282) / .03125), 1)
'Parameter("Weld_Length_Sum") = WELD_LENGTH
iProperties.Value("Custom", "Weld_Length") = WELD_LENGTH
'iProperties.Value("Summary", "Comments") = "Weld Mass LBS" & vbNewLine & WELD_MASS_LB & vbNewLine & vbNewLine & "Weld Length IN" & vbNewLine & WELD_LENGTH
MessageBox.Show("Weld Mass LBS" & vbNewLine & WELD_MASS_LB & vbNewLine & vbNewLine & "Weld Length IN" & vbNewLine & WELD_LENGTH)

  

Steve Hilvers
Inventor Certified User / Vault Professional Influencer
0 Likes