<?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: Using AddForSolid with SketchLInes.AddByTwoPoints in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/13680402#M175485</link>
    <description>&lt;P&gt;I had problems with AddForSolid.&lt;BR /&gt;Merge is extra programming and I don't like that.&lt;BR /&gt;&lt;BR /&gt;This works perfect!&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;firstLine = oSketch.SketchLines.AddByTwoPoints(oPoint2d_a, oPoint2d_b);&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(firstLine.EndSketchPoint, oPoint2d_c);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, oPoint2d_d);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, oPoint2d_e);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, firstLine.StartSketchPoint);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;TY! Brian&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jun 2025 11:55:51 GMT</pubDate>
    <dc:creator>maartenvandooren</dc:creator>
    <dc:date>2025-06-13T11:55:51Z</dc:date>
    <item>
      <title>Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5515732#M120082</link>
      <description>&lt;P&gt;The main issue here is that once I create a set of SketchLines I want to create the Profile but it is throwing an error, can anyone give me a suggestion.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;oSketch.SketchLines.AddByTwoPoints(oPoint2d_a, oPoint2d_b);&amp;nbsp;&lt;BR /&gt;oSketch.SketchLines.AddByTwoPoints(oPoint2d_b, oPoint2d_c);&lt;BR /&gt;oSketch.SketchLines.AddByTwoPoints(oPoint2d_c, oPoint2d_d);&lt;BR /&gt;oSketch.SketchLines.AddByTwoPoints(oPoint2d_d, oPoint2d_e);&lt;BR /&gt;oSketch.SketchLines.AddByTwoPoints(oPoint2d_e, oPoint2d_a);&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;oProfile = oSketch.Profiles.AddForSolid(); //here is the problem&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Feb 2015 20:42:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5515732#M120082</guid>
      <dc:creator>bravaiser</dc:creator>
      <dc:date>2015-02-21T20:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5515810#M120083</link>
      <description>&lt;P&gt;What are your point variables referencing?&amp;nbsp; If they're existing sketch points then I would expect it to work.&amp;nbsp; If they're Point objects then I can see why it is failing.&amp;nbsp; The reason is that the code will be creating 5 lines that aren't connected.&amp;nbsp; They might visibly be connected but when creating a profile they must be connected by either sharing the same sketch point or through constraints.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming they are Point objects, this variation of your program should work.&amp;nbsp; It's using the sketch&amp;nbsp;point from the last line as the first point of the next line so everything will be connected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SketchLine firstLine;&lt;/P&gt;
&lt;P&gt;SketchLine lastLine;&lt;/P&gt;
&lt;P&gt;firstLine = oSketch.SketchLines.AddByTwoPoints(oPoint2d_a, oPoint2d_b);&amp;nbsp;&lt;BR /&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(firstLine.EndSketchPoint, oPoint2d_c);&lt;BR /&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, oPoint2d_d);&lt;BR /&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, oPoint2d_e);&lt;BR /&gt;oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, firstLine.StartSketchPoint);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;oProfile = oSketch.Profiles.AddForSolid();&lt;/P&gt;</description>
      <pubDate>Sun, 22 Feb 2015 01:01:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5515810#M120083</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2015-02-22T01:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5517421#M120084</link>
      <description>&lt;P&gt;thnak you for the suggestion I ended up using something like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;lineOne =  oSketch.SketchLines.AddByTwoPoints(oPoint2d_a, oPoint2d_b);      
lineTwo = oSketch.SketchLines.AddByTwoPoints(oPoint2d_b, oPoint2d_c);
lineThree = oSketch.SketchLines.AddByTwoPoints(oPoint2d_c, oPoint2d_d);
lineFour = oSketch.SketchLines.AddByTwoPoints(oPoint2d_d, oPoint2d_e);
lineFive = oSketch.SketchLines.AddByTwoPoints(oPoint2d_e, oPoint2d_a);

