Hello,
I want to have my code run and change all views= representations of the VISIBLE components in my assembly to "Default". I've got it to where it does it for all components but I'm having trouble checking for visiblity. Here is what I've got:
Dim doc as AssemblyDocument = ThisDoc.Document Dim oAsmCompDef As ComponentDefinition oAsmCompDef = doc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence For Each oCompOcc in oAsmCompDef.Occurrences If Component.Visible(oCompOcc) = True Then MessageBox.Show("Message", "Title") Else End If 'oCompOcc.SetDesignViewRepresentation("Default", True) On Error Resume Next Next ThisApplication.ActiveView.Fit
Solved! Go to Solution.
Solved by MechMachineMan. Go to Solution.
I dont know if you have it arranged like that for communication purposes, but if you dont, you need to move your creation in under the if statement. Also, syntax:
ComponentOccurrence.Visible Property
Description
Property gets and set whether the occurrence is visible or not.
Syntax
ComponentOccurrence.Visible() As Boolean
Dim doc as AssemblyDocument = ThisDoc.Document Dim oAsmCompDef As ComponentDefinition oAsmCompDef = doc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence For Each oCompOcc in oAsmCompDef.Occurrences If oCompOcc.Visible = True Then oCompOcc.SetDesignViewRepresentation("Default", True) End If
On Error Resume Next Next
ThisApplication.ActiveView.Fit
Can't find what you're looking for? Ask the community or share your knowledge.