Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Examples

  • Last UpdatedJan 07, 2026
  • 1 minute read

This example shows how to calculate the total weight of a hull block, and then just print out the sum.

Example:

import kcs_ui
import kcs_util
import kcs_dex


1

total_weight = 0.0
block = kcs_ui.string_req('Key in name of block')
if block[0] == kcs_util.ok():
     string = "HULL.BLOCK('" + block[1]\
           +"').PANEL(*).WEIGHT"
     kcs_dex.extract(string)
     type = kcs_dex.next_result()
     while type >= 0:
           if type == 2:
                 total_weight = total_weight\
                        +kcs_dex.get_real()
           type = kcs_dex.next_result()
     print"Total weight for block " + block[1] +  \
     " is: " + `total_weight` + " tons"

2
3


4
5
6
7


8


9

  1. Make data extraction statements available in the Vitesse program.

  2. Initialize sum variable.

  3. Ask user to key in name of hull block to calculate weight for.

    This command is further explained in User Interface.

  4. Build up the data extraction string.

  5. Do the actual data extraction.

  6. Check the outcome of the extraction command.

  7. Loop to pick up all the values from the data extraction result tree.

  8. Add the weight from this panel to the total sum.

  9. Simply print out the sum accompanied with a simple explanation.

TitleResults for “How to create a CRG?”Also Available in