Hi, What happens is that the workplane you have created is not within the reference files, that is to say of its components, the workplane is within your active assembly. That's why I added the same lines in the code and changed the access to the document (in red)
Try the following ilogic code
On Error Resume Next
'define the active assembly
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
'get user input as True or False
wfBoolean = InputRadioBox("Turn all Work Features On/Off", "On", "Off", False, "iLogic")
'Check all referenced docs
Dim oDoc As Inventor.Document
For Each oDoc In oAssyDoc.AllReferencedDocuments
'set work plane visibility
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
oWorkPlane.Visible = wfBoolean
Next
'set work axis visibility
For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
oWorkAxis.Visible = wfBoolean
Next
'set work point visibility
For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
oWorkPoint.Visible = wfBoolean
Next
'set sketch visibility
For Each oSketch In oDoc.ComponentDefinition.Sketches
oSketch.Visible = wfBoolean
Next
Next
For Each oWorkPlane In oAssyDoc.ComponentDefinition.WorkPlanes
oWorkPlane.Visible = wfBoolean
Next
'set work axis visibility
For Each oWorkAxis In oAssyDoc.ComponentDefinition.WorkAxes
oWorkAxis.Visible = wfBoolean
Next
'set work point visibility
For Each oWorkPoint In oAssyDoc.ComponentDefinition.WorkPoints
oWorkPoint.Visible = wfBoolean
Next
'set sketch visibility
For Each oSketch In oAssyDoc.ComponentDefinition.Sketches
oSketch.Visible = wfBoolean
Next
'update the files
InventorVb.DocumentUpdate()
I hope it is useful for you. regards
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn