Message 1 of 3
iLogic Change Hole Thread Type

Not applicable
11-19-2012
09:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello All,
I'm currently trying to change an Imperial based machine into a Metric one by changing the threaded holes to Metirc.
I'm running into an error where I can't create the TapInfo, the attached photo is the error that occurs. I realize and understand what it's asking, but unsure of how to fix it.
Changing the Thread Type alone and setting it doesn't seem to work..... So I've changed my approach
Below is a chunck of the code which should be enough to see the error. The code as a whole will cycle through all occurences in an assembly, and change the threads in a whole if necessary:
------------------------------------- Code --------------------------------------------
Dim oCompOcc As ComponentOccurrence
Dim oSurface As SurfaceBody
For Each oCompOcc In oCompDef.Occurrences
' Check if it's child occurrence (leaf node)
If oCompOcc.DefinitionDocumentType = kPartDocumentObject Then
oPart = oCompOcc.Definition.Document
For Each oPartFeature In oPart.ComponentDefinition.Features
If oPartFeature.Type = kHoleFeatureObject Then
MsgBox("Hole Feature-******: " & oPartFeature.Name)
Dim oHoleFeature As HoleFeature
oHoleFeature = oPartFeature
Dim oHoleTapInfo As HoleTapInfo
oHoleTapInfo = oHoleFeature.TapInfo
Dim CurrThread As String
CurrThread = oHoleTapInfo.ThreadType
If CurrThread = "ANSI Unified Screw Threads" Then
Dim MetricThread As String
MetricThread = "ANSI Metric M Profile"
'oHoleTapInfo.ThreadType = MetricThread
oRightHanded = oHoleTapInfo.RightHanded
oThreadDesig = oHoleTapInfo.ThreadDesignation
oClass = oHoleTapInfo.Class
oFullThread = oHoleTapInfo.FullThreadDepth
If oFullThread = False Then
oThreadDepth = oHoleTapInfo.ThreadDepth
End If
Dim NewThreadInfo As HoleTapInfo
MessageBox.Show("1", "Title")
If oFullThread = True Then
-----------------------------------------------------------Error occurs here---------------
NewThreadInfo = oHoleFeature.CreateTapInfo(oRightHanded, MetricThread, oThreadDesig, oClass, oFullThread) ', oThreadDepth)
----------------------------------------------------------------------Error line ends
Else If oFullThread = False
NewThreadInfo = oHoleFeature.CreateTapInfo(oRightHanded, MetricThread, oThreadDesig, oClass, oFullThread, oThreadDepth)
End If
MessageBox.Show("2", "Title")
oHoleFeature.TapInfo = NewThreadInfo
MsgBox(CurrThread & vbLf & MetricThread & vbLf & oHoleTapInfo.ThreadType)' & vbLf & ThreadDesig)
End If
End If
Next
----------------------------------Code Ends -----------------------------------------------------
I'm able to get by the error which is attached by using the following line of code instead:
NewThreadInfo = oCompDef.Features.HoleFeatures.CreateTapInfo(oRightHanded, MetricThread, oThreadDesig, oClass, oFullThread, oThreadDepth)
But a different error occurs which simply states "Unspecified Error".....
Thanks in advance
Mitch