OnSave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all
Within my InventorAddin in vb.net we are trying to force users to a particular folder when they save 3D Parts, Drawings etc.
To this end I have (Witrh help from this forum) created this code. This 'SaveAs' form does indeed fire, but after the 'Inventor' own 'SaveAs' form window. Can we suppress 'Inventors' window or even change that so it points to our preferred location.?
If we do not do this we are goinf to have 3D Drawings in the Parts folder etc etc.
Any help, greatly appreciated
GW
PrivateSub applicationEvents_OnSaveDocument(DocumentObject As Inventor._Document, BeforeOrAfter As Inventor.EventTimingEnum, Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles applicationEvents.OnSaveDocument
If iApplication.ActiveEditDocument.FileSaveCounter = 0 Then
'Dim DocumentObject As Document = iApplication.ActiveEditDocument
'this file has never been saved before so start your code to save it
Using SFD AsNew System.Windows.Forms.SaveFileDialog
SFD.Title =
"This is the 3D CAD Parts folder location.."
SFD.InitialDirectory =
"c:\"
If DocumentObject.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
SFD.Filter =
"Part File (*.ipt) |*.ipt"
ElseIf DocumentObject.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
SFD.Filter =
"Assembly File (*.iam)|(*.iam)"
ElseIf DocumentObject.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
SFD.Filter =
"Drawing File (*.dwg) |*.dwg;(*.idw)|(*.idw)"
EndIf
If SFD.ShowDialog = Windows.Forms.DialogResult.OK Then
DocumentObject.FullFileName = SFD.FileName
DocumentObject.Save()
HandlingCode =
HandlingCodeEnum.kEventHandled
EndIf
EndUsing
EndIf
EndSub