<?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 Betreff: Move pivot to object center via python in VRED Forum</title>
    <link>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9416646#M4559</link>
    <description>&lt;LI-CODE lang="python"&gt;bBoxCenter = getBoundingBoxCenter(getSelectedNode(), False)
print str(bBoxCenter.x()) + ',' + str(bBoxCenter.y()) + ',' + str(bBoxCenter.z())&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 02 Apr 2020 06:02:00 GMT</pubDate>
    <dc:creator>marc.winter2</dc:creator>
    <dc:date>2020-04-02T06:02:00Z</dc:date>
    <item>
      <title>Move pivot to object center via python</title>
      <link>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9413090#M4556</link>
      <description>&lt;P&gt;Hi-&lt;/P&gt;&lt;P&gt;I would like to center the pivot of an object via python script. It would be the equivalent of the "Move to Object Center" buttons in the Transform Window.&lt;/P&gt;&lt;P&gt;I know I can use this command to set the Rotation pivot manually:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;setTransformNodeRotatePivot(node, x, y, z, worldSpace)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I want the pivot at the object's center. So I'm looking for a different command, something like &lt;EM&gt;setTransformNodeRotatePivotCenter(node)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;or I need to get the x,y,z values of the object's center first and transfer them via variables.&lt;/P&gt;&lt;P&gt;I am not aware of either option.&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 19:34:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9413090#M4556</guid>
      <dc:creator>cjess</dc:creator>
      <dc:date>2020-03-31T19:34:05Z</dc:date>
    </item>
    <item>
      <title>Betreff: Move pivot to object center via python</title>
      <link>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9414208#M4557</link>
      <description>&lt;P&gt;getBoundingBoxCenter() gives you a vector with the x, y, z coordinates of the object you than use to center your pivot.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 09:10:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9414208#M4557</guid>
      <dc:creator>seiferp</dc:creator>
      <dc:date>2020-04-01T09:10:06Z</dc:date>
    </item>
    <item>
      <title>Betreff: Move pivot to object center via python</title>
      <link>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9415820#M4558</link>
      <description>&lt;P&gt;Thank you for your quick reply, not sure how I missed that. However, getBoundingBoxCenter() returns a Vec3f.&lt;/P&gt;&lt;P&gt;It does not support indexing so I cannot call a specific x, y or z value.&lt;/P&gt;&lt;P&gt;I was hoping something like this would only call the first value of the Vec3f&lt;/P&gt;&lt;LI-CODE lang="python"&gt;print getBoundingBoxCenter("myNode", false)[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;but it returns the error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TypeError: 'Vec3f' object does not support indexing&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I'm not sure how to convert individual values from the Vec3f to floats as required by&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;setTransformNodeRotatePivot&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Any more ideas? Vielen Dank schon mal&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 19:42:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9415820#M4558</guid>
      <dc:creator>cjess</dc:creator>
      <dc:date>2020-04-01T19:42:46Z</dc:date>
    </item>
    <item>
      <title>Betreff: Move pivot to object center via python</title>
      <link>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9416646#M4559</link>
      <description>&lt;LI-CODE lang="python"&gt;bBoxCenter = getBoundingBoxCenter(getSelectedNode(), False)
print str(bBoxCenter.x()) + ',' + str(bBoxCenter.y()) + ',' + str(bBoxCenter.z())&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 02 Apr 2020 06:02:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9416646#M4559</guid>
      <dc:creator>marc.winter2</dc:creator>
      <dc:date>2020-04-02T06:02:00Z</dc:date>
    </item>
    <item>
      <title>Betreff: Move pivot to object center via python</title>
      <link>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9418377#M4560</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1842879"&gt;@seiferp&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8472544"&gt;@marc.winter2&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The command&amp;nbsp;setTransformNodeRotatePivot requires float values for x,y and z positions so I changed the script just in case anyone else comes across this thread.&lt;/P&gt;&lt;P&gt;I also changed &lt;EM&gt;getSelectedNode()&lt;/EM&gt;&amp;nbsp; to &lt;EM&gt;findNode("myNode")&lt;/EM&gt;&amp;nbsp; as I am targeting a specific node every time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;bBoxCenter = getBoundingBoxCenter(findNode("myNode"), False)
setTransformNodeRotatePivot(findNode("myNode"), float(bBoxCenter.x()), float(bBoxCenter.y()), float(bBoxCenter.z()), false)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was beyond my Python knowledge so thanks again, I learned something!&lt;/P&gt;&lt;P&gt;Stay healthy, Grüsse aus Los Angeles&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 18:29:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vred-forum/move-pivot-to-object-center-via-python/m-p/9418377#M4560</guid>
      <dc:creator>cjess</dc:creator>
      <dc:date>2020-04-02T18:29:06Z</dc:date>
    </item>
  </channel>
</rss>

