Solid Edge Part Type Library
Reorder Method
Specifies the feature object for which the referenced feature object is to be inserted in front of or behind.
Specifies if the active feature object is to be placed before or after the target object. If this argument is True, the active feature object is inserted before the target object. If this argument is False, the feature object is placed after the target object.
Description
Inserts the referenced object in front of or behind another feature.
Syntax
Visual Basic
Public Sub Reorder( _
   ByVal TargetFeature As Object, _
   ByVal InsertBefore As Boolean _
) 
Parameters
TargetFeature
Specifies the feature object for which the referenced feature object is to be inserted in front of or behind.
InsertBefore
Specifies if the active feature object is to be placed before or after the target object. If this argument is True, the active feature object is inserted before the target object. If this argument is False, the feature object is placed after the target object.
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 objExtProt1 As SolidEdgePart.ExtrudedProtrusion
    Dim objExtProt2 As SolidEdgePart.ExtrudedProtrusion
    Dim objExtProfile As SolidEdgePart.Profile
    Dim lngStatus As Long
    Dim i As Integer
    Dim vRng As Variant
    Dim x1 As Double, y1 As Double, z1 As Double, x2 As Double, y2 As Double, z2 As Double
    ' 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
    Set objExtProt1 = objModel.ExtrudedProtrusions(1)
    '*** Create another feature
    Set objExtProfile = objDoc.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objDoc.RefPlanes(3))
    Call objExtProfile.Circles2d.AddByCenterRadius(x:=0.04, y:=0.01, Radius:=0.0075)
    lngStatus = objExtProfile.End(ValidationCriteria:=igProfileClosed)
    If lngStatus <> 0 Then
        MsgBox ("Profile not closed")
    End If
    Set objExtProt2 = objModel.ExtrudedProtrusions.AddFinite(Profile:=objExtProfile, _
                                                             ProfileSide:=igRight, profileplaneSide:=igLeft, Depth:=0.025)
    objExtProfile.Visible = False
    '*******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
    'Reorder the UserDefinedPattern ahead of Hole1
    Call objUDPat1.Reorder(targetfeature:=objExtProt1, InsertBefore:=False)
    ' 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
    Set objExtProt1 = Nothing
    Set objExtProt2 = Nothing
    Set objExtProfile = Nothing
End Sub
See Also

UserDefinedPattern Object  | UserDefinedPattern Members

Send comments on this topic.