<?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 Betreff: Recognize holes in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6917854#M70597</link>
    <description>&lt;P&gt;Hello &lt;FONT size="-1"&gt;Sajith,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;with this code the orientation of the holes changes if the holes are not on the XY-plane:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;&amp;nbsp;' Create a new sketch on the XY plane.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Dim oNewSketch As PlanarSketch&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Set oNewSketch = oCD.Sketches.Add(oCD.WorkPlanes.Item(3))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;How could I keep it?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;Georg&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2017 07:50:03 GMT</pubDate>
    <dc:creator>GeorgK</dc:creator>
    <dc:date>2017-03-03T07:50:03Z</dc:date>
    <item>
      <title>Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6563530#M66808</link>
      <description>&lt;P&gt;Hello together,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sometimes I use the add-in feature recognition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://apps.autodesk.com/PDSU/en/Detail/Index?id=9172877436288348979&amp;amp;appLang=en&amp;amp;os=Win32_64" target="_blank"&gt;https://apps.autodesk.com/PDSU/en/Detail/Index?id=9172877436288348979&amp;amp;appLang=en&amp;amp;os=Win32_64&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The feature recognition recognize each hole as a separate hole. Is it possible to find all holes from the same type and replace them with a pattern?&lt;/P&gt;&lt;P&gt;How could I get the positions of the holes? Or is it possible to move all holes of the same type to one sketch?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Georg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2016 08:34:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6563530#M66808</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-09-15T08:34:21Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6563892#M66816</link>
      <description>&lt;PRE&gt;Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oHoleFeat As HoleFeature

