Solid Edge Assembly Type Library
TranslateMultipleOccurrences Method
Specifies the number of occurrences in the array that are to be moved or copied.
Specifies the occurrences in the array. Although the variable type is specified as "unknown", this is an array.
Member of the MoveMultipleMoveTypeConstants constant set that specifies whether to move or copy the occurrences.
Member of the MoveMultipleRelationshipConstants constant set that specifies whether the relationship between the occurrences in the array should be maintained, dropped, or dropped and grounded.
Specifies the X coordinate for the point to move from.
Specifies the Y coordinate for the point to move from.
Specifies the Z coordinate for the point to move from.
Specifies the X coordinate for the point to move to.
Specifies the Y coordinate for the point to move to.
Specifies the Z coordinate for the point to move to.
Specifies an array of occurrences that were copied or moved. Although the variable type is specified as "variant", this is an array.
Description
This method translates the input occurrences. It takes input and returns an array of the occurrences that were moved or copied. If an occurrence was moved, the output occurrences are the same as the input occurrences. If an occurrence was copied, the output occurrences will be the new occurrence copies.
Syntax
Visual Basic
Public Sub TranslateMultipleOccurrences( _
   ByVal lNumberOfOccurrences As Long, _
   ByRef Occurrences() As Unknown, _
   ByVal MoveType As MoveMultipleMoveTypeConstants, _
   ByVal RelationshipMaintenance As MoveMultipleRelationshipConstants, _
   ByVal FromX As Double, _
   ByVal FromY As Double, _
   ByVal FromZ As Double, _
   ByVal ToX As Double, _
   ByVal ToY As Double, _
   ByVal ToZ As Double, _
   ByRef MovedOrCopiedOccurrences As Variant _
) 
Parameters
lNumberOfOccurrences
Specifies the number of occurrences in the array that are to be moved or copied.
Occurrences
Specifies the occurrences in the array. Although the variable type is specified as "unknown", this is an array.
MoveType
ValueDescription
seMoveMultipleCopy
seMoveMultipleMove
Member of the MoveMultipleMoveTypeConstants constant set that specifies whether to move or copy the occurrences.
RelationshipMaintenance
ValueDescription
seMoveMultipleDropInternalRelationships
seMoveMultipleDropInternalRelationshipsAndGround
seMoveMultipleMaintainInternalRelationships
Member of the MoveMultipleRelationshipConstants constant set that specifies whether the relationship between the occurrences in the array should be maintained, dropped, or dropped and grounded.
FromX
Specifies the X coordinate for the point to move from.
FromY
Specifies the Y coordinate for the point to move from.
FromZ
Specifies the Z coordinate for the point to move from.
ToX
Specifies the X coordinate for the point to move to.
ToY
Specifies the Y coordinate for the point to move to.
ToZ
Specifies the Z coordinate for the point to move to.
MovedOrCopiedOccurrences
Specifies an array of occurrences that were copied or moved. Although the variable type is specified as "variant", this is an array.
Example
Imports System.IO
Imports System.Runtime.InteropServices

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim objSEApplication As SolidEdgeFramework.Application = Nothing
        Dim objDoc As SolidEdgeAssembly.AssemblyDocument = Nothing
        Dim objOcc As SolidEdgeAssembly.Occurrence = Nothing
        Dim MoveType As SolidEdgeAssembly.MoveMultipleMoveTypeConstants
        Dim RelationshipMaintenanceType As SolidEdgeAssembly.MoveMultipleRelationshipConstants
        Dim objOccurrences As SolidEdgeAssembly.Occurrences = Nothing
        Dim objOccurrencesToMove() As Object
        Dim NewOccurrences As Array
        Dim Count As Long
        Dim FromX As Double
        Dim FromY As Double
        Dim FromZ As Double
        Dim ToX As Double
        Dim ToY As Double
        Dim ToZ As Double
        Dim Copy As Boolean = True
        Dim MaintainRelationships As Boolean = True
        Dim DropRelationships As Boolean = False
        Dim SEInstallDir As DirectoryInfo

        Try

            Count = 0
            FromX = 0.0
            FromY = 0.0
            FromZ = 0.0

            ToX = 0.05
            ToY = 0.05
            ToZ = 0.05

            ' Get the application
            objSEApplication = Marshal.GetActiveObject("SolidEdge.Application")
            SEInstallDir = GetTrainingFolder()
            objDoc = objSEApplication.Documents.Open(SEInstallDir.FullName + "\carrier.asm")

            ' Get the active document
            objDoc = objSEApplication.ActiveDocument

            objOccurrences = objDoc.Occurrences

            For Each objOcc In objOccurrences
                Count = Count + 1
            Next

            If (Count <> 0) Then
                Dim i As Integer

                ReDim objOccurrencesToMove(Count)
                
                For i = 1 To Count
                    objOccurrencesToMove(i - 1) = objOccurrences.Item(i)
                Next

                If (Copy) Then
                    MoveType = SolidEdgeAssembly.MoveMultipleMoveTypeConstants.seMoveMultipleCopy
                Else
                    MoveType = SolidEdgeAssembly.MoveMultipleMoveTypeConstants.seMoveMultipleMove
                End If

                If (MaintainRelationships) Then
                    RelationshipMaintenanceType = SolidEdgeAssembly.MoveMultipleRelationshipConstants.seMoveMultipleMaintainInternalRelationships
                ElseIf (DropRelationships) Then
                    RelationshipMaintenanceType = SolidEdgeAssembly.MoveMultipleRelationshipConstants.seMoveMultipleDropInternalRelationships
                Else
                    RelationshipMaintenanceType = SolidEdgeAssembly.MoveMultipleRelationshipConstants.seMoveMultipleDropInternalRelationshipsAndGround
                End If

                objDoc.TranslateMultipleOccurrences(Count, objOccurrencesToMove, MoveType, RelationshipMaintenanceType, FromX, FromY, FromZ, ToX, ToY, ToZ, NewOccurrences)
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
    Function GetTrainingFolder() As DirectoryInfo
        Dim objInstallData As SEInstallDataLib.SEInstallData = Nothing
        Dim objInstallFolder As DirectoryInfo = Nothing
        Dim objTrainingFolder As DirectoryInfo = Nothing

        Try
            objInstallData = New SEInstallDataLib.SEInstallData
            objInstallFolder = New DirectoryInfo(objInstallData.GetInstalledPath())
            objTrainingFolder = New DirectoryInfo(Path.Combine(objInstallFolder.Parent.FullName, "Training"))
        Catch
        Finally
            If Not (objInstallData Is Nothing) Then
                Marshal.FinalReleaseComObject(objInstallData)
                objInstallData = Nothing
            End If
        End Try

        Return objTrainingFolder
    End Function

End Class
See Also

AssemblyDocument Object  | AssemblyDocument Members  | Solid Edge V20 - What's New