Measure cosmetic weld loop

Measure cosmetic weld loop

JhoelForshav
Mentor Mentor
550 Views
4 Replies
Message 1 of 5

Measure cosmetic weld loop

JhoelForshav
Mentor
Mentor

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
0 Likes
551 Views
4 Replies
Replies (4)
Message 2 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @JhoelForshav,

 

Can you please provide sample weld assembly which cosmetic weld loop?

 

Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 5

JhoelForshav
Mentor
Mentor

Hi @chandra.shekar.g,

 

Thank you for replying!

 

I've attached an assembly in which i've put my code as an iLogic rule.

In the assembly cosmetic weld 8 is made with the loop option. 

0 Likes
Message 4 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @JhoelForshav,

 

Unfortunately, edges are not created for Cosmetic weld which is created using "Loop" option. Without edges, failed to calculate the length of cosmetic weld. So, change request is created for the same and find the details below.

 

Change request for this is : INVGEN - 11996 - Unable to calculate length of Cosmetic weld which is created by "Loop" option

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 5

udo.huebner
Autodesk Support
Autodesk Support

I would like to give a short update.

This issue has been fixed in Update 2018.3. Your code will run there as expected without any changes.

Unfortunately, this behavior was not adapted in the 2019 version, but directly in a future release. We hope this will be fixed in the current release with an upcoming update for Inventor 2019 (2019.2).