Hide Table of Contents

Standard Task Add-in

You can write your own task add-in using SolidWorks Enterprise PDM API's methods and interfaces. Doing so gives you full control over what the task should do.

However, if you simply want a task to open files in SolidWorks and run VBScripts on them, then you can reuse the standard task add-in shipped with SolidWorks Enterprise PDM.

The standard task add-in provides two tasks:

  • Printing files using SolidWorks.
  • Converting SolidWorks files to other file formats.

Additionally you can modify the standard task add-in to execute any script.

  1. Make sure that the add-in, SWTaskAddIn, is installed in the vault.
  2. Start the Administration tool, right-click Tasks in the tree, and select New Task.
  3. Select the SWTaskAddIn add-in in the first page of the dialog box.
  4. Go to the Script page and edit the code in the main function.
    The Insert Macro button makes it possible to insert macros that will be replaced with data from SolidWorks Enterprise PDM when the script is executed.
    Read more about macros in the following section.
  5. Set all other tasks settings, such as computer on which to execute, notifications, etc.

Macros

The macros in the Insert Macro menu work inconsistently. Keep in mind:

Menu Option

Macro

Note

Source File Name

<Filename>

This option is added as the literal string "<Filename>" to the script. The script has to scan for the string and replace it with the real file name.

Source File Extension

<Extension>

This option works like <Filename> in the sense that the macro is not resolved.

Configuration Name

<Configuration>

This option works like <Filename> in the sense that the macro is not resolved.

Source Folder Path

<Path>

This macro will be replaced with the file system path to the parent folder of the source file. Add double quotes around "<Path>" to use it as a string. Example: C:\MyVault\Drawings\

Vault Root Folder Path

<VaultPath>

Resolves to the root folder of the vault. For instance: C:\MyVault\

Task Instance GUID

<TaskInstanceGuid>

A GUID (Globally Unique Identifier) that identifies the task instance.

Source File Path

<Filepath>

Resolves to the full path to the source file. Example: C:\MyVault\Drawings\Part.sldprt

You can create an input card using the card editor to provide a user interface when the task is launched. The data entered in the card can then be used in the script. Refer to a card variable value in the script by enclosing it with { }, for example {Description}, to insert a value from variable, Description.

It is a good idea to have a look at the scripts for printing and converting, which are shipped with SolidWorks Enterprise PDM, for hints on how to write scripts. The SolidWorks Enterprise PDM Help contains additional information about the Administration tool and using the standard task add-in.

See Also

Task Add-in Sample

 



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Standard Task Add-in
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2014 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.