<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Copy hole settings in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6889646#M106429</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/534967" target="_blank"&gt;@bshbsh&lt;/A&gt;: I tried the code but I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run-time error 5 - Invalid procedure call or argument.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Call TargetHole.SetToFaceExtent(SourceHole.Extent.ToEntity.Item(1), SourceHole.Extent.ExtendToFace)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Georg&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2017 07:37:13 GMT</pubDate>
    <dc:creator>GeorgK</dc:creator>
    <dc:date>2017-02-20T07:37:13Z</dc:date>
    <item>
      <title>Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6591475#M106423</link>
      <description>&lt;P&gt;Hello together,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am searching for a possibility to copy the hole dimensions and open the dialogbox with those settings or to copy the settings and paste it on an existing hole.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://forums.autodesk.com/t5/inventor-ideas/copy-hole-properties/idi-p/5655082" target="_blank"&gt;http://forums.autodesk.com/t5/inventor-ideas/copy-hole-properties/idi-p/5655082&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 08:45:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6591475#M106423</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-09-29T08:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6599315#M106424</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have a solution for populating the fields in the default&amp;nbsp;Hole Dialog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to use the API to get properties of one hole feature and set the same values on a different hole feature.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your requirement&amp;nbsp;to include user interaction and the use of the clip board? Maybe a solution would be to get the values and then present the user with a custom dialog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Wayne&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 22:00:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6599315#M106424</guid>
      <dc:creator>wayne.brill</dc:creator>
      <dc:date>2016-10-03T22:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6614160#M106425</link>
      <description>&lt;P&gt;Hello Wayne,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the idea was to give the user the possibility to copy the hole settings and paste them to an other hole or to have a new dialog with the settings open to change the values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 07:33:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6614160#M106425</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-10-11T07:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6614544#M106426</link>
      <description>&lt;P&gt;This "copies" hole parameters from a source hole to multiple target holes:&lt;/P&gt;
&lt;PRE&gt;Public Sub CopyHoleSettings()
    Dim InvDoc As Document
    Set InvDoc = ThisApplication.ActiveEditDocument
    Dim SourceHole As Object
    Dim TargetHole As Object
    Dim More As Boolean
    Set SourceHole = ThisApplication.CommandManager.Pick(kPartFeatureFilter, "Select SOURCE hole! (ESC to abort)")
    If (Not SourceHole Is Nothing) Then
        If SourceHole.Type = kHoleFeatureObject Then
            Set TargetHole = Nothing
            More = True
            Do Until More = False
                Set TargetHole = ThisApplication.CommandManager.Pick(kPartFeatureFilter, "Select TARGET hole! (ESC to abort)")
                If (Not TargetHole Is Nothing) Then
                    If TargetHole.Type = kHoleFeatureObject Then
                        If SourceHole.HoleType = kCounterBoreHole Then Call TargetHole.SetCBore(SourceHole.CBoreDiameter.Value, SourceHole.CBoreDepth.Value)
                        If SourceHole.HoleType = kCounterSinkHole Then Call TargetHole.SetCSink(SourceHole.CSinkDiameter.Value, SourceHole.CSinkAngle.Value)
                        If SourceHole.HoleType = kSpotFaceHole Then Call TargetHole.SetSpotFace(SourceHole.SpotFaceDiameter.Value, SourceHole.SpotFaceDepth.Value)
                        If SourceHole.HoleType = kDrilledHole Then Call TargetHole.SetDrilled
                        If SourceHole.ExtentType = kThroughAllExtent Then Call TargetHole.SetThroughAllExtent(SourceHole.Extent.Direction)
                        If SourceHole.ExtentType = kDistanceExtent Then
                            If SourceHole.FlatBottom = True Then
                                Call TargetHole.SetDistanceExtent(SourceHole.Extent.Distance.Value, SourceHole.Extent.Direction, True)
                            Else
                                Call TargetHole.SetDistanceExtent(SourceHole.Extent.Distance.Value, SourceHole.Extent.Direction, Fales, SourceHole.BottomTipAngle.Value)
                            End If
                        End If
                        If SourceHole.ExtentType = kToExtent Then
                            Call TargetHole.SetEndOfPart(True)
                            Call TargetHole.SetToFaceExtent(SourceHole.Extent.ToEntity.Item(1), SourceHole.Extent.ExtendToFace)
                            Call InvDoc.ComponentDefinition.SetEndOfPartToTopOrBottom(False)
                        End If
                        If SourceHole.Tapped = True Then
                            If SourceHole.TapInfo.FullTapDepth = True Then
                                TargetHole.TapInfo = InvDoc.ComponentDefinition.Features.HoleFeatures.CreateTapInfo(SourceHole.TapInfo.RightHanded, SourceHole.TapInfo.ThreadType, SourceHole.TapInfo.ThreadDesignation, SourceHole.TapInfo.Class, True)
                            Else
                                TargetHole.TapInfo = InvDoc.ComponentDefinition.Features.HoleFeatures.CreateTapInfo(SourceHole.TapInfo.RightHanded, SourceHole.TapInfo.ThreadType, SourceHole.TapInfo.ThreadDesignation, SourceHole.TapInfo.Class, False, SourceHole.TapInfo.ThreadDepth.Value)
                            End If
                            TargetHole.Tapped = True
                        Else
                            TargetHole.Tapped = False
                            TargetHole.HoleDiameter.Value = SourceHole.HoleDiameter.Value
                        End If
                        InvDoc.Update
                    End If
                Else
                    More = False
                End If
            Loop
        End If
    End If
