Hide Table of Contents

Set Custom Bend Deduction Example (VB.NET)

This example shows how to set a custom bend deduction for a miter flange feature.

'---------------------------------------------------------------------------
' Preconditions:
' 1. Open a sheet metal part that contains a miter flange feature with bends.
' 2. Select the flange feature.
'
' Postconditions: Selected flange's bend deduction is 1 mm.
'----------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System

Partial Class SolidWorksMacro

    
Dim Part As ModelDoc2
    
Dim boolstatus As Boolean
    Dim FeatureData As MiterFlangeFeatureData
    
Dim Feature As Feature
    
Dim Component As Component
    
Dim bData As CustomBendAllowance
    
Dim nam As String

    Sub main()

        Part = swApp.ActiveDoc

        
' Get the selected feature
        Feature = Part.SelectionManager.GetSelectedObject6(1, -1)

        
' Get the name of the selected feature
        nam = Feature.GetTypeName

        
' Get the feature definition
        FeatureData = Feature.GetDefinition

        
' Get whether to use default bend allowance to determine the current state
        Dim useCustom As Boolean
        useCustom = FeatureData.UseDefaultBendAllowance

        
' Get the custom bend allowance object
        bData = FeatureData.GetCustomBendAllowance

        
Dim bType As Long
        bType = bData.Type
        
' Set the bend allowance type to deduction
        bData.Type = swBendAllowanceTypes_e.swBendAllowanceDeduction

        
' Set the value of the bend deduction
        bData.BendDeduction = 0.001

        FeatureData.UseDefaultBendAllowance =
False

        ' Set the value of the bend deduction
        Call FeatureData.SetCustomBendAllowance(bData)

        
' Modify the feature definition
        boolstatus = Feature.ModifyDefinition(FeatureData, Part, Component)

    
End Sub

  
    
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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Set Custom Bend Deduction Example (VB.NET)
*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) 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.