Surface Plots:
The following macro is used to generate four plots of the models. The macro is used for vessel modeling because it is a good idea to periodically take a look at what you have created during the work in progress and of course you will want to look at your final product.
$ $********************************************* plot macro $ &MACRO SUPLOT NAMES &SELEC :N -SEL %NAMES &IF %DEMO &THEN &DEVICE -PRIMARY SCREEN &SUBTITLE %SUBT PICTURE ISO &PICT ISO -CAT :N &LOCAL DUM = &GET(YES/NO ) &IF &STRING(MATCH %DUM% YES) &THEN &ENDIF &SUBTITLE %SUBT PICTURE TOP &PICT TOP &LOCAL DUM = &GET(YES/NO ) &IF &STRING(MATCH %DUM% YES) &THEN &ENDIF &SUBTITLE %SUBT PICTURE BOW &PICT BOW &LOCAL DUM = &GET(YES/NO ) &IF &STRING(MATCH %DUM% YES) &THEN &ENDIF &SUBTITLE %SUBT PICTURE STARB &PICT STARB &LOCAL DUM = &GET(YES/NO ) &IF &STRING(MATCH %DUM% YES) &THEN &ENDIF &ELSE &DEVICE -PRIMARY DEVICE &SUBTITLE %SUBT PICTURE ISO &PICT ISO -CAT :N &SUBTITLE %SUBT PICTURE TOP &PICT TOP &SUBTITLE %SUBT PICTURE BOW &PICT BOW &SUBTITLE %SUBT PICTURE STARB &PICT STARB &ENDIF &ENDMACROThe beginning of the macro is marked by the command &MACRO and the end is marked by &ENDMACRO. The macro name is SUPLOT and it requires at least one entry for the argument 'names'. The first entry of the macro is to create a selector for the 'names' argument. The option -CAT on the first occurrence of &PICT restricts the plotting to the blocks selected and stored in the selector :N. Notice that for the remaining &PICT commands, this option is not needed since it remains on effect until it is modified. %SUBT% returns anything previously stored in the variable SUBT. The test &IF, &ELSE, &ENDIF, based on the value of the variable %DEMO is used so that if the file is to be run in the background with no user interaction, then the graphics are printed in a file, and if the user wants to look at the progress of his work, the graphics are redirected to the screen. The final component of the macro is the use of the string function &GET(YES/NO ...). This is useful to stop the program at each picture occurrence. Hitting the RETURN key is enough to continue the run.
Generating Columns:
This macro is used in three of the vessel modeling samples, files tlp_bld.cif, spar.cif and ssub.cif.
$ $********************************************* macro for columns $ &MACRO COLUMN CN X Y -NPOINT POI NP = 9 \ -HEIGHT HEI HEIGHT \ -DIAMETER DI DIA BLOCK %CN -LOCATION %X %Y 00 0 -90 &SET ANGI = &NUMBER( REAL 180/(%NP%-1) ) PLANE 0 %HEIGHT% -CIRC 0 0 %DIA%/2 0 %ANGI% %NP END &ENDMACRO &M_ACT COLUMN BLOCKThis macro generates a column. The required data for the macro COLUMN are CN, X, and Y. CN is the name of the block and X and Y are the location of the cylinder coordinate system. The column coordinate system will always be at Z = 0. The option -NPOINT is used for the number of points around the circle. If this option is not used, the default of 9 points in 180 degrees will be used. The option -HEIGHT specifies the distance between the ends of the column. The last option -DIAMETER is used to specify the diameter of the column. That concludes the data needed as input.
The data is used to make a column. A building block, named CN, is created and located in the global coordinate system. This is done with the command and option BLOCK with the option -LOCATION. This command also enters us into the Block menu. In order to create a circle we need to tell the program the starting point, which increment to take around the circle, and how many increments to take. All this information is used with the -CIRC option. The first value after -CIRC is the Y starting point, the second value is the Z starting point, the third value is the radius of the circle, the fourth value is the angle to start, the fifth value is the increment angle, the last value is number of points to make in a half circle. The variable ANGI takes care of finding the increment between the points. Here we have set the variable to a string function &NUMBER(REAL ...). This sets the variable ANGI to the result of the arithmetic after the word real and the last close parenthesis. Please notice that we have subtracted 1 from the number of points. This we like to refer to as the fence and post problem. If you are putting up a fence with 9 posts you will have 8 spaces. So in order to get 9 evenly spaced points in a half circle we need a total of 8 spaces. All of this is used in the PLANE command. The PLANE command makes two planes for the column. After building the block the Block menu is exited with END.
The command &M_ACT tells the program to accept the new command COLUMN wherever it accepts the native program command BLOCK.
Emitting a Mesh:
The following commands generate a data file which can later be used by MOSES for hydrostatic or hydrodynamic analyses. The files generated will have a suffix ppo. The commands discussed here were taken from the jackup sample.
$********************************************* rename $ RENAME JACKUP -EQUIV .1 $ $********************************************* emit $ EMIT JACKUP -PART EMIT JACKUP -3DDIF -USE_NAME YES $ $********************************************* all done $ ENDThe command RENAME removes all other blocks except JACKUP. The option -EQUIV is used to reduce the number of points in the mesh model. In the above example all points that are within .1 units (feet or meters) of each other will be declared to be the same. The references to the deleted point are removed from all panels. This option is quite useful in removing small pieces of trash which results from combining blocks.
The EMIT command emits the mesh model. This command with the option -PART emits points only, and places the part name JACKUP in the file using the appropriate command syntax. The option -3DDIF option emits a diffraction mesh, complete with a piece description and compartment permeability. Panel names for a diffraction mesh will be generated with the flag YES on the option -USE_NAME.