End Sub&lt;/PRE&gt;
&lt;P&gt;Needs a little more error checking and stuff. Also, ToFace extent holes may or may not work, depending on where the target hole is in relation to the ToFace. G-Threads won't work either since they don't have a Class. (Autodesk should really fix this.)&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 11:51:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6614544#M106426</guid>
      <dc:creator>bshbsh</dc:creator>
      <dc:date>2016-10-11T11:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6614654#M106427</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/534967"&gt;@bshbsh﻿&lt;/a&gt; This is very promising code to start with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/68582"&gt;@wayne.brill﻿&lt;/a&gt; How could I fix the problem with G-Threads?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 12:52:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6614654#M106427</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-10-11T12:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6635898#M106428</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure what is being asked for related to G-Threads.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have a part file that has&amp;nbsp;holes that have&amp;nbsp;these types of threads and there is not a way to access them or something about them from the API? If so please upload&amp;nbsp;the Inventor&amp;nbsp;file I can use research.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Wayne&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 20:34:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6635898#M106428</guid>
      <dc:creator>wayne.brill</dc:creator>
      <dc:date>2016-10-20T20:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6889646#M106429</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/534967" target="_blank"&gt;@bshbsh&lt;/A&gt;: I tried the code but I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run-time error 5 - Invalid procedure call or argument.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Call TargetHole.SetToFaceExtent(SourceHole.Extent.ToEntity.Item(1), SourceHole.Extent.ExtendToFace)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Georg&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 07:37:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6889646#M106429</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-02-20T07:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6916355#M106430</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may help to&amp;nbsp;understand why the error occurs by&amp;nbsp;debugging and finding what these objects are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;SourceHole.Extent.ToEnt&lt;WBR /&gt;ity.Item(1) and &amp;nbsp;SourceHole.Extent.ExtendToFace&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I could research this. Can you upload an assembly that is getting the Invalid procedure call&amp;nbsp;when the code is run? If you have modified code different from what bshbsh provided on this thread please provide your modified code too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Wayne&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 18:46:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6916355#M106430</guid>
      <dc:creator>wayne.brill</dc:creator>
      <dc:date>2017-03-02T18:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6917930#M106431</link>
      <description>&lt;P&gt;Hello Wayne,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;attached is a plate where I get the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 08:33:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6917930#M106431</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-03T08:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6918816#M106432</link>
      <description>&lt;P&gt;I can't open your file, I'm still on IV2014.&lt;/P&gt;
