Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save As PDF Macro with Custom Properties

Status
Not open for further replies.

Jterry85

Mechanical
Sep 28, 2010
9
Hello,

I'm looking for a Save As PDF Macro that's a little different from the ones I've found.

Here's what I'm looking for:

- Ability to save multiple open drawings as PDF files
- Save in original folder as drawing files
- Automatically name pdf file the name of drawing file AND name it the current revision (ex: saving "Connecting_Bar.slddrw" which happens to be REV2 in the custom part properties to "Connecting_Bar-Rev2.PDF"

I'm using solidworks 08

Below is the macro code I currently use:



Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2

Sub main()

Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc

Dim FilePath As String
Dim PathSize As Long
Dim PathNoExtension As String
Dim NewFilePath As String

FilePath = Part.GetPathName
PathSize = Strings.Len(FilePath)
PathNoExtension = Strings.Left(FilePath, PathSize - 6)
NewFilePath = PathNoExtension & "pdf"

Part.SaveAs2 NewFilePath, 0, True, fale


End Sub



Anyone have a macro like this?



 
Replies continue below

Recommended for you

Bummer..Guess I'll stick with renaming each file for the time being.

Thank you all for your efforts.
 
There are other macros out there that propagate custom properties from models to drawings... you could run one of those and then run the pdf macro.

-Dustin
Professional Engineer
Pretty good with SolidWorks
 
Just have funny, Dustin. :)

The Rev will pull from the drawing only. If you are using the part or assembly rev on the drawing, there's no way to get the macro to pick that up by referring to the custom property directly. You'll need to traverse the drawing to find the desired part or assy, then pull the values directly from that selected file.

Matt Lorono
Lorono's SolidWorks Resources & SolidWorks Legion

http://groups.yahoo.com/group/solidworks & http://twitter.com/fcsuper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor