<?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 Mirror an object by rotation in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/mirror-an-object-by-rotation/m-p/12994103#M503</link>
    <description>&lt;P&gt;Gentlemen, I have a script that I found on the Internet. It creates an Attribute Holder on a spline object (in this case, it is a controller for the left leg: "CThigh_Controller_L"). There is a button on the attribute that perfectly mirrors the position from the left to the right leg (in this case, these are not bones, but ordinary points). Does anyone know what a command would look like that would do the same thing only with rotation? Don't forget that all objects are in a hierarchy. Thank you.&lt;/P&gt;&lt;P&gt;Original script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Define custom attributes&lt;BR /&gt;myAttributes = attributes my_custom_attributes&lt;BR /&gt;(&lt;BR /&gt;-- Create a rollout with buttons&lt;BR /&gt;rollout my_rollout "My Custom Rollout"&lt;BR /&gt;(&lt;BR /&gt;button btn2 "Left to Right" width:100 height:20&lt;/P&gt;&lt;P&gt;-- Define actions for the button&lt;BR /&gt;on btn2 pressed do&lt;BR /&gt;(&lt;BR /&gt;-- Define the left and right objects&lt;BR /&gt;leftObjects = #($CThigh_Controller_L)&lt;BR /&gt;rightObjects = #($CThigh_Controller_R)&lt;/P&gt;&lt;P&gt;-- Function to mirror the positions of right objects relative to left objects&lt;BR /&gt;fn mirrorPositions leftObjs rightObjs =&lt;BR /&gt;(&lt;BR /&gt;undo on&lt;BR /&gt;(&lt;BR /&gt;-- Ensure the number of left and right objects match&lt;BR /&gt;if (leftObjs.count == rightObjs.count) then&lt;BR /&gt;(&lt;BR /&gt;-- Iterate through each pair of left and right objects&lt;BR /&gt;for i = 1 to leftObjs.count do&lt;BR /&gt;(&lt;BR /&gt;leftObj = leftObjs[i]&lt;BR /&gt;rightObj = rightObjs[i]&lt;/P&gt;&lt;P&gt;-- Check if the objects are valid&lt;BR /&gt;if (isValidNode leftObj and isValidNode rightObj) then&lt;BR /&gt;(&lt;BR /&gt;-- Calculate the mirrored position of the right object relative to the left object&lt;BR /&gt;mirroredPos = [leftObj.pos.x * -1, leftObj.pos.y, leftObj.pos.z]&lt;/P&gt;&lt;P&gt;-- Set the mirrored position for the right object&lt;BR /&gt;rightObj.pos = mirroredPos&lt;BR /&gt;)&lt;BR /&gt;else&lt;BR /&gt;(&lt;BR /&gt;print ("One or both objects in pair " + i as string + " are invalid.")&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;else&lt;BR /&gt;(&lt;BR /&gt;print "The number of left and right objects must be the same."&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;-- Call the function to mirror positions&lt;BR /&gt;mirrorPositions leftObjects rightObjects&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;-- Define parameters for the Attribute Holder&lt;BR /&gt;parameters main rollout:my_rollout&lt;BR /&gt;(&lt;BR /&gt;-- Add parameters here if needed&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;-- Create an empty Attribute Holder modifier&lt;BR /&gt;attrHolder = EmptyModifier()&lt;/P&gt;&lt;P&gt;-- Add the custom attributes to the Attribute Holder&lt;BR /&gt;custAttributes.add attrHolder myAttributes&lt;/P&gt;&lt;P&gt;-- Find the spline object by name and apply the Attribute Holder&lt;BR /&gt;splineObj = $CThigh_Controller_L&lt;BR /&gt;addModifier splineObj attrHolder&lt;/P&gt;</description>
    <pubDate>Sun, 01 Sep 2024 10:35:48 GMT</pubDate>
    <dc:creator>Radush</dc:creator>
    <dc:date>2024-09-01T10:35:48Z</dc:date>
    <item>
      <title>Mirror an object by rotation</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/mirror-an-object-by-rotation/m-p/12994103#M503</link>
      <description>&lt;P&gt;Gentlemen, I have a script that I found on the Internet. It creates an Attribute Holder on a spline object (in this case, it is a controller for the left leg: "CThigh_Controller_L"). There is a button on the attribute that perfectly mirrors the position from the left to the right leg (in this case, these are not bones, but ordinary points). Does anyone know what a command would look like that would do the same thing only with rotation? Don't forget that all objects are in a hierarchy. Thank you.&lt;/P&gt;&lt;P&gt;Original script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Define custom attributes&lt;BR /&gt;myAttributes = attributes my_custom_attributes&lt;BR /&gt;(&lt;BR /&gt;-- Create a rollout with buttons&lt;BR /&gt;rollout my_rollout "My Custom Rollout"&lt;BR /&gt;(&lt;BR /&gt;button btn2 "Left to Right" width:100 height:20&lt;/P&gt;&lt;P&gt;-- Define actions for the button&lt;BR /&gt;on btn2 pressed do&lt;BR /&gt;(&lt;BR /&gt;-- Define the left and right objects&lt;BR /&gt;leftObjects = #($CThigh_Controller_L)&lt;BR /&gt;rightObjects = #($CThigh_Controller_R)&lt;/P&gt;&lt;P&gt;-- Function to mirror the positions of right objects relative to left objects&lt;BR /&gt;fn mirrorPositions leftObjs rightObjs =&lt;BR /&gt;(&lt;BR /&gt;undo on&lt;BR /&gt;(&lt;BR /&gt;-- Ensure the number of left and right objects match&lt;BR /&gt;if (leftObjs.count == rightObjs.count) then&lt;BR /&gt;(&lt;BR /&gt;-- Iterate through each pair of left and right objects&lt;BR /&gt;for i = 1 to leftObjs.count do&lt;BR /&gt;(&lt;BR /&gt;leftObj = leftObjs[i]&lt;BR /&gt;rightObj = rightObjs[i]&lt;/P&gt;&lt;P&gt;-- Check if the objects are valid&lt;BR /&gt;if (isValidNode leftObj and isValidNode rightObj) then&lt;BR /&gt;(&lt;BR /&gt;-- Calculate the mirrored position of the right object relative to the left object&lt;BR /&gt;mirroredPos = [leftObj.pos.x * -1, leftObj.pos.y, leftObj.pos.z]&lt;/P&gt;&lt;P&gt;-- Set the mirrored position for the right object&lt;BR /&gt;rightObj.pos = mirroredPos&lt;BR /&gt;)&lt;BR /&gt;else&lt;BR /&gt;(&lt;BR /&gt;print ("One or both objects in pair " + i as string + " are invalid.")&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;else&lt;BR /&gt;(&lt;BR /&gt;print "The number of left and right objects must be the same."&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;-- Call the function to mirror positions&lt;BR /&gt;mirrorPositions leftObjects rightObjects&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;-- Define parameters for the Attribute Holder&lt;BR /&gt;parameters main rollout:my_rollout&lt;BR /&gt;(&lt;BR /&gt;-- Add parameters here if needed&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;-- Create an empty Attribute Holder modifier&lt;BR /&gt;attrHolder = EmptyModifier()&lt;/P&gt;&lt;P&gt;-- Add the custom attributes to the Attribute Holder&lt;BR /&gt;custAttributes.add attrHolder myAttributes&lt;/P&gt;&lt;P&gt;-- Find the spline object by name and apply the Attribute Holder&lt;BR /&gt;splineObj = $CThigh_Controller_L&lt;BR /&gt;addModifier splineObj attrHolder&lt;/P&gt;</description>
      <pubDate>Sun, 01 Sep 2024 10:35:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/mirror-an-object-by-rotation/m-p/12994103#M503</guid>
      <dc:creator>Radush</dc:creator>
      <dc:date>2024-09-01T10:35:48Z</dc:date>
    </item>
  </channel>
</rss>

