When Smar Team Basic Scripts Are Not Enough
When Smar. Team Basic Scripts Are Not Enough: VB. NET Scripting for ENOVIA Smar. Team Marc Young x. LM Solutions, LLC.
Outline • Scripting in Smar. Team • Why? What? How? • Myths vs. Facts • Smar. Team Script Editor • Limitations • Example and Debugging • Microsoft Visual Studio • Advantages • Example and Debugging • ROI Analysis • Conclusions
Scripting in Smar. Team Why? • Some processes are tedious to carry out in Smar. Team • 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
Scripting in Smar. Team What? • Bulk Loading Tools • Custom Part Numbers • Workflow Assignments • Special Notifications • Special Reports • etc.
Scripting in Smar. Team How? • • Smar. Team 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 Smar. Team 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.
“I do not want or need to customize the system” Myths • Companies are hesitant to customize their Smar. Team installations for fear of • Problems with upgrades (compatibility issues) • Increased complexity • System becomes unsupported Facts • Majority of Smar. Team customers have implemented customizations • APIs are largely compatible across versions • e. g. , Smar. Team V 5 R 12 scripts function properly in V 5 R 20 • 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 Smar. Team to develop and deploy optimized solutions for their enterprise PLM needs Challenge • To balance customization versus out-of-the-box functionalities
Smar. Team Script Editor • Default Smar. Team “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 Smar. Team customization scripts • Easy to deploy—put scripts in the shared Smar. Team script directory: C: Program FilesSMARTEAMConfiguration. SettingsDataDomainsmarteam. std. legacy. Prefe rences. config. xml <Directory_Structure. Script. Directory>\Server. NameSt. Scripts</Directory_Structure. Script. Directory> • Script Editor Review
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
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*)
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. , Intelli. Sense) • 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 Smar. Team Script/UDT Development • Smar. Team 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
Visual Studio Example
Configuring the Project Environment • Smar. Team Primary “Interop” Assemblies (PIA’s) • e. g. , Sm. Applic, Sm. Rec. List, Sm. Util • 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 (HKLMSoftwareMicrosoft. NETFrameworkAssembly. Folders on 32 bit windows)
Tips for Creating a Windows Customization • As Smar. Team’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
VB. NET COM Class Template
Project References • Both Projects • Smar. Team. Std. Interop. Smar. Team. Sm. Applic • Smar. Team. Std. Interop. Smar. Team. Sm. Rec. List • Server Side Script DLL • Smar. Team. Std. Interop. Smar. Team. Smart. Server. Hook. Std
Project References Tip: Change Copy Local and Specific Version to False • Makes it easier to recompile on newer versions of Smar. Team.
Tips for Creating a Windows Customization Advanced Tip • By default in VS 2005, all classes in current project are set to Com. Visible=True • Recommendation: • Update the Assembly. Info. vb (via the UI or direct editing) and set Com. Visible to false • Explicitly expose the desired classes
Visual Studio Example – Check For Duplicates • For a thick client, call the user defined. NET DLL from the script: • Dim o. Dll As Object • Set o. Dll = Create. Object("Check. For. Duplicate. Smar. Team. Interface") • Dim retcode As Integer • retcode = o. Dll. check. For. Duplicate(Sm. Session, First. Rec, Third. Rec) • For Web Editor (Server-Side) Script, enter the following configuration setting: • High level (simplest, and shown in the current example) • <Server. Hooks. Init>Server. Side. Scripts. Server. Side. Duplicates</Server Hooks. Init> • Low Level (more involved) • <Server. Hooks. CLSID>{82 F 7 EBD 2 -61 D 9 -4 CEB-8 FD 8 - 535 EF 32 DEB 2 C}</Server. Hooks. CLSID>
ROI for a Simple Script Can we justify the investment? • Script development cost = $5000. 00 • 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, 833. 33 or a 316. 67% return • Expand this to year 2, 3, 4, 5, …
ROI Calculator
Script Implementation Considerations • Should you implement a script? • Are users repeatedly making the same mistakes? • Are certain processes tedious? • See “Scripting in Smar. Team: 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 Smar. Team • Request source code or insure a way for maintaining the script
Conslusion • Scripting is a powerful and economical approach to expand customize Smar. Team for enterprise PLM needs • Tools are readily available • Smar. Team Script Editor (included) • Microsoft Visual Studio (free versions available) • The cost savings and ROI can be tremendous (even for a 10 -min process)
Thank Questions You! ? Script example shown is available at: http: //www. xlmsolutions. com Marc Young x. LM Solutions, LLC. 248 -926 -5932 myoung@xlmsolutions. com
- Slides: 25