Reply

Use of CreateOrEditSimplifiedAssembly command

Hi everybody,

 

Can't manage to make this code works, always get an exception when creating simplified assembly.

 

Do you have any clues ?

 

 

Sub Main()

Dim objApplication As SolidEdgeFramework.Application = Nothing

Dim objdocuments As SolidEdgeFramework.Documents = Nothing

Dim objDocument As SolidEdgeDocument = Nothing

Dim objASSY As SolidEdgeAssembly.AssemblyDocument = Nothing

Try

objApplication = CType(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

 

If objApplication.ActiveDocumentType = DocumentTypeConstants.igAssemblyDocument Then

objASSY = objApplication.ActiveDocument

 

If objASSY.IsAssemblySimplified Then

objASSY.UpdateSimplifiedAssembly()

Else

Dim OCCArray() = Nothing

Dim OCCArray2() = Nothing

[b][i][color=#ff0000] objASSY.CreateOrEditSimplifiedAssembly(0, OCCArray, 1, objassy.occurences.count, OCCArray2)[/color][/i][/b]

End If

End If

 

Catch ex As Exception

If Not (objApplication Is Nothing) Then

Marshal.ReleaseComObject(objApplication)

objApplication = Nothing

End If

End Try

 

End Sub

 

Posted by: Romuald
Post date: 9/25/2013 1:23:45 PM

1 REPLY

Use of CreateOrEditSimplifiedAssembly command

I managed to make things works :

 

Sub Main()

Dim objApplication As SolidEdgeFramework.Application = Nothing

Dim objdocuments As SolidEdgeFramework.Documents = Nothing

Dim objDocument As SolidEdgeDocument = Nothing

Dim objASSY As SolidEdgeAssembly.AssemblyDocument = Nothing

Try

objApplication = CType(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)

 

If objApplication.ActiveDocumentType = DocumentTypeConstants.igAssemblyDocument Then

objASSY = objApplication.ActiveDocument

 

If objASSY.IsAssemblySimplified Then

objASSY.UpdateSimplifiedAssembly()

Else

Dim NbOCC As Long = objASSY.Occurrences.Count

Dim EcludeRangeRatio As Double = 0.5

Dim NumOccurrenceExclude As Long = 0

Dim arrayRetExcludeOccs(0) As Object

Dim arrayRetIncludeOccs() As Object = System.Array.CreateInstance(GetType(Object), NbOCC)

 

For i = 0 To NbOCC - 1

arrayRetIncludeOccs(i) = objASSY.Occurrences(i)

Next

 

objASSY.CreateOrEditSimplifiedAssembly(NumOccurrenceExclude, arrayRetExcludeOccs, EcludeRangeRatio, NbOCC, arrayRetIncludeOccs)

End If

End If

 

Catch ex As Exception

If Not (objApplication Is Nothing) Then

Marshal.ReleaseComObject(objApplication)

objApplication = Nothing

End If

End Try

 

End Sub

 

Posted by: Romuald
Post date: 10/10/2013 3:57:23 AM