<?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: How to add a WorkPlane to a Weldment Design View Rep in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-add-a-workplane-to-a-weldment-design-view-rep/m-p/12527224#M14147</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;.&amp;nbsp; In Line 25 you are &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DesignViewRepresentation_Copy" target="_blank" rel="noopener"&gt;copying&lt;/A&gt; an existing DVR, but not capturing the new DVR to a variable.&amp;nbsp; Then you continue working with the original DVR after that point, instead of the new/copy DVR.&amp;nbsp; Was that your intention?&amp;nbsp; Also, you usually need to make sure there have not been any recordable changes to the DVR you are attempting to copy, or it may be in a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DesignViewRepresentation_DesignViewType" target="_blank" rel="noopener"&gt;'transient' state&lt;/A&gt;.&amp;nbsp; If in a transient state when copied, those previous changes may not be present in the new copy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Below is an edited version of your code, just as an example.&amp;nbsp; See if this works better for you.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;''' &amp;lt;summary&amp;gt;
''' Utility to copy a DVR, activate copied DVR, toggle a workplane visibility, restore Default DVR
''' &amp;lt;/summary&amp;gt;

Private Sub Main()
	' Get the active assembly document
	Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
	' Get weldment info
	Dim oWeldCompDef As WeldmentComponentDefinition
	If TypeOf oAsmDoc.ComponentDefinition Is WeldmentComponentDefinition Then
		oWeldCompDef = oAsmDoc.ComponentDefinition
	Else
		MessageBox.Show("Error: This is not a weldment." &amp;amp; vbLf &amp;amp; vbLf &amp;amp; "Exiting rule.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
		Exit Sub
	End If
	Dim oRepsMgr As RepresentationsManager = oWeldCompDef.RepresentationsManager
	Dim oDVRs As DesignViewRepresentations = oRepsMgr.DesignViewRepresentations
	Dim oDefaultDVR As DesignViewRepresentation = oDVRs.Item("Default")
	' Copy View Rep named Default, To Disassemble
	' Declare name for DVR
	Dim oNewDVRName As String = "Disassemble"
	Dim oNewDVR As DesignViewRepresentation = oDefaultDVR.Copy(oNewDVRName)
	' Activate Disassemble View Rep
	oNewDVR.Activate
	' Disassemble Work Plane Visibility = True
	Dim oWPlanes As WorkPlanes = oWeldCompDef.WorkPlanes
	Dim oWP As WorkPlane
	For Each oWP In oWPlanes
		If oWP.Name.Contains(oNewDVRName) Then
			oWP.Visible = True
			Exit For
		End If
	Next
	' Set to iso view
	Dim oView As Inventor.View = ThisApplication.ActiveView
	Dim oCamera As Camera = oView.Camera
	oCamera.ViewOrientationType = 10759 'Isometric -- Top Right View
	oCamera.Apply
	' Zoom all
	oView.Fit
	'update assembly
	oAsmDoc.Update2(True)
	'Save Disassemble View Rep
	oNewDVR.SaveCurrentCamera
	'Activate Default View Rep
	oDefaultDVR.Activate
	oWP.Visible = False
	' Update
	oAsmDoc.Update2(True)
End Sub&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 29 Jan 2024 19:11:58 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2024-01-29T19:11:58Z</dc:date>
    <item>
      <title>How to add a WorkPlane to a Weldment Design View Rep</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-add-a-workplane-to-a-weldment-design-view-rep/m-p/12527188#M14146</link>
      <description>&lt;P&gt;Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I trying to add an existing WorkPlane to a copied Design View Representation (DVR) in a weldment.&lt;/P&gt;&lt;P&gt;The goal is to copy a DVR, activate it, and then make an existing WorkPlane visible. The existing WorkPlane name is 'Disassemble'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next, restore the Default DVR, which should have the Disassemble WorkPlane invisible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I can:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;copy Default DVR to Disassemble DVR&lt;/LI&gt;&lt;LI&gt;activate Disassemble DVR&lt;/LI&gt;&lt;LI&gt;toggle Disassemble WorkPlane visibility = true&lt;/LI&gt;&lt;LI&gt;activate Default DVR&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have been unsuccessful in getting the WorkPlane's visibilty saved to the Disassemble DVR. I don't think Occurrences is the correct property to use with WorkPlanes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suspect there is more to editing a DVR with iLogic than what the user performs manually in the browser.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;''' &amp;lt;summary&amp;gt;
''' Utility to copy a DVR, activate copied DVR, toggle a workplane visibility, restore Default DVR
''' &amp;lt;/summary&amp;gt;

Private Sub Main()

	' Get the active assembly document
	Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
	' Get the active document info
	Dim oAsmCompDef As AssemblyComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition
	' Get weldment info
	Dim oWeldCompDef As WeldmentComponentDefinition
	Try
		oWeldCompDef = oAsmDoc.ComponentDefinition
	Catch ex As Exception
		MessageBox.Show("Error: This is not a weldment." &amp;amp; vbLf &amp;amp; vbLf &amp;amp; "Exiting rule.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
		Exit Sub
	End Try
	
	' Declare name for DVR
	Dim oNewDVR As String = "Disassemble"

	' Copy View Rep named, Default, To Disassemble
	Dim oDisDVR As DesignViewRepresentation = oWeldCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default")
	oDisDVR.Copy(oNewDVR)

	' Activate Disassemble View Rep
	oDisDVR.Activate

	' Disassemble Work Plane Visibility = True
	Dim oWP As WorkPlane
	For Each oWP In oWeldCompDef.WorkPlanes
		If oWP.Name.Contains(oNewDVR) Then
			oWP.Visible = True
			Exit For
		End If
	Next

	' Set to iso view
	Dim oCamera As Camera
	oCamera = ThisApplication.ActiveView.Camera
	oCamera.ViewOrientationType = 10759 'Isometric -- Top Right View
	oCamera.Apply

	' Zoom all
	ThisApplication.ActiveView.Fit

	' Update
	InventorVb.DocumentUpdate()

	'Save Disassemble View Rep
	oDisDVR.SaveCurrentCamera

	'Activate Default View Rep
	oWeldCompDef.RepresentationsManager.DesignViewRepresentations.Item("Default").Activate
	oWP.Visible = False

	' Update
	InventorVb.DocumentUpdate()

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time and attention. I look forward to your replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 18:36:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-add-a-workplane-to-a-weldment-design-view-rep/m-p/12527188#M14146</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-01-29T18:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a WorkPlane to a Weldment Design View Rep</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-add-a-workplane-to-a-weldment-design-view-rep/m-p/12527224#M14147</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;.&amp;nbsp; In Line 25 you are &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DesignViewRepresentation_Copy" target="_blank" rel="noopener"&gt;copying&lt;/A&gt; an existing DVR, but not capturing the new DVR to a variable.&amp;nbsp; Then you continue working with the original DVR after that point, instead of the new/copy DVR.&amp;nbsp; Was that your intention?&amp;nbsp; Also, you usually need to make sure there have not been any recordable changes to the DVR you are attempting to copy, or it may be in a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DesignViewRepresentation_DesignViewType" target="_blank" rel="noopener"&gt;'transient' state&lt;/A&gt;.&amp;nbsp; If in a transient state when copied, those previous changes may not be present in the new copy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Below is an edited version of your code, just as an example.&amp;nbsp; See if this works better for you.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;''' &amp;lt;summary&amp;gt;
''' Utility to copy a DVR, activate copied DVR, toggle a workplane visibility, restore Default DVR
''' &amp;lt;/summary&amp;gt;

Private Sub Main()
	' Get the active assembly document
	Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
	' Get weldment info
	Dim oWeldCompDef As WeldmentComponentDefinition
	If TypeOf oAsmDoc.ComponentDefinition Is WeldmentComponentDefinition Then
		oWeldCompDef = oAsmDoc.ComponentDefinition
	Else
		MessageBox.Show("Error: This is not a weldment." &amp;amp; vbLf &amp;amp; vbLf &amp;amp; "Exiting rule.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
		Exit Sub
	End If
	Dim oRepsMgr As RepresentationsManager = oWeldCompDef.RepresentationsManager
	Dim oDVRs As DesignViewRepresentations = oRepsMgr.DesignViewRepresentations
	Dim oDefaultDVR As DesignViewRepresentation = oDVRs.Item("Default")
	' Copy View Rep named Default, To Disassemble
	' Declare name for DVR
	Dim oNewDVRName As String = "Disassemble"
	Dim oNewDVR As DesignViewRepresentation = oDefaultDVR.Copy(oNewDVRName)
	' Activate Disassemble View Rep
	oNewDVR.Activate
	' Disassemble Work Plane Visibility = True
	Dim oWPlanes As WorkPlanes = oWeldCompDef.WorkPlanes
	Dim oWP As WorkPlane
	For Each oWP In oWPlanes
		If oWP.Name.Contains(oNewDVRName) Then
			oWP.Visible = True
			Exit For
		End If
	Next
	' Set to iso view
	Dim oView As Inventor.View = ThisApplication.ActiveView
	Dim oCamera As Camera = oView.Camera
	oCamera.ViewOrientationType = 10759 'Isometric -- Top Right View
	oCamera.Apply
	' Zoom all
	oView.Fit
	'update assembly
	oAsmDoc.Update2(True)
	'Save Disassemble View Rep
	oNewDVR.SaveCurrentCamera
	'Activate Default View Rep
	oDefaultDVR.Activate
	oWP.Visible = False
	' Update
	oAsmDoc.Update2(True)
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 29 Jan 2024 19:11:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-add-a-workplane-to-a-weldment-design-view-rep/m-p/12527224#M14147</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-01-29T19:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a WorkPlane to a Weldment Design View Rep</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-add-a-workplane-to-a-weldment-design-view-rep/m-p/12527416#M14148</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you. That was not my intention to continue to edit the original DVR. I overlooked that simple mistake.&lt;/P&gt;&lt;P&gt;I was close though. Thanks, Wesley!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 20:08:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-add-a-workplane-to-a-weldment-design-view-rep/m-p/12527416#M14148</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2024-01-29T20:08:52Z</dc:date>
    </item>
  </channel>
</rss>

