<?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: sketch on a face with dimension text in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10666962#M45069</link>
    <description>&lt;P&gt;Look at the attached picture. I need this length to be as a text on the measured face. If I understand right, the dimension in your code is from 0,0 point in the global coordinate system? I only need the dimension of the specific element.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 07:48:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-10-05T07:48:05Z</dc:date>
    <item>
      <title>sketch on a face with dimension text</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10666839#M45067</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would like to create a text on a face we select.&amp;nbsp; The text should be the length of the selected face.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example. We have a square with 100x80mm (thickness doesn't matter). On a top face, we want a text with the length (100mm). It would be good if fontsize could be adjustable in code. Is that possible to create using iLogic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the help.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 06:42:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10666839#M45067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-05T06:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: sketch on a face with dimension text</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10666898#M45068</link>
      <description>&lt;P&gt;Try this sample. It works on faces parallel to XY. You need to specify what do you mean "length of face". I use global size of face in X and Y direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()
    Dim pick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select face")
    Dim face As Face = pick

    Dim faceBox = face.Evaluator.RangeBox
    Dim x As Double = faceBox.MaxPoint.X - faceBox.MinPoint.X
    Dim y As Double = faceBox.MaxPoint.Y - faceBox.MinPoint.Y

    'To [mm]
    x *= 10
    y *= 10

    Dim partDef As PartComponentDefinition = face.Parent.Parent
    Dim planarSketch = partDef.Sketches.Add(face)

    'Fixed position
    'Dim position As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(0, 0)

    'Projected center of mass
    Dim position As Point2d = planarSketch.ModelToSketchSpace(partDef.MassProperties.CenterOfMass)
    
    planarSketch.TextBoxes.AddFitted(position, String.Format("{0}x{1}", x, y))

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 07:20:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10666898#M45068</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2021-10-05T07:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: sketch on a face with dimension text</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10666962#M45069</link>
      <description>&lt;P&gt;Look at the attached picture. I need this length to be as a text on the measured face. If I understand right, the dimension in your code is from 0,0 point in the global coordinate system? I only need the dimension of the specific element.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 07:48:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10666962#M45069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-05T07:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: sketch on a face with dimension text</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10667077#M45070</link>
      <description>&lt;P&gt;In my example is shown how to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Pick face&lt;/LI&gt;&lt;LI&gt;Get its dimensions&lt;/LI&gt;&lt;LI&gt;Convert coordinates of Point in model space to sketch space&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Create new sketch on selected face&lt;/LI&gt;&lt;LI&gt;Add text box to this sketch&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now you need to test my code on simple model (simple box for example). Then you can try to modify this code to your needs. Size of the face can be calculated in many ways and only you know what is the right way. You can read some parameters value, calculate distance between vertices, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 08:32:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10667077#M45070</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2021-10-05T08:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: sketch on a face with dimension text</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10667272#M45071</link>
      <description>&lt;P&gt;Thank you! Solved my problem. One more question.. How can I convert decimal numbers to integer? I am new to iLogic&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 10:06:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10667272#M45071</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-05T10:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: sketch on a face with dimension text</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10667457#M45072</link>
      <description>&lt;P&gt;In this case it is not necessary convert double to int. You can use formatting in String.Format function. See&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=net-5.0#control-formatting" target="_blank"&gt;https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=net-5.0#control-formatting&lt;/A&gt;&lt;/P&gt;&lt;P&gt;for more information.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&amp;nbsp;string.Format("{0:N0}", 1.213) returns "1" (First argument has zero decimal places)&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 11:45:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/sketch-on-a-face-with-dimension-text/m-p/10667457#M45072</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2021-10-05T11:45:14Z</dc:date>
    </item>
  </channel>
</rss>

