<?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 Toggle &amp;quot;Position Offset&amp;quot; for selected components in positional view. in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/toggle-quot-position-offset-quot-for-selected-components-in/m-p/10381055#M48958</link>
    <description>&lt;P&gt;Might there be any function for the check box "Position Offset"?&lt;/P&gt;&lt;P&gt;I can't seem to find anything in the API help docs.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 457px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/929037i7184CA39B8EEE595/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a code similarly to what was done here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/lock-rotation-right-click-menu-on-insert-constraint/idi-p/8819760" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ideas/lock-rotation-right-click-menu-on-insert-constraint/idi-p/8819760&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this code as a starting template:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;qLock = InputRadioBox("Select one:", "Lock Rotation", "Un-Lock Rotation", True, "ilogic")
oLock = ThisApplication.ActiveDocument

Dim oInsert As InsertConstraint

For Each oInsert In oLock.SelectSet
		Call oInsert.ConvertToInsertConstraint2( _
		oInsert.EntityOne, _
		oInsert.EntityTwo, _
		oInsert.AxesOpposed, _
		oInsert.Distance.Value, _
		qLock)
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Idea Thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/assembly-position-offset-issue/idc-p/10374152#M42377" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ideas/assembly-position-offset-issue/idc-p/10374152#M42377&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jun 2021 23:28:18 GMT</pubDate>
    <dc:creator>davis.j</dc:creator>
    <dc:date>2021-06-10T23:28:18Z</dc:date>
    <item>
      <title>Toggle "Position Offset" for selected components in positional view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/toggle-quot-position-offset-quot-for-selected-components-in/m-p/10381055#M48958</link>
      <description>&lt;P&gt;Might there be any function for the check box "Position Offset"?&lt;/P&gt;&lt;P&gt;I can't seem to find anything in the API help docs.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 457px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/929037i7184CA39B8EEE595/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a code similarly to what was done here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/lock-rotation-right-click-menu-on-insert-constraint/idi-p/8819760" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ideas/lock-rotation-right-click-menu-on-insert-constraint/idi-p/8819760&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using this code as a starting template:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;qLock = InputRadioBox("Select one:", "Lock Rotation", "Un-Lock Rotation", True, "ilogic")
oLock = ThisApplication.ActiveDocument

Dim oInsert As InsertConstraint

For Each oInsert In oLock.SelectSet
		Call oInsert.ConvertToInsertConstraint2( _
		oInsert.EntityOne, _
		oInsert.EntityTwo, _
		oInsert.AxesOpposed, _
		oInsert.Distance.Value, _
		qLock)
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Idea Thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/assembly-position-offset-issue/idc-p/10374152#M42377" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ideas/assembly-position-offset-issue/idc-p/10374152#M42377&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 23:28:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/toggle-quot-position-offset-quot-for-selected-components-in/m-p/10381055#M48958</guid>
      <dc:creator>davis.j</dc:creator>
      <dc:date>2021-06-10T23:28:18Z</dc:date>
    </item>
    <item>
      <title>Betreff: Toggle "Position Offset" for selected components in positional view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/toggle-quot-position-offset-quot-for-selected-components-in/m-p/10381604#M48959</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try this one?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim oAssDoc As AssemblyDocument = ThisDoc.Document
Dim oAssCompDef As AssemblyComponentDefinition=oAssDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence
Dim oObj As Object 
Dim oPosRep As PositionalRepresentation = oAssCompDef.RepresentationsManager.ActivePositionalRepresentation 
Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oAssDoc, "Activate Position Offset")

Dim qPosOffset As Boolean = InputRadioBox("Select one:", "Position Offset activate", "Postion Offset deactivate", True, "iLogic")

For Each oObj In oAssDoc.SelectSet 
	oOcc = TryCast(oObj, ComponentOccurrence)
	If oOcc IsNot Nothing Then
		If qPosOffset Then
			oPosRep.SetTransformOverride(oOcc, oOcc.Transformation)
		Else
			oPosRep.RemoveTransformOverride(oOcc)
		End If
	End If
	oOcc=Nothing
Next

oTrans.End&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 11 Jun 2021 06:11:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/toggle-quot-position-offset-quot-for-selected-components-in/m-p/10381604#M48959</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-06-11T06:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle "Position Offset" for selected components in positional view.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/toggle-quot-position-offset-quot-for-selected-components-in/m-p/10389276#M48960</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/564136"&gt;@Ralf_Krieg&lt;/a&gt;&amp;nbsp;, this is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There was some small edits I made to make the code more stable. I set it to continue the rule only if the active positional view does not =&amp;nbsp; "Master". It isn't written the cleanest but it works for me. &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

If oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name &amp;lt;&amp;gt; "Master" Then

	Dim oAssDoc As AssemblyDocument = ThisDoc.Document
	Dim oAssCompDef As AssemblyComponentDefinition=oAssDoc.ComponentDefinition
	Dim oOcc As ComponentOccurrence
	Dim oObj As Object 
	Dim oPosRep As PositionalRepresentation = oAssCompDef.RepresentationsManager.ActivePositionalRepresentation 
	Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(oAssDoc, "Activate Position Offset")

	Dim qPosOffset As Boolean = InputRadioBox("Select one:", "Position Offset activate", "Postion Offset deactivate", True, "iLogic")

	For Each oObj In oAssDoc.SelectSet 
		oOcc = TryCast(oObj, ComponentOccurrence)
		If oOcc IsNot Nothing Then
			If qPosOffset Then
				oPosRep.SetTransformOverride(oOcc, oOcc.Transformation)
			Else
				oPosRep.RemoveTransformOverride(oOcc)
			End If
		End If
		oOcc=Nothing
	Next

	oTrans.End
Else
	MessageBox.Show("Please activate a Positional view first.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 17:02:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/toggle-quot-position-offset-quot-for-selected-components-in/m-p/10389276#M48960</guid>
      <dc:creator>davis.j</dc:creator>
      <dc:date>2021-06-14T17:02:33Z</dc:date>
    </item>
  </channel>
</rss>

