NAPA Basic Programming

Discussion in 'Software' started by ELam, Mar 14, 2018.

  1. ELam
    Joined: Mar 2018
    Posts: 2
    Likes: 0, Points: 1
    Location: London

    ELam New Member

    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.
     
  2. TANSL
    Joined: Sep 2011
    Posts: 7,377
    Likes: 706, Points: 123, Legacy Rep: 300
    Location: Spain

    TANSL Senior Member

    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..
     
  3. ELam
    Joined: Mar 2018
    Posts: 2
    Likes: 0, Points: 1
    Location: London

    ELam New Member

    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')?
     
  4. TANSL
    Joined: Sep 2011
    Posts: 7,377
    Likes: 706, Points: 123, Legacy Rep: 300
    Location: Spain

    TANSL Senior Member

    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.
     
  5. rwatson
    Joined: Aug 2007
    Posts: 6,165
    Likes: 495, Points: 83, Legacy Rep: 1749
    Location: Tasmania,Australia

    rwatson Senior Member

    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'
     
  6. TANSL
    Joined: Sep 2011
    Posts: 7,377
    Likes: 706, Points: 123, Legacy Rep: 300
    Location: Spain

    TANSL Senior Member

    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.
     
  7. rwatson
    Joined: Aug 2007
    Posts: 6,165
    Likes: 495, Points: 83, Legacy Rep: 1749
    Location: Tasmania,Australia

    rwatson Senior Member

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

    Attached Files:

  8. TANSL
    Joined: Sep 2011
    Posts: 7,377
    Likes: 706, Points: 123, Legacy Rep: 300
    Location: Spain

    TANSL Senior Member

  9. Dr34m3r
    Joined: Mar 2012
    Posts: 161
    Likes: 4, Points: 18, Legacy Rep: 10
    Location: Europe

    Dr34m3r Senior Member


  10. Gotenz
    Joined: Dec 2018
    Posts: 2
    Likes: 0, Points: 1
    Location: Singapore

    Gotenz New Member

    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
     
Loading...
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 potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.