DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to work with flags in scripts

Solved!
Go to solution

Hi all,

 

I'm trying to automate the process of evaluating data in Diadem View using flags. So far I can set the flags through script commands (chnflagset) , but after that I need to change to interactive mode to replace the flagged data by NoValues (Flags: Remove data points). Is there a way to call this command from within my script so that I don't need the user interaction?

 

Thanks,

Marcel

0 Kudos
Message 1 of 11
(7,691 Views)

Hi Marcel,

 

If I do a search in the DiaDem help, I find the following information:

 

Note To delete all flags of all the channels, use the ChnFlagDelAll command. To delete the flags of one channel, use the ChnFlagDel command. To delete or to set several flags in one channel, use the ChnFlagSet command.

 

Does this help?

 

Regards,

 

Bas van Dijke

AE, The Netherlands

 

 

0 Kudos
Message 2 of 11
(7,677 Views)

Bas,

 

Thank you for the suggestion, but unfortunately the commands you found are just to control the flags (set / remove) and they are not used to actually delete / replace the data itself.

The functionality is there to do it manually (or via interaction mode), but I would like to call deletion of graph portions directly from a script.

 

Thanks,

Marcel

0 Kudos
Message 3 of 11
(7,672 Views)

Hi Marcel,

 

I wonder if you really need flags.  How are you determining the X-axis region you want to delete?  If it's completely programmatically, then you don't need to set flags.  Instead, you can use the "ChnAreaDel()" command for one channel or the "DataBLDel()" command to delete a block of contiguous rows/values from multiple channels.

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 11
(7,664 Views)

Hi Brad,

 

I've thought about that, but it's a bit more complicated. . I'm setting the flags programmatically and after that I'm opening Diadem View with a pre-defined layout. This will show the user what actually was changed by the script. If he /she agrees with suggestions made, I want to proceed with the next step (deletion /interpolation). The reason for this is that I'm taking into account that my script will not cover all tasks / problems involved, so I want the user to interact if necessary (but only if necessary). Since I can not check if the flagged portions were actually deleted I have to trust that the user takes appropriate steps making sure the script doesn't crash later on.

 

Thanks,

Marcel

 

 

 

 

0 Kudos
Message 5 of 11
(7,656 Views)
Solution
Accepted by Marcel_

Hi Marcel,

 

I see, and now I fully understand what you're doing and why you need to automate flags and flag actions.  The functions to set and delete flags are documented, but we do not have any documented functions to fit, delete, or copy the flagged points.  These functions do exist, and are called when you interactively press the VIEW buttons.  There is a way to call them, but since it is not documented, that means that code you write today might not work in a later DIAdem version.  However, I do have code that works up to the latest version of DIAdem now available, 11.1 Beta1.  Feel free to email me at brad.turpin@ni.com to request these commands.

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 6 of 11
(7,629 Views)

Hi Brad,

 

I have similar problem where i want user to select the data band interactivly from view and then script should continue to work on that selected band of data.

 

I have a sine wave data i want user to select the portion of sine wave so that further processing can be done. Currently i am using DataBlDel() command and i have to hard code the start and end point of the required band after looking in the view panel manually. Can this process be automated with the help of script.

 

Regards

Gaurav Upneja

g.upneja@tatamotors.com

0 Kudos
Message 7 of 11
(6,559 Views)

Hi GDU,

 

Actually, I'd recommend that you stay with the approach to use the band cursors and avoid programming with flags.  The one place where flags are indispensible is when the user needs to highlight multiple X regions of the graph in one user session.  Otherwise they're more trouble than they're worth, and actually the programmatic use of flags is officially unsupported.

 

Are there any questions or problems you have with just grabbing the Cursor.X1 and Cursor.X2 properties from the band cursor and operating on the X region in between?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 8 of 11
(6,549 Views)

Working with Band cursor is Ok with me by grabbing the X1 & X2 position from the view. But how do i tell my program that the user is finished with band selection i.e. after setting the range on the band cursor how do i give signal to my program that the selection is done is there any getchar() function or sth that will tell my program to move on with these X1 & X2 values.

0 Kudos
Message 9 of 11
(6,542 Views)

Hi GDU,

 

Do you have a script running before the user is supposed to select a region of the X axis on the VIEW graph?  If so you should onsider using the InteractionOn() command.  Alternatively you could break your script into two scripts-- one for everything before the user selection and the other for everything after the user selection.  Then the user can manually nudge the second script to run by clicking on a custom icon or selecting a custom menu or one of the script shortcuts.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 10 of 11
(6,526 Views)