Transcript Document

3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
1
Exploring the Power of EPDM
Tasks
Working with and Developing Tasks in
SolidWorks Enterprise PDM (EPDM)
By:
Marc Young
xLM Solutions
www.xlmsolutions.com
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
What is an EPDM Task
2
• Tasks are customizations that can be queued up and run on a separate computer / batch server
• Printing / PDF Generation
• Updating Files
• Checking file integrity
• The running of a task off loads the work to a server/computer so it does not take up time / resources
of the individual’s computer
• Out of the Box EPDM Tasks (involving SolidWorks files)
• Convert
• Print
• Check
• Customized tasks can be created to handle very specific requirements
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Sample Customized Tasks (1 / 2)
3
• Watermarking Files
• Writing to a variable on the Drawing
• Creating a temporary note on the drawing
• Using third party software i.e. Adobe Writer
• Batch Printing Other Files Types – AutoCAD, Office, Inventor, SolidEdge ….
• Publishing Data
• Upon Release of a file / converted files gets moved to a secure location
• SharePoint
• Windows Share
• Another EPDM Vault
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Sample Customized Task (2 / 2)
4
• Merging files
• Generating one large PDF of all drawings / documentation in a project
• Engineering Change information that combines EC meta data and the file(s) effected
• Generating Reports
• Adding Custom Headers and Footers to Documents
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Out of the Box EPDM Tasks
5
• There are out of the box tasks for EPDM
• Print
• Convert
• Check
• These tasks can be configured and
customized
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Configuring Out of the Box Task
6
• Assign the task name
• What Add-in to use
• Who will execute it as
• Should an input card be used
• Number of retries
• Minutes before failing
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Execution Method
7
• Determine where the task will run
• A computer needs to be designated
via the Task Host Configuration
• If multiple task hosts can be picked
• Right click on blueberry to set a
machine up as the task host
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Menu Command
8
• Display the menu command to
execute the task
• The task could also be executed via a
state transition
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Task Specific Info (1/2)
9
Specific info for the task
• Print Task
• Always use one specific printer
• Provide a list of Printers for the user
to pick
• Based on the printer on the sheet size
of the drawing
• Convert Task
• Convert Format
• Conversion Options
• Configuration Options
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Task Specific Info (2/2)
10
• Print
• Page Size
• Orientation
• Margins
• Header Info
• Footer Info
• Convert
• Map Variables
• Output paths
• Reference links
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Print Task - Files
11
• Determine what files to print
• Just the select file
• The select file and all of its references
i.e. children
• Determine to use as built or latest
• Where the log info will be written to
• Advanced Configurations (Macro that
performs this operation)
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Advanced Scripting Options
12
• This is the SolidWorks Macro that does the work
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Notification
13
• Who should notify when the task is
successful
• Who should notify when the task fails
• What he message should say….
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Adding Variable to Convert Task Output
14
1.
Open up the script via Advance
Scripting Options
2.
Declare a Vault Object Variable
3.
Add Functions
•
LogIntoVault
•
GetVariableValue
4.
Call Functions from main function
5.
Associated Variable Value to File
Name
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Declare Vault Object
15
Dim vault As Object
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Add Function - LoginToVault
16
Private Sub LoginToVault()
On Error GoTo ErrHand
Dim strTempVaultName As String
Dim strVaultName As String
strTempVaultName = "<VaultPath>"
i = Len(strTempVaultName)
j = InStrRev(strTempVaultName, "\")
strVaultName = Right(strTempVaultName, i - j)
Set vault = CreateObject("ConisioLib.EdmVault")
vault.LoginAuto strVaultName, 0
Exit Sub
ErrHand:
If Not vault Is Nothing Then
Dim errname As String
Dim errdesc As String
vault.GetErrorString Err.Number, errname, errdesc
Log
errdesc
) ("LoginToVault error" & vbCrLf & errname & vbCrLf &
Else
Log "Error creating file vault interface."
End If
End Sub
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Add Function - GetVariableValue
17
Private Function GetVariableValue(FilePath, VariableName, Configuration)
On Error GoTo ErrHand
Dim File As Object
'Get the interface of the file (and its parent folder)
Dim Folder As Object
Set File = vault.GetFileFromPath(FilePath, Folder)
'Obtain the variable interface
Dim pEnumVar As Object
Set pEnumVar = File.GetEnumeratorVariable
Dim Value As Variant
If pEnumVar.GetVar(VariableName, Configuration, Value) Then
GetVariableValue = Value
Else
GetVariableValue = ""
End If
Exit Function
ErrHand:
Dim ename As String
Dim edesc As String
vault.GetErrorString Err.Number, ename, edesc
Log "GetvariableValue
End Function
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Add Function – Call Functions
18
•
•
Find Function Convert(docFileName)
Add code below
• Specify the Variable Name and
Configuration
'Get the vault interface
Call LoginToVault
'Get Variable Value
Dim VarValue
VarValue = GetVariableValue(docFileName, "Number", "@")
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Add Function – Associate Variable Value To Name
19
•
•
Find Build destination filenames
section
Add code below where the filename is
being configured
convFileName = Replace(convFileName, "<VariableValue>", VarValue)
Updated Code
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
All aspects of the Task can be configured:
20
Customization of EPDM Tasks
•
Setup
• Configuration GUI Properties
• On close of the configuration window of the Task
•
Initialization
• RMB Menu / bring up a GUI
• On close of the Task Initiates
•
Execution
• The performing of the task
•
Task Details
•
The Details GUI of a the task
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Setting up your Environment
21
• Reference in the EPDM Library
• Set the import (simplify declarations) - Imports EdmLib
• Add the implements line - Imports EdmLib
• Write code for the two main add-In functions
• GetAddInfo – Information about the add-in
• OnCmd – Information about executing the Add-In Functions
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
OnTaskSetup
22
This controls the setup behavior of the custom task
1.
2.
Add a Control to your project
Create a sub for the OnTaskSetup
1.
2.
3.
3.
4.
Set where the control can run (menu / change state)
Menu command for the control
Associate GUI setup to task
Design the control
Set the Load Data and Store Data functions
1.
(you will need to create these functions)
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
OnTaskSetupButton
23
This controls what happens then user hits okay or cancel at the end of the
setup
• Per the entered values, save them to EPDM
• The task Properties object is used to store this information:
IEdmTaskProperties
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
OnTaskLaunch
24
This code executes on the client when the client initiates the task
• For instance, prompt the user to change the PDF Location
• This functions code will:
1.
Get selected files
1.
Store them in the task instance object
2.
Populate GUI based on info in Task Setup
3.
Show GUI
4.
If Cancel exit task
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
OnTaskLaunchButton
25
Controls what happens if a Data Card is presented and the user hits okay /
cancel
Not used in this example
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
OnTaskRun
26
The actual execution of the task
• The code will perform the following actions:
1.
Get selected files
1.
2.
Retrieve from the Task Instance Object
Do something with them (purpose of the task)
1.
2.
Create PDF for Excel Documents
Store info regarding the execution of the task
1.
3.
The Task Instance object can be used
Set the task status
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
OnTaskDetails
27
Allows the addition information / behavior present in the Detail information
of the Task
1.
Add a Control to your project
2.
Create a sub for the OnTaskDetails
3.
Design the control
4.
Set the Load Data and Store Data functions
1.
You will need to create these functions
2.
If can be read from the task instance object
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Best Practices for Running a Task
28
• Have a dedicated Task Host machine to run the task
• It should be powerful enough to run SolidWorks or any CAD that be used
• The EPDM (blueberry) must started and use must be logged into the task
host
• When the task runs a license of EPDM and SolidWorks will be taken
• Need to insure licenses will be available for the task host
• For Convert task it is recommend to set SolidWorks Visible to true
• swApp.Visible = True
• Clean up stuck (Cancelling) tasks via SQL
• UPDATE TaskInstances SET TaskStatus = 8 WHERE
TaskStatus = 6
• Make sure to control what files the task runs on when executed from a
transition
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
Conclusion
29
• Task can be a powerfully way to off load time / processor consuming tasks
• Many of common requests can be done with the out of the box task
• If the out of the box task, cannot handle it, the task can be programed to handle
almost any customer requirement
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014
30
Thank
You!
Questions?
Marc Young
xLM Solutions, LLC.
248-926-5932
[email protected]
Script example shown is available at: http://www.xlmsolutions.com
31
3DS.COM/SOLIDWORKS © Dassault Systèmes | Confidential Information | 7/21/2015 | ref.: 3DS_Document_2014