Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error NXOpen: ModelCompare function API called UF_MODL_model_compare

Status
Not open for further replies.

RV4223

Automotive
Oct 24, 2016
3
Hello,

I have following error (see in a picture below) while debugging Model Compare function in both NX 10 & 11 Environment. Can anyone help me to solve this error and I didn't understand what the meaning of "an RM Object has an unsuitable OM class."
Or anyone suggests me if there is any mistake in code.

Code:
Function MyModelCompare(ByVal iListWindow As ListingWindow, ByRef iPart1 As Part, ByRef iPart2 As Part) As ComparePartMapData


        Try
           
          Dim intPart1Tag As NXOpen.Tag = iPart1.Tag         'Tag derived from input part1 
            Dim oBody_Eids_Part1 As Tag = CType(vbNull, NXOpen.Tag)
             'Dim oPartTransform1 As Double()
            Dim intPart2Tag As NXOpen.Tag = iPart2.Tag
            Dim oBody_Eids_Part2 As NXOpen.Tag = CType(vbNull, NXOpen.Tag)
             'Dim oPartTransform2 As Double()


           'iListWindow.WriteLine(TypeName(nxMappingData))
            iListWindow.WriteLine("Part1 Tag: " & CStr(intPart1Tag))
            iListWindow.WriteLine("oBody_Eids_Part1: " & CStr(oBody_Eids_Part1))
            iListWindow.WriteLine("intPart2Tag: " & CStr(intPart2Tag))
            iListWindow.WriteLine("oBody_Eids_Part2: " & CStr(oBody_Eids_Part2))



            Dim theUFSession As UFSession = Nothing
            
            Try
                theUFSession = UFSession.GetUFSession()
                If Not theUFSession Is Nothing Then
                    ilistWindow.WriteLine("Session Tag: " + CStr(theUFSession.Tag.ToString))
                Else
                    iListWindow.WriteLine("Session is nothing!")
                End If
            Catch ex As Exception
                MsgBox(ex.Message.ToString)
            End Try

            'Initialize nx CompareMapdata
            
            Dim nxMappingData As ComparePartMapData
            theUFSession.Modl.InitializeCompareData(nxMappingData)

            iListWindow.WriteLine("NX identical parts value = " + CStr(nxMappingData.identical_parts))
            iListWindow.WriteLine(nxMappingData.part1.edges.num_entities.ToString)

            iListWindow.WriteLine("UF Session derived!")
            Dim a_mtx4Identity(15) As Double
            theUFSession.Mtx4.Identity(a_mtx4Identity)


            Dim oModl As UFModl = Nothing
            Try
                oModl = theUFSession.Modl
            Catch ex1 As Exception
                iListWindow.WriteLine("Unable to get Modl object!")
            End Try

            'Try
            '    theUFSession.Modl.FreeCompareData(nxMappingData)
            'Catch ex1 As Exception
            '    Throw New Exception("Error with FreeCompareData3!")
            'End Try

            Dim dblTolerance As Double = 0.001
            Try


                oModl.ModelCompare(intPart1Tag,
                                    oBody_Eids_Part1,
                                    a_mtx4Identity,
                                    intPart2Tag,
                                    oBody_Eids_Part2,
                                    a_mtx4Identity,
                                    True,
                                    CompareAccuracy.CompCoarse,
                                    dblTolerance,
                                    CompareIdenticalfaceRule.CompAlledges,
                                    CompareChangeduniquefaceRule.CompNonidenticalsfChanged,
                                    False,
                                    nxMappingData)

            Catch ex1 As Exception
                Throw New Exception(ex1.message.Tostring)
            End Try

            Return nxMappingData
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
    End Function

Error_fv1ich.jpg
 
Replies continue below

Recommended for you

According to the API docs, you should probably be using the .ModelCompare3 method. Try .ModelCompare3 and see if you get the same error.

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor