Surface Object

The Surface object is a very important object as it contains all the objects, properties and methods that describe the surfaces currently in the Maxsurf application. This includes all the properties available in the surfaces window in Maxsurf and methods for moving and altering control points and surfaces.

 

A summary of all the properties and methods of a Surface object are listed in the table below.

Property

Type

Description

Assembly

Long

Get the ID of the assembly this surface belongs to

Color

OLE_COLOR

Set/Get the Colour of the surface

ID

Long

Read Only. Returns the ID of the surface.

Index

Long

Read Only. Returns the Index of the surface

Locked

Boolean

Set/Get if the surface is locked for modification

LongitudinalStiffness

Long

Set/Get the Surfaces Longitudinal Stiffness

Material

Long

Set/Get the surface material

Name

String

Set/Get the descriptive name for a surface

SkinDirection

msSurfaceSkinDirection

Set/Get the surfaces skin direction

Split

Boolean

Set/Get if a surface is split in the body plan view

Symmetrical

Boolean

Set/Get if the surface is symmetrical about a Centreline Plane

Thickness

Double

Set/Get the surface thickness

Transparency

Long

Set/Get the percentage transparency for the surface

TransverseStiffness

Long

Set/Get the Transverse Stiffness of the Surface

Type

msSurfaceType

Set/Get the surface type

Use

msSurfaceUse

Set/Get the use of the surface (hull/internal)

Visible

Boolean

Set/Get if a surface is Visible

 

Method

Type

Description

ControlPointLimits

iRows As Long, iColumns As Long

Read Only. Returns the number of Rows and Columns in a surface.

Delete

-

Deletes a Surface

GetControlPoints

iRow As Long, iColumn As Long, xVal As Double, yVal As Double, zVal As Double

Gets the x,y,z coordinates for a control point, given the row and column indices

Move

X As Double,
Y As Double,
Z As Double

Moves a surface

Rotate

dRoll As Double, dPitch As Double, dYaw As Double, dLongCentre As Double, dTransCentre As Double, dVertCentre As Double

Rotates a Surface

SetControlPoint

iRow As Long, iColumn As Long, xVal As Double, yVal As Double, zVal As Double

Sets the x,y,z coordinates for a control point, given the row and column indices


OLE_COLOR

The OLE_COLOR data type represents a colour as a BGR (Blue, Green, Red) value. The OLE_COLOR value of a colour specified by its red, green and blue components (each of which has a value from 0 - 255) is determined using the following expression:

   OLE_COLOR value = red + (green x 256)  + (blue x 2562)

The OLE_COLOR values of some common colours are as follows:

          Black                0
          Dark Grey         4210752
          Grey                 8421504
          Light Grey         12632256
          White               16777215
          Red                   255
          Green               65280
          Blue                  16711680
          Magenta           16711935
          Cyan                 16776960

See Also:

Surface on page 22

Tutorial Part 1: A Basic Maxsurf Script on page 28

Surface Example

To determine the OLE_COLOR of the surface i, Use the Color property. This will return a value as described above.

    MsgBox msDesign.Surfaces(i).Color

 

Alternatively, we could set a cell colour in Excel to be the same as the surface colour in Maxsurf using the code;

  Range("E13").Interior.Color = msApp.Design.Surfaces(1).Color

 

To determine the number of Rows and Columns of Control Points in the ith surface;

    Dim NumRows As Long

    Dim NumCols As Long

   

    msDesign.Surfaces(i).ControlPointLimits NumRows, NumCols

    MsgBox "There are " & NumRows & " rows and " & NumCols & " columns"