<?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: Replace Sketch Entity in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-sketch-entity/m-p/6742162#M105696</link>
    <description>&lt;P&gt;Any update? Advice? Idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Danijel&lt;/P&gt;</description>
    <pubDate>Sun, 11 Dec 2016 20:34:16 GMT</pubDate>
    <dc:creator>danijel.radenkovic</dc:creator>
    <dc:date>2016-12-11T20:34:16Z</dc:date>
    <item>
      <title>Replace Sketch Entity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-sketch-entity/m-p/6678112#M105694</link>
      <description>&lt;P&gt;Hello to all,&lt;/P&gt;&lt;P&gt;I am not sure that this is the right place for this topic but I would like to hear opinion from someone who had a similar problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for the way to easily replace 2D sketch geometry with another 2d sketch geometry without loosing references.&lt;/P&gt;&lt;P&gt;For example, imagine that I have created one arc which is extruded to surface. I believe there is way, somewhere, to replace arc with straight line or another arc but without breaking extruded surface feature. I have to say that sketch geometry is not generated but imported from AutoCAD format, .dwg or .dxf. I have tried using "import" feature to place 2D geometry and it works perfect if you try to modify the current geometry through the AutoCAD and update in Inventor. But, if you try to break the sketch and add/remove something new inside of sketch, it doesn't work and all referenced features are broken-what is if you agree, expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see attached video for better understanding.&lt;/P&gt;&lt;P&gt;Any help, link, advice is very appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Danijel&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>Wed, 09 Nov 2016 22:05:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-sketch-entity/m-p/6678112#M105694</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2016-11-09T22:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Sketch Entity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-sketch-entity/m-p/6709615#M105695</link>
      <description>&lt;P&gt;Hello to all,&lt;/P&gt;&lt;P&gt;I have tried with an simpler example. VBA code bellow creates a 4 lines which are constrained in the shape of rectangle (I am not using rectangle function cause this is a simple representation of my problem and I will later use arcs and lines):&lt;/P&gt;&lt;PRE&gt;Option Explicit

Sub CreateNewSkecth()

    ' Declare a variable to handle a reference to a document.
    Dim invDoc As Inventor.Document
    ' Set a reference to the active document.
    Set invDoc = ThisApplication.ActiveDocument
    
    ' Get the component definition.
    Dim partDef As Inventor.PartComponentDefinition
    Set partDef = invDoc.ComponentDefinition
        
    ' Use existing sketch.
    Dim xySketch As Inventor.PlanarSketch
    Set xySketch = partDef.Sketches.Item("Sketch1")
    
     ' Get a reference to the TransientGeometry object.
    Dim tg As TransientGeometry
    Set tg = ThisApplication.TransientGeometry
    
    ' Get a reference to the SketchLines collection.
    Dim xyLines As Inventor.SketchLines
    Set xyLines = xySketch.SketchLines
       
    ' Draw a lines
    Dim line1 As Inventor.SketchLine
    Set line1 = xyLines.AddByTwoPoints(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(4, 0))
    Dim line2 As Inventor.SketchLine
    Set line2 = xyLines.AddByTwoPoints(tg.CreatePoint2d(4, 0), tg.CreatePoint2d(4, 4))
    Dim line3 As Inventor.SketchLine
    Set line3 = xyLines.AddByTwoPoints(tg.CreatePoint2d(4, 4), tg.CreatePoint2d(0, 4))
    Dim line4 As Inventor.SketchLine
    Set line4 = xyLines.AddByTwoPoints(tg.CreatePoint2d(0, 4), tg.CreatePoint2d(0, 0))
       
    ' Make a constraints
    line1.EndSketchPoint.Merge line2.StartSketchPoint
    line2.EndSketchPoint.Merge line3.StartSketchPoint
    line3.EndSketchPoint.Merge line4.StartSketchPoint
    line4.EndSketchPoint.Merge line1.StartSketchPoint
                     
End Sub

&lt;/PRE&gt;&lt;P&gt;Second part of the code will delete existing lines and create a 4 new lines and update a model. As it is expected, extrusion is broken because of loosing references:&lt;/P&gt;&lt;PRE&gt;  ' Delete existing lines
    Dim oEntity As SketchEntity
    For Each oEntity In xySketch.SketchLines()
    oEntity.Delete
    Next

    ' Draw a new lines
    Dim line5 As Inventor.SketchLine
    Set line5 = xyLines.AddByTwoPoints(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(4, 0))
    Dim line6 As Inventor.SketchLine
    Set line6 = xyLines.AddByTwoPoints(tg.CreatePoint2d(4, 0), tg.CreatePoint2d(4, 4))
    Dim line7 As Inventor.SketchLine
    Set line7 = xyLines.AddByTwoPoints(tg.CreatePoint2d(4, 4), tg.CreatePoint2d(0, 4))
    Dim line8 As Inventor.SketchLine
    Set line8 = xyLines.AddByTwoPoints(tg.CreatePoint2d(0, 4), tg.CreatePoint2d(0, 0))

    ' Make a new constraints
    line5.EndSketchPoint.Merge line6.StartSketchPoint
    line6.EndSketchPoint.Merge line7.StartSketchPoint
    line7.EndSketchPoint.Merge line8.StartSketchPoint
    line8.EndSketchPoint.Merge line5.StartSketchPoint
    
    'Update a model
    ThisApplication.ActiveDocument.Update&lt;/PRE&gt;&lt;P&gt;Do you have some suggestion how to recover features bellow sketch? Replacing a sketch entities will be the best solution but as far as I am informed, it&amp;nbsp; is not possible.&lt;/P&gt;&lt;P&gt;If I am wrong, please react.&lt;/P&gt;&lt;P&gt;Here is how it is possible in SolidWorks: &lt;A href="https://www.youtube.com/watch?v=X2QxPWkVTMI" target="_self"&gt;https://www.youtube.com/watch?v=X2QxPWkVTMI&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Danijel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2016 14:39:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-sketch-entity/m-p/6709615#M105695</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2016-11-25T14:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace Sketch Entity</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-sketch-entity/m-p/6742162#M105696</link>
      <description>&lt;P&gt;Any update? Advice? Idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Danijel&lt;/P&gt;</description>
      <pubDate>Sun, 11 Dec 2016 20:34:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-sketch-entity/m-p/6742162#M105696</guid>
      <dc:creator>danijel.radenkovic</dc:creator>
      <dc:date>2016-12-11T20:34:16Z</dc:date>
    </item>
  </channel>
</rss>

