Turning on/off visibility of work planes/axis for Content Center parts

Turning on/off visibility of work planes/axis for Content Center parts

Snivek
Enthusiast Enthusiast
917 Views
6 Replies
Message 1 of 7

Turning on/off visibility of work planes/axis for Content Center parts

Snivek
Enthusiast
Enthusiast

I have written some code for turning on/off work planes and axis by selecting a part(s) and clicking the appropriate button and it works great for custom part files and assemblies. It errors though when you try to turn on or off planes or axis for a content center part (system.RuntimeType.forwardcalltoinvokemember 0x80004005). I assume it is because they are read only files. I can turn them on and off through the browser though. Is there a way programmatically to allow them to be turned on/off like I can do through the browser?

Program FormProgram Form

Imports Inventor
Imports System.Windows.Forms

Public Class WFonandoff
    Dim thisapplication As Inventor.Application = g_inventorApplication

    Private Sub WFonandoff_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.TopMost = True
    End Sub

    Private Sub OPon_Click(sender As Object, e As EventArgs) Handles OPon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Try
                                Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                                oPlane.Visible = True
                            Catch ex As Exception
                                MsgBox(ex.ToString)
                            End Try
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkPlanes.Count - 2) To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Try
                                Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                                oPlane.Visible = True
                            Catch ex As Exception
                                MsgBox(ex.ToString)
                            End Try
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub OPoff_Click(sender As Object, e As EventArgs) Handles OPoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkPlanes.Count - 2) To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UPon_Click(sender As Object, e As EventArgs) Handles UPon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = True
                    Next
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = True
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkPlanes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = True
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UPoff_Click(sender As Object, e As EventArgs) Handles UPoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = False
                    Next
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = False
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkPlanes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = False
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub OAon_Click(sender As Object, e As EventArgs) Handles OAon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkAxes.Count - 2) To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub OAoff_Click(sender As Object, e As EventArgs) Handles OAoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkAxes.Count - 2) To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UAon_Click(sender As Object, e As EventArgs) Handles UAon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = True
                        oAxis.AutoResize = True
                    Next
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = True
                        oAxis.AutoResize = True
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkAxes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = True
                        oAxis.AutoResize = True
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UAoff_Click(sender As Object, e As EventArgs) Handles UAoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = False
                    Next
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = False
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkAxes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = False
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub cbALL_CheckedChanged(sender As Object, e As EventArgs) Handles cbALL.CheckedChanged
        If cbALL.Checked Then
            UserWF.Visible = False
            Origin.Text = "Origin/User"
        Else
            UserWF.Visible = True
            Origin.Text = "Origin"
        End If
    End Sub
End Class

 

Inventor Professional 2018.3.3

Vault Basic 2018

Visual Studio 2015

Accepted solutions (1)
918 Views
6 Replies
Replies (6)
Message 2 of 7

clutsa
Collaborator
Collaborator

Does it have trouble with iPartFactory/iAssemblyFactory Members? I don't know a ton about Content Center parts but in my head they work much like factories and you my have trouble if you're accessing the factory and not the member.

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 3 of 7

JamieVJohnson2
Collaborator
Collaborator

Perhaps your answer lies in the ComponentOccurrence itself.  See if you can SetDisplayMode to override (kOverrideDisplayMode = 54275), then change the work features visibility.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 4 of 7

Snivek
Enthusiast
Enthusiast

@clutsa, I think you are on the right track. I placed an ipart and tried turning on the origin planes and got the same error.

 

@JamieVJohnson2, I still get the error with your suggestion but I appreciate the idea. Sounded hopeful.

0 Likes
Message 5 of 7

Snivek
Enthusiast
Enthusiast

@chandra.shekar.g Any help on this one? I am not real sure how to access the member to create the workplaneproxy or if that is indeed the approach I need to take.

Thank you

0 Likes
Message 6 of 7

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Snivek,

 

As you are editing or modifying library documents(content center parts), need to specify that _LibraryDocumentModifiable as true before editing library document. For more details, refer below help documentation link.

 

https://knowledge.autodesk.com/support/inventor-products/troubleshooting/caas/sfdcarticles/sfdcartic...

app.[_LibraryDocumentModifiable] = True                               ‘ Allow Library document modification
oPart.PropertySets.Item(1).Item(1).Value = "test123"              ‘ Modify a property in a read-only document
app.[_LibraryDocumentModifiable] = False                              ‘ Revert to default behavior

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 7 of 7

