Switch Hole Feature Types with iLogic via Form

Switch Hole Feature Types with iLogic via Form

micah_k_fitz
Contributor Contributor
896 Views
2 Replies
Message 1 of 3

Switch Hole Feature Types with iLogic via Form

micah_k_fitz
Contributor
Contributor

Hi, 

I am trying to toggle between different Hole Types via an iLogic Form.  I have set up a multi-value parameter to make these selections.  However, I am receiving an errors initially when I try to select a "TAPPED" or "TAPER TAPPED" selection.  Can anyone help me out?  Below is what I have so far.

 

Dim oPartDoc As PartDocument
oPartDoc = ThisDoc.Document
                
Dim oCompDef As PartComponentDefinition
oCompDef = oPartDoc.ComponentDefinition

Dim oHoleFeature As HoleFeature
oHoleFeature = oPartDoc.ComponentDefinition.Features.HoleFeatures.Item("Hole1")

Dim oTappedHole1 As HoleTapInfo
oTappedHole1 = oCompDef.Features.HoleFeatures.CreateTapInfo(True, "ANSI Unified Screw Threads", "1/4-20 UNC", "2B", True)

Dim oTappedHole2 As TaperedThreadInfo
oTappedHole2 = oCompDef.Features.HoleFeatures.CreateTaperedTapInfo(True, "NPT", "1/4-18 NPT")

Select Case HoleType
Case "THRU"
oHoleFeature.Tapped = False
oHoleFeature.TapInfo = Nothing

Case "BLIND"
oHoleFeature.Tapped = False
oHoleFeature.TapInfo = Nothing

Case "TAPPED"
oHoleFeature.Tapped = True
oHoleFeature.TapInfo = oTappedHole1

Case "TAPER TAPPED"
oHoleFeature.Tapped = True
oHoleFeature.TapInfo = oTappedHole2
End Select

 10.11.18.PNG

0 Likes
Accepted solutions (2)
897 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @micah_k_fitz,

 

I think the syntax would be this:

 

Dim oTappedHole2 As TaperedThreadInfo
oTappedHole2 = oCompDef.Features.HoleFeatures.CreateTaperedTapInfo(True, "NPT", "1/4")

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 3 of 3

micah_k_fitz
Contributor
Contributor
Accepted solution

Sorry for the delayed response, but thank you @Curtis_Waguespack! I corrected my code and added a few other pieces to my rule. It works just like I hoped it would.  Below is my corrected code.  Again, thank you!! and have a wonderful day!

 

  - Micah

Dim oPartDoc As PartDocument
        oPartDoc = ThisDoc.Document
                
Dim oCompDef As PartComponentDefinition
	oCompDef = oPartDoc.ComponentDefinition

Dim oHoleFeature As HoleFeature
	oHoleFeature = oPartDoc.ComponentDefinition.Features.HoleFeatures.Item("Hole1")

'Dim oTappedHole1 As HoleTapInfo
'oTappedHole1 = oCompDef.Features.HoleFeatures.CreateTapInfo(True, "ANSI Unified Screw Threads", "1/4-20 UNC", "2B", True)

Dim oTappedHole2 As TaperedThreadInfo
'oTappedHole2 = oCompDef.Features.HoleFeatures.CreateTaperedTapInfo(True, "NPT", "1/4")

Select Case HoleSizeFractional
Case = "1/4"
	HoleSizeDecimal = 0.25
Case = "3/8"
	HoleSizeDecimal = 0.375
End Select

Select Case HoleType
Case "THRU"
	oHoleFeature.Tapped = False
	oHoleFeature.SetDrilled()
	oHoleFeature.HoleDiameter.Expression = HoleSizeDecimal
Case "TAPER TAPPED"
	oTappedHole2 = oCompDef.Features.HoleFeatures.CreateTaperedTapInfo(True, "NPT", HoleSizeFractional)
	oHoleFeature.TapInfo = oTappedHole2
End Select