Try this code in an external iLogic rule.
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Part Documents.",vbOK, "WRONG DOCUMENT TYPE")
Return
End If
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oUParams As UserParameters = oDef.Parameters.UserParameters
Dim oThreadFeat As ThreadFeature = oDef.Features.ThreadFeatures.Item(1)
Dim oStartEdge As Edges = oThreadFeat.StartEdge
If oThreadFeat.FullDepth = True Then
oThreadFeat.FullDepth = False
oThreadFeat.SetThreadDepth(oUParams.Item("GEL"),oStartEdge)
ElseIf oThreadFeat.FullDepth = False Then
Dim oThreadDepthParam As Parameter = oThreadFeat.ThreadDepth
Dim oThreadDepth As Double = oThreadDepthParam.Value
oThreadFeat.FullDepth = True
End If
Or try it this way for an local (saved inside the document) iLogic rule.
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oThreadFeat As ThreadFeature = oDef.Features.ThreadFeatures.Item(1)
Dim oStartEdge As Edges = oThreadFeat.StartEdge
If oThreadFeat.FullDepth = True Then
oThreadFeat.FullDepth = False
oThreadFeat.SetThreadDepth(GEL,oStartEdge)
ElseIf oThreadFeat.FullDepth = False Then
Dim oThreadDepthParam As Parameter = oThreadFeat.ThreadDepth
Dim oThreadDepth As Double = oThreadDepthParam.Value
oThreadFeat.FullDepth = True
End If
This code will toggle FullDepth On if it is currently Off, or it will toggle it Off if it is currently On.
Then, if turns FullDepth Off, it will maintain the same StartEdge and set the ThreadDepth to your Parameter.
If it turns the FullDepth On, it just captures the Parameter it was using when it was set to a specific length.
Wesley Crihfield

(Not an Autodesk Employee)