Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
Trying to write a iLogic code that is run from the assembly file, that opens all related drawings,
update them then ask if you want to proceed to the next drawing, save and close it.
But im not sure if i got the code right. The thing im not sure with is the Update bit of the code. (Red text in the code below)
First iLogic code i have written by my self.
'define the active document As an Assembly file Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument oAsmName = Left(oAsmDoc.DisplayName, Len(oAsmDoc.DisplayName) -4) '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.", "iLogic") Exit Sub End If '- - - - - - - - - - - - -Component Drawings - - - - - - - - - - - -'look at the files referenced by the assembly Dim oRefDocs As DocumentsEnumerator oRefDocs = oAsmDoc.AllReferencedDocuments Dim oRefDoc As Document 'work the 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 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) InventorVb.DocumentUpdate() question = MessageBox.Show("Continue with next Drawing?", "Drawing Looks Good?",MessageBoxButtons.YesNo,MessageBoxIcon.Question) If question = vbYes Then 'Save oDrawDoc.Save 'close the file oDrawDoc.Close Else Return End If Else End If
Some help would be appreciated.
Thanks
//Jesper
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Solved! Go to Solution.