
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have some code that I want to use for presentation images. Pretty straight forward, saves a jpg of a desired resolution to a folder that - at the moment is hard coded in to the rule.
Each time you run the rule, it overwrites the file made previously.. Which is the purpose of this post as I don't want to over write the files, I need to create unique names.
SO...I'd like to either have the system open a save as dialgoue type window and the user can then choose a folder and filename - OR - The code checks if a file of a name exists and if so postfix it with 'something'
I've been stuck with this for a little while now so any help will be very warmly received !!
Thanks all..
SyntaxEditor Code Snippet
'catch and skip errors On Error Resume Next 'define the active assembly Dim oAssyDoc As AssemblyDocument oAssyDoc = ThisApplication.ActiveDocument 'Check all referenced docs Dim oDoc As Inventor.Document For Each oDoc In oAssyDoc.AllReferencedDocuments 'set work plane visibility For Each oWorkPlane In oDoc.ComponentDefinition.WorkPlanes oWorkPlane.Visible = False Next 'set work axis visibility For Each oWorkAxis In oDoc.ComponentDefinition.WorkAxes oWorkAxis.Visible = False Next 'set work point visibility For Each oWorkPoint In oDoc.ComponentDefinition.WorkPoints oWorkPoint.Visible = False Next Next 'update the files InventorVb.DocumentUpdate() 'Change Scheme to Presentation ThisApplication.ColorSchemes("Presentation").Activate ' Get the active view. Dim oView As View oView = ThisApplication.ActiveView oFolder = Left(oPath, InStrRev(oPath, "C:\temp\temp.jpg")) & "C:\temp\temp.jpg" ' Save the view as a jpg file. Call oView.SaveAsBitmap(oFolder, 6000, 0)
Solved! Go to Solution.