01-17-2022
11:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-17-2022
11:04 PM
Design data are at a central location. They have been for years. And it works, because all recent parts have the tap diameters we changed in the thread.xls file.
Also:
Sub ThreadFix()
Dim pDoc As PartDocument
Set pDoc = ThisApplication.ActiveDocument
Dim oCompdef As PartComponentDefinition
Set oCompdef = pDoc.ComponentDefinition
Dim oHole As HoleFeature
Set oHole = oCompdef.Features.HoleFeatures.item(1)
Dim oTappedHole As HoleTapInfo
Set oTappedHole = oHole.TapInfo
oTappedHole.TapDrillDiameter = 13.37 '<~~ wrong!
Debug.Print "Before: " & oTappedHole.TapDrillDiameter 'Before: 13,37
Dim newTappedHole As HoleTapInfo
If oTappedHole.FullTapDepth Then
Set newTappedHole = oCompdef.Features.HoleFeatures.CreateTapInfo( _
RightHanded:=oTappedHole.RightHanded, _
ThreadType:=oTappedHole.ThreadType, _
ThreadDesignation:=oTappedHole.ThreadDesignation, _
Class:=oTappedHole.Class, _
FullTapDepth:=oTappedHole.FullTapDepth)
Else
Set newTappedHole = oCompdef.Features.HoleFeatures.CreateTapInfo( _
RightHanded:=oTappedHole.RightHanded, _
ThreadType:=oTappedHole.ThreadType, _
ThreadDesignation:=oTappedHole.ThreadDesignation, _
Class:=oTappedHole.Class, _
FullTapDepth:=oTappedHole.FullTapDepth, _
ThreadDepth:=oTappedHole.ThreadDepth)
End If
Debug.Print "'After': " & newTappedHole.TapDrillDiameter ''After': 10,4
Set oHole.TapInfo = newTappedHole '<~~ Nope
The new TapInfo object has the correct tap diameter. I just can't apply it to the existing hole feature.