@RoyWickrama_RWEI,
Thanks for providing sample,
Try the following modified iLogic code to hide selected sketche(es).
Sub Main()
Dim oDoc As Document
oDoc = ThisDoc.Document
Dim oVisibility As New ArrayList
oVisibility.add("ON - ALL SKECHES") '0-ok
oVisibility.add("OFF - ALL SKECHES") '1-ok
oVisibility.add("ON - SELECTED SKECHES") '2-ok
oVisibility_IP = InputListBox("SELECT FROM ABOVE!", oVisibility, oVisibility.Item(0), "SELECT", "VISIBILITY CONTROL")
'oInput = InputRadioBox("SELECT:", _
' "Turn ON - All", _
' "Turn OFF - ALL", "False", "VISIBILITY CONTROL")
Select Case oVisibility_IP
Case oVisibility(0)
oVisibility_On()
Case oVisibility(1)
oVisibility_Off()
Case oVisibility(2)
oVisibility_SelectedSketches()
End Select
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
If oWorkPlane.Name = "XY Plane" Then oWorkPlane.Visible = False
If oWorkPlane.Name = "XZ Plane" Then oWorkPlane.Visible = False
If oWorkPlane.Name = "YZ Plane" Then oWorkPlane.Visible = False
Next
iLogicVb.UpdateWhenDone = True
End Sub
Sub oVisibility_On()
Dim oDoc As Document
oDoc = ThisDoc.Document
For Each oSketch In oDoc.ComponentDefinition.Sketches
oSketch.Visible = True
oSketch.DimensionsVisible = False
Next
End Sub
Sub oVisibility_Off()
Dim oDoc As Document
oDoc = ThisDoc.Document
For Each oSketch In oDoc.ComponentDefinition.Sketches
oSketch.Visible = False
oSketch.DimensionsVisible = False
Next
End Sub
Sub oVisibility_SelectedSketches()
Dim obj As Object
Dim oSketch As Inventor.PlanarSketch
While True
obj = ThisApplication.CommandManager.Pick(
SelectionFilterEnum.kSketchDefaultFilter,
"Select a sketch to hide")
On Error Resume Next
oSketch = obj.Parent
oSketch.Visible = False
' If nothing gets selected then we're done
If IsNothing(obj) Then Exit While
End While
End Sub
Please feel free to contact if there is any queries.
If solves problem, click on "Accept as solution" / give a "Kudo".
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network