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: 

Changing hole termination

2 REPLIES 2
Reply
Message 1 of 3
planglais75
410 Views, 2 Replies

Changing hole termination

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

2 REPLIES 2
Message 2 of 3
nagwani
in reply to: planglais75

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

 

 

Message 3 of 3
planglais75
in reply to: nagwani

Thank you Ishwar,

 

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

 

 

Pascal

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

Post to forums  

Autodesk Design & Make Report