<?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: Rotating Component in assembly around one of it's own axis in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450297#M15397</link>
    <description>&lt;P&gt;If the constraint is in the plane of rotation then yes, you cannot rotate it, you need to suppress the constraint or delete it and create a new one in other planes.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2023 12:36:46 GMT</pubDate>
    <dc:creator>Andrii_Humeniuk</dc:creator>
    <dc:date>2023-12-19T12:36:46Z</dc:date>
    <item>
      <title>Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450105#M15394</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I've got Component A in my assembly, which i want to rotate x degrees around it's own Y-Axis. I found the following which i think need&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oCurrentOccurrence.Transformation.SetToRotation()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As input i need the the angle of rotation(variable), a workaxis(Y-axis of component), and a point (not sure what the point is for). I found a post of&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;describing i need to create a proxy to acces the components Work-Axis/Point so i did the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;		Dim oCurrentOccurrence As ComponentOccurrence = oACD.Occurrences.Item(5)
		Dim oAngle = 90

		Dim oPoint As WorkPoint = oCurrentOccurrence.Definition.WorkPoints.Item(1)
		Dim oAxis As WorkAxis = oCurrentOccurrence.Definition.WorkAxes.Item(1)
		
		Dim oPointProxy As WorkPointProxy = Nothing
		Dim oAxisProxy As WorkAxisProxy = Nothing
		
		oCurrentOccurrence.CreateGeometryProxy(oPoint, oPointProxy)
		oCurrentOccurrence.CreateGeometryProxy(oAxis, oAxisProxy)
		
		oCurrentOccurrence.Transformation.SetToRotation(oAngle, oAxis, oPoint)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It throws an error on line 13&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTES&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Before this the component is placed in the assembly with '.AddUsingiMates' so this means there are contraints applied to the component. Once it is placed these contrains can be ignored.&lt;/LI&gt;&lt;LI&gt;To be clear, i need the component to rotate around it's own Y-Axis. NOT the Y-Axis of the assembly.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Tue, 19 Dec 2023 11:19:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450105#M15394</guid>
      <dc:creator>Daan_M</dc:creator>
      <dc:date>2023-12-19T11:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450190#M15395</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8021187"&gt;@Daan_M&lt;/a&gt;&amp;nbsp;.&amp;nbsp;I see you're trying to use &lt;U&gt;&lt;STRONG&gt;WorkAxis&lt;/STRONG&gt; &lt;/U&gt;for the &lt;A title="help.autodesk.com" href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Matrix_SetToRotation" target="_blank" rel="noopener"&gt;SetToRotation&lt;/A&gt; method, but you actually need to use &lt;U&gt;&lt;STRONG&gt;Vector&lt;/STRONG&gt;&lt;/U&gt;.&lt;BR /&gt;The line (13) that gives an error should look like this:&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;oCurrentOccurrence.Transformation.SetToRotation(oAngle, oAxisProxy.Line.Direction.AsVector(), oPointProxy)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't tested it, but it seems you also need to use Point instead of WorkPoint.&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;oCurrentOccurrence.Transformation.SetToRotation(oAngle, oAxisProxy.Line.Direction.AsVector(), oPointProxy.Point)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 11:50:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450190#M15395</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-12-19T11:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450285#M15396</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;Thank you for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code runs without error when i use your second suggestion:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;oCurrentOccurrence.Transformation.SetToRotation(oAngle, oAxisProxy.Line.Direction.AsVector(), oPointProxy.Point)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I see no result, the component has not rotated in any way. Maybe the contrains from 'AddUsingiMates()' play a role?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marked red = The component&lt;/P&gt;&lt;P&gt;Blue arrow = points to Y-Axis of the component&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daan_M_0-1702988629477.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1306268iE694916AD0ADB31B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daan_M_0-1702988629477.png" alt="Daan_M_0-1702988629477.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The updated code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;		Dim oCurrentOccurrence As ComponentOccurrence = oACD.Occurrences.Item(5)
		Dim oAngle = 45
		
		MsgBox(oacd.Occurrences.Item(5).Name)
		Dim oPoint As WorkPoint = oCurrentOccurrence.Definition.WorkPoints.Item(1)
		Dim oAxis As WorkAxis = oCurrentOccurrence.Definition.WorkAxes.Item(1)
		
		Dim oPointProxy As WorkPointProxy = Nothing
		Dim oAxisProxy As WorkAxisProxy = Nothing
		
		oCurrentOccurrence.CreateGeometryProxy(oPoint, oPointProxy)
		oCurrentOccurrence.CreateGeometryProxy(oAxis, oAxisProxy)
		
		oCurrentOccurrence.Transformation.SetToRotation(oAngle, oAxisProxy.Line.Direction.AsVector(), oPointProxy.Point)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 12:30:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450285#M15396</guid>
      <dc:creator>Daan_M</dc:creator>
      <dc:date>2023-12-19T12:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450297#M15397</link>
      <description>&lt;P&gt;If the constraint is in the plane of rotation then yes, you cannot rotate it, you need to suppress the constraint or delete it and create a new one in other planes.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 12:36:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450297#M15397</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-12-19T12:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450342#M15398</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;Ok i put in some code to delete the contraints, but the component still has not rotated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe i am doing something wrong defining the workpoint and workaxis. Right now i use&amp;nbsp;'.WorkAxes.Item(1)' and '.Workpoints.Item(1) but i'm not even sure what (1) is. I want to rotate around the components Y-Axis and im not sure what the point is for.&amp;nbsp;Are these things in the component by Default or do i need to define these placing them myself in the partfile as Axis and workpoint?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Updated code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;		oACD.Occurrences.AddUsingiMates(oFullPath, False)
		
		'DELETE CONSTRAINTS
		
		Dim oCurrentOccurrence As ComponentOccurrence = oACD.Occurrences.Item(5)
		For Each OCS In oCurrentOccurrence.Constraints
		OCS.Delete
		Next
		
		'ROTATION
		
		Dim oAngle = 45
	
		Dim oPoint As WorkPoint = oCurrentOccurrence.Definition.WorkPoints.Item(1)
		Dim oAxis As WorkAxis = oCurrentOccurrence.Definition.WorkAxes.Item(1)
		
		Dim oPointProxy As WorkPointProxy = Nothing
		Dim oAxisProxy As WorkAxisProxy = Nothing
		
		oCurrentOccurrence.CreateGeometryProxy(oPoint, oPointProxy)
		oCurrentOccurrence.CreateGeometryProxy(oAxis, oAxisProxy)
		
		oCurrentOccurrence.Transformation.SetToRotation(oAngle, oAxisProxy.Line.Direction.AsVector(), oPointProxy.Point)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 13:11:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450342#M15398</guid>
      <dc:creator>Daan_M</dc:creator>
      <dc:date>2023-12-19T13:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450370#M15399</link>
      <description>&lt;P&gt;The Y-axis is numbered 2. The X-axis is numbered 1.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Andrii_Humeniuk_0-1702991696511.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1306283i9CD716B8432340B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Andrii_Humeniuk_0-1702991696511.png" alt="Andrii_Humeniuk_0-1702991696511.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 13:15:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450370#M15399</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-12-19T13:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450377#M15400</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;Still no result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Made a clean test file, please see the attached Assembly and Partfile.&lt;/P&gt;&lt;P&gt;Run the code in the assembly called 'Rotate', i get no result in any direction.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 13:20:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450377#M15400</guid>
      <dc:creator>Daan_M</dc:creator>
      <dc:date>2023-12-19T13:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Rotating Component in assembly around one of it's own axis</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450416#M15401</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oACD As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence = oACD.Occurrences.Item(1)

Dim oAngle as Double = 3.14159265358979 / 4

Dim oPoint As WorkPoint = oOcc.Definition.WorkPoints("Work Point1")
Dim oAxis As WorkAxis = oOcc.Definition.WorkAxes("Work Axis1")
		
Dim oPointProxy As WorkPointProxy
Dim oAxisProxy As WorkAxisProxy
		
call oOcc.CreateGeometryProxy(oPoint, oPointProxy)
Call oOcc.CreateGeometryProxy(oAxis, oAxisProxy)
Dim oTransform As Matrix = oOcc.Transformation

Call oTransform.SetToRotation(oAngle, oAxisProxy.Line.Direction.AsVector(), oPointProxy.Point)

oOcc.Transformation = oTransform&lt;/LI-CODE&gt;
&lt;P&gt;If it does not move, try changing the degree.&lt;/P&gt;
&lt;P&gt;Also keep in mind that the Inventor understands radians as degrees.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 13:44:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/rotating-component-in-assembly-around-one-of-it-s-own-axis/m-p/12450416#M15401</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-12-19T13:44:48Z</dc:date>
    </item>
  </channel>
</rss>

