Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Getting all parameters of an holefeature

Anonymous

Getting all parameters of an holefeature

Anonymous
Not applicable

Hi All,

 

i am writing a rule wich accsesses the parameters of the holefeatures in my parts.

When i use the code below on a part with a counterbore hole it only returns the parameter of the drilled part and ingnores the 

depth and the diameter of the counterbore.

 

I attached the partfile with the rule.

 

 

SyntaxEditor Code Snippet

Dim oDoc as Inventor.PartDocument = ThisDoc.Document
Dim oParam as Inventor.Parameter
Dim oTol as Inventor.Tolerance
Dim i As Integer
Dim oFeat As PartFeature
Dim oDim as FeatureDimension

For i=1 To oDoc.ComponentDefinition.Features.count
    oFeat=oDoc.componentdefinition.Features.item(i)

    If oFeat.Type = 83912192 Then        '83912192 = Holefeatures

        For n=1 To oFeat.FeatureDimensions.count
        oDim=oFeat.FeatureDimensions.item(n)
        oParam = oDim.Parameter

               MessageBox.Show(oFeat.Type & oParam.Name & oParam.Tolerance.HoleTolerance, " ", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)

        Next
    End If
Next

 

 

 

0 Likes
Reply
Accepted solutions (1)
401 Views
2 Replies
Replies (2)

Anonymous
Not applicable
Accepted solution

Hi Udo.eckardt,

 

Welcome to the Comumunity!!

 

I hope the following code will be helpful for your requirement.

 

SyntaxEditor Code Snippet

Dim oPart As Document

oPart = ThisApplication.ActiveDocument
Dim oHoleFeature As HoleFeature
For Each oHoleFeature In oPart.ComponentDefinition.Features.HoleFeatures
Dim oHoleType As String
If oHoleFeature.HoleType = 21507 Then
oHoleType = "CounterBoreHole"
ElseIf oHoleFeature.HoleType = 21506 Then
oHoleType = "CounterSinkHole"
ElseIf oHoleFeature.HoleType = 21505 Then
oHoleType = "DrilledHole"
ElseIf oHoleFeature.HoleType = 21508 Then
oHoleType = "SpotFaceHole"
End If
MsgBox ("Counter bore Diameter: " & oHoleFeature.CBoreDiameter.Value & vbNewLine & _
        "Counter Bore Depth: " & oHoleFeature.CBoreDepth.Value & vbNewLine & _
        "Hole Type: " & oHoleType & vbNewLine & _
        "Hole Name:" & oHoleFeature.Name & "")
Next

 

0 Likes

Anonymous
Not applicable

Thanks,

 

now i got an idea of how to read the parameters and its properties.

This was helpful.

 

Udo

0 Likes