Forums:
Hello Folks,
I have following error while debugging ModelCompare 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."
ERROR:
System.Exception: An RM object had an unsuitable OM class for this situation bei NXJournal.MyModelCompare(ListingWindow iListWindow, Part& iPart1, Part& ipart2) in
C:\Users\AppData\Temp\NXJournals6996\journal.vb:Zeile216.
foo ="bar"; baz ="foz" 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() IfNot theUFSession IsNothingThen ilistWindow.WriteLine("Session Tag: "+CStr(theUFSession.Tag.ToString)) Else iListWindow.WriteLine("Session is nothing!") EndIf Catch ex As Exception MsgBox(ex.Message.ToString) EndTry '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)AsDouble 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!") EndTry 'Try ' theUFSession.Modl.FreeCompareData(nxMappingData) 'Catch ex1 As Exception ' Throw New Exception("Error with FreeCompareData3!") 'End Try Dim dblTolerance AsDouble=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 ThrowNew Exception(ex1.message.Tostring) EndTry Return nxMappingData Catch ex As Exception MessageBox.Show(ex.ToString) EndTry EndFunction