Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Tapered Tapped Hole

8 REPLIES 8
Reply
Message 1 of 9
Allen_Gager
601 Views, 8 Replies

Tapered Tapped Hole

I know this looks familiar, but I have another twist to it...

Dim oFeature As Inventor.PartFeature

For Each oFeature In oPartDoc.ComponentDefinition.Features

If oFeature.Tapped Then

If oFeature.TapInfo.FullTapDepth Then
ThreadDepth = " TapThru"
else
ThreadDepth = ""
end if
Else
more code...
End if

Next oFeature

The problem I have is that when I have an NPT tapped hole, I get an error 'FullTapDepth' on type 'IRxTaperedThreadInfo' not found. It fails at the If statement.

So the Direct Questions is how do I get to the Tapered Tap Information?

I'm having a terrible struggle with this because the intellisense doesn't recognize anything.

Also, this Select Case gets a warning while in an AddIn but it doesn't in a stand alone app.

Warning 1 Operands of type Object used in expressions for 'Select', 'Case' statements; runtime errors could occur.

Select Case oFeature.HoleType

Case Is = Inventor.HoleTypeEnum.kDrilledHole

Thx in advance for any assistnace...

AllenG Edited by: agager@atferrell.com on Jan 9, 2009 2:04 PM
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Allen_Gager


The HoleFeature.TapInfo property returns a
HoleTapInfo object for standard threads and a TaperedTapInfo object for tapered
threads. Does this help?

 

Sanjay-
Message 3 of 9
Allen_Gager
in reply to: Allen_Gager

Hi Sanjay,


Could you provide the code snippet to access the TaperedTapInfo? I cannot get this to work.

Dim Tap as String = ""
Dim oFeature As Inventor.PartFeature

For Each oFeature In oPartDoc.ComponentDefinition.Features

If oFeature.Tapped then
if not oFeature.TaperedTapInfo = Nothing then
Tap = oFeature.TaperedTapInfo.ThreadDesignation.ToString
end if
end if

next oFeature

My sample part is an extrusion with a single NPT hole in it.


-AllenG
Message 4 of 9
Anonymous
in reply to: Allen_Gager


I've modified the code to run through all tapped
hole features on the active part.

 

Sanjay-

 

 

Sub TaperedHoles()
   

    Dim oPartDoc As PartDocument
    Set
oPartDoc = ThisApplication.ActiveDocument
   

    Dim Tap As String
    Dim oFeature As
Inventor.HoleFeature

 

    For Each oFeature In
oPartDoc.ComponentDefinition.Features.HoleFeatures

 

        If
oFeature.Tapped
Then
           

            Tap =
oFeature.TapInfo.ThreadDesignation
           

            If TypeOf
oFeature.TapInfo Is HoleTapInfo
Then
               
' Standard
thread...
           
Else
               
' Tapered
thread...
           
End If
           

        End If

 

    Next
oFeature
   
End Sub
Message 5 of 9
Allen_Gager
in reply to: Allen_Gager

Sub TaperedHoles()


Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

Dim Tap As String
Dim oFeature As Inventor.HoleFeature

For Each oFeature In oPartDoc.ComponentDefinition.Features.HoleFeatures

If oFeature.Tapped Then

'Tap = oFeature.TapInfo.ThreadDesignation

If TypeOf oFeature.TapInfo Is TaperedThreadInfo Then

' Tapered thread...

MsgBox (oFeature.TapInfo.ThreadDesignation) ' gives me 1/16

MsgBox (oFeature.TapInfo.ThreadType) ' gives me NPT

Msgbox(oFeature.TapInfo.PitchDesignation) ' Fails

Else

' Standard thread...

Tap = oFeature.TapInfo.ThreadDesignation ' gives me 1/4-20 UNC

End If

End If

Next oFeature
End Sub

How do I get the Pitch of an NPT tapered thread?

My NPT thread should read 1/16 - 27 NPT


Thx,

AllenG
Message 6 of 9
Allen_Gager
in reply to: Allen_Gager

Sub TaperedHoles()


Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

Dim Tap As String
Dim oFeature As Inventor.HoleFeature

For Each oFeature In oPartDoc.ComponentDefinition.Features.HoleFeatures

If oFeature.Tapped Then

'Tap = oFeature.TapInfo.ThreadDesignation

If TypeOf oFeature.TapInfo Is TaperedThreadInfo Then

' Tapered thread...

MsgBox (oFeature.TapInfo.ThreadDesignation) ' gives me 1/16

MsgBox (oFeature.TapInfo.ThreadType) ' gives me NPT

Msgbox(oFeature.TapInfo.PitchDesignation) ' Fails

Else

' Standard thread...

Tap = oFeature.TapInfo.ThreadDesignation ' gives me 1/4-20 UNC

End If

End If

Next oFeature
End Sub

How do I get the Pitch of an NPT tapered thread?

My NPT thread should read 1/16 - 27 NPT


Thx,

AllenG
Message 7 of 9
Anonymous
in reply to: Allen_Gager


oFeature.TapInfo.ThreadsPerInch will return the
value 27 for the tapered thread. See the VBA object browser for
properties/methods that an object supports.

 

Sanjay-
Message 8 of 9
Allen_Gager
in reply to: Allen_Gager

Thank You Sanjay,

I actually did look in the vba object browser repeatedly for clues to what I wanted to do. After your last post I tried again and still couldn't find it until I searched for ThreadsPerInch and it returned the TaperedThreadInfo class. Then the light came on. 😛

Thx for your help Sanjay, I got my code working and I learned a littel bit more about using the object browser in the process.

-AllenG
Message 9 of 9
rfink
in reply to: Anonymous

Sanjay,

 

I saw your posts regarding HoleFeatures and was hoping you could tell me how to set the ThreadDesignation property of the TapInfo object?

 

Best Regards

RFink

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report