General HydroStatics
Ship Stability Software |
Command of the Week
(New or interesting aspects of GHS that you may not know about) |
GF VARIABLES
|
The Part Maker documentation mentions that variables are "placed in the Geometry File header ... so when read by GHS the variables will be stored in the GF module."
Chances are this is news to most GHS users. In other words, when Part Maker writes a Geometry File, it includes variable names and their values. Thereafter, whenever that Geometry File is read by the GHS main program, those variables show up in the GF module. What is the GF module? Keep reading. Part Maker works fine without native variables. If you want to make use of variables in Part Maker, then regular variable references can appear in the Part-Maker portion of your run file as well as anywhere else. So why is this a COW issue at all? Part Maker offers extensive support for automating geometry creation. If you get into this, you will soon be using PMX (Part Maker extended ) and a different kind of variable native to Part Maker. These are the variables that get written into the GF in order that their values can be accessed in the main program if desired. Here is a brief example using regular main-program variables to calculate the length of a hold to be created: |
variable MidBodyLen=100 variable HoldLen set HoldLen={MidBodyLen} div 2 variable x1f, x1a set x1f=20 set x1a={x1f} plus {HoldLen} ENTER PM READ ASHIP.GF CREATE AHOLD1.C ENDS {x1f}, {x1a} FIT HULL / WRITE ASHIP2.GF QUIT PM |
Compare that with Part Maker's native style of variable arithmetic: |
ENTER PMX READ ASHIP.GF real MidBodyLen:=100 real HoldLen:=MidBodyLen/2 real x1f:=20 CREATE AHOLD1X.C ENDS x1f, x1f+HoldLen FIT HULL / WRITE ASHIP2.GF QUIT PM |
Back in the main program environment, the variables defined in the PMX
environment and stored in the Geometry File can be accessed.
For example,
variable HoldLen={GF.HoldLen}(Since the purpose of this is to communicate from Part Maker to the main program, the Geometry File does not normally bring them back into Part Maker.) If while in the main program environment it is desired to dump all variables residing in the GF module out onto a run file, the following bit of code within your run file will do it. |
RUN /CALL:GF WRITE (VARIABLES) MyPMvars.rf RUN /CALL |
If you know of a good use for this—variables being transmitted from Part Maker to the main program—let us know what it is. |
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 |