vb.net program keeps catching on sub-routine

vb.net program keeps catching on sub-routine

BromanSillito
Advocate Advocate
308 Views
1 Reply
Message 1 of 2

vb.net program keeps catching on sub-routine

BromanSillito
Advocate
Advocate

I'm using vb.net to create a configurator for Inventor. While creating the program it was running well until a few weeks ago when it started hanging up on a certain function. It is just changing a text parameter in a sub-component of an assembly. The component does have some iLogic in it as well (it uses an embedded spreadsheet to look up dimension parameters). I'm wondering if anyone out there has any idea why this might be happening and how to fix it. Thanks in advance! Here is the sub:

 

Public Sub ChgPrtTxtParam(componentName As String, paramName As String, setValue As String)
        Try
            Dim asmDoc As AssemblyDocument
            asmDoc = oInventorApp.ActiveDocument
            Dim oOccs As ComponentOccurrences
            oOccs = asmDoc.ComponentDefinition.Occurrences
            Dim oOcc As ComponentOccurrence

            If setValue = Nothing Then
                setValue = ""
                Exit Sub
            End If

            oOcc = oOccs.ItemByName(componentName)
            Dim oPartDef As PartComponentDefinition
            oPartDef = oOcc.Definition
            If oPartDef.Parameters.Item(paramName).Value <> setValue Then
                oPartDef.Parameters.Item(paramName).Value = setValue
            End If

        Catch ex As Exception
            MsgBox(ex.Message & " - Error: ChgPrtTxtParam component: " & componentName & ", parameter: " & paramName)
        End Try
    End Sub
0 Likes
309 Views
1 Reply
Reply (1)
Message 2 of 2

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

You would need to add logging or something to your code in order to be able to track what's going on inside the iLogic part too:

http://adndevblog.typepad.com/manufacturing/2014/08/debug-ilogic.html

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes