<?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: Need a VBA macro for creating a single sketch, a point and use punch at the in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7437734#M75570</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add these several lines into your code to create a sketch point, before you exit the sketch env.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// Add a sketch point to a planar sketch&lt;/P&gt;
&lt;P&gt;Dim oPointOnFace As Point&lt;BR /&gt;Set oPointOnFace = planarEntity.PointOnFace //just use the PointOnFace as an example, sounds you will get user input anyway&lt;/P&gt;
&lt;P&gt;sk.SketchPoints.Add sk.ModelToSketchSpace(oPointOnFace)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After you exit the sketch env, you can add these lines to execute the Punch Tool command which will pop up the dialog. Hope this is helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// Find the ButtonDefinition of Punch Tool command and execute it&lt;/P&gt;
&lt;P&gt;Dim oDef As ButtonDefinition&lt;BR /&gt;For Each oDef In ThisApplication.CommandManager.ControlDefinitions&lt;BR /&gt; If oDef.InternalName = "SheetMetalPunchToolCmd" Then&lt;BR /&gt; oDef.Execute&lt;BR /&gt; End If&lt;BR /&gt;Next&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2017 20:06:40 GMT</pubDate>
    <dc:creator>FrodoZhou</dc:creator>
    <dc:date>2017-10-05T20:06:40Z</dc:date>
    <item>
      <title>Need a VBA macro for creating a single sketch, a point and use punch at the end.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7417153#M75368</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I required help for performing a operation in Inventor 2014. It is repeated task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a VBA macro for creating one sketch, a single point and use that point for punch a mark.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, steps are as follows for macro. (Note - Below all steps should be in a single macro.)&lt;/P&gt;&lt;P&gt;1. Create Sketch (need to select face manually of sheet metal part) --&amp;gt; I already have one macro for the same. I can share, taken from forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. on the same sketch, plotting a single point. Co-ordinates for point will be Introduced manually by the user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. and the last step just open punch tool window, let the user select punch and press "OK".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Macro for creating sketch as i said earlier : Please see if below macro can help.&lt;/P&gt;&lt;P&gt;__________________________________________________________________________&lt;/P&gt;&lt;P&gt;Public Sub NewSketchOnPlane()&lt;BR /&gt;Dim partDoc As PartDocument&lt;BR /&gt;Set partDoc = ThisApplication.ActiveDocument&lt;BR /&gt;&lt;BR /&gt;' Create a new sketch on a selected face.&lt;BR /&gt;Dim planarEntity As Object&lt;BR /&gt;Set planarEntity = ThisApplication.CommandManager.Pick(kAllPlanarEntities, _&lt;BR /&gt;"Select a face or work plane.")&lt;BR /&gt;Dim sk As sketch&lt;BR /&gt;Set sk = partDoc.ComponentDefinition.Sketches.Add(planarEntity)&lt;BR /&gt;&lt;BR /&gt;' Bring the sketch into edit mode.&lt;BR /&gt;sk.Edit&lt;BR /&gt;End Sub"&lt;/P&gt;&lt;P&gt;_______________________________________________________________&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&amp;nbsp;&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 14:39:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7417153#M75368</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-09-28T14:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need a VBA macro for creating a single sketch, a point and use punch at the</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7437734#M75570</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can add these several lines into your code to create a sketch point, before you exit the sketch env.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// Add a sketch point to a planar sketch&lt;/P&gt;
&lt;P&gt;Dim oPointOnFace As Point&lt;BR /&gt;Set oPointOnFace = planarEntity.PointOnFace //just use the PointOnFace as an example, sounds you will get user input anyway&lt;/P&gt;
&lt;P&gt;sk.SketchPoints.Add sk.ModelToSketchSpace(oPointOnFace)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After you exit the sketch env, you can add these lines to execute the Punch Tool command which will pop up the dialog. Hope this is helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;// Find the ButtonDefinition of Punch Tool command and execute it&lt;/P&gt;
&lt;P&gt;Dim oDef As ButtonDefinition&lt;BR /&gt;For Each oDef In ThisApplication.CommandManager.ControlDefinitions&lt;BR /&gt; If oDef.InternalName = "SheetMetalPunchToolCmd" Then&lt;BR /&gt; oDef.Execute&lt;BR /&gt; End If&lt;BR /&gt;Next&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 20:06:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7437734#M75570</guid>
      <dc:creator>FrodoZhou</dc:creator>
      <dc:date>2017-10-05T20:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Need a VBA macro for creating a single sketch, a point and use punch at the</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7441057#M75616</link>
      <description>&lt;P&gt;Hey thanks for the help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually I am not from Coding Background, so could you please do one more favor ?&lt;/P&gt;&lt;P&gt;can u please create a single macro for the same, which I can copy paste.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry for trouble. Thanks again.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 19:53:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7441057#M75616</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-06T19:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need a VBA macro for creating a single sketch, a point and use punch at the</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7441191#M75619</link>
      <description>&lt;P&gt;No problem. Try how does this work for you. If it works you should have a sketch point created and the punch tool dialog should pop up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Public Sub NewSketchOnPlane()&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Dim partDoc As PartDocument&lt;BR /&gt;Set partDoc = ThisApplication.ActiveDocument&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Create a new sketch on a selected face.&lt;BR /&gt;Dim planarEntity As Object&lt;BR /&gt;Set planarEntity = ThisApplication.CommandManager.Pick(kAllPlanarEntities, _&lt;BR /&gt;"Select a face or work plane.")&lt;BR /&gt;Dim sk As Sketch&lt;BR /&gt;Set sk = partDoc.ComponentDefinition.Sketches.Add(planarEntity)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Bring the sketch into edit mode.&lt;BR /&gt;sk.Edit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Add a sketch point to a planar sketch&lt;BR /&gt;Dim oPointOnFace As Point&lt;BR /&gt;Set oPointOnFace = planarEntity.PointOnFace 'just use the PointOnFace as an example, sounds you will get user input anyway&lt;BR /&gt;sk.SketchPoints.Add sk.ModelToSketchSpace(oPointOnFace)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Exit sketch edit&lt;BR /&gt;sk.ExitEdit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Find the ButtonDefinition of Punch Tool command and execute it&lt;BR /&gt;Dim oDef As ButtonDefinition&lt;BR /&gt;Set oDef = ThisApplication.CommandManager.ControlDefinitions("SheetMetalPunchToolCmd")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Execute the Punch Tool command&lt;BR /&gt;oDef.Execute&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 21:02:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7441191#M75619</guid>
      <dc:creator>FrodoZhou</dc:creator>
      <dc:date>2017-10-06T21:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need a VBA macro for creating a single sketch, a point and use punch at the</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7462665#M75818</link>
      <description>&lt;P&gt;Hell Yeah ...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Its working.. .but still the window for point selection doesn't pop up, it takes point anywhere on sketch and goes to next step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No worries, you have literally solved my issue 90%. Now I can use Dimension to&amp;nbsp;set point where I want to&amp;nbsp;by visiting Sketch Environment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really Thank you,&lt;/P&gt;&lt;P&gt;This macro can save my lot of time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Keep Helping guys like Me. &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Again.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 09:55:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/need-a-vba-macro-for-creating-a-single-sketch-a-point-and-use/m-p/7462665#M75818</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-16T09:55:40Z</dc:date>
    </item>
  </channel>
</rss>

