Message 1 of 7
iLogic skip readonly files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have a rule here that opens, updates, and closes the drawings, it works well so far.
But I would like if someone can help me to finish/complete the rule.
I would like if it is possible when it opens the drawings to skip those that are readonly.
Is that possible?
Many thanks!
' ------------Check that the active document is an assembly file------------------------ If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then MessageBox.Show("Please run this rule from the assembly file.", "Drawing update") Exit Sub End If ' ---------------Define the active document As an Assembly file-------------------------- Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Dim oAsmName As String oAsmName = Left(oAsmDoc.DisplayName, Len(oAsmDoc.DisplayName) -4) '-------------------------------Component Drawings -------------------------------------- '----------------Look at the files referenced by the assembly---------------------------- Dim oRefDocs As DocumentsEnumerator oRefDocs = oAsmDoc.AllReferencedDocuments Dim oRefDoc As Document '======================================================================================== Dim i As Integer i = 0 For Each oRefDoc In oRefDocs Dim idwPathName As String idwPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) -3) & "idw" '-------Check to see that the model has a drawing of the same path and name--------------- If(System.IO.File.Exists(idwPathName)) Then i = i+1 End If Next If i = 0 Then MessageBox.Show("No drawings found", "Drawing update", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1) Exit Sub End If If i > 0 Then Dim Q As Integer Q = MessageBox.Show(" "& i & " drawings found in this Assembly" & vbCrLf & "Do you want to Update the checked out drawings?", "Number of Drawings",MessageBoxButtons.OKCancel,MessageBoxIcon.Information) If Q = vbCancel Then End If If Q = vbOK Then '=========================================================================================== ' ------------------Work the drawing files for the referenced models------------------------ ' -------------This expects that the model has a drawing of the same path and name---------- For Each oRefDoc In oRefDocs Dim idwPathName As String idwPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "idw" '--------------Check to see that the model has a drawing of the same path and name---------- If(System.IO.File.Exists(idwPathName)) Then Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.Documents.Open(idwPathName, True) oDrawDoc.Update oDrawDoc.Save oDrawDoc.Close End If Next End If End If