Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

ModelCompare function API called UF_MODL_model_compare

$
0
0

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.

  1. foo ="bar";
  2. baz ="foz"
  3.  
  4.  
  5. Function MyModelCompare(ByVal iListWindow As ListingWindow, ByRef iPart1 As Part, ByRef iPart2 As Part)As ComparePartMapData
  6.  
  7.  
  8. Try
  9.  
  10. Dim intPart1Tag As NXOpen.Tag= iPart1.Tag'Tag derived from input part1
  11. Dim oBody_Eids_Part1 As Tag =CType(vbNull, NXOpen.Tag)
  12. 'Dim oPartTransform1 As Double()
  13. Dim intPart2Tag As NXOpen.Tag= iPart2.Tag
  14. Dim oBody_Eids_Part2 As NXOpen.Tag=CType(vbNull, NXOpen.Tag)
  15. 'Dim oPartTransform2 As Double()
  16.  
  17.  
  18. 'iListWindow.WriteLine(TypeName(nxMappingData))
  19. iListWindow.WriteLine("Part1 Tag: "&CStr(intPart1Tag))
  20. iListWindow.WriteLine("oBody_Eids_Part1: "&CStr(oBody_Eids_Part1))
  21. iListWindow.WriteLine("intPart2Tag: "&CStr(intPart2Tag))
  22. iListWindow.WriteLine("oBody_Eids_Part2: "&CStr(oBody_Eids_Part2))
  23.  
  24.  
  25.  
  26. Dim theUFSession As UFSession =Nothing
  27.  
  28. Try
  29. theUFSession = UFSession.GetUFSession()
  30. IfNot theUFSession IsNothingThen
  31. ilistWindow.WriteLine("Session Tag: "+CStr(theUFSession.Tag.ToString))
  32. Else
  33. iListWindow.WriteLine("Session is nothing!")
  34. EndIf
  35. Catch ex As Exception
  36. MsgBox(ex.Message.ToString)
  37. EndTry
  38.  
  39. 'Initialize nx CompareMapdata
  40.  
  41. Dim nxMappingData As ComparePartMapData
  42. theUFSession.Modl.InitializeCompareData(nxMappingData)
  43.  
  44. iListWindow.WriteLine("NX identical parts value = "+CStr(nxMappingData.identical_parts))
  45. iListWindow.WriteLine(nxMappingData.part1.edges.num_entities.ToString)
  46.  
  47. iListWindow.WriteLine("UF Session derived!")
  48. Dim a_mtx4Identity(15)AsDouble
  49. theUFSession.Mtx4.Identity(a_mtx4Identity)
  50.  
  51.  
  52. Dim oModl As UFModl =Nothing
  53. Try
  54. oModl = theUFSession.Modl
  55. Catch ex1 As Exception
  56. iListWindow.WriteLine("Unable to get Modl object!")
  57. EndTry
  58.  
  59. 'Try
  60. ' theUFSession.Modl.FreeCompareData(nxMappingData)
  61. 'Catch ex1 As Exception
  62. ' Throw New Exception("Error with FreeCompareData3!")
  63. 'End Try
  64.  
  65. Dim dblTolerance AsDouble=0.001
  66. Try
  67.  
  68.  
  69. oModl.ModelCompare(intPart1Tag,
  70. oBody_Eids_Part1,
  71. a_mtx4Identity,
  72. intPart2Tag,
  73. oBody_Eids_Part2,
  74. a_mtx4Identity,
  75. True,
  76. CompareAccuracy.CompCoarse,
  77. dblTolerance,
  78. CompareIdenticalfaceRule.CompAlledges,
  79. CompareChangeduniquefaceRule.CompNonidenticalsfChanged,
  80. False,
  81. nxMappingData)
  82.  
  83. Catch ex1 As Exception
  84. ThrowNew Exception(ex1.message.Tostring)
  85. EndTry
  86.  
  87. Return nxMappingData
  88. Catch ex As Exception
  89. MessageBox.Show(ex.ToString)
  90. EndTry
  91. EndFunction

Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>