iLogic Change Hole Thread Type

iLogic Change Hole Thread Type

Anonymous
Not applicable
1,234 Views
2 Replies
Message 1 of 3

iLogic Change Hole Thread Type

Anonymous
Not applicable
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
0 Likes
1,235 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Solved... I was trying to put Imperial Thread Designations on a Metric Type, needed to change all aspects to Metric.

0 Likes
Message 3 of 3

Anonymous
Not applicable
Can you please post the code which you used. Because, the above code doesn't seem to be working. It shows multiple errors, and when I rectify those errors it does not perform anything. Thanks
0 Likes