<?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: Finding Center of a flat pattern in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691271#M28009</link>
    <description>&lt;P&gt;Thanks again. I can place a workpoint on the formed part, but I get an error trying to place it on the flat pattern. Can you point me in the right direction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTO&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TransientObjects&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;


 &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;componentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;BaseFace&lt;/SPAN&gt;.&lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt;
              &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;.&lt;SPAN&gt;IsOuterEdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
                    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeColl&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeCollection&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateEdgeCollection&lt;/SPAN&gt;
                    &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oEdge&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;.&lt;SPAN&gt;Edges&lt;/SPAN&gt;
                        &lt;SPAN&gt;oEdgeColl&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oEdge&lt;/SPAN&gt;)
                    &lt;SPAN&gt;Next&lt;/SPAN&gt;
		   &lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = ThisApplication.ActiveDocument.componentDefinition.WorkPoints.AddAtCentroid(oEdgeColl)&lt;/SPAN&gt;
                    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oWorkpoint&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkPoint&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;componentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;WorkPoints&lt;/SPAN&gt;.&lt;SPAN&gt;AddAtCentroid&lt;/SPAN&gt;(&lt;SPAN&gt;oEdgeColl&lt;/SPAN&gt;)
                   
                &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
            &lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 17:54:22 GMT</pubDate>
    <dc:creator>brianA32ZM</dc:creator>
    <dc:date>2023-01-19T17:54:22Z</dc:date>
    <item>
      <title>Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11689504#M28002</link>
      <description>&lt;P&gt;Hello, I am attempting to locate the center of a flat pattern (the side A is defined) to place a text box. My initial thought was to locate the center of the flat pattern range box by subtracting the Min point from the max point. This method appeared to work, however in some parts the text box falls. Is there a better method to locatedthe center of the flat pattern? Thanks&amp;nbsp;in advance.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFlatPattern&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;FlatPattern&lt;/SPAN&gt; = &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;BR /&gt;oFlatPattPRR = oFlatPattern.RangeBox&lt;BR /&gt;oFlatPattPRR_X = oFlatPattPRR.MaxPoint.X - oFlatPattPRR.MinPoint.X &lt;BR /&gt;oFlatPattPRR_Y = oFlatPattPRR.MaxPoint.Y - oFlatPattPRR.MinPoint.Y&lt;BR /&gt;Dim oPoint2d As Point2d = ThisApplication.TransientGeometry.CreatePoint2d((oFlatPattPRR_X / 2) + oFlatPattPRR.MinPoint.X, (oFlatPattPRR_Y / 2) -oFlatPattPRR.MaxPoint.Y)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 00:09:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11689504#M28002</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-19T00:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11690772#M28003</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did a small test with min and maxpoints of the flatpattern&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i seem to get weird min and maxpoint results when the flatpattern is rotated compared to folded model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can change rotation by double clicking the flat pattern, then&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit flatpattern definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to see what works, but thought of sharing this first&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 14:55:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11690772#M28003</guid>
      <dc:creator>Cadkunde.nl</dc:creator>
      <dc:date>2023-01-19T14:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11690808#M28004</link>
      <description>&lt;P&gt;I made some screengrabs from my test.&lt;/P&gt;&lt;P&gt;When The flatpattern is rotated 90 degrees, Xmin becomes -4.4408etc&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Knipsel.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1164595iF989BD3F114285B9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Knipsel.PNG" alt="Knipsel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Couldnt find a solution but maybe this helps you a bit. Good luck&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 15:09:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11690808#M28004</guid>
      <dc:creator>Cadkunde.nl</dc:creator>
      <dc:date>2023-01-19T15:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11690960#M28005</link>
      <description>&lt;P&gt;Thank you. I need to test it, but I believe the range box would shift depending on the rotation point when rotating the flat pattern.&lt;/P&gt;&lt;P&gt;I should have noted that the X axis results appear to work as&amp;nbsp;expected. The Y axis is the direction that results in the text box falling off the part.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:00:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11690960#M28005</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-19T16:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691098#M28006</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11141098"&gt;@brianA32ZM&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3133719"&gt;@Cadkunde.nl&lt;/a&gt;.&amp;nbsp; Are you trying to find the center of the FlatPattern's body (a 3D point), or just the center of one of its main faces (a 2D point)?&amp;nbsp; To get a more accureate center of the body (3D point), you could use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=SurfaceBody" target="_blank" rel="noopener"&gt;SurfaceBody&lt;/A&gt; object of the FlatPattern (from &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=FlatPattern_Body" target="_blank" rel="noopener"&gt;FlatPattern.Body&lt;/A&gt;), then you could use its SurfaceBody.&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=SurfaceBody_OrientedMinimumRangeBox" target="_blank" rel="noopener"&gt;OrientedMinimumRangeBox&lt;/A&gt; property to get an &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=OrientedBox" target="_blank" rel="noopener"&gt;OrientedBox&lt;/A&gt; object, which would be more accurate when the model may not be perfectly rectangular or not aligned with origin axes/planes.&amp;nbsp; To get the center of a face, you could try creating a temporary sketch on the face, projects its outer profile to the sketch, then get its &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Profile" target="_blank" rel="noopener"&gt;Profile&lt;/A&gt; object, then use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Profile_RegionProperties" target="_blank" rel="noopener"&gt;RegionProperties&lt;/A&gt; of that Profile, which has a property called &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=RegionProperties_Centroid" target="_blank" rel="noopener"&gt;Centroid&lt;/A&gt;.&amp;nbsp; That should return the most accurate center of the face you could get.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:52:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691098#M28006</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-01-19T16:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691122#M28007</link>
      <description>&lt;P&gt;Thank you. The goal is to find the center of a 2d face; I will test your method soon.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:59:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691122#M28007</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-19T16:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691151#M28008</link>
      <description>&lt;P&gt;Another idea, which may be a step simpler, would be to use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=WorkPoints_AddAtCentroid" target="_blank" rel="noopener"&gt;WorkPoints.AddAtCentroid&lt;/A&gt; method.&amp;nbsp; Then, as input for that method, you could use the &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=EdgeLoop" target="_blank" rel="noopener"&gt;EdgeLoop&lt;/A&gt; from the FlatPattern.&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Face_EdgeLoops" target="_blank" rel="noopener"&gt;BaseFace.EdgeLoops&lt;/A&gt; collection that returns True for its &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=EdgeLoop_IsOuterEdgeLoop" target="_blank" rel="noopener"&gt;EdgeLoop.IsOuterEdgeLoop&lt;/A&gt; property.&amp;nbsp; Then you could use the position of that WorkPoint for your needs, then maybe delete the WorkPoint, as long as your point is not dependent on it.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 17:09:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691151#M28008</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-01-19T17:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691271#M28009</link>
      <description>&lt;P&gt;Thanks again. I can place a workpoint on the formed part, but I get an error trying to place it on the flat pattern. Can you point me in the right direction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTO&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TransientObjects&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;


 &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;componentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;BaseFace&lt;/SPAN&gt;.&lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt;
              &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;.&lt;SPAN&gt;IsOuterEdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
                    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeColl&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeCollection&lt;/SPAN&gt; = &lt;SPAN&gt;oTO&lt;/SPAN&gt;.&lt;SPAN&gt;CreateEdgeCollection&lt;/SPAN&gt;
                    &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oEdge&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;.&lt;SPAN&gt;Edges&lt;/SPAN&gt;
                        &lt;SPAN&gt;oEdgeColl&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oEdge&lt;/SPAN&gt;)
                    &lt;SPAN&gt;Next&lt;/SPAN&gt;
		   &lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = ThisApplication.ActiveDocument.componentDefinition.WorkPoints.AddAtCentroid(oEdgeColl)&lt;/SPAN&gt;
                    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oWorkpoint&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkPoint&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;componentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;WorkPoints&lt;/SPAN&gt;.&lt;SPAN&gt;AddAtCentroid&lt;/SPAN&gt;(&lt;SPAN&gt;oEdgeColl&lt;/SPAN&gt;)
                   
                &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
            &lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 17:54:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691271#M28009</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-19T17:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691310#M28010</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11141098"&gt;@brianA32ZM&lt;/a&gt;.&amp;nbsp; It looks like you are trying to work with every other EdgeLoop except for the outside one.&amp;nbsp; That seems odd to me.&amp;nbsp; Maybe remove the keyword 'Not' from that 'check' line to get only the one that is the outer edge loop.&amp;nbsp; There should only be one outer EdgeLoop, but it is possible to have multiple inner edge loops.&amp;nbsp; And if you add all the edges of multiple EdgeLoops to the EdgeCollection, that is probably where the problem is coming from.&amp;nbsp; It may only be able to find the center of one EdgeLoop at a time...or one EdgeCollection, only if all the edges within are connected.&amp;nbsp; The online help page for that method, at the link in my earlier response, includes some of this explanation of functionality.&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Wait...I misread the code you posted.&amp;nbsp; You are only attempting to create one WorkPoint per EdgeLoop.&amp;nbsp; Maybe you just need to 'Clear' the EdgeCollection each time, even though you are creating it new each time...just as a clean-up precaution.&lt;/P&gt;
