GHS BULLETIN
PMX Features not shared by PM

(New features not covered in the standard PM documentation)




PMX is an "experimental" extended version of Part Maker which includes some features that are not currently available in the standard Part Maker program. It is being supplied to GHS users who are interested in using these "Part Maker eXtensions." These features are described below.


Syntax Note

The syntax rules in PMX are more stringent than in PM:

-Parameters must be separated by commas (extra spaces permitted).

-Defining commands must use the "=" between the command name and its parameters.

-A back slash ("\") must be the separator between part and component names.

-Only one command per line.


Conditional Blocks

Unlike GHS, PMX conditionals are in block form:

IF boolean expression THEN
    block of command lines
END

Optionally ELSIF and ELSE parts can be included in the block.

Conditional blocks can be nested.


Variables

REAL and STR variables may be defined as in PM. Additionally the CARD variable is for positive integers or "cardinal" numbers, and the BOOL variable holds TRUE/FALSE "boolean" values.

Variable names are case sensitive: X and x are two variables.

Variable arrays can be defined using the [] postfix. For example,

REAL X[20]

In this example, the 20 is the highest value that the array index can take. All arrays are zero based. So X[0] is the first element of the X array and X[20] is the last.

Variable arithmetic is available in PMX. The usual programming-language operators are employed, and groupings by parentheses are allowed.

SET can be omitted when assigning a value to a variable if the equal sign is prefixed with a colon. For example,

A:=1.0

is equivalent to

SET A=1.0

In variable definitions this syntax allows assigning a value (which may be an expression) in the same command where the variable is defined. For example,

REAL B:=2.0

When a variable is defined in this manner no error results if it has been defined previously.

Functions

Function names, like variable names, are case sensitive.

n:=CHARS(s) returns the number of characters in string s. For example,

STR s
s:="a string value"
CARD n
n:=CHARS(s)

s:=CHAR(n,t) returns the nth character in the string t.

s:=CHR(n) returns the character represented by the ASCII number in n.

n:=ASC(s) returns the ASCII value of the first character in s.

s:=LEFT(n,t) returns the first n characters in the string t.

s:=RIGHT(n,t) returns the last n characters in the string t.

s:=SLICE(n,t) returns the slice of the string in t from the nth character to the
end.

s:=STRIPBL(t) returns the string in t stripped of leading and trailing blanks.

b:=HASQUOTE(s) returns whether the string in s begins with a double quotation
mark, ignoring initial blanks.

s:=UNQUOTE(t) returns the contents string t without its enclosing
quotation marks, if any.

s:=CAP1(t) returns contents of t with its first character capitalized.

s:=CAP(t) returns contents of string t capitalized.

s:=STR(x) returns the string representation of the contents of x, which may
be of any type.

s:=ITEM(n,t) returns the nth item from the string t. Item separators include
blanks, commas, semicolons, colons, equal signs.

s:=REPLACE(t,u,v) returns t with all occurrences of u replaced by v.

x:=SIN(a) x:=COS(a) x:=TAN(a) return sine, cosine, tangent of radian angle a.

a:=ATAN(x) returns the arctangent in radians.

a:=RAD(d) returns the radian angle equivalent of an angle in degrees.

d:=DEG(a) returns the degree angle equivalent of an angle in radians.

x:=SQRT(y) returns the square root.

x:=ABS(y) returns the absolute value.

n:=HIGH(X) returns the maximum index of array X.

a:=INTEGRAL(i,x,y) returns the accumulated area to the ith point under
the curve represented by the x,y points beginning with i=0. The integration is 2nd order, not linear. For example,
a:=INTEGRAL(0, 0.0, 0.0) ` a is zero
a:=INTEGRAL(1, 1.0, 1.0) ` a is 0.5
a:=INTEGRAL(2, 2.0, 1.0) ` a is 1.58333

b:=COPY(fn1,fn2) copies file named in fn1 to name in fn2 and returns whether
successful.

b:=ERASE(fn) erases the file named in fn and returns whether successful.

b:=FEXIST(fn) returns whether the named file exists.

s:=PROGFILE(fn) returns the given string prepended with the path to the
program folder. Does not check to see whether such a file exists.

Predefined (System) Variables

Caution: it is possible to cover a system variable by defining your own variable by the same name, in which case the system variable will not be seen.

ERROR latest error string

HEREDIR path to the current working folder

INSTANCE program instance as a string

PAGE page number of the report

PRINTING whether a report is being generated

PROGDIR path to the program folder

SCREENROWS size of screen in terms of text rows, including header

SECONDS number of seconds since the session began

TEMPLOK template return number

VERSION program version number

WINDOWS whether running under the Windows operating system

LUNIT length unit

WUNIT weight unit

COMPONENT array of component names for current part

CONTAINER array of container (tank) names

DESCRIPTION of current part

DISPLACER array of displacer part names

NCOMPONENTS number of components in current part

NCONTAINERS number of containers

NDISPLACERS number of displacers

NPOINTS number of points on current station

NSAILS number of sail parts

NSTATIONS number of stations in current component

PARTS current part list

POINTC point code array

POINTX point transverse coordinate array

POINTY point vertical coordinate array

SAIL array of sail names

STATION current station location

ANGLES[i] angle i+1 in the angles list given by the ANGles command.

DEPTH origin depth

DISPLWT displacement weight

GFREAD path and filename of last geometry file read

HEEL heel angle in degrees

HMMT heeling moment

LCB longitudinal center of buoyancy

RAHABS absolute righting arm in heel (ignoring heeling moment)

TCB transverse center of buoyancy

TRIM trim angle in degrees

UNEMBED name of file in which file embedded in GF has been written

VCB vertical center of buoyancy


EDGE statement

Shapes can be defined by Edges, which are longitudinal line segments represented by their end points:
    EDGE l1,t1,v1, l2,t2,v2
The EDGE statements should occur in order such that a section cutting across the lines would have the intersection points occurring in a counter clockwise sequence. Up to 30 edge statements can be used in one shape creation.

For example,
    create hull\arm1.c
     edge -35, 7, 0,  -53, 3, 5
     edge -35, 7, 8,  -53, 3, 8
     spacing 0.5
    /


DISPLAY PRINT options

Several parameters affect the generation and presentation of the offsets table:
    DISPLAY [(part\component)] PRINT [/FILE:name] [/MARK[:SAVE][:NEW]] [/UNITS:code]
    [/FORMAT:LINES|SECTIONS]
/FILE allows for writing the offsets table as a text file.

/MARK causes line markings (deck edge, chines, etc.) to be automatically added to the geometry. If the SAVE subparameter is present, the geometry file is updated. If the NEW subparameter is present, any existing line markings are removed before the automatic marking is done.

/UNITS sets the units in which the offsets are to appear. This may be,

M - meters
CM - centimeters
MM - millimeters
FT - decimal feet
IN - decimal inches
FI - feet and decimal inches
FIE - feet inches and eighths
FIS - feet inches and sixteenths

/FORMAT specifies whether the offsets are to be organized as longitudinal lines or as sections.


CHOP command
    CHOP FWD|AFT, location
Removes all geometry in the model forward or aft of the given location.


RADIUS statement
    RADIUS [(n)] r
Used with rectangular-section shape definitions to radius a corner. For example,
    project MIDBODY
    enter pmx
    create hull\hull.c
     ends 0, 100
     top 10
     bot 0
     out 10
     radius 2
     spacing 2
    /
    display
    write midbody.gf
    quit pmx
The optional n indicates to which corner the radius is to be applied, going in the counter clockwise direction starting with the bottom right corner.


ROTATE statement
    ROTATE t, h, a
A shape definition made of Edges (either explicit or implicitly derived from Top, Bottom, etc. boxes) or shapes such as Cylinders, Elbows, and Spheres can be rotated about the trim axis, the heel axis, and the azimuth axis. The rotation turns around the origin unless a part Reference point has been assigned. For example,
    create hull\leg2.s
     spacing 1
     ends -5,5
     bot 0
     top 10
     in -5
     out 5
     rotate 0,0,45 `rotates 45 degrees in plan view
    /


ICE statement
  ICE side, top
Converts the component to a layer on its surface with the given thicknesses. For example,
    CREATE FOCSLICE.S
     SHAPE HULL\FOCSLE.C
     ICE 0.1, 0.2
    /
This creates a tank which would be loaded at 100% to represent the weight of the ice on the focsle.


$DISPLACERS and $SAILS keywords for PARTS list

The keywords $DISPLACERS (meaning all displacers) and $SAILS (meaning all sails) may be used when specifying the default PARTS list and in commands having part (list) parameter.


If you would like to see another bulletin created regarding a specific topic, please email Creative Systems, Inc. at support@ghsport.com.

Copyright (C) 2017 Creative Systems, Inc.