<?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 Why intermediate Work entities are needed? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5682232#M56781</link>
    <description>&lt;P&gt;I have a Polyline3d having four lines, forming a planar rectangle (&lt;SPAN style="line-height: 15px;"&gt;pt1,pt2,pt3,pt4)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I wish to create a sketch, which is normal to the rectangle plane, along one of the rectangle sides (say, pt1-&amp;gt;pt4).&lt;/P&gt;&lt;P&gt;In the sketch, I wish to add a line, starting from pt1, at a distance 'd' along the normal. Picture attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following code does it, but just to be compatible with the arguments, I have to create some intermediate work entities. Why? Is there ant elegant way?&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;Private Function CreateGuideSketchForFlange(ByVal oPl As Inventor.Polyline3d, ByRef ofeat As FlangeFeature) As PlanarSketch&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point1 As Point = oPl.PointAtIndex(1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point2 As Point = oPl.PointAtIndex(2)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point3 As Point = oPl.PointAtIndex(3)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point4 As Point = oPl.PointAtIndex(4)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim v1 As Vector = _invApp.TransientGeometry.CreateVector(point2.X - point1.X, point2.Y - point1.Y, point2.Z - point1.Z)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim uv1 As UnitVector = v1.AsUnitVector&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim v2 As Vector = _invApp.TransientGeometry.CreateVector(point4.X - point1.X, point4.Y - point1.Y, point4.Z - point1.Z)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim uv2 As UnitVector = v2.AsUnitVector&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim v3 As Vector = v1.CrossProduct(v2)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim uv3 As UnitVector = v3.AsUnitVector&lt;BR /&gt;&amp;nbsp; &amp;nbsp; uv3.AsVector.ScaleBy(m_thickness)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point5 As Point = point1.Copy()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; point5.TranslateBy(uv3.AsVector)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp; &amp;nbsp; Dim wpt1 As WorkPoint = m_compDef.WorkPoints.AddFixed(point1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim wpt2 As WorkPoint = m_compDef.WorkPoints.AddFixed(point5)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim pl As WorkPlane = m_compDef.WorkPlanes.AddFixed(point1, uv1, uv3)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skt As PlanarSketch = m_compDef.Sketches.Add(pl)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skpt1 As SketchPoint = skt.AddByProjectingEntity(wpt1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skpt2 As SketchPoint = skt.AddByProjectingEntity(wpt2)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skln1 As SketchLine = skt.SketchLines.AddByTwoPoints(skpt1, skpt2)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CreateGuideSketchForFlange = skt&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jun 2015 06:06:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-06-18T06:06:01Z</dc:date>
    <item>
      <title>Why intermediate Work entities are needed?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5682232#M56781</link>
      <description>&lt;P&gt;I have a Polyline3d having four lines, forming a planar rectangle (&lt;SPAN style="line-height: 15px;"&gt;pt1,pt2,pt3,pt4)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I wish to create a sketch, which is normal to the rectangle plane, along one of the rectangle sides (say, pt1-&amp;gt;pt4).&lt;/P&gt;&lt;P&gt;In the sketch, I wish to add a line, starting from pt1, at a distance 'd' along the normal. Picture attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following code does it, but just to be compatible with the arguments, I have to create some intermediate work entities. Why? Is there ant elegant way?&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;Private Function CreateGuideSketchForFlange(ByVal oPl As Inventor.Polyline3d, ByRef ofeat As FlangeFeature) As PlanarSketch&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point1 As Point = oPl.PointAtIndex(1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point2 As Point = oPl.PointAtIndex(2)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point3 As Point = oPl.PointAtIndex(3)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point4 As Point = oPl.PointAtIndex(4)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim v1 As Vector = _invApp.TransientGeometry.CreateVector(point2.X - point1.X, point2.Y - point1.Y, point2.Z - point1.Z)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim uv1 As UnitVector = v1.AsUnitVector&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim v2 As Vector = _invApp.TransientGeometry.CreateVector(point4.X - point1.X, point4.Y - point1.Y, point4.Z - point1.Z)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim uv2 As UnitVector = v2.AsUnitVector&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim v3 As Vector = v1.CrossProduct(v2)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim uv3 As UnitVector = v3.AsUnitVector&lt;BR /&gt;&amp;nbsp; &amp;nbsp; uv3.AsVector.ScaleBy(m_thickness)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim point5 As Point = point1.Copy()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; point5.TranslateBy(uv3.AsVector)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp; &amp;nbsp; Dim wpt1 As WorkPoint = m_compDef.WorkPoints.AddFixed(point1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim wpt2 As WorkPoint = m_compDef.WorkPoints.AddFixed(point5)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim pl As WorkPlane = m_compDef.WorkPlanes.AddFixed(point1, uv1, uv3)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skt As PlanarSketch = m_compDef.Sketches.Add(pl)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skpt1 As SketchPoint = skt.AddByProjectingEntity(wpt1)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skpt2 As SketchPoint = skt.AddByProjectingEntity(wpt2)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim skln1 As SketchLine = skt.SketchLines.AddByTwoPoints(skpt1, skpt2)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; CreateGuideSketchForFlange = skt&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 06:06:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5682232#M56781</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-18T06:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why intermediate Work entities are needed?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5687326#M56858</link>
      <description>&lt;P&gt;Hi Yogesh,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be using a 3d sketch, add a work point and use the sketch point from "p1" that you already have from the 2d sketch.&lt;/P&gt;
&lt;P&gt;the SketchLine3D can then be used to create a path, if you wish to sweep the profile along the normal direction.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;        Dim oSketch3d As Sketch3D
        oSketch3d = partDoc.ComponentDefinition.Sketches3D.Add

        Dim wp2 As Inventor.WorkPoint
        wp2 = oCompDef.WorkPoints.AddFixed(oTG.CreatePoint(0, 0, 1))

        Dim oLine As SketchLine3D
        oLine = oSketch3d.SketchLines3D.AddByTwoPoints(skp1, wp2, False, 1)&lt;/PRE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2015 09:50:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5687326#M56858</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2015-06-22T09:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why intermediate Work entities are needed?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5694451#M56971</link>
      <description>&lt;P&gt;Created 3D sketch as suggested, but using this line as path and a rectangular&amp;nbsp;profile, with those 4 points, SWEEP could not be generated.&lt;/P&gt;&lt;P&gt;the path created using the line seems to be&amp;nbsp;erroneous.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Visually both profile and path look correct. In fact, though they fail to create SWEEP programmetically, if I selected them intereactively, SWEEP is generated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both pictures attached.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 04:23:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5694451#M56971</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-26T04:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why intermediate Work entities are needed?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5694456#M56973</link>
      <description>&lt;P&gt;Another picture attached&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 04:24:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5694456#M56973</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-26T04:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why intermediate Work entities are needed?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5694628#M56978</link>
      <description>&lt;P&gt;Can you please share the sample code to reproduce the behavior ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not share any information that you consider confidential.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Balaji&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>Fri, 26 Jun 2015 09:47:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/why-intermediate-work-entities-are-needed/m-p/5694628#M56978</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2015-06-26T09:47:28Z</dc:date>
    </item>
  </channel>
</rss>

