Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bend Deduction Drawing Link

Status
Not open for further replies.

captainhog

Mechanical
Apr 28, 2009
7
Hello,

I work for a fabrication shop where we generate our sheet metal parts using a list of deductions we have compiled through bending and measuring parts of various thickness and material type. This requires me to enter the bend deduction for every part I draw and the chance for error when doing this for large assemblies seems very high. Now I know a bend table would be ideal for this situation but my boss fears change and does not want us to create one.

Now for each of our drawings we create a note that states our deduction (i.e. DEDUCTION = .238) which helps verify if the deduction in correct but it does not reference the deduction of the part. Is there a way to link bend deduction used in the part to a property that I can reference in the drawing. I am looking for something similar to the way I would call out thickness if I wanted a material thickness note (Thicknes = "SW-Thickness@blah.sldprt")

Hopefully there is a way to do this or someone has created an API that would be able to accomplish this.
 
Replies continue below

Recommended for you

I looked for the variable for bend deduction but find no way to link it directly. A macro can be used to add a Bend deduction property in the part with vale and then that can be linked in drawing via note.

Deepak Gupta
SW2009 SP4.1
SW2007 SP5.0
MathCAD 14.0
 
Look for this "Get All Sheet Metal Feature Data Example (VB6)" under API help. Modify it to set the Bend Deduction property in part.



Deepak Gupta
SW2009 SP4.1
SW2007 SP5.0
MathCAD 14.0
 
I appreciate your responses, they have definitely pointed me in what I believe is the right direction. I tried to use and modify the getallsheetmetal example but the vanilla version of that script does not compile. Has anyone else had any luck with getting this to compile?
 
The example in the SW API help has some bugs. This is a fixed one which worked for me.
Code:
'----------------------------------------------

'

' Preconditions: Sheet metal part is open.

'

' Postconditions: None

'

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

 

Option Explicit

 

Sub Process_CustomBendAllowance(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swCustBend As SldWorks.CustomBendAllowance)

    Debug.Print "      BendAllowance    = " & swCustBend.BendAllowance * 1000# & " mm"

    Debug.Print "      BendDeduction    = " & swCustBend.BendDeduction * 1000# & " mm"

    Debug.Print "      BendTableFile    = " & swCustBend.BendTableFile

    Debug.Print "      KFactor          = " & swCustBend.KFactor

    Debug.Print "      Type             = " & swCustBend.Type

End Sub

 

