The majority of the time when I engage a new PLM 360 user, I get asked how to write the best script. My answer has always been, “The best script one that performs the desired action or task.” If I’m being humbly honest, I don’t feel I’m as good as some of our top developers and programmers at Autodesk – I see myself as just an average, avid scripter.
In my 4 years here at Autodesk, I have encountered many best practices from various scripters/coders that have done great things in PLM 360. Today, I want to share some of these Best Practices, which can be useful to both new and advanced users. Remember, this is not about writing the “best script”, but rather developing consistent, good habits.
Understanding Scripting in PLM 360:
- PLM 360 has server-side scripting that is powerful and versatile to perform tasks in response to certain events within a finite set and allocate timeframe.
- For Condition Scripts the set time to perform are 4 secs.
- For Validation and Action Scripts the set time to perform are 9 secs.
- The total time to run a chaining operation is 90 secs.
Best Practices:
- Start with the requirement
- Understand the Basic Types of Scripts and know how to trigger them properly
- Understand the Behaviors and Constraints
- Be cognizant of time out when chaining scripts through the use of functions calling other functions
- Be mindful of script(s) that will require more computation time as the number of records are created
2. Continue with Writing Scripts (Naming Convention)
- Use readable and simple naming convention and not abbreviate or acronyms
- Avoid using Identifiers that conflict with keywords in programming languages (javascript).
- Consider use of Prefix and Suffix separate by underscore to distinguish the workspace, number of revision, and relationship
- Provide a 1 liner to highlight and describe the script in Description Field
3. Finally Write and Maintain the Code
- Create a Header with: Purpose, Objective/Expected Result, and short setup description.
- Create a Footer: Author, Date of Original Creation; and Revision/Updates
- User Comments to mark for key areas or functions
- Create a cookie crumb trail by using comments next to code line when updates or modifications are made – R#
For posts from some of our seasoned scripters, coders, and developers check out: Just Ones & Zeros
- Trung Nguyen
Photo: Rachel Johnson
Comments
You can follow this conversation by subscribing to the comment feed for this post.