Message 1 of 5
New problem with existing code - no ComponentDefenition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey all,
I've used this iLogic for a long time. Not sure why its not working now. It's stopping on line 37 because oDoc does not contain a "ComponentDefenition" property. Any clue how I fix this? Thanks!
'verify document type
If ThisApplication.ActiveDocumentType <> Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
'MessageBox.Show("Document Type: " & ThisApplication.ActiveDocumentType.ToString)
MessageBox.Show("Must be run from an Assembly! Program will now exit.")
Exit Sub
End If
'get current colorcheme name
'oColorScheme = ThisApplication.ActiveColorScheme.Name
'get current colorcheme background type
'oBackGroundType = ThisApplication.ColorSchemes.BackgroundType
'Change to Presentation (white background)
'ThisApplication.ColorSchemes.Item("Presentation").Activate
'set to use one color background type
'ThisApplication.ColorSchemes.BackgroundType = _
'BackgroundTypeEnum.kOneColorBackgroundType
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
Dim oDoc As Document
Dim oRefFile As FileDescriptor
'set iproperty to use ISO view on save
oAsmDoc.SetThumbnailSaveOption _
(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
For Each oDoc In oAsmDoc.AllReferencedDocuments
ThisApplication.Documents.Open(oDoc.FullFileName, True)
'MessageBox.Show("Processing: " & oDoc.FullDocumentName)
For Each oSketch In oDoc.ComponentDefinition.Sketches
oSketch.Visible = False
Next
'set work plane visibility
For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes
oWorkPlane.Visible = False
Next
'set work axis visibility
For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes
oWorkAxis.Visible = False
Next
'set work point visibility
For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints
oWorkPoint.Visible = False
Next
'set iproperty to use ISO view on save
oDoc.SetThumbnailSaveOption _
(ThumbnailSaveOptionEnum.kActiveComponentIsoViewOnSave)
'save and close the file
oDoc.Save
oDoc.Close
Next
'Change back to original scheme
'ThisApplication.ColorSchemes.Item(oColorScheme).Activate
'Change back to origina back ground type
'ThisApplication.ColorSchemes.BackgroundType = oBackGroundType