Changing hole termination

Changing hole termination

Anonymous
Not applicable
546 Views
2 Replies
Message 1 of 3

Changing hole termination

Anonymous
Not applicable

Hi all,

 

How can I change the termination of an existing hole feature ?.

 

 

If app.ActiveDocument Is PartDocument Then
    Dim doc as PartDocument 
    doc = app.ActiveDocument

    Dim hole as HoleFeature
    hole = doc.ComponentDefinition.Features.HoleFeatures(1)

    ...

End If

 

Thanks,

 

Pascal Langlais

0 Likes
547 Views
2 Replies
Replies (2)
Message 2 of 3

nagwani
Alumni
Alumni

Hi Pascal,

 

The sample VBA code shown below changes the extent of hole from ToExtent to Through hole and vice versa. 

 

Hope this helps!

 

-Ishwar N

 

Sub changeHoleTermination()
    Dim app As Inventor.Application
    Set app = ThisApplication
    If TypeOf app.ActiveDocument Is PartDocument Then
        Dim doc As PartDocument
        Set doc = app.ActiveDocument
        Dim def As PartComponentDefinition
        Set def = doc.ComponentDefinition
        Dim hole As HoleFeature
        Set hole = def.Features.HoleFeatures.Item(1)
        If hole.ExtentType = kToExtent Then
            ' Make it a through hole
            hole.SetThroughAllExtent (kPositiveExtentDirection)
        ElseIf hole.ExtentType = kThroughAllExtent Then
' In this sample the 4th workplane is at center of extruded part Call hole.SetToFaceExtent(def.WorkPlanes.Item(4), True) End If End If End Sub

 

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you Ishwar,

 

I will take a look this week-end and I'll give you feedback next week

 

 

Pascal

0 Likes