Table of Contents

License & Copyright iii

Table of Contents. v

Nomenclature. 7

About this Manual 9

Chapter 1 Introduction. 11

Automation. 12

VBA. 12

VBA Compatibility. 13

Object Models. 13

Uses of Automation. 13

What can’t I automate?. 13

Speed. 14

Code Samples. 14

Early and Late Binding. 14

Initial Settings. 15

Object Browser 16

Further Reading. 17

The Maxsurf Object Model 19

Collections Objects and Lists. 19

Application Object 19

Design Object 20

Frame of Reference. 21

Grids. 21

Hydrostatics. 22

Surface. 22

Markers. 24

Preferences Object 25

Chapter 2 Getting Started. 27

Example of a Simple Macro. 27

Tutorial: Creating a Simple Hull Form.. 28

Tutorial Part 1: A Basic Maxsurf Script 28

Tutorial Part 2: Moving the Surface Control Points. 29

Tutorial Part 3: Creating a Grid. 30

Tutorial Part 4: Calculating the Hydrostatics. 31

Tutorial Part 5: Combining the Code Segments. 32

Chapter 3 Basic Maxsurf Automation. 35

Basic Operations. 36

Opening and Closing a Design. 36

Saving and Exporting Designs. 37

Screen Updating and Refresh. 37

Working With The Design. 39

Frame of Reference Object 39

Grids Object 40

Hydrostatics Object 40

Marker Object 43

Surface Object 44

Preferences and Units. 47

Units. 47

Precision. 47

Chapter 4 Advanced Maxsurf Automation. 49

Using Collections. 50

Collection Properties. 50

Collection Methods. 50

Using Lists. 51

Declaring Lists. 51

List Properties. 52

List Methods. 53

Chapter 5 User Interface. 55

Change Title. 55

Screen updating. 55

Refresh. 56

Trimming. 56

Preferences. 56

Chapter 6 Examples. 57

Modifying Grid Lines in Excel 58

Exercise 1 - Inserting Section Lines for Hydromax. 62

Creating a Systematic Series. 64

Exercise 2– Optimising Code for Faster Execution. 69

Exercise 3 – Placement of Containers in a Container Ship. 70

Blending Hull Forms. 71

Exercise 4 – Generic Code for Hull Blending. 73

Importing Markers into AutoCAD. 75

Importing Markers using Collections. 75

Importing Markers in an Array. 77

Importing Markers using Lists. 79

Creating a Chined Hull Vessel 81

Exercise 5 – Finding the Displacement and Immersion for the Chined Hull 83

Appendix A Object Model Summary. 84

Objects. 84

Enumerated Types. 84

Index. 87