General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

CONTENTS (part 6) - Transform

Hopefully by now all our readers know the basics of the CONTENTS command. In fact, after being the subject of 5 COWs already, you might question what else there is to learn. Keep reading for a nifty trick that might come in handy.

Surely our readers are familiar with UNITS SAVE and UNITS RESTORE. What if you need a way to temporarily change the contents of a tank and later restore the original setting?

One approach is to group the CONTENTS commands in a MACRO which can be easily executed at any time to restore the initial settings.

Alternatively, it is also possible to write macros to save and restore tank contents using system variables; but there is an even easier method.

Using the command:

CONTENTS (tanklist) *, density

transforms the cargo of the tanks in tanklist, while leaving the contents description and (notably) the weight for each tank unchanged.

Once you are finished with the alternate density, restore the value saved for each description from the CONTENTS /TABLE:

CONTENTS (tanklist) *

The beauty of this sequence is that it works even when the target tanks don't all carry the same cargo as demonstrated below.

Can you think of a practical application for this technique? Tune in to a future COW for the answer to this and other of life's most important questions.

Questions, comments, or requests?
Contact Creative Systems, Inc.

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

Click here for an index to this and previous COWs