Sub Process_SMBaseFlange(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    Dim swBaseFlange                As SldWorks.BaseFlangeFeatureData

    

    Set swBaseFlange = swFeat.GetDefinition

    Debug.Print "    BendRadius = " & swBaseFlange.BendRadius * 1000# & " mm"

End Sub

 

Sub Process_SheetMetal(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    Dim swCustBend As SldWorks.CustomBendAllowance

    Dim swSheetMetal  As SldWorks.SheetMetalFeatureData

    
    Set swSheetMetal = swFeat.GetDefinition

    Set swCustBend = swSheetMetal.GetCustomBendAllowance

    Debug.Print "    BendRadius = " & swSheetMetal.BendRadius * 1000# & " mm"

 

    Process_CustomBendAllowance swApp, swModel, swCustBend

End Sub

 

Sub Process_SM3dBend(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    Dim swSketchBend As SldWorks.SketchedBendFeatureData

    Dim swCustBend As SldWorks.CustomBendAllowance

    

    Set swSketchBend = swFeat.GetDefinition

    Set swCustBend = swSketchBend.GetCustomBendAllowance

    Debug.Print "    UseDefaultBendAllowance = " & swSketchBend.UseDefaultBendAllowance

    Debug.Print "    UseDefaultBendRadius = " & swSketchBend.UseDefaultBendRadius

    Debug.Print "    BendRadius = " & swSketchBend.BendRadius * 1000# & " mm"

    

    Process_CustomBendAllowance swApp, swModel, swCustBend

End Sub

 

Sub Process_SMMiteredFlange(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    Dim swMiterFlange As SldWorks.MiterFlangeFeatureData

    

    Set swMiterFlange = swFeat.GetDefinition

    

    Debug.Print "    UseDefaultBendAllowance = " & swMiterFlange.UseDefaultBendAllowance

    Debug.Print "    UseDefaultBendRadius = " & swMiterFlange.UseDefaultBendRadius

    Debug.Print "    BendRadius = " & swMiterFlange.BendRadius * 1000# & " mm"

End Sub

 

Sub Process_Bends(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swBends As SldWorks.BendsFeatureData)

    Dim swCustBend  As SldWorks.CustomBendAllowance

    

    Set swCustBend = swBends.GetCustomBendAllowance

    

    Debug.Print "    BendRadius                 = " & swBends.BendRadius * 1000# & " mm"

    Debug.Print "    UseDefaultBendAllowance    = " & swBends.UseDefaultBendAllowance

    Debug.Print "    UseDefaultBendRadius       = " & swBends.UseDefaultBendRadius

    

    Process_CustomBendAllowance swApp, swModel, swCustBend

End Sub

 

Sub Process_ProcessBends(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    Dim swBends                     As SldWorks.BendsFeatureData

    

    Set swBends = swFeat.GetDefinition

    

    Process_Bends swApp, swModel, swBends

End Sub

 

Sub Process_FlattenBends(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    

    Dim swBends                     As SldWorks.BendsFeatureData

    

    Set swBends = swFeat.GetDefinition

    Process_Bends swApp, swModel, swBends

End Sub

 

Sub Process_EdgeFlange(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    Dim swEdgeFlange                As SldWorks.EdgeFlangeFeatureData

    

    Set swEdgeFlange = swFeat.GetDefinition

    Debug.Print "    UseDefaultBendRadius = " & swEdgeFlange.UseDefaultBendRadius

    Debug.Print "    BendRadius = " & swEdgeFlange.BendRadius * 1000# & " mm"

End Sub

 

Sub Process_FlatPattern(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    

    Dim swFlatPatt                  As SldWorks.FlatPatternFeatureData

    

    Set swFlatPatt = swFeat.GetDefinition

    

    Debug.Print "    To do..."

End Sub

 

Sub Process_Hem(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    

    Dim swHem                       As SldWorks.HemFeatureData

    Dim swCustBend                  As SldWorks.CustomBendAllowance

    

    Set swHem = swFeat.GetDefinition

    Set swCustBend = swHem.GetCustomBendAllowance

    Debug.Print "    UseDefaultBendAllowance = " & swHem.UseDefaultBendAllowance

    Debug.Print "    Radius = " & swHem.Radius * 1000# & " mm"

    

    Process_CustomBendAllowance swApp, swModel, swCustBend

End Sub

 

Sub Process_Jog(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    Dim swJog                       As SldWorks.JogFeatureData

    Dim swCustBend                  As SldWorks.CustomBendAllowance

    

    Set swJog = swFeat.GetDefinition

    Set swCustBend = swJog.GetCustomBendAllowance

    Debug.Print "    UseDefaultBendAllowance = " & swJog.UseDefaultBendAllowance

    Debug.Print "    UseDefaultBendRadius = " & swJog.UseDefaultBendRadius

    Debug.Print "    BendRadius = " & swJog.BendRadius * 1000# & " mm"

    

    Process_CustomBendAllowance swApp, swModel, swCustBend

End Sub

 

Sub Process_LoftedBend(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    

    Dim swLoftBend                  As SldWorks.LoftedBendsFeatureData

    

    Set swLoftBend = swFeat.GetDefinition

    

    Debug.Print "    To do..."

End Sub

 

Sub Process_Rip(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    

    Dim swRip                       As SldWorks.RipFeatureData

    

    Set swRip = swFeat.GetDefinition

    

    Debug.Print "    To do..."

End Sub

 

Sub Process_CornerFeat(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "  +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    

    Dim swCloseCorner               As SldWorks.ClosedCornerFeatureData

    

    Set swCloseCorner = swFeat.GetDefinition

    

    Debug.Print "    To do..."

End Sub

 

Sub Process_OneBend(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swFeat As SldWorks.Feature)

    Debug.Print "    +" & swFeat.Name & " [" & swFeat.GetTypeName & "]"

    

    Dim swOneBend  As SldWorks.OneBendFeatureData

    Dim swCustBend As SldWorks.CustomBendAllowance

    

    Set swOneBend = swFeat.GetDefinition

    Set swCustBend = swOneBend.GetCustomBendAllowance

    Debug.Print "      UseDefaultBendAllowance = " & swOneBend.UseDefaultBendAllowance

    Debug.Print "      UseDefaultBendRadius = " & swOneBend.UseDefaultBendRadius

    

    Process_CustomBendAllowance swApp, swModel, swCustBend

End Sub

 

Sub main()

    Dim swApp                       As SldWorks.SldWorks

    Dim swModel                     As SldWorks.ModelDoc2

    Dim swSelMgr                    As SldWorks.SelectionMgr

    Dim swFeat                      As SldWorks.Feature

    Dim swSubFeat                   As SldWorks.Feature

    Dim bRet                        As Boolean

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager

    Set swFeat = swModel.FirstFeature

    

    Debug.Print "File = " & swModel.GetPathName

    Do While Not swFeat Is Nothing

        ' Process top-level sheet metal features

        Select Case swFeat.GetTypeName

            Case "SMBaseFlange"

                Process_SMBaseFlange swApp, swModel, swFeat

                

            Case "SheetMetal"

                Process_SheetMetal swApp, swModel, swFeat

                

            Case "SM3dBend"

                Process_SM3dBend swApp, swModel, swFeat

                

            Case "SMMiteredFlange"

                Process_SMMiteredFlange swApp, swModel, swFeat

                

            Case "ProcessBends"

                Process_ProcessBends swApp, swModel, swFeat

                

            Case "FlattenBends"

                Process_FlattenBends swApp, swModel, swFeat

                

            Case "EdgeFlange"

                Process_EdgeFlange swApp, swModel, swFeat

                

            Case "FlatPattern"

                Process_FlatPattern swApp, swModel, swFeat

                

            Case "Hem"

                Process_Hem swApp, swModel, swFeat

                

            Case "Jog"

                Process_Jog swApp, swModel, swFeat

                

            Case "LoftedBend"

                Process_LoftedBend swApp, swModel, swFeat

                

            Case "Rip"

                Process_Rip swApp, swModel, swFeat

                

            Case "CornerFeat"

                Process_CornerFeat swApp, swModel, swFeat

            

            Case Else

                ' Probably not a sheet metal feature

        End Select

        

        ' process sheet metal sub-features

        Set swSubFeat = swFeat.GetFirstSubFeature

        Do While Not swSubFeat Is Nothing

            Select Case swSubFeat.GetTypeName

                Case "OneBend"

                    Process_OneBend swApp, swModel, swSubFeat

            

                Case Else

                    ' Probably not a sheet metal feature

            End Select

            

            Set swSubFeat = swSubFeat.GetNextSubFeature()

        Loop

        

        Set swFeat = swFeat.GetNextFeature

    Loop

End Sub

'-----------------------------------------------
 
Great, it can be modified now for setting up the property.

Deepak Gupta
SW2009 SP4.1
SW2007 SP5.0
MathCAD 14.0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor