GHS Port Reference Center
Information for maritime designers, engineers and builders
Maintained by Creative Systems, Inc., Creators of GHS
Click here for information about GHS and other fine marine software.
Go to Main page

Example run file using Templates for common commands.
    if not exist master then write (macros) temp.mac
    macro t
     save temp.old
     clear variables
     screen nohead
     screen max
     report off
     page 1
    /
    if not exist master then .t | clear macros
    
    variable (string) prj,rpfile,t
    variable draft1:0:999, draft2:0:99, draftN:0:99, nvcg:0:99
    
    set prj="HSPROP"
    
    macro readgf
     template t "Note"
      "No geometry file has been read."
      "Do you want to locate and Read one now?"
      "Yes" "No" exit
     //
     if "{gf}"="" then .t | if {templok}=0 then exit
     template t1 "Geometry file"
      "Read" file t /ext:"gf" /exist
     //
     .t1
     if {templok}=0 then exit
     clear
     read {t}
     me
    /
    
    macro save
     report off
     save {prj}.sav
    /
    
    macro units
     if {LUNIT}="FEET" then set t = "LT" else set t = "MT"
     template t "Select Units"
      "English":"LT" "Metric":"MT" t
     //
     .t
     units {t}
    /
    
    macro ghs
     vcg {nvcg}
     cls
     ghs {draft1} {draft2} ... {draftN}
    /
    
    macro cc
     vcg {nvcg}
     cls
     cc {draft1} {draft2} ... {draftN}
    /
    
    macro view
     view
    /
    
    macro preview
     print /preview
    /
    
    macro report
     report {rpfile} /box
    /
    
    macro newrep
     template t "Select Geometry File"
      file rpfile /ext:"pf"
     //
     .t
     if {templok}=0 then exit
     report off
     page 1
     .report
    /
    
    template dialog "Hydrostatic Properties & Cross Curves Wizard"
     "Read Geometry"          .readgf
     "Change Units"           .units
     "First draft"   draft1 | "{lunit}"
     "Second draft"  draft2 | "{lunit}"
     "Last draft"    draftN | "{lunit}"
     "Nominal VCG"   nvcg   | "{lunit}"
     "Hydrostatic Properties" .ghs
     "Cross Curves"           .cc
     "View Report"            .view
     "Print Preview"          .preview
     "New Report"             .newrep
    /
    
    macro dodialog
     me
     .report
     macro esc
      exit dialog
     //
     .dialog
     macro esc
     //
     report off
     if {templok}=0 then exit
     .save
    /
    
    macro init
     set rpfile="{prj}"
     set draft1=1.0, draft2=1.5, draftN=8.0
     set nvcg=0.0
    /
    
    mac esc
     if fexist "{prj}.sav" then erase "{prj}.sav"
     .init
    /
    
    if fexist "{prj}.sav" then run "{prj}.sav" /call else .init
    
    mac esc
    /
    
    if "{gf}"="" then .readgf
    if "{gf}"<>"" then .dodialog
    
    if exist master then end
    
    clear macros
    clear variables
    run temp.old /call
    template t "Note"
     "Original condition restored."
    /
    .t
    macro t
    /
    run temp.mac /call
    erase temp.mac
    erase temp.old
    scr head
    
    

Add a free link to your site
Copyright © , Creative Systems, Inc.