Message 1 of 3

Not applicable
08-09-2019
04:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I can't figure out what is wrong with this... I'm trying to open all drawings whose filename contains the project number. If i remove the "For each subOcc...." part it works fine. It seems to error out at the "oCurrentFilenameWithExtension = oOcc.ReferencedFileDescriptor.FullFileName" Line on the first sub occurence.
Error shown under my rule.
Also "ThisApplication.ActiveView.Fit" seems to be doing sweet FA
Class ThisRule Dim ComponentArray As New ArrayList Sub Main Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oOcc_s As ComponentOccurrences = oCompDef.Occurrences 'look at each occurrence in the assembly For Each oOcc As ComponentOccurrence In oOcc_s OpenDrawing(oOcc) Next MessageBox.Show("Please Check for Overlapping Dimensions, then Check in to Vault.", "All Drawings Have Been Generated") End Sub Sub OpenDrawing(oOcc) oCurrentFilenameWithExtension = oOcc.ReferencedFileDescriptor.FullFileName oCurrentFilenameWithoutExtension = oCurrentFilenameWithExtension.Substring(0, oCurrentFilenameWithExtension.Length - 4) If oOcc.Name.Contains(Project_Folder) And ComponentArray.Contains(oCurrentFilenameWithExtension) = False ComponentArray.Add(oCurrentFilenameWithExtension) Dim DrawingDoc As DrawingDocument = ThisApplication.Documents.Open(oCurrentFilenameWithoutExtension & ".dwg", True) ThisApplication.ActiveView.Fit DrawingDoc.Save For Each subOcc As ComponentOccurrence In oOcc.SubOccurrences OpenDrawing(subOcc) Next End If End Sub End Class
Solved! Go to Solution.