Previous Next        Current Page: NeXtMidas Training / Primitives / Lab 2 / Instructions
back
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
   + Overview   
   + Open, Process, Close   
   + Building   
   + The NeXtMidas API   
   + Lab 1   
   + Special Variables   
   - Lab 2   
      - Instructions   
      - Solution   
   + Lab 3*   
   + Files in a Primitive   
   + Lab 4   
   + Lab 5*   
   + Test Macros   
   + Lab 6   
   + Real Time Controls   
   + Lab 7   
   + Working with Messages   
   + Lab 8   
   + Primitive Restarts   
   + Introduction to DSP   
   + Lab 9   
WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Lab 2 (Part A):
    • Create a new primitive called primlab2.
    • The primitive will take in a single argument STR1 which will be a message string to print out.
    • It will then print out the value of the message (as an INFO message) in the open() method of the primitive.
      • open() should return FINISH.
      • You do not need a process() or a close().
    • Use UPDATE to update the command dictionary.
    • Use BUILD or BLD to build the primitive.
    • Once you are done, give it a try.
      nM> primlab2 "Hello World!"
      INFO: Hello World! [PRIMLAB2]
  • Lab 2 (Part B):
    • Modify the primitive you wrote in Part A so that it will print out the message as a warning if the /WARN switch is given.
    • Once you are done, give it a try.
      nM> primlab2 "Hello World!"
      INFO: Hello World! [PRIMLAB2]
      nM> primlab2/warn "Hello World!"
      WARN: Hello World! [PRIMLAB2]
  • Lab 2 (Part C):
    • Modify the primitive you wrote in Part B so that it will take in a keyword only parameter RESNAME.
      • Tip: Keyword only parameters are read the same way as any other parameter.
      • Tip: You will need to tell UPDATE that your primitive now takes in 1+ arguments.
    • Once the message has been printed put a copy of the message in a new result that matches the name given with RESNAME.
    • Once you are done, give it a try.
      nM> primlab2 "Hello" RESNAME=myres
      INFO: Hello [PRIMLAB2]
      nM> res myres
      5S: Hello
    • Now run it again, but with the message Hi. What happens?
      • Tip: Use the "untranslated" get method to get names of results parameters and not their value.
Don't Make This Mistake:
Caution sign When using the UPDATE command, make sure to include the = after specifying each parameter name. Example: STR1=, instead of STR1. Failure to include the = sign will result in the parameter not being recognized by NeXtMidas.

back