Solid Edge Part Type Library
AddSimplifyEnclosure Method
Total number of inputs.
Array of Occurrences.
Reference plane as object.
Name of the Body.
Description
Adds a simplify enclosure.
Syntax
Visual Basic
Public Sub AddSimplifyEnclosure( _
   ByVal numInputs As Long, _
   ByRef Occurrences() As Object, _
   ByVal RefPlane As Object, _
   ByVal EncloseType As EnclosureTypeConstant, _
   ByVal BodyName As String, _
   ByRef Enclosure As Object _
) 
Parameters
numInputs
Total number of inputs.
Occurrences
Array of Occurrences.
RefPlane
Reference plane as object.
EncloseType
ValueDescription
igEnclosureTypeBox
igEnclosureTypeInsideCylinder
igEnclosureTypeOutsideCylinder
BodyName
Name of the Body.
Enclosure
Example
Imports System.Runtime.InteropServices
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim objApplication As SolidEdgeFramework.Application = Nothing
        Dim objAssy As SolidEdgeAssembly.AssemblyDocument = Nothing
        Dim objSimpAssys As SolidEdgeAssembly.SimplifiedAssemblies = Nothing
        Dim objSimpAssy As SolidEdgeAssembly.SimplifiedAssembly = Nothing
        Dim objSimpModel As SolidEdgePart.SimplifiedAssemblyModel = Nothing
        Dim objEnclosures As SolidEdgePart.Enclosures = Nothing
        Dim objOccs As SolidEdgeAssembly.Occurrences = Nothing
        Dim objOcc As SolidEdgeAssembly.Occurrence = Nothing
        Dim objRef As SolidEdgeFramework.Reference = Nothing
        Dim objEnc As SolidEdgePart.Enclosure = Nothing
        Dim objEnc2 As SolidEdgePart.Enclosure = Nothing
        Dim objSubOccs As SolidEdgeAssembly.SubOccurrences = Nothing
        Dim objSubOcc As SolidEdgeAssembly.SubOccurrence = Nothing
        Dim objModels As SolidEdgePart.Models = Nothing
        Dim objModel As SolidEdgePart.Model = Nothing
        Dim objConsts As SolidEdgePart.Constructions = Nothing
        Dim objIPCs As SolidEdgePart.InterpartConstructions = Nothing
        Dim objMRefPlanes As SolidEdgePart.RefPlanes = Nothing
        Dim objMRefPlane As SolidEdgePart.RefPlane = Nothing
        Dim objBody As SolidEdgeGeometry.Body = Nothing
        Dim bodyArray As System.Array = Array.CreateInstance(GetType(SolidEdgeGeometry.Body), 1)
        Dim occArray As System.Array = Array.CreateInstance(GetType(SolidEdgeFramework.Reference), 1)

        'The following sample code creates a simplified enclosure around one part suboccurrence of the first occurrence in the assembly.
        
        Try
            objApplication = Marshal.GetActiveObject("SolidEdge.Application")

            objAssy = objApplication.ActiveDocument
            objOccs = objAssy.Occurrences
            objOcc = objOccs.Item(1)
            objSubOccs = objOcc.SubOccurrences
            For Each subocc As SolidEdgeAssembly.SubOccurrence In objSubOccs
                If (subocc.ThisAsOccurrence.Subassembly = False) Then
                    objSubOcc = subocc
                End If
            Next
            objRef = objSubOcc.Reference
            objRef = objAssy.CreateReference(objOcc, objSubOcc.ThisAsOccurrence)
            occArray(0) = objRef
            objSimpAssys = objAssy.SimplifiedAssemblies
            objSimpAssy = objSimpAssys.Item(1)
            objSimpModel = objSimpAssy.SimplifiedModel
            objMRefPlanes = objSimpModel.RefPlanes
            objMRefPlane = objMRefPlanes(1)
            objModels = objSimpModel.Models
            objModels.AddSimplifyEnclosure(1, occArray, objMRefPlane, SolidEdgePart.EnclosureTypeConstant.igEnclosureTypeBox, "body", objEnc)
            'Following code will Edit Simplify Enclosure.
            objEnc.EditSimplifyEnclosure(1, occArray, objMRefPlane, SolidEdgePart.EnclosureTypeConstant.igEnclosureTypeOutsideCylinder)
            Console.WriteLine(objEnclosures.Count)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try

    End Sub
End Class
See Also

Models Collection  | Models Members