Presentation is loading. Please wait.

Presentation is loading. Please wait.

Marc Young xLM Solutions, LLC.

Similar presentations


Presentation on theme: "Marc Young xLM Solutions, LLC."— Presentation transcript:

1 Marc Young xLM Solutions, LLC.
When SmarTeam Basic Scripts Are Not Enough: VB.NET Scripting for ENOVIA SmarTeam Marc Young xLM Solutions, LLC.

2 Outline Scripting in SmarTeam SmarTeam Script Editor
Why? What? How? Myths vs. Facts SmarTeam Script Editor Limitations Example and Debugging Microsoft Visual Studio Advantages ROI Analysis Conclusions

3 Scripting in SmarTeam Why?
Some processes are tedious to carry out in SmarTeam Manual processing is prone to mistakes Out-of-the-box functionalities do not meet business needs and requirements Integrate with other applications and business systems To demonstrate some “cool” stuff and features

4 Scripting in SmarTeam What? Bulk Loading Tools Custom Part Numbers
Workflow Assignments Special Notifications Special Reports etc.

5 Scripting in SmarTeam How? SmarTeam has provided a robust API
Can be developed in different programming languages (VB, VB.Net, C#, C++, ASP.NET) Different Development Suites – Script Editor, Visual Studio Documentation SDK - API Reference Guide, Samples Server-Side_Hooks_for_Server-Based_Applications.pdf Many SmarTeam tools and functionalities are implemented using this API Community Workspace PLM DB Tools Search and Link Create Folders Upload Documents Display Drawing from Items etc.

6 “I do not want or need to customize the system”
Myths Companies are hesitant to customize their SmarTeam installations for fear of Problems with upgrades (compatibility issues) Increased complexity System becomes unsupported Facts Majority of SmarTeam customers have implemented customizations APIs are largely compatible across versions e.g., SmarTeam V5R12 scripts function properly in V5R20 Properly constructed scripts are easy to deploy and maintain Scripts may be disabled to aid in troubleshooting and diagnostics Scripts allow customers to harness the power of SmarTeam to develop and deploy optimized solutions for their enterprise PLM needs Challenge To balance customization versus out-of-the-box functionalities

7 SmarTeam Script Editor
Default SmarTeam “Macro” language tool Based on Visual Basic 4.0 (> 15 years old) A third party tool from Summit Software (www.summsoft.com) Suitable for developing simple SmarTeam customization scripts Easy to deploy—put scripts in the shared SmarTeam script directory: C:\Program Files\SMARTEAM\ConfigurationSettings\Data\Domain\smarteam.std.legacyPreferences.config.xml <Directory_Structure.ScriptDirectory>\\ServerName\StScripts</Directory_Structure.ScriptDirectory> Script Editor Review

8 Script Editor Limitations
Inherent libraries and functions Based on VB 4.0 released in 1995 Split function String manipulation Lists and complex data types etc. GUI features and functionalities Debugging support Poor Formatting Indentation and case correction Example: Check for Duplicate

9 Microsoft Visual Studio & MSDN
Visual Studio Editions 2005/2008 Team System 2005/2008 Professional 2005/2008 Standard 2005 Tools for Office 2008 Express (VB, C#, C++)—free 2010 Editions MSDN Subscription (Professional & Premium*) 10.9 TB and 13,000+ downloads Windows & Windows Servers Toolkits, language tools, SDKs, driver development kits All other server products* Microsoft Office products* Technical support incidents (2 or 4*)

10 Advantages of Visual Studio & .NET Framework
Programming languages include the easy-to-use Visual Basic and more structured languages like C++ and C# True object-oriented programming languages Rich GUI and user experiences (e.g., IntelliSense) Integrated local and remote debugging capabilities with static code analysis improve code quality and reliability Vast amount of resources and examples available on the web Integrated web development and testing environment Microsoft .NET Framework provides a large collection of classes and services that allows you to work more efficiently SmarTeam Script/UDT Development SmarTeam is currently a .NET 2.0 application .NET 2.0 is the minimum supported runtime for UDTs Visual Studio 2005 and 2008 can target the .NET 2.0 environment

11 Visual Studio Example

12 Configuring the Project Environment
SmarTeam Primary “Interop” Assemblies (PIA’s) e.g., SmApplic, SmRecList, SmUtil Copy assemblies from the Global Assembly Cache (GAC) to a local folder to make referencing easier (Optional) Add the local folder to Visual Studio’s reference search path (HKLM\Software\Microsoft\.NETFramework\AssemblyFolders on 32 bit windows)

13 Tips for Creating a Windows Customization
As SmarTeam’s scripting engine is COM-based, the user-defined library must also expose a COM interface VB.NET provides a template for COM classes C# is a bit more involved but allows for finer control on what happens The sample code provided has the ComVisible behavior switched from the default. This is not necessary but keeps things more elegant/clean to COM. In small projects, it is not an issue, but I have had larger projects have issues when exposing everything to COM.

14 VB.NET COM Class Template

15

16 Project References Both Projects Server Side Script DLL
SmarTeam.Std.Interop.SmarTeam.SmApplic SmarTeam.Std.Interop.SmarTeam.SmRecList Server Side Script DLL SmarTeam.Std.Interop.SmarTeam.SmartServerHook SmarTeam.Std.Interop.SmarTeam.SmartServerHookStd

17 Project References Tip: Change Copy Local and Specific Version to False Makes it easier to recompile on newer versions of SmarTeam.

18 Tips for Creating a Windows Customization
Advanced Tip By default in VS2005, all classes in current project are set to ComVisible=True Recommendation: Update the AssemblyInfo.vb (via the UI or direct editing) and set ComVisible to false Explicitly expose the desired classes The sample code provided has the ComVisible behavior switched from the default. This is not necessary but keeps things more elegant/clean to COM. In small projects, it is not an issue, but I have had larger projects have issues when exposing everything to COM.

19

20 Visual Studio Example – Check For Duplicates
For a thick client, call the user defined .NET DLL from the script: Dim oDll As Object Set oDll = CreateObject("CheckForDuplicate.SmarTeamInterface") Dim retcode As Integer retcode = oDll.checkForDuplicate(SmSession,FirstRec,ThirdRec) For Web Editor (Server-Side) Script, enter the following configuration setting: High level (simplest, and shown in the current example) <ServerHooks.Init>ServerSideScripts.ServerSideDuplicates</ServerHooks.Init> Low Level (more involved) <ServerHooks.CLSID>{82F7EBD2-61D9-4CEB-8FD8-535EF32DEB2C}</ServerHooks.CLSID>

21 ROI for a Simple Script Can we justify the investment?
Script development cost = $ What are the time and cost savings of an automation solution versus developing a script? 10 engineers Engineer cost per hour = $62.50 10 minutes saving per engineer per day 200 days in the year Savings per engineer per day ($62.5 x 1/6) = $10.42 Savings per engineer per year ($10.42 x 200) = $2,083.33 Saving for 10 engineers per year = $20,833.33 ROI in year 1 = $15, or a % return Expand this to year 2, 3, 4, 5, …

22 ROI Calculator

23 Script Implementation Considerations
Should you implement a script? Are users repeatedly making the same mistakes? Are certain processes tedious? See “Scripting in SmarTeam: Why?” Define the functional criteria for the script Define test cases Build an environment for testing To ensure script will not adversely affect production Maintain detailed script description and instructions on how to hook into SmarTeam Request source code or insure a way for maintaining the script

24 Conslusion Scripting is a powerful and economical approach to expand and customize SmarTeam for enterprise PLM needs Tools are readily available SmarTeam Script Editor (included) Microsoft Visual Studio (free versions available) The cost savings and ROI can be tremendous (even for a 10-min process)

25 Script example shown is available at: http://www.xlmsolutions.com
Thank You! Questions? Script example shown is available at: Marc Young xLM Solutions, LLC.


Download ppt "Marc Young xLM Solutions, LLC."

Similar presentations


Ads by Google