&lt;P&gt;Edit 2:&amp;nbsp; You may also just need to break down those long lines of code a bit, so it will recognize each objects Type.&amp;nbsp; That is sometimes an issue when using really long lines of code like that.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 18:16:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691310#M28010</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-01-19T18:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691404#M28011</link>
      <description>&lt;P&gt;Thank you again. Sorry for the confusion, my coding knowledge is limited. I pulled that code from another forum post and tried to adapt it. I made the changes and the result was an error placing the work point on the Flat and success placing on the formed again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Flatpattern&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;FlatPattern&lt;/SPAN&gt; = &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;BaseFace&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt; = &lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;BaseFace&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt; = &lt;SPAN&gt;BaseFace&lt;/SPAN&gt;.&lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTO&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TransientObjects&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;BR /&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;.&lt;SPAN&gt;IsOuterEdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;'		Dim oEdgeColl As EdgeCollection = oTO.CreateEdgeCollection&lt;/SPAN&gt;
&lt;SPAN&gt;'		For Each oEdge In oEdgeloop.Edges&lt;/SPAN&gt;
&lt;SPAN&gt;'			oEdgeColl.Add(oEdge)&lt;/SPAN&gt;
&lt;SPAN&gt;'		Next&lt;/SPAN&gt;
		&lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = ThisApplication.ActiveDocument.componentDefinition.WorkPoints.AddAtCentroid(oEdgeColl)&lt;/SPAN&gt;
		&lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = Flatpattern.WorkPoints.AddAtCentroid(oEdgeColl)&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oWorkpoint&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkPoint&lt;/SPAN&gt; = &lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;WorkPoints&lt;/SPAN&gt;.&lt;SPAN&gt;AddAtCentroid&lt;/SPAN&gt;(&lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;)
		&lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = oCompDef.WorkPoints.AddAtCentroid(oEdgeloop) '**This work on the Formed Model&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 19:00:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691404#M28011</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-19T19:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691426#M28012</link>
      <description>&lt;P&gt;I can't believe that I forgot to mention this earlier, but I think you have to put the FlatPattern into 'Edit Mode' before you can make edits to it.&amp;nbsp; The &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=FlatPattern" target="_blank" rel="noopener"&gt;FlatPattern&lt;/A&gt; object has two methods...one called &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=FlatPattern_Edit" target="_blank" rel="noopener"&gt;Edit&lt;/A&gt;, and the other called &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=FlatPattern_ExitEdit" target="_blank" rel="noopener"&gt;ExitEdit&lt;/A&gt;, that I think you will have to use in this case.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 19:07:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691426#M28012</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-01-19T19:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691442#M28013</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well it still does not like me. I really appreciate the help! The error is shown below as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;Flatpattern&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;FlatPattern&lt;/SPAN&gt; = &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;BaseFace&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Face&lt;/SPAN&gt; = &lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;BaseFace&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt; = &lt;SPAN&gt;BaseFace&lt;/SPAN&gt;.&lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oTO&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TransientObjects&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;

