Hide Table of Contents

Modify Closed Corner Feature Example (VBA)

This example shows how to modify a closed corner feature in a sheet metal part.

 

'-------------------------------------

'

' Preconditions: Sheet metal part open that

'                has a Closed Corner feature

'

' Postconditions: Closed corner feature modified

'                as specified in macro.

'

'-------------------------------------

Option Explicit

 

Dim swApp As SldWorks.SldWorks

Dim swDoc As SldWorks.ModelDoc2

Dim SelMgr As SldWorks.SelectionMgr

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

Dim component As SldWorks.Component2

Dim Feature As Object

 

Sub main()

 

    Set swApp = Application.SldWorks

    Set swDoc = swApp.ActiveDoc

    Set SelMgr = swDoc.SelectionManager

  

    Dim swFeat As SldWorks.Feature

    Dim swFeatData As SldWorks.ClosedCornerFeatureData

    Dim bRet As Boolean

    

    ' Traverse the FeatureManager design tree

    ' When CornerFeat found, modify it

    Set swFeat = swDoc.FirstFeature

    Do While Not swFeat Is Nothing

        Debug.Print swFeat.GetTypeName

          If swFeat.GetTypeName = "CornerFeat" Then

              

               Set swFeatData = swFeat.GetDefinition

               

               bRet = swFeatData.AccessSelections(swDoc, component)

               Debug.Print "AccessSelections:", bRet

               Debug.Print "-------------Before--------------"

               Debug.Print "CornerType:", swFeatData.CornerType

               Debug.Print "GapDistance:", swFeatData.GapDistance

               Debug.Print "OverlapUnderlapRatio:", swFeatData.OverlapUnderlapRatio

               Debug.Print "OpenBendRegion:", swFeatData.OpenBendRegion

               

               swFeatData.GapDistance = 0.0002

               swFeatData.OverlapUnderlapRatio = 0.5

               swFeatData.OpenBendRegion = True

                              

               Debug.Print "-------------After--------------"

               Debug.Print "GapDistance:", swFeatData.GapDistance

               Debug.Print "OverlapUnderlapRatio:", swFeatData.OverlapUnderlapRatio

               Debug.Print "OpenBendRegion:", swFeatData.OpenBendRegion

               

               bRet = swFeat.ModifyDefinition(swFeatData, swDoc, Nothing)

               Debug.Print "ModifyDefinition:", bRet

          

               swFeatData.ReleaseSelectionAccess

                 

           End If

          

        Set swFeat = swFeat.GetNextFeature

    Loop

End Sub



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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Modify Closed Corner Feature Example (VBA)
*Comment:  
*   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:

x

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
x

Web Help Content Version: API Help (English only) 2014 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.