- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have modified the following code using assets from other threads. (Credit to those before me 🙂)
What the rule does is temporarily turn off some vault functionality to ignore prompts and errors. It then proceeds to snap and new thumbnail photo for each unique component in throughout the assembly tree. I've got it to a point that works but it is not perfect and large assemblies behave oddly sometimes. My end goal to have a stable rule that can be executed with no errors (Hopefully.)
Can someone test this with me. I am trying to identify why sometimes the parts don't close and continue and rather stay open. It is annoying to have to close them all after if the rule doesn't close them automatically.
Also how can I specify the code to look for derived parts in a given part and then open those as well and re-snap the thumbnail photo.
Idea Thread:
Save all thumbnails with white background.
Sub Main()
oColorScheme = ThisApplication.ActiveColorScheme.Name
oBackGroundType = ThisApplication.ColorSchemes.BackgroundType
ThisApplication.ColorSchemes.Item("Presentation").Activate
ThisApplication.ColorSchemes.BackgroundType = _
BackgroundTypeEnum.kOneColorBackgroundType
Dim a = iLogicVb.Automation
a.RulesOnEventsEnabled = False
If ThisDoc.Document.DocumentType <> kAssemblyDocumentObject Then
MessageBox.Show("This rule must be run from an Assembly.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1)
Exit Sub
End If
Dim oAsmDoc As Document
oAsmDoc = ThisApplication.ActiveDocument
Call MakeNewThumbnail(oAsmDoc)
Dim oSubDoc As Document
For Each oSubDoc In oAsmDoc.AllReferencedDocuments
If oSubDoc.IsModifiable Then
oSubDoc = ThisApplication.Documents.Open(oSubDoc.FullFileName, True)
Call MakeNewThumbnail(oSubDoc)
oSubDoc.Close
End If
Next
Call MakeNewThumbnail(oAsmDoc)
a.RulesOnEventsEnabled = True
ThisApplication.ColorSchemes.Item(oColorScheme).Activate
ThisApplication.ColorSchemes.BackgroundType = oBackGroundType
End Sub
Sub MakeNewThumbnail(oDoc As Document)
On Error Resume Next
With oDoc.ObjectVisibility
.AllWorkFeatures = False
.Sketches = False
.Sketches3D = False
End With
oDoc.SetThumbnailSaveOption (kActiveComponentIsoViewOnSave)
oDoc.Save
On Error GoTo 0
End Sub
Solved! Go to Solution.