Message 1 of 4
Suppress work surfaces in components from assembly.

Not applicable
05-08-2014
10:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this code that toggles Visibility of work surfaces. I have tried to modify it so it would suppress instead, but failed. I thought i could just swap "visibility" with "IsActive" but that did not work. Would anyone have an idea how to make this work? Thanks.
ORIGINAL CODE:
'Sub HideSurfacesInAsm() 'catch and skip errorsOn Error Resume Next 'define the active assemblyDim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument Dim oSurfacebody As WorkSurface Dim Vis As Boolean Dim result result = MsgBox("Make all surfaces visible?", vbYesNoCancel) Select Case result Case vbYes Vis = True Case vbNo Vis = False Case vbCancel Exit Sub End Select Dim oDoc As Inventor.Document For Each oDoc In oAssyDoc.AllReferencedDocuments For Each oSurfacebody In oDoc.ComponentDefinition.WorkSurfaces oSurfacebody.Visible = Vis Next Next ThisApplication.ActiveDocument.Update 'End Sub
MODIFIED CODE:
'Sub HideSurfacesInAsm() 'catch and skip errorsOn Error Resume Next 'define the active assemblyDim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument Dim oSurfacebody As WorkSurface Dim SUPPR As Boolean Dim result result = MsgBox("Suppress all surface features?", vbYesNoCancel) Select Case result Case vbNo SUPPR = True Case vbYes SUPPR = False Case vbCancel Exit Sub End Select Dim oDoc As Inventor.Document For Each oDoc In oAssyDoc.AllReferencedDocuments For Each oSurfacebody In oDoc.ComponentDefinition.WorkSurfaces oSurfacebody.IsActive = SUPPR Next Next ThisApplication.ActiveDocument.Update