Message 1 of 5
Measure cosmetic weld loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to measure cosmetic welds in a weldment assembly in order to estimate welding time.
The code i've written works fine for edges and chains, but when it comes to loops i can't find anything useful for this purpose in the CosmeticWeld object.
My approach is to access every edge in the cosmeticweld, add it to a green highlight set (this is to confirm to the user that the weld is being measured) and measure the weld.
A cosmetic weld defined by the loop option however does not contain any edges?
Does anybody here have any suggestion on how to measure these welds?
This is the code i have today:
Imports Inventor Imports System.Runtime.InteropServices Public Class Form1 Dim ThisApplication = GetObject(, "Inventor.Application") Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim HS As HighlightSet Dim oUOM As UnitsOfMeasure oUOM = ThisApplication.ActiveDocument.UnitsOfMeasure HS = ThisApplication.ActiveDocument.CreateHighlightSet HS.Color = ThisApplication.TransientObjects.CreateColor(0, 255, 0) Dim ThisDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim weldCompDef As WeldmentComponentDefinition = ThisDoc.ComponentDefinition Dim cosmeticWelds As CosmeticWelds = weldCompDef.Welds.CosmeticWelds Dim cosmeticWeld As CosmeticWeld Dim dTotLength As Double dTotLength = 0 For Each cosmeticWeld In cosmeticWelds Dim oEdge As Edge Try For Each oEdge In cosmeticWeld.Edges HS.AddItem(oEdge) Dim dMin As Double, dMax As Double Call oEdge.Evaluator.GetParamExtents(dMin, dMax) Dim dLength As Double Call oEdge.Evaluator.GetLengthAtParam(dMin, dMax, dLength) dTotLength = dTotLength + dLength Next Catch 'THIS IS WHERE I NEED HELP MsgBox("Can't measure loops") End Try Next MsgBox("Total Weld Length: " & oUOM.GetStringFromValue(dTotLength, UnitsTypeEnum.kMillimeterLengthUnits)) End Sub End Class
Jhoel Forshav Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website