&lt;P&gt;ToFace Extents are difficult to handle and my code didn't even try to do it. See my comment below the code: "Also, ToFace extent holes may or may not work, depending on where the target hole is in relation to the ToFace."&lt;/P&gt;
&lt;P&gt;Let's say your source hole is on the top side of a plate and drilled with extent to the bottom face of the plate. Say, you try to copy the hole parameters to a hole that is drilled into the bottom face, with extent to the top face. This copy will fail, since my simple and dumb code would try to apply the same extent (aka bottom face) to the bottom hole, which would result in an invalid extent and a 0 depth hole. Similarly, if you try to copy an "extent hole" to another hole that is say perpendicular to the extent of the source, it will be invalid. Or if the extent is further down the model tree then the target hole - it will fail too, since the extent object doesn't exist at that point in the model tree.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also there's some typos and mistakes in my code: "Fales" is obviously "False", and the two lines with "TargetHole.Tapped=" have to be removed.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 14:31:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6918816#M106432</guid>
      <dc:creator>bshbsh</dc:creator>
      <dc:date>2017-03-03T14:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6918972#M106433</link>
      <description>&lt;P&gt;Hello bshbsh,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did the modification. But I could not get it to run. Is it possible to get the extend for the different types?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works only for a simple hole.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 15:16:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6918972#M106433</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-03T15:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6929261#M106435</link>
      <description>&lt;P&gt;Maybe it is better to replace the hole with a new one.....&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button65.Click
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 oHoles As HoleFeatures
oHoles = oDoc.ComponentDefinition.Features.HoleFeatures
Dim oHole As HoleFeature

For Each oHole In oHoles

oDoc.SelectSet.Clear()
oDoc.SelectSet.Select(oHole)

Dim oHoleCenter As Point
Dim oSketchPoint As SketchPoint

Dim oCollection As ObjectCollection
oCollection = m_inventorApp.TransientObjects.CreateObjectCollection

If TypeOf oHole.HoleCenterPoints.Item(1) Is SketchPoint Then
' Get the sketch point.
oSketchPoint = oHole.HoleCenterPoints.Item(1)

' Get the position of the sketch point in model space.
oSketch = oSketchPoint.Parent
oHoleCenter = oSketch.SketchToModelSpace(oSketchPoint.Geometry)


'Dim oSketchpoint As SketchPoint
For Each oSketchPoint In oHole.Sketch.SketchPoints
If oSketchPoint.HoleCenter Then
Call oCollection.Add(oSketchPoint)
End If
Next

'Löschen
oHole.Delete(True)
Call oCompDef.Features.HoleFeatures.AddDrilledByThroughAllExtent(oCollection, "10 mm", PartFeatureExtentDirectionEnum.kPositiveExtentDirection)

oDoc.Update()
Else

oHoleCenter = oHole.HoleCenterPoints.Item(1)
MsgBox(oHoleCenter.X &amp;amp; "; " &amp;amp; oHoleCenter.Y &amp;amp; "; " &amp;amp; oHoleCenter.Z)

' How to replace the hole without sketch?

End If

Next

oTrans.End()
End Sub&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How could I replace the holes without sketch?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It should be possible to replace each hole-type with another hole-type.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 10:22:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6929261#M106435</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-08T10:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6933468#M106436</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/68582"&gt;@wayne.brill&lt;/a&gt;Did you found a solution for the problem?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 09:57:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6933468#M106436</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-09T09:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6935986#M106437</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am finding that replacing a hole can be problematic. I started with your example that uses AddDrilledByThroughAllExtent() and the ipt file attached to a previous post in this thread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have made edits that&amp;nbsp;create a new PointHolePlacementDefinition&amp;nbsp;with HoleFeatures.CreatePointPlacementDefinition()&amp;nbsp;so that it can create holes with values from holes that use a Point or WorkPoint. (I believe this is what you meant by "How could I replace the holes without sketch?"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code&amp;nbsp;creates new&amp;nbsp;HoleFeatures but the newly created HoleFeatures created by AddDrilledByThroughAllExtent()&amp;nbsp; have a health of "kDriverLostHealth" -&amp;nbsp;11780 -&amp;nbsp;Object is driven by data from other Object(s), and one or more of them have been disconnected&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this the problem you are getting?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Wayne&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 01:33:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6935986#M106437</guid>
      <dc:creator>wayne.brill</dc:creator>
      <dc:date>2017-03-10T01:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6936462#M106438</link>
      <description>&lt;P&gt;Hello Wayne,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;with the code from &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/534967"&gt;@bshbsh&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;Public Sub CopyHoleSettings()