&lt;SPAN&gt;oCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;FlatPattern&lt;/SPAN&gt;.&lt;SPAN&gt;Edit&lt;/SPAN&gt;()

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;EdgeLoops&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;.&lt;SPAN&gt;IsOuterEdgeLoop&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;'		Dim oEdgeColl As EdgeCollection = oTO.CreateEdgeCollection&lt;/SPAN&gt;
&lt;SPAN&gt;'		For Each oEdge In oEdgeloop.Edges&lt;/SPAN&gt;
&lt;SPAN&gt;'			oEdgeColl.Add(oEdge)&lt;/SPAN&gt;
&lt;SPAN&gt;'		Next&lt;/SPAN&gt;
		&lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = ThisApplication.ActiveDocument.componentDefinition.WorkPoints.AddAtCentroid(oEdgeColl)&lt;/SPAN&gt;
		&lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = Flatpattern.WorkPoints.AddAtCentroid(oEdgeColl)&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oWorkpoint&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;WorkPoint&lt;/SPAN&gt; = &lt;SPAN&gt;Flatpattern&lt;/SPAN&gt;.&lt;SPAN&gt;WorkPoints&lt;/SPAN&gt;.&lt;SPAN&gt;AddAtCentroid&lt;/SPAN&gt;(&lt;SPAN&gt;oEdgeloop&lt;/SPAN&gt;)
		&lt;SPAN&gt;'Dim oWorkpoint As WorkPoint = oCompDef.WorkPoints.AddAtCentroid(oEdgeloop) '**This work on the Formed Model&lt;/SPAN&gt;

	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))&lt;BR /&gt;at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;at Inventor.WorkPoints.AddAtCentroid(Object Entities, Boolean Construction)&lt;BR /&gt;at ThisRule.Main() in rule: Rule0, in document 23-8942-50-S.ipt:line 21&lt;BR /&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 19:14:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691442#M28013</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-19T19:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691548#M28014</link>
      <description>&lt;P&gt;I just opened one of my fairly simple sheet metal 'testing' files, and write some code in it for this task, to test it on my end.&amp;nbsp; I am also getting errors.&amp;nbsp; I am not 100% sure, but this might be restricted for some reason.&amp;nbsp; I know that creating work features in an assembly by code is pretty restricted also, but haven't really explored creating them much within the FlatPattern before.&amp;nbsp; We may have to fall back to the sketch routine I mentioned before.&amp;nbsp; I'm out for the day, but I may have another look at this tomorrow.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 20:06:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691548#M28014</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-01-19T20:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691563#M28015</link>
      <description>&lt;DIV class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054" target="_self"&gt;&lt;SPAN class=""&gt;WCrihfield t&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054" target="_self"&gt;&lt;SPAN class=""&gt;hank you once again!&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 20:11:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11691563#M28015</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-19T20:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11693210#M28016</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11141098"&gt;@brianA32ZM&lt;/a&gt;.&amp;nbsp; Turns out that it did not like working with the value of the FlatPattern.BaseFace property, because as soon as I switched that to using FlatPattern.BottomFace, all my code variations started working.&amp;nbsp; I got both the WorkPoints.AddAtCentroid method to work, and the sketch routine to work.&amp;nbsp; Since both code variations have some length to them, I will opt to attach both of them to this post as a text file, to keep it clean, and short.&amp;nbsp; Give these a try, and let me know if they work for you, and if you need any further help with your main task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 12:59:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11693210#M28016</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-01-20T12:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Center of a flat pattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11693856#M28017</link>
      <description>&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054" target="_self"&gt;&lt;SPAN class=""&gt;WCrihfield&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;I cannot thank you enough. This issue has&amp;nbsp;been plaguing me for way too long. In the end I used the WorkPoint solution. On the limited models I tested only one produced an odd result. It was on a simple disk where the work point was reported as being on the edge (0 , 3.81) of the outer profile when in reality it was at 0 , 0.&amp;nbsp; The location was gathered from: oPoint2d_X = oFaceCenter.Point.X &amp;amp;&amp;nbsp;oPoint2d_X = oFaceCenter.Point.X&lt;/P&gt;&lt;P&gt;As I get time I would also like to test the other solution.&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 16:42:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/finding-center-of-a-flat-pattern/m-p/11693856#M28017</guid>
      <dc:creator>brianA32ZM</dc:creator>
      <dc:date>2023-01-20T16:42:33Z</dc:date>
    </item>
  </channel>
</rss>

