Hello everyone.
So, I am trying to modify an existing Hole Wizard feature using WizardHoleFeatureData2 interface.
I understand that, to modify an existing hole, I need to:
1. access hole definitions using WizardHoleFeatureData2 interface
2. Get feature definitions and set it to WizardHoleFeatureData2 object
3. change the values
with the code I have written, it is changing the TapDrillDepth and ThreadDepth values alright, but it is not changing the standard of the hole using ChangeStandard method. Wheryby I am trying to update the standard to Din and then hole dia to "M40"
Here is my code. Please let me know what is it that I am doing wrong
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFeat As SldWorks.Feature
Dim bRet As Boolean
Dim boolstatus As Boolean
Dim swWizHole As SldWorks.WizardHoleFeatureData2
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
swModel.Extension.SelectByID2 "JFHole", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0
Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
Set swWizHole = swFeat.GetDefinition
swWizHole.ChangeStandard 4, 76, "M50"
' 4 = swStandardDIN , 76 = swstandardDINtappedHole
' If boolstatus = True Then
' MsgBox "Standard changed"
' ElseIf boolstatus = False Then
' MsgBox "Standard not change"
' End If
swWizHole.TapDrillDepth = 400 / 1000
swWizHole.ThreadDepth = 200 / 1000
boolstatus = swFeat.ModifyDefinition(swWizHole, swModel, Nothing)
swModel.ForceRebuild3 False
swModel.ClearSelection2 True
End Sub