Rules and Standards

CAA V5 Automation Code Presentation Rules

Presentation conventions to improve the readability of Automation code
Technical Article

Abstract

This article presents how to program scripts using Dassault Systèmes V5 product lines scripting capabilities as regards code layout. 


General Considerations

As Dassault Systèmes V5 product lines currently officially support VBScript 5.x and BasicScript 2.25, this document targets scripts developped using those languages. It does not cover all topics needed to develop a complex application using for example Visual Basic but most of the rules still apply to this kind of application.

As a general rule, unless overridden by the present document, apply Microsoft (R) VBScript Coding Convention Rules.

[Top]


Layout

[l1] A copyright is mandatory for scripts to be delivered within any Dassault Systèmes product.

[l2] A global header is mandatory, it must contain:

Purpose Description of what this sample does  
Assumptions List of external elements impacting the behavior of this files,  state of the session, selected objects  
Author For customer provided scripts, empty for samples delivered within a Dassault Systèmes product  
Languages Supported development languages VBScript, BasicScript, VBA and/or VB
CATIA Level Original CATIA version. 
Available interfaces can change from one version to the other
ex: V5R4, V5R5, ...
Locale Macros recorded or written for a specific locale may not work for another one. Use language names described in the interactive product documentation. As of V5R5: English, French, German, Japanese, Czech, Polish, Russian, Korean or Simplified Chinese

[l3] Indentation should be 4 spaces

[l4] Comment important variables on the same line

[l5] Prefer the ' syntax to the REM keyword for comments

[l6] Align comments concerning a nested block with its indentation 

[l7] A header for each internal function or procedure containing purpose, description of parameters and return values.

[l8] Keep lines length shorter than 80 characters

[Top]


Naming Conventions

[n1] method names are to be verbs or verb phrases, in mixed case with the first letter of any word capitalized:


Sub DoItBetter()
  ...
End Sub

[n2] variable names are to begin with a lowercase letter describing its type, if you don't have to use your own prefix system (as for example Microsoft's VBScript Coding Conventions), the following minimal prefixes are mandatory:
b boolean bIsUpToDate
d double dLength
s string sName
i int iNumberOfElements
o objects

oSketch1

 

[n3] constants names should be a sequences of one or more words, acronyms, or abbreviations, in uppercase letters, with components separated by underscore "_" characters:


 MAX_VALUE.

[Top]


Example

[Top]


History
Version: 1.0 [Sep 2000] Document created

[Top]


Copyright © 2000, Dassault Systèmes. All rights reserved.