We have written a code to check Interferences in an Assembly file. But unfortunately we are getting errors. Can somebody help us in giving us a sample code in VB or VB.NET?
Dim occurrences As SolidEdgeAssembly.Occurrences
occurrences = objAsmDoc.Occurrences
Dim set1(objAsmDoc.Occurrences.Count) As SolidEdgeAssembly.Occurrence
Dim status As SolidEdgeAssembly.InterferenceStatusConstants
Dim numInterferences AsObject = 0
Dim interferenceOccurrence AsObject = Nothing
Dim iTempCount As Int32
For iTempCount = 1 To occurrences.Count
set1.SetValue(occurrences.Item(iTempCount), iTempCount - 1)
objAsmDoc.CheckInterference(set1.Length, set1, status, _
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, _
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value)
We are using .Net 2.0 and VB.NETAbove code always throws:
"The server threw an exception. (Exception from HRESULT (RPC_E_SERVERFAULT))"
Posted by: Siddhartha Mishra
Post date: 4/8/2008 4:30:02 AM
You're not going to like my answer but this is the solution. Passing arrays from .NET to COM can be a real pain. Often times when a method fails like this, you have to resort to using .NET reflection.Imports SolidEdgeConstantsImports System.ReflectionImports System.Runtime.InteropServicesModule Module1 Sub Main() Dim objApplication As SolidEdgeFramework.Application Dim objAssembly As SolidEdgeAssembly.AssemblyDocument Dim objOccurrences As SolidEdgeAssembly.Occurrences Dim objOccurrence As SolidEdgeAssembly.Occurrence Dim objArray As Array Dim index As Integer Dim status As SolidEdgeAssembly.InterferenceStatusConstants objApplication = Marshal.GetActiveObject("SolidEdge.Application") objAssembly = objApplication.ActiveDocument objOccurrences = objAssembly.Occurrences objArray = Array.CreateInstance(GetType(SolidEdgeAssembly.Occ
Posted by: Jason Newell
Post date: 4/16/2008 8:34:35 PM
Thanks so much for your help on this function... It's been a while I fight with it to get it works...
It's now working, but I can not get back InterferingPartsSet1 nor InterferingPartsOtherSet
Do you know why ?
thanks in advance ...
Posted by: Anthony PONCEOT
Post date: 4/28/2008 2:15:45 AM