Solid Edge Part Type Library
Delete Method
Description
Deletes the referenced object.
Syntax
Visual Basic
Public Sub Delete() 
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeFramework.Application
    Dim objDoc As SolidEdgePart.PartDocument
    Dim objProfile(1 To 2) As SolidEdgePart.Profile
    Dim objLines As SolidEdgeFrameworkSupport.Lines2d
    Dim objRelns As SolidEdgeFrameworkSupport.Relations2d
    Dim objModel As SolidEdgePart.Model
    Dim objProf As SolidEdgePart.Profile
    Dim objProfileCollection As SolidEdgePart.Profiles
    Dim objProfArr(1 To 3) As SolidEdgePart.Profile
    Dim objHole As SolidEdgePart.Hole
    Dim objHolData As SolidEdgePart.HoleData
    Dim objUDPat1 As SolidEdgePart.UserDefinedPattern
    Dim lngStatus As Long
    Dim i As Integer
    ' Report errors
    Const PI = 3.14159265358979
    ' Create/get the application with specific settings
    On Error Resume Next
    Set objApp = GetObject(, "SolidEdge.Application")
    If Err Then
        Err.Clear
        Set objApp = CreateObject("SolidEdge.Application")
        Set objDoc = objApp.Documents.Add("SolidEdge.PartDocument")
        objApp.Visible = True
    Else
        Set objDoc = objApp.ActiveDocument
    End If
    'Draw the Base Profile
    Set objProfile(1) = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:= _
                                                            objDoc.RefPlanes(3))
    Set objLines = objProfile(1).Lines2d
    Call objLines.AddBy2Points(x1:=0, y1:=0, x2:=0.08, y2:=0)
    Call objLines.AddBy2Points(x1:=0.08, y1:=0, x2:=0.08, y2:=0.06)
    Call objLines.AddBy2Points(x1:=0.08, y1:=0.06, x2:=0.064, y2:=0.06)
    Call objLines.AddBy2Points(x1:=0.064, y1:=0.06, x2:=0.064, y2:=0.02)
    Call objLines.AddBy2Points(x1:=0.064, y1:=0.02, x2:=0.048, y2:=0.02)
    Call objLines.AddBy2Points(x1:=0.048, y1:=0.02, x2:=0.048, y2:=0.06)
    Call objLines.AddBy2Points(x1:=0.048, y1:=0.06, x2:=0.032, y2:=0.06)
    Call objLines.AddBy2Points(x1:=0.032, y1:=0.06, x2:=0.032, y2:=0.02)
    Call objLines.AddBy2Points(x1:=0.032, y1:=0.02, x2:=0.016, y2:=0.02)
    Call objLines.AddBy2Points(x1:=0.016, y1:=0.02, x2:=0.016, y2:=0.06)
    Call objLines.AddBy2Points(x1:=0.016, y1:=0.06, x2:=0, y2:=0.06)
    Call objLines.AddBy2Points(x1:=0, y1:=0.06, x2:=0, y2:=0)
    ' Define Relations among the Line objects to make the Profile closed
    Set objRelns = objProfile(1).Relations2d
    Call objRelns.AddKeypoint(Object1:=objLines(1), Index1:=igLineEnd, Object2:=objLines(2), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(2), Index1:=igLineEnd, Object2:=objLines(3), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(3), Index1:=igLineEnd, Object2:=objLines(4), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(4), Index1:=igLineEnd, Object2:=objLines(5), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(5), Index1:=igLineEnd, Object2:=objLines(6), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(6), Index1:=igLineEnd, Object2:=objLines(7), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(7), Index1:=igLineEnd, Object2:=objLines(8), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(8), Index1:=igLineEnd, Object2:=objLines(9), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(9), Index1:=igLineEnd, Object2:=objLines(10), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(10), Index1:=igLineEnd, Object2:=objLines(11), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(11), Index1:=igLineEnd, Object2:=objLines(12), Index2:=igLineStart)
    Call objRelns.AddKeypoint(Object1:=objLines(12), Index1:=igLineEnd, Object2:=objLines(1), Index2:=igLineStart)
    ' Check for the Profile Validity
    lngStatus = objProfile(1).End(ValidationCriteria:=igProfileClosed)
    If lngStatus <> 0 Then
        MsgBox ("Profile not closed")
    End If
    'Create the Base Extruded Protrusion Feature
    Set objModel = objDoc.Models.AddFiniteExtrudedProtrusion(NumberOfProfiles:=1, _
                                                             profileArray:=objProfile, _
                                                             profileplaneSide:=igRight, _
                                                             ExtrusionDistance:=0.05)
    objProfile(1).Visible = False
    ' Check the Status of the Base Feature
    If objModel.ExtrudedProtrusions(1).Status <> igFeatureOK Then
        MsgBox ("Error in the Creation of Base Protrusion Feature object")
    End If

    '*******Create an UDP with RegularHoles (simpleHoles)
    ' Create a new profile to use for the feature.
    Set objProf = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(2))
    ' Define the location for three holes.
    Call objProf.Holes2d.Add(xCenter:=-0.02, yCenter:=0.03)
    Call objProf.Holes2d.Add(xCenter:=-0.01, yCenter:=0.043)
    Call objProf.Holes2d.Add(xCenter:=-0.01, yCenter:=0.01)
    objProf.Visible = False
    lngStatus = objProf.End(ValidationCriteria:=igProfileClosed)
    If lngStatus <> 0 Then
        MsgBox ("Invalid Profile")
    End If
    Set objProfileCollection = objProf.Parent.Profiles
    ' Load an array with these profiles.
    For i = 1 To objProfileCollection.Count
        Set objProfArr(i) = objProfileCollection(i)
    Next
    ' Create the HoleDataOjbect to define the hole parameters.
    Set objHolData = objDoc.HoleDataCollection.Add(HoleType:=igRegularHole, _
                                                   HoleDiameter:=0.01)
    ' Create a hole feature to serve as the seed feature.
    Set objHole = objModel.Holes.AddFinite(Profile:=objProfileCollection(1), _
                                           profileplaneSide:=igRight, _
                                           FiniteDepth:=0.016, _
                                           Data:=objHolData)
    If objHole.Status <> igFeatureOK Then
        MsgBox ("Error in the Creation of Hole object")
    End If
    ' Create the UDP with the AddByProfiles method
    Set objUDPat1 = objModel.UserDefinedPatterns.AddByProfiles(NumberOfProfiles:= _
                                                               objProfileCollection.Count, ProfilesArray:=objProfArr, _
                                                               SeedFeature:=objHole)
    ' Check the status of UserDefinedPattern Feature
    If objUDPat1.Status <> igFeatureOK Then
        MsgBox ("Error in the Creation of UserDefinedPattern with RegularHoles")
    End If
    ' Delete the UserDefinedPattern object
    Call objUDPat1.Delete
    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objProfile(1) = Nothing
    Set objProfile(2) = Nothing
    Set objLines = Nothing
    Set objRelns = Nothing
    Set objModel = Nothing
    Set objProf = Nothing
    Set objProfileCollection = Nothing
    Set objProfArr(1) = Nothing
    Set objProfArr(2) = Nothing
    Set objProfArr(3) = Nothing
    Set objHole = Nothing
    Set objHolData = Nothing
    Set objUDPat1 = Nothing
End Sub
See Also

UserDefinedPattern Object  | UserDefinedPattern Members

Send comments on this topic.