Snivek
Enthusiast
Enthusiast

@chandra.shekar.g That did the trick. Never would have found that. Thank you.

Imports Inventor
Imports System.Windows.Forms

Public Class WFonandoff
    Dim thisapplication As Inventor.Application = g_inventorApplication

    Private Sub WFonandoff_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.TopMost = True
    End Sub

    Private Sub OPon_Click(sender As Object, e As EventArgs) Handles OPon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkPlanes.Count - 2) To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = True
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub OPoff_Click(sender As Object, e As EventArgs) Handles OPoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkPlanes.Count - 2) To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkPlanes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                            oPlane.Visible = False
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UPon_Click(sender As Object, e As EventArgs) Handles UPon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    thisapplication.[_LibraryDocumentModifiable] = True
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = True
                    Next
                    thisapplication.[_LibraryDocumentModifiable] = False
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = True
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkPlanes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = True
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UPoff_Click(sender As Object, e As EventArgs) Handles UPoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oPlane As WorkPlaneProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    thisapplication.[_LibraryDocumentModifiable] = True
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = False
                    Next
                    thisapplication.[_LibraryDocumentModifiable] = False
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkPlanes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = False
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkPlanes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkPlanes.Item(x), oPlane)
                        oPlane.Visible = False
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub OAon_Click(sender As Object, e As EventArgs) Handles OAon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkAxes.Count - 2) To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = True
                            oAxis.AutoResize = True
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub OAoff_Click(sender As Object, e As EventArgs) Handles OAoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If Not cbALL.Checked Then
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To 3
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = (modeldef.WorkAxes.Count - 2) To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    End If
                Else
                    If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                        Dim modeldef As PartComponentDefinition = obj.Definition
                        thisapplication.[_LibraryDocumentModifiable] = True
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                        thisapplication.[_LibraryDocumentModifiable] = False
                    ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                        Dim modeldef As AssemblyComponentDefinition = obj.Definition
                        For x = 1 To modeldef.WorkAxes.Count
                            Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                            oAxis.Visible = False
                        Next
                    End If
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UAon_Click(sender As Object, e As EventArgs) Handles UAon.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    thisapplication.[_LibraryDocumentModifiable] = True
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = True
                        oAxis.AutoResize = True
                    Next
                    thisapplication.[_LibraryDocumentModifiable] = False
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = True
                        oAxis.AutoResize = True
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkAxes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = True
                        oAxis.AutoResize = True
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub UAoff_Click(sender As Object, e As EventArgs) Handles UAoff.Click
        Dim AssyModel As AssemblyDocument = thisapplication.ActiveDocument
        Dim AssyModelDef As AssemblyComponentDefinition = AssyModel.ComponentDefinition
        If AssyModel.SelectSet.Count > 0 Then
            For Each obj As ComponentOccurrence In AssyModel.SelectSet
                Dim oAxis As WorkAxisProxy
                Dim x As Integer
                Dim doc As Document = obj.ReferencedDocumentDescriptor.ReferencedDocument
                If doc.SubType = "{4D29B490-49B2-11D0-93C3-7E0706000000}" Or doc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'part or sheetmetal
                    Dim modeldef As PartComponentDefinition = obj.Definition
                    thisapplication.[_LibraryDocumentModifiable] = True
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = False
                    Next
                    thisapplication.[_LibraryDocumentModifiable] = False
                ElseIf doc.SubType = "{E60F81E1-49B3-11D0-93C3-7E0706000000}" Then 'assembly
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 4 To modeldef.WorkAxes.Count
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = False
                    Next
                ElseIf doc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then 'weldment
                    Dim modeldef As AssemblyComponentDefinition = obj.Definition
                    For x = 1 To (modeldef.WorkAxes.Count - 3)
                        Call obj.CreateGeometryProxy(modeldef.WorkAxes.Item(x), oAxis)
                        oAxis.Visible = False
                    Next
                End If
                x = 0
            Next
            AssyModel.Update()
        Else
            MessageBox.Show("No selections made. Please select components and try again.", "Selection", MessageBoxButtons.OK)
        End If
    End Sub

    Private Sub cbALL_CheckedChanged(sender As Object, e As EventArgs) Handles cbALL.CheckedChanged
        If cbALL.Checked Then
            UserWF.Visible = False
            Origin.Text = "Origin/User"
        Else
            UserWF.Visible = True
            Origin.Text = "Origin"
        End If
    End Sub
End Class