Deafault K factor changing

Hello!

I know that similar topic already have been discussed on that forum. Unfortunately I didn't find clear answer how to change default K-factor in SheetMetal part.

Could somebody explain me why example below doesn't work properly:

=====================================================================================

Option Explicit

    Dim swApp                             As SldWorks.SldWorks

    Dim swModel                           As SldWorks.ModelDoc2

     Dim swFeat                            As SldWorks.Feature

    Dim swBaseFlange                 As SldWorks.BaseFlangeFeatureData

    Dim swSheetMetal                 As SldWorks.SheetMetalFeatureData

Sub main()

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    

    Set swFeat = swModel.FirstFeature

      Do While Not swFeat Is Nothing

        If swFeat.GetTypeName = "SheetMetal" Then

     

                  Set swSheetMetal = swFeat.GetDefinition

                  swSheetMetal.AccessSelections swModel, Nothing

                  swSheetMetal.BendAllowanceType = 2

                  swSheetMetal.Kfactor = 0.2

                  swFeat.ModifyDefinition swSheetMetal, swModel, Nothing

                   End If

 

    Set swFeat = swFeat.GetNextFeature

    Loop

    swModel.ForceRebuild3 False

    swModel.Save

End Sub

===============================================

The K-factor value is changed in model but I have to click "Override default value" in sheet menu. That is very unacceptable for me.

I would really appreciate if smb could explain me how to change Default K-factor value.

==================================================

After some time I've found out that I need to edit kfactor of SheetMetalTemplate, not particular SheetMetal.

Using loop:

@

Do While Not swFeat Is Nothing

        If swFeat.GetTypeName = "SheetMetal" Then

@

I am not able to get SheetMetalTemplate object.

Does anyone have any idea how to get it?

Wiadomość była edytowana przez: Piotr Tetlak

SolidworksApi macros