AnsweredAssumed Answered

How to create a PDF based off of a data card variable

Question asked by Tara Campese on Dec 8, 2014
Latest reply on Dec 9, 2014 by Tara Campese

I have a variable called "Cleaning Required" on the data card of all of my drawings.  When a specific macro is run by the user, that check box gets marked. Once any drawing is approved a PDF is created.  What I want is in addition to the currently generated PDF, I would like a second PDF generated based on if that "Cleaning Required" check box has a value of 1.  Ideally, I would just modify the secondary output path of the task add-in script to Save a second PDF with "-Cleaning" if the variable is present.  But I can't figure out how to check for the variable in this script. 

 

I tried changing the existing script to: (changes in bold)

 

‘Checks variable for cleaning

Function GetFileVariable(sVarName As String)
sVarVal = swModel.CustomInfo2("",“Cleaning Required”))
GetFileVariable = sVarVal

    If GetFileVariable = 0 then GoTo Here:

End Function

 

    If bSecondOutput = True Then

        convFileName2 = Replace(convFileName2, "<Filename>", modelFileName)

        convFileName2 = Replace(convFileName2, "<Extension>", modelExtension)

 

        convFilePath2 = Left(convFileName2, InStrRev(convFileName2, "\"))

        CreatePath convFilePath2

        convFileName2 = convFileName2 & ext

    End If

 

Sub main()

   

    Here:

    On Error GoTo Fail:

 

    Set FileSystemObj = CreateObject("Scripting.FileSystemObject")

    docFileName = "<Filepath>"

   

    ' Get SW interface object

    Set swApp = Application.SldWorks

    swApp.Visible = True    'SPR 682792, 538578, 651998

    Convert docFileName

   

    Exit Sub

 

I have looked through the forums and have not been able to find an answer to this question.  Solution S-052490 appears to be on the right track, but still not exactly what I need. Any help is appreciated.

 

Thank you,

Tara

 

PS I am running SW 2014 SP4.0 and Enterprise PDM 2014

Outcomes