Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
chandra.shekar.g
in reply to: GeorgK

Hi George,

 

Please find the sample code to change the hole without sketch

 

Public Sub ModifY_Hole()
        Dim m_inventorApp As Inventor.Application = Nothing

        ' Try to get an active instance of Inventor
        Try
            m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try


        ' Create a transaction.
        Dim oTransMgr As TransactionManager
        oTransMgr = m_inventorApp.TransactionManager
        Dim oTrans As Transaction
        oTrans = oTransMgr.StartTransaction(m_inventorApp.ActiveDocument, "Replace hole")

        Dim oSketch As PlanarSketch = Nothing
        Dim oDoc As PartDocument
        oDoc = m_inventorApp.ActiveDocument

        ' Set a reference to the component definition.
        Dim oCompDef As PartComponentDefinition
        oCompDef = oDoc.ComponentDefinition

        Dim oCollection As ObjectCollection
        oCollection = m_inventorApp.TransientObjects.CreateObjectCollection

        Dim ohole As HoleFeature
        ohole = m_inventorApp.CommandManager.Pick(SelectionFilterEnum.kPartFeatureFilter, "Select hole feature")

        ohole.SetCBore("10 mm", "2.5 mm")

        oTrans.End()
    End Sub

 

Please feel free to contact if there is any doubt.


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network