<?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: Command or script for aligning pivot x-axis along a 2-point-spline with different z-coordinates in 3ds Max Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358636#M16597</link>
    <description>&lt;P&gt;Yes, indeed. Only with the x-axis pointing to the second point. It would be perfect if then the pivot would move to the half of the line. I´m sadly not able to program it myself, I have to learn it. I have only programmed some simple autoLISP routines in the past..&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 15:26:02 GMT</pubDate>
    <dc:creator>3d-labor</dc:creator>
    <dc:date>2021-06-02T15:26:02Z</dc:date>
    <item>
      <title>Command or script for aligning pivot x-axis along a 2-point-spline with different z-coordinates</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358121#M16595</link>
      <description>&lt;P&gt;I searched for a long time because I was sure that it must be an easy problem. I have hundreds of lines generated by the "Glue" script of Itoosoft (wrap elements onto a surface). Sadly the pivot points remains in the position of the original lines. So I want an easy tool to align the x-axis of the pivot point along the new generated line between the two vertices which I can use on multiple lines at once. I need it to later distribute some xref-objects with the "Clone and Align" tool of 3dsmax. I found some scripts but none which does it correct. The script "scriptedglue" which is similar to "glue" move the pivot point correctly but it moves the x- and y-coordinates a little bit. So I can´t use this for my project. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 12:06:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358121#M16595</guid>
      <dc:creator>3d-labor</dc:creator>
      <dc:date>2021-06-02T12:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Command or script for aligning pivot x-axis along a 2-point-spline with different z-coordinates</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358399#M16596</link>
      <description>&lt;P&gt;Here's a modified version of a script I wrote some time ago.&amp;nbsp; It will reposition the pivot of selected splines to the first vertex of the spline with the Z axis pointing in the direction of the second vertex.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this what you want except that the X axis should point to the second vertex?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;-- changes the pivot of selected lines and splines so that the local
-- z axis is collinear with the line's first two vertices and is located 
-- at the first vertex of the line.
-- L. Minardi  6/2/2021  v3
-- 
for spl in selection where classof spl == line do (
s=1
e1 = getKnotPoint spl s 1 
e2 = getKnotPoint spl s 2
vu = normalize(e2-e1)  -- unit vector from vertex 1 to 2
m = spl.transform  -- spline matrix
ftm = translate (matrixfromnormal vu) e1
itm = ftm*(inverse m)
spl.transform = ftm
spl.objectOffsetPos *= inverse itm
spl.objectOffsetRot *= inverse itm.rotation
spl.transform
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 13:49:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358399#M16596</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2021-06-02T13:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Command or script for aligning pivot x-axis along a 2-point-spline with different z-coordinates</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358636#M16597</link>
      <description>&lt;P&gt;Yes, indeed. Only with the x-axis pointing to the second point. It would be perfect if then the pivot would move to the half of the line. I´m sadly not able to program it myself, I have to learn it. I have only programmed some simple autoLISP routines in the past..&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 15:26:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358636#M16597</guid>
      <dc:creator>3d-labor</dc:creator>
      <dc:date>2021-06-02T15:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: Command or script for aligning pivot x-axis along a 2-point-spline with different z-coordinates</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358848#M16598</link>
      <description>&lt;P&gt;I wanted to use rotateY to reorient the matrix so that the x axis would point in the direction of z but it didn't do what I wanted.&amp;nbsp; Luckily I could fudge an appropriate matrix by replacing the x vector with z and using a cross product to calculate a new z.&amp;nbsp; Unorthodox but it works!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;-- changes the pivot of selected lines and splines so that the local
-- X axis is collinear with the line's first two vertices and is located 
-- at the midpoint of the line.
-- L. Minardi  6/2/2021  v4
-- 
for spl in selection where classof spl == line do (
s=1
e1 = getKnotPoint spl s 1 
e2 = getKnotPoint spl s 2
emid = 	((e1 + e2)/ 2.)
vu = normalize(e2-e1)  -- unit vector from vertex 1 to 2
m = spl.transform  -- spline matrix
mm = MatrixFromNormal(vu)
-- rotate matrix by 90° about Y
mm.row1 = mm.row3
mm.row3 = cross mm.row1 mm.row2
ftm = translate mm emid
itm = ftm*(inverse m)
spl.transform = ftm
spl.objectOffsetPos *= inverse itm
spl.objectOffsetRot *= inverse itm.rotation
spl.transform 
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 02 Jun 2021 16:43:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10358848#M16598</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2021-06-02T16:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Command or script for aligning pivot x-axis along a 2-point-spline with different z-coordinates</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10359116#M16599</link>
      <description>&lt;P&gt;Awesome, my friend! Thank you very much.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 18:37:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/command-or-script-for-aligning-pivot-x-axis-along-a-2-point/m-p/10359116#M16599</guid>
      <dc:creator>3d-labor</dc:creator>
      <dc:date>2021-06-02T18:37:46Z</dc:date>
    </item>
  </channel>
</rss>

