This chapter presents a number of example VBA-scripts to show what you can do with Maxsurf automation. The first three examples show the use of various objects, properties and methods of the Maxsurf Object Model, such as editing grid lines, performing parametric transformations and moving control points.
The fourth example shows how automation can be optimised using list objects instead of collections, to import marker data into AutoCAD. The final example also uses list objects to edit surfaces in a chined hull vessel.
§ Modifying Grid Lines in Excel
Grids
§ Creating a Systematic Series
Performing parametric transformations, hydrostatic calculations and file handling through Excel to create a series of hull forms with systematically varying parameters.
Moving Control Points and performing parametric transformations to create a hull, blended from two other hull forms.
§ Importing Markers into AutoCAD
Moving marker points from Maxsurf to AutoCAD using three different methods; through a collection, through an array and through a list.
§ Creating a Chined Hull Vessel
Altering the size and shape of a simple chined hull according to parameters specified in an Excel sheet. The Example could be used as an effective starting point for designs.
Note
Exercises:
Some examples also contain exercises to show other uses of Automation. The exercises are designed to build on the example file, by extending its uses or altering the file to another use. These exercises have not been worked through for this manual, but all are possible. The exercises are:
§ Exercise 1 - Inserting Section Lines for Hydromax
§ Exercise 2– Optimising Code for Faster Execution
§ Exercise 3 – Placement of Containers in a Container Ship
§ Exercise 4 – Generic Code for Hull Blending
§ Exercise 5 – Finding the Displacement and Immersion for the Chined Hull