<?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: iLogic rule - Get point coordinates referring to custom origin in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8478785#M92637</link>
    <description>&lt;P&gt;Can you just subtract the UCS offsets from the workpoints?&lt;/P&gt;
&lt;PRE&gt;Dim punto As WorkPoint = ThisApplication.ActiveDocument.ComponentDefinition.WorkPoints("Work Point1")
Dim ucs As UserCoordinateSystem = ThisApplication.ActiveDocument.ComponentDefinition.UserCoordinateSystems(1)
Dim x As Double = punto.Point.X - ucs.XOffset.Value

Dim y As Double = punto.Point.Y - ucs.YOffset.Value

Dim z As Double = punto.Point.Z - ucs.ZOffset. Value

MessageBox.Show("X: " &amp;amp; x &amp;amp; " Y: " &amp;amp; y &amp;amp; " Z: " &amp;amp; z, "Title")&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The ucs offsets are in cm so you may need to convert to mm but that's a simple enough conversion&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Dec 2018 17:00:45 GMT</pubDate>
    <dc:creator>clutsa</dc:creator>
    <dc:date>2018-12-19T17:00:45Z</dc:date>
    <item>
      <title>iLogic rule - Get point coordinates referring to custom origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8478170#M92620</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I'm getting point coordinates referred to the main origin with the following code:&lt;/P&gt;
&lt;P&gt;punto = ThisApplication.ActiveDocument.ComponentDefinition.WorkPoints("Punto1")&lt;/P&gt;
&lt;P&gt;x = punto.point.x&lt;/P&gt;
&lt;P&gt;y = punto.point.y&lt;/P&gt;
&lt;P&gt;z = punto.point.z&lt;/P&gt;
&lt;P&gt;I can make the same with measure tool (see Position.jpg)&lt;/P&gt;
&lt;P&gt;I would like to obtain (with code) the position of the point (x, y, z), but referring to a secondary origin (already set in the part), as I can do with measure tool (see Position other origin.jpg).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks to all for the cooperation!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 13:26:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8478170#M92620</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-19T13:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic rule - Get point coordinates referring to custom origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8478785#M92637</link>
      <description>&lt;P&gt;Can you just subtract the UCS offsets from the workpoints?&lt;/P&gt;
&lt;PRE&gt;Dim punto As WorkPoint = ThisApplication.ActiveDocument.ComponentDefinition.WorkPoints("Work Point1")
Dim ucs As UserCoordinateSystem = ThisApplication.ActiveDocument.ComponentDefinition.UserCoordinateSystems(1)
Dim x As Double = punto.Point.X - ucs.XOffset.Value

Dim y As Double = punto.Point.Y - ucs.YOffset.Value

Dim z As Double = punto.Point.Z - ucs.ZOffset. Value

MessageBox.Show("X: " &amp;amp; x &amp;amp; " Y: " &amp;amp; y &amp;amp; " Z: " &amp;amp; z, "Title")&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;The ucs offsets are in cm so you may need to convert to mm but that's a simple enough conversion&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 17:00:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8478785#M92637</guid>
      <dc:creator>clutsa</dc:creator>
      <dc:date>2018-12-19T17:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic rule - Get point coordinates referring to custom origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8480224#M92661</link>
      <description>&lt;P&gt;The new origin it is not a point, but as an origin it have 3 planes, 3 axis and a central point (see origin.jpg).&lt;/P&gt;
&lt;P&gt;So, the point X, Y, Z i need is not a distance or offset, but a point position with the 3 coordinates completely different because central point and axis directions are different.&lt;/P&gt;
&lt;P&gt;When you use the measuring tool, if you click only a point the windows gives you the position referred to an origin (see position.jpg). In the same windows you can select from a list box a different origin, and you get the coordinates rererred to another "triade".&lt;/P&gt;
&lt;P&gt;So I can't do it measuring a distance between two point (or offset), due to different axis direction too.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 08:34:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8480224#M92661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-20T08:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic rule - Get point coordinates referring to custom origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8482080#M92704</link>
      <description>&lt;P&gt;I see what you mean... try this...&lt;/P&gt;
&lt;PRE&gt;Dim app As Inventor.Application = ThisApplication
Dim doc As Document = app.ActiveDocument
Dim compDef As PartComponentDefinition = doc.ComponentDefinition


Dim wp1 As WorkPoint = compDef.WorkPoints("Work Point1")
Dim ucs As UserCoordinateSystem = compDef.UserCoordinateSystems(1)
'copy workpoint so it can be manipulated
Dim testPoint As Point = wp1.Point.Copy
'get the transform matrix for ucs
Dim invertMatrix As Matrix = ucs.Transformation
'invert matrix to find origin
invertMatrix.Invert
'transform point by inverted matrix to get desired point
testPoint.TransformBy(invertMatrix)

'you won't need to convert from metric to imperial but i'm leaving that in for me =P
MessageBox.Show("X: " &amp;amp; testPoint.X / 2.54 &amp;amp; " Y: " &amp;amp; testPoint.Y / 2.54 &amp;amp; " Z: " &amp;amp; testPoint.Z / 2.54 , "Title")&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Dec 2018 21:20:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8482080#M92704</guid>
      <dc:creator>clutsa</dc:creator>
      <dc:date>2018-12-20T21:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic rule - Get point coordinates referring to custom origin</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8482766#M92718</link>
      <description>&lt;P&gt;It works EXACTLY as I need! Fantastic!&lt;/P&gt;
&lt;P&gt;Many thanks to you and Autodesk Forum!!!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Dec 2018 08:04:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-get-point-coordinates-referring-to-custom-origin/m-p/8482766#M92718</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-21T08:04:25Z</dc:date>
    </item>
  </channel>
</rss>

