Hi guys,
I've searched on the forum but I couldn't find exactly what I want. I worked a few months with SW now (was an Inventor user) and I love the macro-function.
I'm using an PDF-export macro for a while, but for now I needs a few things modified. So the macro should be modified because I want the revision value (custom property part) in de PDF document name.
What I want: "partname_Rev_A.pdf" (A=variable) when the part has an revision. If there is not an revision I want: "partname.pdf"
I've tried to modify the macro from Deepak ('Export Drawing as DXF_PDF (Revision).swp ------------- 12/15/14)
I got it working, but not without : _Rev_" Please help!
_______________________________________________________________________________________________________
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDrawModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim nErrors As Long
Dim nWarnings As Long
Dim Revision As String
Set swApp = Application.SldWorks
Set swDrawModel = swApp.ActiveDoc
If swDrawModel Is Nothing Then
MsgBox "There is no active drawing document"
Exit Sub
End If
If swDrawModel.GetType <> swDocDRAWING Then
MsgBox "Open a drawing first and then TRY again!"
Exit Sub
End If
Set swDraw = swDrawModel
Set swView = swDraw.GetFirstView
Set swView = swView.GetNextView
Set swModel = swView.ReferencedDocument
If swModel.GetPathName = "" Then
MsgBox "Insert a View first and then TRY again!"
Exit Sub
End If
Revision = swModel.GetCustomInfoValue("", "Revision")
If Revision = "" Then
Revision = ""
End If
Prop = ("Rev_")
If Revision = "" Then
Prop = ""
End If
swDraw.SaveAs3 Left(swDraw.GetPathName, InStrRev(swDraw.GetPathName, ".") - 1) & Prop & Revision & ".PDF", 0, 0
End Sub
SolidworksApi macros