Hide Table of Contents

Access Edges on Rip Feature Example (VB.NET)

This example shows how to access edges on a rip feature.

' Preconditions:
' 1. Verify that the specified model document exists.
' 2. Open an Immediate window.
' Postconditions:
' 1. Opens the specified part.
' 2. Creates Shell1 and Rip1 features.
' 3. Inspect the FeatureManager design tree, the graphics area, and
'    the Immediate window.
' NOTE: Because the model is used elsewhere, do not save changes.
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
Imports System.Diagnostics
Partial Class SolidWorksMacro
    Sub main()
        Dim swModel As ModelDoc2
        Dim swSelMgr As SelectionMgr
        Dim swFeat As Feature
        Dim swRip As RipFeatureData
        Dim vEdge As Object
        Dim swEdge As Edge
        Dim swEnt As Entity
        Dim i As Integer
        Dim lRipDirection As Integer
        Dim bRet As Boolean
        Dim longstatus As Integer, longwarnings As Integer
        lRipDirection = 64
        swModel = swApp.OpenDoc6("C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\samples\tutorial\api\box.sldprt", 1, 0, "", longstatus, longwarnings)
        swApp.ActivateDoc2("box"False, longstatus)
        swModel = swApp.ActiveDoc
        swSelMgr = swModel.SelectionManager
        bRet = swModel.Extension.SelectByID2("""FACE", -0.0566885410894997, 0.0299999999999159, 0.0200993374069753, False, 1, Nothing, 0)
        swModel.InsertFeatureShell(0.01, False)
        bRet = swModel.Extension.SelectByID2("""EDGE", 0.0441585455038194, 0.0151990980971277, 0.0459121462268968, True, lRipDirection, Nothing, 0)
        bRet = swModel.Extension.SelectByID2("Rip1""BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
        swFeat = swSelMgr.GetSelectedObject6(1, -1)
        ' Get rip feature data
        swRip = swFeat.GetDefinition
        Debug.Print("Gap: " & swRip.Gap * 1000.0# & " mm")
        bRet = swRip.AccessSelections(swModel, Nothing)
        Debug.Print("Number of edges: " & swRip.GetEdgesCount)
        vEdge = swRip.Edges
        For i = 0 To UBound(vEdge)
            swEdge = vEdge(i)
            swEnt = swEdge
            Debug.Print("Direction of rip for edge (0=current, 1=other, 2=both): " & swRip.GetDirection(swEdge))
            bRet = swEnt.Select4(TrueNothing)
        Next i
    End Sub
    ''' <summary>
    ''' The SldWorks swApp variable is pre-assigned for you.
    ''' </summary>
    Public swApp As SldWorks
End Class


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   Access Edges on Rip Feature Example (VB.NET)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2016 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.