lineOne.EndSketchPoint.Merge(lineTwo.StartSketchPoint);
lineTwo.EndSketchPoint.Merge(lineThree.StartSketchPoint);
lineThree.EndSketchPoint.Merge(lineFour.StartSketchPoint);
lineFour.EndSketchPoint.Merge(lineFive.StartSketchPoint);
lineFive.EndSketchPoint.Merge(lineOne.StartSketchPoint);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 20:13:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5517421#M120084</guid>
      <dc:creator>bravaiser</dc:creator>
      <dc:date>2015-02-23T20:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5519015#M120085</link>
      <description>&lt;P&gt;Brian&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a performance issue with this function,&amp;nbsp;my call to create this sketchlines are inside a loop, there are no gaps in&amp;nbsp;my code, as far as I can tell. When I check for time utilization in this part of the code, the creation of the elements in my pattern takes longer and longer. What can I do to speed up the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for any advice&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;for (int i=0; i&amp;lt; numberOfElements.Count(); i++){

...

                        lineOne =  oSketch.SketchLines.AddByTwoPoints(oPoint2d_a, oPoint2d_b);  
                        lineTwo = oSketch.SketchLines.AddByTwoPoints(oPoint2d_b, oPoint2d_c);
                        lineThree = oSketch.SketchLines.AddByTwoPoints(oPoint2d_c, oPoint2d_d);
                        lineFour = oSketch.SketchLines.AddByTwoPoints(oPoint2d_d, oPoint2d_e);
                        lineFive = oSketch.SketchLines.AddByTwoPoints(oPoint2d_e, oPoint2d_a);

                        lineOne.EndSketchPoint.Merge(lineTwo.StartSketchPoint);
                        lineTwo.EndSketchPoint.Merge(lineThree.StartSketchPoint);
                        lineThree.EndSketchPoint.Merge(lineFour.StartSketchPoint);
                        lineFour.EndSketchPoint.Merge(lineFive.StartSketchPoint);
                        lineFive.EndSketchPoint.Merge(lineOne.StartSketchPoint);

....

oProfile = oSketch.Profiles.AddForSolid();


}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:07:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5519015#M120085</guid>
      <dc:creator>bravaiser</dc:creator>
      <dc:date>2015-02-24T21:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5519037#M120086</link>
      <description>&lt;P&gt;With the few number of lines you're creating, I don't know if the line creation is what's taking the time.&amp;nbsp; What else is in that loop; sketch creation, feature creation?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you were creating a large sketch, then using the Sketch.DeferUpdates property can help.&amp;nbsp; Set this property to True, create your sketch entities, and then set it back to False.&amp;nbsp; But with the small number of lines you're creating I don't know if this will help that much.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:23:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5519037#M120086</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2015-02-24T21:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5519042#M120087</link>
      <description>&lt;P&gt;I am actually creating hundreds&amp;nbsp;of&amp;nbsp;elements&amp;nbsp;formed with this few sketchlines, then create a solid and perform a protrusion. I create a pentagon on a surface and then a protrusion, hundreds of times, the process seams to work but it takes 18 min for 290 elements. That is a long time, analysing&amp;nbsp;the code, this part eats 30% of the time, then protrusion other 30%. But it seams like is reading all the profiles each time before creates a new one, and also for the protrusions, as if is reading all the protrusions in the geometry, so more elements more time...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me try your suggestion in the mean time... thank you Brian&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:30:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/5519042#M120087</guid>
      <dc:creator>bravaiser</dc:creator>
      <dc:date>2015-02-24T21:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/6556113#M120088</link>
      <description>&lt;P&gt;Greetings!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi all, after a year again I'm into Inventor Customization. Here, I have few questions as per this thread.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a sketch contains multiple lines, can we write a For loop to creating them. If so, how to Merge the points to get the profile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LineA.StartSketchPoint.Merge(LineB.StartSketchPoint) .. Here, I'm limiting to LineA, LineB, LineC and LineD. So that, I could Merge the points for retrieving the profile, which is used to create Extrude or Revolve etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone's help would be greatly appreciated, either in C#.net ot VB.net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you all...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naresh Kalyan&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 06:45:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/6556113#M120088</guid>
      <dc:creator>naresh_kalyan</dc:creator>
      <dc:date>2016-09-12T06:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/6556773#M120089</link>
      <description>&lt;P&gt;Even we tried in this way, But still not merging the lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If oSketch.SketchLines.Item(i).StartSketchPoint.Geometry.X = oSketch.SketchLines.Item(j).StartSketchPoint.Geometry.X Then&lt;/P&gt;&lt;P&gt;If oSketch.SketchLines.Item(i).StartSketchPoint.Geometry.Y = oSketch.SketchLines.Item(j).StartSketchPoint.Geometry.Y Then&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;oSketch.SketchLines.Item(i).StartSketchPoint.Merge(oSketch.SketchLines.Item(j).StartSketchPoint)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;end if&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;Naresh Kalyan&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 13:20:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/6556773#M120089</guid>
      <dc:creator>naresh_kalyan</dc:creator>
      <dc:date>2016-09-12T13:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/6565883#M120090</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;It got resolved by using couple of For loops. Thought it might be useful for anyone who's facing similar challenge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public i, j, NumLines as long&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For i = 1 To NumLines&lt;/P&gt;&lt;P&gt;For j = i + 1 To NumLines&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If i &amp;lt;&amp;gt; j Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If osketch.SketchLines.Item(i).StartSketchPoint.Geometry.X = osketch.SketchLines.Item(j).StartSketchPoint.Geometry.X And _&lt;BR /&gt;osketch.SketchLines.Item(i).StartSketchPoint.Geometry.Y = osketch.SketchLines.Item(j).StartSketchPoint.Geometry.Y Then&lt;BR /&gt;Call osketch.SketchLines.Item(i).StartSketchPoint.Merge(osketch.SketchLines.Item(j).StartSketchPoint)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ElseIf osketch.SketchLines.Item(i).EndSketchPoint.Geometry.X = osketch.SketchLines.Item(j).StartSketchPoint.Geometry.X And _&lt;BR /&gt;osketch.SketchLines.Item(i).EndSketchPoint.Geometry.Y = osketch.SketchLines.Item(j).StartSketchPoint.Geometry.Y Then&lt;BR /&gt;Call osketch.SketchLines.Item(i).EndSketchPoint.Merge(osketch.SketchLines.Item(j).StartSketchPoint)&lt;/P&gt;&lt;P&gt;ElseIf osketch.SketchLines.Item(i).StartSketchPoint.Geometry.X = osketch.SketchLines.Item(i).EndSketchPoint.Geometry.X And _&lt;BR /&gt;osketch.SketchLines.Item(i).StartSketchPoint.Geometry.Y = osketch.SketchLines.Item(j).EndSketchPoint.Geometry.Y Then&lt;BR /&gt;Call osketch.SketchLines.Item(i).StartSketchPoint.Merge(osketch.SketchLines.Item(j).EndSketchPoint)&lt;/P&gt;&lt;P&gt;ElseIf osketch.SketchLines.Item(i).EndSketchPoint.Geometry.X = osketch.SketchLines.Item(j).EndSketchPoint.Geometry.X And _&lt;BR /&gt;osketch.SketchLines.Item(i).EndSketchPoint.Geometry.Y = osketch.SketchLines.Item(j).EndSketchPoint.Geometry.Y Then&lt;BR /&gt;Call osketch.SketchLines.Item(i).EndSketchPoint.Merge(osketch.SketchLines.Item(j).EndSketchPoint)&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;odoc.Save()&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2016 05:33:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/6565883#M120090</guid>
      <dc:creator>naresh_kalyan</dc:creator>
      <dc:date>2016-09-16T05:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using AddForSolid with SketchLInes.AddByTwoPoints</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/13680402#M175485</link>
      <description>&lt;P&gt;I had problems with AddForSolid.&lt;BR /&gt;Merge is extra programming and I don't like that.&lt;BR /&gt;&lt;BR /&gt;This works perfect!&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;firstLine = oSketch.SketchLines.AddByTwoPoints(oPoint2d_a, oPoint2d_b);&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(firstLine.EndSketchPoint, oPoint2d_c);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, oPoint2d_d);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lastLine = oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, oPoint2d_e);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;oSketch.SketchLines.AddByTwoPoints(lastLine.EndSketchPoint, firstLine.StartSketchPoint);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;TY! Brian&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 11:55:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addforsolid-with-sketchlines-addbytwopoints/m-p/13680402#M175485</guid>
      <dc:creator>maartenvandooren</dc:creator>
      <dc:date>2025-06-13T11:55:51Z</dc:date>
    </item>
  </channel>
</rss>