For Each oHoleFeat In oDoc.ComponentDefinition.Features.HoleFeatures
    Debug.Print ("X:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(1).X)
    Debug.Print ("Y:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(1).Y)
    Debug.Print ("Z:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(1).Z)
    Debug.Print ("Durchmesser:" &amp;amp; oHoleFeat.HoleDiameter.Expression)
    Debug.Print ("Bohrungstiefe:" &amp;amp; oHoleFeat.Extent.Distance.Expression)
Next

'#################
Sub addHole() 
    Dim oDoc As PartDocument 
    Set oDoc = ThisDocument 
    Dim oCD As PartComponentDefinition 
    Set oCD = oDoc.ComponentDefinition 
    
    Dim oHF As HoleFeature 
    Set oHF = oCD.Features.HoleFeatures.Item(1) 
    
    Dim oSK As PlanarSketch 
    Set oSK = oHF.Sketch 
    Call oSK.Edit 
    Dim oPt As Inventor.Point2d 
    Set oPt = ThisApplication.TransientGeometry.CreatePoint2d(3, 1) 
    Call oSK.SketchPoints.Add(oPt, True) 
    Call oSK.ExitEdit 
    
    Dim oNewObjColl As ObjectCollection 
    Set oNewObjColl = ThisApplication.TransientObjects.CreateObjectCollection 
  
    Call oNewObjColl.Add(oCD.Sketches(2).SketchPoints(1)) ' Existing hole centre 
    Call oNewObjColl.Add(oCD.Sketches(2).SketchPoints(2)) ' New hole centre 
    oHF.HoleCenterPoints = oNewObjColl 
End Sub &lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Sep 2016 12:13:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6563892#M66816</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-09-15T12:13:16Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6570386#M66884</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand&amp;nbsp;the hole is sketch based. Hence,&amp;nbsp;you would need to access the X, Y,&amp;nbsp;Z coordinates using the Geometry&amp;nbsp;API&amp;nbsp;&amp;nbsp;in the for loop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So instead of&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Debug.Print ("X:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(1).X)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you could use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print&amp;nbsp;("X:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(2).Geometry.X)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, in the addHole() subroutine you could change&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oNewObjColl.Add(oCD.Sketches(2).SketchPoints(1)) ' Existing hole centre&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to use the reference sketch of the hole.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oNewObjColl.Add(oSK.SketchPoints(1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sajith&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 12:17:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6570386#M66884</guid>
      <dc:creator>sajith_subramanian</dc:creator>
      <dc:date>2016-09-19T12:17:32Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6572916#M66908</link>
      <description>&lt;P&gt;Hello Sajith,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the first problem is to get the position of each hole. The second problem is to compare the different holes and move them to the right sketch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help me with the comparison of the holes?&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, 20 Sep 2016 12:46:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6572916#M66908</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-09-20T12:46:03Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6575121#M66926</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To compare the type of holes you could use the Holetype api.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A simple way would be to filter out the type in the for loop itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Each oHoleFeat In oDoc.ComponentDefinition.Features.HoleFeatures&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If oHoleFeat.HoleType = HoleTypeEnum.kDrilledHole Then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Filter out the drilled holes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print ("X:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(1).X)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print ("Y:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(1).Y)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print ("Z:" &amp;amp; oHoleFeat.HoleCenterPoints.Item(1).Z)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print ("Durchmesser:" &amp;amp; oHoleFeat.HoleDiameter.Expression)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print ("Bohrungstiefe:" &amp;amp; oHoleFeat.Extent.Distance.Expression)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End if&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly you can filter out the various types by referring below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;kCounterBoreHole&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;:&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole is counterbored.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;kCounterSinkHole&amp;nbsp;&amp;nbsp; :&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole is countersunk.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;kDrilledHole&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole is drilled (no countersink or counterboring).&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;kSpotFaceHole&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Hole is spotfaced.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sajith&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 09:58:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6575121#M66926</guid>
      <dc:creator>sajith_subramanian</dc:creator>
      <dc:date>2016-09-21T09:58:29Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6575139#M66927</link>
      <description>&lt;P&gt;Hello Sajith,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the sample code. But how could I recognize if the holes could be patternd?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 10:10:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6575139#M66927</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-09-21T10:10:19Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6577508#M66960</link>
      <description>&lt;P&gt;Hi Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Inventor 2017, there is an&amp;nbsp;api to create a pattern from a sketch.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have your points moved to the sketch, you could use the sketch&amp;nbsp;and the hole feature that needs to be patterned, to create a sketch based pattern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case your code would be something&amp;nbsp;similar to&amp;nbsp;the&amp;nbsp;following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Sub addHole()&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oDoc As PartDocument&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oDoc = ThisDocument&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oCD As PartComponentDefinition&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oCD = oDoc.ComponentDefinition&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oHF As HoleFeature&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oHF = oCD.Features.HoleFeatures.Item(1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oSK As PlanarSketch&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oSK = oHF.Sketch&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oSK.Edit&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oPt As Inventor.Point2d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oPt = ThisApplication.TransientGeometry.CreatePoint2d(3 ,1 )&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oSK.SketchPoints.Add(oPt, True)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oSK.ExitEdit&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oNewObjColl As ObjectCollection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oNewObjColl = ThisApplication.TransientObjects.CreateObjectCollection&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oNewObjColl.Add(oSK.SketchPoints(1)) ' Existing hole centre&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oNewObjColl.Add(oSK.SketchPoints(2)) ' New hole centre&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oHF.HoleCenterPoints = oNewObjColl&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '## Add&amp;nbsp; the&amp;nbsp;hole feature to an object collection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oNewHolesColl As ObjectCollection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oNewHolesColl = ThisApplication.TransientObjects.CreateObjectCollection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oNewHolesColl.Add(oHF)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; '## Pass&amp;nbsp;the sketch and&amp;nbsp;hole feature as input to create&amp;nbsp;a&amp;nbsp; pattern.&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim defn As SketchDrivenPatternDefinition&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oCD.Features.SketchDrivenPatternFeatures.Add(oCD.Features.SketchDrivenPatternFeatures.CreateDefinition(oNewHolesColl, oSK))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sajith&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 09:39:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6577508#M66960</guid>
      <dc:creator>sajith_subramanian</dc:creator>
      <dc:date>2016-09-22T09:39:52Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6583709#M67012</link>
      <description>&lt;P&gt;Hello Sajith,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am searching for an easy way to get all points from the same holes to one sketch. Do you know a way to do this?&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>Mon, 26 Sep 2016 07:58:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6583709#M67012</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-09-26T07:58:40Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6586417#M67046</link>
      <description>&lt;P&gt;Hello Georg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get all the hole points from same type of holes to one sketch, you could&amp;nbsp;try the following code which gets the hole centre points and adds them to a new sketch.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Dim xcoord As Double&lt;BR /&gt;&amp;nbsp; Dim ycoord As Double&lt;BR /&gt;&amp;nbsp; Dim oPt As Inventor.Point2d&lt;BR /&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;' Create a new sketch on the XY plane.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Dim oNewSketch As PlanarSketch&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Set oNewSketch = oCD.Sketches.Add(oCD.WorkPlanes.Item(3))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Put the sketch in edit mode.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oNewSketch.Edit&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;For Each oHoleFeat In oDoc.ComponentDefinition.Features.HoleFeatures&lt;BR /&gt;&amp;nbsp;If oHoleFeat.HoleType = HoleTypeEnum.kDrilledHole Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xcoord = oHoleFeat.HoleCenterPoints.Item(1).Geometry.X&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ycoord = oHoleFeat.HoleCenterPoints.Item(1).Geometry.Y&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oPt = ThisApplication.TransientGeometry.CreatePoint2d(xcoord, ycoord)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call oNewSketch.SketchPoints.Add(oPt, True)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;End If&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Next&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;oNewSketch.ExitEdit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 09:30:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6586417#M67046</guid>
      <dc:creator>sajith_subramanian</dc:creator>
      <dc:date>2016-09-27T09:30:48Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6586512#M67050</link>
      <description>&lt;P&gt;Hello &lt;FONT size="-1"&gt;Sajith,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;thank you very much.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;Georg&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 10:36:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6586512#M67050</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2016-09-27T10:36:24Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6917854#M70597</link>
      <description>&lt;P&gt;Hello &lt;FONT size="-1"&gt;Sajith,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;with this code the orientation of the holes changes if the holes are not on the XY-plane:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;&amp;nbsp;' Create a new sketch on the XY plane.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Dim oNewSketch As PlanarSketch&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Set oNewSketch = oCD.Sketches.Add(oCD.WorkPlanes.Item(3))&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;How could I keep it?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="-1"&gt;Georg&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 07:50:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6917854#M70597</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-03T07:50:03Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6922823#M70627</link>
      <description>&lt;P&gt;Hello Sajith,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how could I replace a hole with another hole-feature (save the position, delete the hole and replace it with another one)?&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>Mon, 06 Mar 2017 07:34:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6922823#M70627</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-06T07:34:32Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6925731#M70644</link>
      <description>&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;How could I replace the holes without sketch?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 07:29:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6925731#M70644</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-07T07:29:14Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6932995#M70716</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please find the sample code to change the hole without sketch&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please feel free to contact if there is any doubt.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 05:53:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6932995#M70716</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2017-03-09T05:53:44Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6936578#M70749</link>
      <description>&lt;P&gt;Hello Chandra,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much for the code. But the holes could not be changed in all cases. There is another post with the same problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/copy-hole-settings/m-p/6935986/highlight/false#M70746" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/copy-hole-settings/m-p/6935986/highlight/false#M70746&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think there is a bug in the API because I can reproduce the errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 09:18:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6936578#M70749</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-10T09:18:58Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6936974#M70762</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My example works for PartDocument. Meanwhile, it is very switch to AssemblyDocument.&amp;nbsp;I gone through the link provided in the post. There is no such example is explained.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please provide example with situation? I will look into it.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2017 12:41:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6936974#M70762</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2017-03-10T12:41:19Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6937144#M70764</link>
      <description>&lt;P&gt;Hello Chandra,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the first idea was to copy the hole settings from one hole to another one. But this does not work very stable at all. Therefore I tried to get the position of the origin hole, delete it, and put a new one at the origin position. But this does not work either very stable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/autodesk/attachments/autodesk/120/70598/1/Platte_Bohrungen00_2017.ipt" target="_blank"&gt;https://forums.autodesk.com/autodesk/attachments/autodesk/120/70598/1/Platte_Bohrungen00_2017.ipt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe you could find a stable solution that works in part and assembly environment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your code works for some holes, but not for all. For one hole it works and for the next one it does not work. The type of holes are equal.&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, 10 Mar 2017 13:43:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6937144#M70764</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-10T13:43:28Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6944456#M70829</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are few holes which is having "LinearHolePlacementDefinition" fails to convert other hole types. Which throws an exception "The parameter is incorrect". It may be due to references of "LinearHolePlacemntDefinition" as shown in the following image. Other than, many hole types are able to convert hole types.&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="LinearDefinition.JPG" style="width: 613px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/333001i4621DF0D43577C82/image-size/large?v=v2&amp;amp;px=999" role="button" title="LinearDefinition.JPG" alt="LinearDefinition.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 12:44:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6944456#M70829</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2017-03-14T12:44:56Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6944648#M70832</link>
      <description>&lt;P&gt;Hello Chandra,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wayne Brill did&amp;nbsp; some modifications to solve the problem. But the code does not work for all hole types and directions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/copy-hole-settings/m-p/6918816/highlight/false#M70602" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/copy-hole-settings/m-p/6918816/highlight/false#M70602&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you Georg&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 14:00:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6944648#M70832</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2017-03-14T14:00:09Z</dc:date>
    </item>
    <item>
      <title>Betreff: Recognize holes</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6950087#M70901</link>
      <description>&lt;P&gt;Hi George,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see go through the following sample code. It adds a drilled hole feature using "LinearHolePlacementDefinition"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    Dim oLinearPlacementDef As LinearHolePlacementDefinition
    Set oLinearPlacementDef = oCompDef.Features.HoleFeatures.CreateLinearPlacementDefinition _
    (oFace, oEdge1, "2 cm", oEdge2, "2 cm", oBiasPoint)
    
    ' Create the hole feature.
    Call oCompDef.Features.HoleFeatures.AddDrilledByThroughAllExtent( _
                            oLinearPlacementDef, "1 cm", kPositiveExtentDirection)&lt;/PRE&gt;
&lt;P&gt;For definition of "LinearHolePlacementDefinition" requires more&amp;nbsp;parameters like face, edges and base point. So, unable to convert these kind of holefeature.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 11:03:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/recognize-holes/m-p/6950087#M70901</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2017-03-16T11:03:00Z</dc:date>
    </item>
  </channel>
</rss>

