<?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: How to collect the current position of the robot arm X, Y, Z axis in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497291#M13216</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;It sounds like you want to use &lt;A href="https://docs.flexsim.com/en/22.1/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/Object.html#Method-getLocation"&gt;getLocation&lt;/A&gt;, rotation and &lt;A href="https://docs.flexsim.com/en/22.1/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Vec3.html#Method-project"&gt;project &lt;/A&gt;which will allow you to easily find all required x,y,z relative to your desired coordinate space.   Assign them to a Vec3, say, armLoc1, and then access them using armLoc1.x, armLoc1.y, armLoc1.z.&lt;/P&gt;&lt;P&gt;You may need to run updatelocations on the objects before you access them.&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 01 May 2022 08:11:20 GMT</pubDate>
    <dc:creator>jason_lightfoot_adsk</dc:creator>
    <dc:date>2022-05-01T08:11:20Z</dc:date>
    <item>
      <title>How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497290#M13215</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 20.0.10 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;我收集機械臂每次改變運動的XYZ軸坐標並需要寫入表格（位置表）&lt;/P&gt;
 &lt;P&gt;我應該如何獲得這些信息，希望你能幫我修改這個模型並得到一個可以解決問題的答案，謝謝。&lt;/P&gt;
 &lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/51543-collect-robot-arm-axis-coordinates.fsm" target="_blank"&gt;Collect robot arm axis coordinates.fsm&lt;/A&gt;&lt;/P&gt;
 &lt;P&gt;Translation: "I&lt;EM&gt; collect the XYZ axis coordinates of each movement of the robotic arm and need to write to a table (position table) How should I get this information, I hope you can help me modify this model and get an answer that can solve the problem, thanks.&lt;/EM&gt;"&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sun, 01 May 2022 08:00:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497290#M13215</guid>
      <dc:creator>leelichou1112</dc:creator>
      <dc:date>2022-05-01T08:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497291#M13216</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;It sounds like you want to use &lt;A href="https://docs.flexsim.com/en/22.1/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/Object.html#Method-getLocation"&gt;getLocation&lt;/A&gt;, rotation and &lt;A href="https://docs.flexsim.com/en/22.1/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Vec3.html#Method-project"&gt;project &lt;/A&gt;which will allow you to easily find all required x,y,z relative to your desired coordinate space.   Assign them to a Vec3, say, armLoc1, and then access them using armLoc1.x, armLoc1.y, armLoc1.z.&lt;/P&gt;&lt;P&gt;You may need to run updatelocations on the objects before you access them.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 01 May 2022 08:11:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497291#M13216</guid>
      <dc:creator>jason_lightfoot_adsk</dc:creator>
      <dc:date>2022-05-01T08:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497292#M13217</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;是的，這就是我想做的&lt;/P&gt;
 &lt;P&gt;有沒有可以給我參考的例子？&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;Translation: "Yes, that's what I want to do. Is there an example that I can refer to?"&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 May 2022 02:57:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497292#M13217</guid>
      <dc:creator>leelichou1112</dc:creator>
      <dc:date>2022-05-02T02:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497293#M13218</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;There's not that much to it. Let's say you want to find the coordinate of the centre of joint6 in model space (the root of the model tree).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;Object joint6=Model.find("Basic /Joint 1/Joint 2/Joint 3/Joint 4/Joint 5/Joint 6");
Vec3 j6loc=joint6.getLocation(0.5,0.5,0.5);   //  The location of joint6 in it's container's space.  Use 0.5 for x,y and z meaning he center of the bounding box
Vec3 j6modelCoords=j6loc.project(joint6.up, model());  // translates the joint5 coordinates to model coordinates.
applicationcommand("outputconsole");
print("X:",j6modelCoords.x,"Y:",j6modelCoords.y,"Z:",j6modelCoords.z);&lt;/PRE&gt;&lt;P&gt;I see in your model that you've not put the joints in the correct locations.  If you want to try that, use the &lt;EM&gt;centroid &lt;/EM&gt;attribute in the tree ("&amp;gt;spatials/centroid"). Set its value to 2 and then add 3 nodes for the coordinates of the joint relative to the objects own coordinate space. &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1651493694225.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1510092i1DB7335D9D7F8DD2/image-size/large?v=v2&amp;amp;px=999" role="button" title="1651493694225.png" alt="1651493694225.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 May 2022 12:04:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497293#M13218</guid>
      <dc:creator>jason_lightfoot_adsk</dc:creator>
      <dc:date>2022-05-02T12:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497294#M13219</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Thank you, this answer helped me a lot&lt;/P&gt;
 &lt;P&gt;I also want to know, how to replace outputconsole with Global Table&lt;/P&gt;
 &lt;P&gt;I need to use Global Table to collect this relevant information&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 May 2022 13:46:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497294#M13219</guid>
      <dc:creator>leelichou1112</dc:creator>
      <dc:date>2022-05-02T13:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497295#M13220</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;You should know this already or find it in the manual.&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;Table("Tablename")[1][1]=j6modelCoords.x; //writes the x coords to row1, col1 cell.&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 May 2022 13:58:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497295#M13220</guid>
      <dc:creator>jason_lightfoot_adsk</dc:creator>
      <dc:date>2022-05-02T13:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497296#M13221</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;我使用這種方法，但會得到錯誤&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1651545109107.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1510094i19C6AA2E0D6D2C0C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1651545109107.png" alt="1651545109107.png" /&gt;&lt;/span&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1651545190297.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1510095iC1C77E3D46A44687/image-size/large?v=v2&amp;amp;px=999" role="button" title="1651545190297.png" alt="1651545190297.png" /&gt;&lt;/span&gt;&lt;/P&gt;
 &lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/51578-0503-xyz-%E8%BB%B8%E5%BA%A7%E6%A8%99.fsm" target="_blank"&gt;0503 XYZ軸座標.fsm&lt;/A&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 May 2022 02:34:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497296#M13221</guid>
      <dc:creator>leelichou1112</dc:creator>
      <dc:date>2022-05-03T02:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497297#M13222</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;The row you want to write to has to exist in the table. To add a new row before writing to the table use "Table().addRow()". You are also writing each value to the first column, overwriting the previous one (so you would end up with only the z-coordinate).&lt;/P&gt;&lt;P&gt;Either write them to different columns or combine the numbers in a single string (text) and write that to the table.&lt;/P&gt;&lt;PRE&gt;int row = Table("Location").addRow().numRows;  // add new row and get its number
Table("Location")[row][1] = BasicmodelCoords.x; &amp;nbsp;// x-location, column 1
Table("Location")[row][2] = BasicmodelCoords.y; &amp;nbsp;// y-location, column 2
Table("Location")[row][3] = BasicmodelCoords.z; &amp;nbsp;// z-location, column 3


string combined = "X: " + string.fromNum(BasicmodelCoords.x, 2) + ", Y: " + string.fromNum(BasicmodelCoords.y, 2) + ", Z: " + string.fromNum(BasicmodelCoords.x, 2);
Table("Location")[row][4] = combined;  // write all coordinates as text to column4&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 May 2022 06:12:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497297#M13222</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2022-05-03T06:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to collect the current position of the robot arm X, Y, Z axis</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497298#M13223</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;感謝您的幫助，我對部分代碼的了解較少，它幫助我解決了問題&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 May 2022 11:02:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-collect-the-current-position-of-the-robot-arm-x-y-z-axis/m-p/13497298#M13223</guid>
      <dc:creator>leelichou1112</dc:creator>
      <dc:date>2022-05-03T11:02:45Z</dc:date>
    </item>
  </channel>
</rss>

