3 Replies Latest reply on Nov 21, 2012 3:02 PM by Nick Langer

    how to check sheetmetal parts for a bend radius of 0

    Nick Langer

      Currently, our practice for sheetmetal parts that require a back cut bend, is to model the bend with a radius of 0. What I want is to have an excel listing all the parts and highlight those with a bend radius of 0. I have been able to make an excel macro that goes through the features and if they are sheetmetal features, check the feature data for a bend radius of 0. The problem is, I've run into two exceptions: One is if the part doesn't contain any bends but is still a sheetmetal part with the bend radius set to 0. The other is if within the base-flange feature, you edit the basebends to have a radius of 0, but the base-flange and sheetmetal features still have a radius other than 0, meaning the feature data will show a bend radius other than 0. It seems like if I could just get information about the basebends within the base-flange I could solve both issues but I have been unable to figure out how to access the basebend info. Any help would be much appreciated.

       

      Thanks,

      Nick

        • Re: how to check sheetmetal parts for a bend radius of 0
          Keith Rice

          Hi Nick,

           

          If you uploaded parts containing these two exceptions then it would be easier for us to test code that might solve your problem.

           

          Keith

          Video Tutorials for the SolidWorks API

          • Re: how to check sheetmetal parts for a bend radius of 0
            Nick Langer

            Nvm, I figured out how to get the bend radius of the basebend. Turns out it is a subfeature of baseflange with type name of "SketchBend" and with this value I can catch both conditions. I still have one question, is there an easier way to find the type name of features than using a macro that gets the type name of a selected feature in an open part? Here is the heart of the feature data extraction, I left out the conditional parts that determine what has a zero bend radius since that was the easy part once I had all the feature data:

             

            Dim swModelDoc As SldWorks.ModelDoc2

             

            Dim swFeat As SldWorks.Feature

             

            Dim swSubFeat As SldWorks.Feature

             

            Set swFeat = swModelDoc.FirstFeature

             

            Do While Not swFeat Is Nothing

             

                 Select Case swFeat.GetTypeName

             

                      Case "SMBaseFlange"

             

                            Dim swBaseFlange As SldWorks.BaseFlangeFeatureData

                           

                            Set swBaseFlange = swFeat.GetDefinition

             

                            Application.Cells(xlCount, 9).Value = swBaseFlange.BendRadius

                           

                            Set swSubFeat = swFeat.GetFirstSubFeature

             

                            Do While Not swSubFeat Is Nothing

                   

                                Select Case swSubFeat.GetTypeName

                   

                                    Case "SketchBend"

                                       

                                        Set swBaseBend = swSubFeat.GetDefinition

                                       

                                        Application.Cells(xlCount, 15).Value = swBaseBend.BendRadius

                   

                                    Case Else

                   

                                End Select

                   

                                Set swSubFeat = swSubFeat.GetNextSubFeature()

                   

                            Loop

             

                        Case "SheetMetal"

                       

                            Dim swSheetMetal As SldWorks.SheetMetalFeatureData

             

             

                            Set swSheetMetal = swFeat.GetDefinition

                           

                            Application.Cells(xlCount, 10).Value = swSheetMetal.BendRadius

             

                        Case "SM3dBend"

             

                            Dim swSketchBend As SldWorks.SketchedBendFeatureData

                           

                            Set swSketchBend = swFeat.GetDefinition

                           

                            Application.Cells(xlCount, 11).Value = swSketchBend.BendRadius

             

                        Case "ProcessBends"

             

                            Dim swBends As SldWorks.BendsFeatureData

             

                            Set swBends = swFeat.GetDefinition

                           

                            Application.Cells(xlCount, 12).Value = swBends.BendRadius               

                           

                        Case "EdgeFlange"

             

                            Dim swEdgeFlange As SldWorks.EdgeFlangeFeatureData

             

                            Set swEdgeFlange = swFeat.GetDefinition

                           

                            Application.Cells(xlCount, 13).Value = swEdgeFlange.BendRadius

                       

                        Case "SMMiteredFlange"

             

                            Dim swMiterFlange As SldWorks.MiterFlangeFeatureData

             

                            Set swMiterFlange = swFeat.GetDefinition

                           

                            Application.Cells(xlCount, 14).Value = swMiterFlange.BendRadius

             

                        Case Else

             

                            ' Probably not a sheet metal feature

                           

                    End Select

             

                    Set swFeat = swFeat.GetNextFeature

             

                Loop