task to save as jpeg all configs name with custom property

so im trying to add a task to my vault that exports a jpeg of each configuration in the file and name the jpeg using a configuration specific custom property (Partno).

i believe ive found the right chunk of code but im unsure of how to execute the get command to recieve the property and output it into the correct variable to be used.

<p>Function GetFullFileName(convFileName, conf, i, itemCount)</p><p>    ' Configuration name may include backslash. Remove it since otherwise saving will</p><p>    ' fail due a missing directory</p><p>    conf = Replace(conf, "\\", "")</p><p>    conf = Replace(conf, "/", "")</p><p>    </p><p>    finalFileName = Replace(convFileName, "<Configuration>", conf)</p><p>    </p><p>    ' If no configuration</p><p>    If finalFileName = convFileName And itemCount > 0 Then</p><p>        finalFileName = Left(convFileName, InStrRev(convFileName, ".") - 1) & "_" & i & Mid(convFileName, InStrRev(convFileName, "."))</p><p>    End If</p><p>    </p><p>    ' Remove illegal characters from filename</p><p>    finalFileName = Replace(finalFileName, "<", "")</p><p>    finalFileName = Replace(finalFileName, ">", "")</p><p>    finalFileName = Left(finalFileName, 2) + Replace(finalFileName, ":", "", 3) ' Don't start from begin since drive has :</p><p>    finalFileName = Replace(finalFileName, "*", "")</p><p>    finalFileName = Replace(finalFileName, "?", "")</p><p>    finalFileName = Replace(finalFileName, """", "")</p><p>    finalFileName = Replace(finalFileName, "|", "")</p><p>    </p><p>    GetFullFileName = finalFileName</p><p>End Function</p>
<p>GetFullFileName = finalFileName</p><p>End Function</p>

any help on where to go from here would be great.

thanks

SolidworksTask Scheduler
Answers 5
JS
JS 2017-11-09 Best Answer

ok here is an update i have found s-054527 which gives access to pdm variables.

this is set to use the @ tab variables

'Get the vault interface

Call LoginToVault

'Get Variable Value

Dim VarValue

VarValue = GetVariableValue(docFileName, "PartNumber", "@")

so how can i enter the config name in there so it runs on every config?

AJ
AJ 2017-11-15

Are you going to add the task as an action to some transition state in your workflow?

JS
JS 2017-11-15

yes that is the plan. it will be included in the release transition.

I had found that this is possible in #task but I couldn't figure out how to add that to the workflow.

AJ
AJ 2017-11-15

I have sent you some information in PM.

JS
JS 2017-11-22

so i have figured this out, and here is how.

first i tried to just dump the var value function into getfullfilename and that didnt work then i realised convfilename is not the same as docfilename so i added the requirement for a docfilename into getfullfilename, so it looks like this.

<p>Function GetFullFileName(convFileName, conf, i, itemCount, <span style="color: #3a0699;">docFileName)</span></p><p>    ' Configuration name may include backslash. Remove it since otherwise saving will</p><p>    ' fail due a missing directory</p><p>Dim VarValue</p><p>VarValue = GetVariableValue(docFileName, "PartNumber", conf)</p><p></p><p></p><p>    conf = VarValue</p><p>    conf = Replace(conf, "\", "")</p><p>    conf = Replace(conf, "/", "")</p><p></p><p>  finalFileName = Replace(convFileName, "<Configuration>", conf)</p><p></p><p>    ' If no configuration</p><p>    If finalFileName = convFileName And itemCount > 0 Then</p><p>        finalFileName = Left(convFileName, InStrRev(convFileName, ".") - 1) & "_" & i & Mid(convFileName, InStrRev(convFileName, "."))</p><p>    End If</p><p></p><p>    ' Remove illegal characters from filename</p><p>    finalFileName = Replace(finalFileName, "<", "")</p><p>    finalFileName = Replace(finalFileName, ">", "")</p><p>    finalFileName = Left(finalFileName, 2) + Replace(finalFileName, ":", "", 3) ' Don't start from begin since drive has :</p><p>    finalFileName = Replace(finalFileName, "*", "")</p><p>    finalFileName = Replace(finalFileName, "?", "")</p><p>    finalFileName = Replace(finalFileName, """", "")</p><p>    finalFileName = Replace(finalFileName, "|", "")</p><p></p><p>    GetFullFileName = finalFileName</p><p>End Function</p>

then you just need to find everylocation that getfullfilename is used and add docfilename like so

convFileNameTemp = GetFullFileName(convFileName, "All", 0, 0, docFileName)

thanks and good luck