Vb.net NX Open中出错:名为UF_MODL_model_compare的ModelCompare函数API
在NX 10和11环境中调试Vb.net NX Open中出错:名为UF_MODL_model_compare的ModelCompare函数API,vb.net,Vb.net,在NX 10和11环境中调试模型比较功能时,我收到一个错误(见下图) 有谁能帮我解决这个错误,因为我不理解“RM对象具有不合适的OM类”的含义 代码: 错误截图: 此问题仍然存在吗?此问题仍然存在吗? Function MyModelCompare(ByVal iListWindow As ListingWindow, ByRef iPart1 As Part, ByRef iPart2 As Part) As ComparePartMapData Try Di
模型比较
功能时,我收到一个错误(见下图)
有谁能帮我解决这个错误,因为我不理解“RM对象具有不合适的OM类”的含义
代码:
错误截图:
此问题仍然存在吗?此问题仍然存在吗?
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