NAPA Basic Programming

ELam

New Member
Joined
Mar 14, 2018
Posts
2
Reaction score
0
Location
London
Hi, I'm learning NAPA Basic and am trying to write a simple if statement. For example, I want to check when the draught is less than 10m. How do I get the value of the draught in the current loading condition? I tried @IF T<10 ! TYPE OK. When I tried to run this, it tells me the variable is undefined. Any help would be appreciated.
 
The normal thing is that you have to declare the variables that you are going to use, declaring them as numerical values, integers, decimals, ... or as strings (texts). Perhaps your problem is that you have not declared the variable "T" yet or perhaps the program uses another variable name to store the value of the draft..
 
So how do I declare the variable to equal to the draught of the loading condition? In Excel VBA, it would be T = Range("A1").Value. Is there something equivalent in NAPA like, T = T('STABHULL')?
 
If you have to declare the variable, the NAPA manual, somewhere, will tell you how to do it. It will also tell you what variable the program uses to store each hydrostatic value.
Maybe, as you suggest, it's something as simple as "Dim T as shipdraught." The Manual will say it, sure.
 
file:///C:/Users/Owner/Downloads/1%20Intro%20to%20NAPA.pdf

IN that help file - a few examples

– TDWL design draught

Try something like :

Dim DDraftHull
let DDraftHull = 'TWDL'
 
This is probably the location of the file on your computer when you downloaded it. Could you provide us with a link to search it on the internet? Many thanks.

Ah yes, oops. I just googled NAPA Basic, but I'll attach the file. It's not very big or comprehensive.
 

Attachments

Hi, I'm learning NAPA Basic and am trying to write a simple if statement. For example, I want to check when the draught is less than 10m. How do I get the value of the draught in the current loading condition? I tried @IF T<10 ! TYPE OK. When I tried to run this, it tells me the variable is undefined. Any help would be appreciated.

Hi Elam,

Hope still not late to answer your question.
You can call draft in the loading condition by using ld.qnt function.
Please read more explanation under !exp ld.qnt

Here is the sample of the simple macro.
(Before run this macro, please make sure you call any defined loading condition in your project)

For example, get BALLAST_ARR

Then run the macro :)

@draught=ld.qnt('T')
@if @draught<10 then
!type OK
@else
!type Current draught is too big!
@endif
 
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making any potentially dangerous or financial decision, always employ and consult appropriate professionals. Your circumstances or experience may be different.

  • Back
    Top