+ All Categories
Home > Documents > When SmarTeam Basic Scripts Are Not Enough: VB.NET Scripting for ENOVIA SmarTeam Marc Young xLM...

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

Date post: 01-Apr-2015
Category:
Upload: alonzo-basil
View: 276 times
Download: 3 times
Share this document with a friend
Popular Tags:
25
When SmarTeam Basic Scripts Are Not Enough: VB.NET Scripting for ENOVIA SmarTeam Marc Young xLM Solutions, LLC.
Transcript
Page 1: When SmarTeam Basic Scripts Are Not Enough: VB.NET Scripting for ENOVIA SmarTeam Marc Young xLM Solutions, LLC.

When SmarTeam Basic Scripts Are Not Enough: VB.NET Scripting for ENOVIA SmarTeam

Marc YoungxLM Solutions, LLC.

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

OutlineOutline

• Scripting in SmarTeam• Why? What? How?• Myths vs. Facts

• SmarTeam Script Editor• Limitations• Example and Debugging

• Microsoft Visual Studio• Advantages• Example and Debugging

• ROI Analysis• Conclusions

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

Scripting in SmarTeamScripting in SmarTeam

Why?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

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

Scripting in SmarTeamScripting in SmarTeam

What?What?• Bulk Loading Tools• Custom Part Numbers• Workflow Assignments• Special Notifications• Special Reports• etc.

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

How?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.

Scripting in SmarTeamScripting in SmarTeam

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

““I do not want or need to customize the system”I do not want or need to customize the system”MythsMyths• Companies are hesitant to customize their SmarTeam

installations for fear of• Problems with upgrades (compatibility issues)• Increased complexity• System becomes unsupported

FactsFacts• 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

ChallengeChallenge• To balance customization versus out-of-the-box functionalities

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

SmarTeam Script EditorSmarTeam 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

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

Script Editor LimitationsScript 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

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

Microsoft Visual Studio & MSDNMicrosoft Visual Studio & MSDN

Visual Studio EditionsVisual 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*)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*)

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

Advantages of Visual Studio & .NET FrameworkAdvantages 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 DevelopmentSmarTeam 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

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

Visual Studio ExampleVisual Studio Example

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

Configuring the Project EnvironmentConfiguring 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)

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

Tips for Creating a Windows CustomizationTips 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

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

VB.NET COM Class TemplateVB.NET COM Class Template

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

Project ReferencesProject References

• Both Projects• SmarTeam.Std.Interop.SmarTeam.SmApplic• SmarTeam.Std.Interop.SmarTeam.SmRecList

• Server Side Script DLL• SmarTeam.Std.Interop.SmarTeam.SmartServerHook• SmarTeam.Std.Interop.SmarTeam.SmartServerHookStd

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

Project ReferencesProject References

Tip: Change Copy Local and Specific Version to False• Makes it easier to

recompile on newer versions of SmarTeam.

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

Tips for Creating a Windows CustomizationTips for Creating a Windows Customization

Advanced TipAdvanced Tip• By default in VS2005, all classes in current project are

set toComVisible=True

• Recommendation:• Update the AssemblyInfo.vb (via the UI or direct editing) and

set ComVisible to false• Explicitly expose the desired classes

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

Visual Studio Example – Check For DuplicatesVisual 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>

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

ROI for a Simple Script ROI for a Simple Script

Can we justify the investment?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, …

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

ROI CalculatorROI Calculator

Script Cost 5,000.00$

Engineer Cost per Hour 62.50$ Engineer Time per Hour 0.17Script Savings per Day 10.42$

Number of Days in the year 200Number of Engineers 10

Script Saving per Engineer per Year 2,083.33$ Script Saving for All Engineers per Year 20,833.33$

Savings per Year 15,833.33$ ROI 316.67%

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

Script Implementation ConsiderationsScript 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

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

ConslusionConslusion

• 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)

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

Thank Thank You!You!

QuestiQuestionsons??

Marc YoungxLM Solutions, [email protected]

Script example shown is available at: http://www.xlmsolutions.com


Recommended