- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm hoping someone has found a solution to this with global forms. I've got a couple ilogic that do different tasks when working with drawings, I've added them to a global form. When you activate the global form. The form stays linked to the document that was active when you opened the form and doesn't change when you change to a new document. For example , I have an external rule for editing the title and stock number. It appears to be the same issue described on this post . How can i force the form to change what file it is linked to? I did try to update the rule to use
ThisApplication.ActiveDocument
or
ThisDoc.Path
but i get errors due to activeDocument or Patht not being a member of object i'm trying to reference. I did find some code when in an ilogic rule that does work. Just brining up the checkin dialog. Anyone have a form work around, or a change to the title & stock that will allow the form to change focus?
Code Snippet that works.
ThisApplication.ActiveDocument.Save ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(False)
Code that doesn't work.
'Inputing New Title & Stock Number' 'doc = ThisDoc.ModelDocument doc = ThisDoc.Document Dim MyTitle As String Dim MyStock As String If doc.DocumentType = kDrawingDocumentObject Then Goto Drawing 'Else If doc.DocumentType = kPartDocumentObject Then Else Goto Other End If Return Drawing: modelName = IO.Path.GetFileName(ThisDoc.ModelDocument.FullFileName) MyTitle = iProperties.Value(modelName, "Summary", "Title") MyStock = iProperties.Value(modelName, "Project", "Stock Number") MyTitle = InputBox("Enter New Title.", "Description Needs to be Changed!", MyTitle) MyStock = InputBox("Enter New Stock Number.", "Description Needs to be Changed!", MyStock) If MyTitle <> Nullstring iProperties.Value(modelName, "Summary", "Title") = MyTitle End If If MyStock <> Nullstring iProperties.Value(modelName, "Project", "Stock Number") = MyStock End If doc.Update() Goto Ending Other: MyTitle = iProperties.Value("Summary", "Title") MyStock = iProperties.Value("Project", "Stock Number") MyTitle = InputBox("Enter New Title.", "Description Needs to be Changed!", MyTitle) MyStock = InputBox("Enter New Stock Number.", "Description Needs to be Changed!", MyStock) If MyTitle <> Nullstring iProperties.Value("Summary", "Title") = MyTitle End If If MyStock <> Nullstring iProperties.Value("Project", "Stock Number") = MyStock End If Goto Ending Return Ending:Return ' 'update the file'ThisApplication.ActiveView.Update()'InventorVb.DocumentUpdate(modelName) InventorVb.DocumentUpdate() iLogicVb.UpdateWhenDone = True
Solved! Go to Solution.