.....&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;and the code of mine I get the error to loose the health. The holes could not be replaced in every position. Is there any fix to solve the problem?&lt;BR /&gt;&lt;BR /&gt;Is it possible to replace it directly or to delete the hole, save the position and place a new hole at the same place?&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This error occurs also when I modify the hole to SetThroughAllExtent. I could read the PartFeatureExtentDirectionEnum and set it to the new hole or the same hole.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Same problem in this solution:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;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&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;It should be possible to copy the settings from one hole to another hole - in part or assembly environment.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Georg&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 08:08:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6936462#M106438</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-10T08:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6938196#M106439</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest not deleting the holes but modifying them instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to comment on this statement from one of your previous posts:&lt;/P&gt;
&lt;P&gt;&amp;gt;&amp;gt; &amp;gt;&amp;gt;&lt;BR /&gt;I tried the code but I get the following error:&lt;BR /&gt;Run-time error 5 - Invalid procedure call or argument.&lt;BR /&gt;Call TargetHole.SetToFaceExtent(SourceHole.Extent.ToEntity.Item(1), SourceHole.Extent.ExtendToFace)&lt;BR /&gt;&amp;lt;&amp;lt; &amp;lt;&amp;lt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It seems that if the reference lines are not set for a hole then changing the hole using the API&amp;nbsp;can fail. Below is a screenshot to help explain. Try&amp;nbsp;adding the reference edges to the holes and then running&amp;nbsp;the CopyHoleSettings() code provided by bshbsh in a previous post. In my tests holes without the reference edges will fail but if I add the reference edges the code&amp;nbsp;changes the hole without error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hole_Edge_Reference_WB.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/331941iAF46B0A0AF71063B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Hole_Edge_Reference_WB.jpg" alt="Hole_Edge_Reference_WB.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Wayne&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 19:32:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6938196#M106439</guid>
      <dc:creator>wayne.brill</dc:creator>
      <dc:date>2017-03-10T19:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6941231#M106440</link>
      <description>&lt;P&gt;Hello Wayne,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is it possible that you share your code, which works with the reference lines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 07:21:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6941231#M106440</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-13T07:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6942992#M106441</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code I used with an update to the ipt you provided previously. (attached)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This VBA code&amp;nbsp;gets through all of the holes in the updated ipt&amp;nbsp;without error. Not sure if it is doing everything you want however.&amp;nbsp; (the code is an update from the code provided by&amp;nbsp;bshbsh)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Sub Modify_Holes()
    Dim invDoc As Document
    Set invDoc = ThisApplication.ActiveDocument
    
    Dim SourceHole As Object
    Dim TargetHole As HoleFeature 'Object
   ' Dim More As Boolean
    'Set SourceHole = ThisApplication.CommandManager.Pick(kPartFeatureFilter, "Select SOURCE hole! (ESC to abort)")
    
    Dim oHoles As HoleFeatures
    Set oHoles = invDoc.ComponentDefinition.Features.HoleFeatures
    
    Set SourceHole = oHoles("Hole11")
    
   If (Not SourceHole Is Nothing) Then
   If SourceHole.Type = kHoleFeatureObject Then
   
   For Each TargetHole In oHoles
          ' Debug.Print SourceHole.name
           Debug.Print TargetHole.name
           ' Set TargetHole = Nothing
           ' More = True
           ' Do Until More = False
                'Set TargetHole = ThisApplication.CommandManager.Pick(kPartFeatureFilter, "Select TARGET hole! (ESC to abort)")
                'If (Not TargetHole Is Nothing) Then
               ' If SourceHole.name &amp;lt;&amp;gt; TargetHole.name Then
                    If TargetHole.Type = kHoleFeatureObject Then
                        If SourceHole.HoleType = kCounterBoreHole Then Call TargetHole.SetCBore(SourceHole.CBoreDiameter.value, SourceHole.CBoreDepth.value)
                        If SourceHole.HoleType = kCounterSinkHole Then Call TargetHole.SetCSink(SourceHole.CSinkDiameter.value, SourceHole.CSinkAngle.value)
                        If SourceHole.HoleType = kSpotFaceHole Then Call TargetHole.SetSpotFace(SourceHole.SpotFaceDiameter.value, SourceHole.SpotFaceDepth.value)
                        If SourceHole.HoleType = kDrilledHole Then Call TargetHole.SetDrilled
                        If SourceHole.ExtentType = kThroughAllExtent Then Call TargetHole.SetThroughAllExtent(SourceHole.Extent.Direction)
                        If SourceHole.ExtentType = kDistanceExtent Then
                            If SourceHole.FlatBottom = True Then
                                Call TargetHole.SetDistanceExtent(SourceHole.Extent.Distance.value, SourceHole.Extent.Direction, True)
                            Else
                                Call TargetHole.SetDistanceExtent(SourceHole.Extent.Distance.value, SourceHole.Extent.Direction, False, SourceHole.BottomTipAngle.value)
                            End If
                        End If
                        If SourceHole.ExtentType = kToExtent Then
                            Call TargetHole.SetEndOfPart(True)
                            Call TargetHole.SetToFaceExtent(SourceHole.Extent.ToEntity.Item(1), SourceHole.Extent.ExtendToFace)
                            Call invDoc.ComponentDefinition.SetEndOfPartToTopOrBottom(False)
                        End If
                        
                        If SourceHole.Tapped = True Then
                            If SourceHole.TapInfo.FullTapDepth = True Then
                                TargetHole.TapInfo = invDoc.ComponentDefinition.Features.HoleFeatures.CreateTapInfo(SourceHole.TapInfo.RightHanded, SourceHole.TapInfo.ThreadType, SourceHole.TapInfo.ThreadDesignation, SourceHole.TapInfo.Class, True)
                            Else
                                TargetHole.TapInfo = invDoc.ComponentDefinition.Features.HoleFeatures.CreateTapInfo(SourceHole.TapInfo.RightHanded, SourceHole.TapInfo.ThreadType, SourceHole.TapInfo.ThreadDesignation, SourceHole.TapInfo.Class, False, SourceHole.TapInfo.ThreadDepth.value)
                            End If
                            TargetHole.Tapped = True
                        Else
                            TargetHole.Tapped = False
                            TargetHole.HoleDiameter.value = SourceHole.HoleDiameter.value
                        End If
                        
                        invDoc.Update
                    End If
'                Else
'                    More = False
                'End If
           ' Loop
        Next
        End If
    End If
End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Wayne&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 19:26:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6942992#M106441</guid>
      <dc:creator>wayne.brill</dc:creator>
      <dc:date>2017-03-13T19:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6943850#M106442</link>
      <description>&lt;P&gt;Hello Wayne,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much for the update. Thats nearly the solution. The problem is that if I use Hole33 the direction is not correct for every hole. Is there a workaround to get the right direction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bohrung9.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/332893i63F6A4648834B501/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bohrung9.jpg" alt="Bohrung9.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 07:24:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6943850#M106442</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-14T07:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Copy hole settings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6943999#M106443</link>
      <description>&lt;P&gt;I get another error with hole13. If the targethole has a thread then the code does not work.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 08:39:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/copy-hole-settings/m-p/6943999#M106443</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-14T08:39:56Z</dc:date>
    </item>
  </channel>
</rss>

