OnSave

OnSave

Anonymous
Not applicable
409 Views
1 Reply
Message 1 of 2

OnSave

Anonymous
Not applicable

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

0 Likes
410 Views
1 Reply
Reply (1)
Message 2 of 2

philippe.leefsma
Alumni
Alumni

Hi There,

 

You would use "FileUIEvents.OnFileSaveAsDialog" for that purpose.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes