Hi,
is there any solution for automatic Zoom all drawing before save it?
I need this because thumbnails in explorer.
I found this code for rule:
ThisApplication.ActiveView.Fit
It works fine, but there is problem with Event Trigger - I use Before save document, but doesn't work. It zooms all, but i think after saving, because thumbnail is not zoomed.
Thanks for help!
'ZOOM IN
ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomallCmd").Execute
iLogicVb.UpdateWhenDone=True
It works same as my first solution (it zooms, but after saving document, so thumbnail is not zoom all picture).
Instead of using
iLogicVb.UpdateWhenDone=True
Try
Call InventorVb.DocumentUpdate
to force the document to update immediately rather than at the end of the rule.
This thread hasn't continued but I can't find a solution to the same problem (Inventor 2024). The thumbnail doesn't update corectly. The .Fit() or .Item("AppZoomallCmd").Execute always happen after the save even though they should run Before Save Document. The thumbnail is not centered and when I open the file, it is zoome to the place it was before the fit occurred.
I have a rule that is run by another rule with a trigger Before Save Document.
Also funnilty enough, if I have a message box pop up in the end of the rule, the Fit or Zoom doesn't happen at all.
ThisDoc.Document.SetThumbnailSaveOption(ThumbnailSaveOptionEnum.kActiveWindowOnSave) 'Neither don't work 'ThisApplication.ActiveView.Fit() ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomallCmd").Execute InventorVb.DocumentUpdate() MessageBox.Show("If this message box is here, the Fit/Zoom isn't working at all")
Is this giving you the result you want?
Dim oCam As Camera = ThisApplication.ActiveView.Camera
oCam.Fit()
oCam.ApplyWithoutTransition()
It still wants to be set to before save event trigger.
@_dscholtes_,
I believe using the "ThisDoc" iCadDoc will reference the document which is calling the rule, but if that document is not open there there probably is not an active view. It would either do nothing or throw an error.
I think you would need to open/activate the document you wish for this to run on. Something like this would probably do it [untested]:
If Not ThisDoc Is ThisApplication.ActiveDocument 'is the calling document the active document?
If ThisDoc.Document.Open 'is the calling document open?
ThisDoc.Document.Activate()
'run the rule
Else
ThisApplication.Documents.Open(ThisDoc.PathAndFileName(True), True) 'Bool1 = include the extension | Bool2 = open visibly [i'm not sure if this would be necessary for the camera to be an object]
'run the rule
ThisDoc.Document.Close(False) 'Don't skip save
End If
Else
'run the rule as normal
End If
Can't find what you're looking for? Ask the community or share your knowledge.