Posted Fri, 13 Jun 2014 15:48:04 GMT by Debora Janos
Hello,

I'm working on a simple plug-in that will allow me to export data in a .plt file for tecplot. I succeded so far, however I would like to be able to choose which property to export. Is there a way I can implement a user input stream to the ifm? Such as cin in c++?

thanks,

Debora
Posted Mon, 16 Jun 2014 15:07:05 GMT by adacovsk
I'm not sure if there's an IFM function that has a textbox prompt, but what I've done as a workaround is import a .txt file representing my user input and store it in vectors pre-simulation...

I'd also like to know if this is possible.

Adam
Posted Wed, 16 Jul 2014 13:52:56 GMT by Carlos Andres Rivera Villarreyes Global Product Specialist - FEFLOW
Hi Debora and Adam,

You can take all the advantage of the graphical interface of the IFM plug-in. Below a small example to create two input boxes. You can reach this by right-click on the name of attached plug-in and then choose [b]Edit [/b] option.

[color=blue][i]static IfmPropExtInt aux= { 2, 50};

IfmProperty props[] = {
{ "Param1", IfmPROP_DOUBLE, &par1, &DefaultParam1, "Write value of Parameter 1", &aux },
{ "Param2", IfmPROP_DOUBLE, &par2, &DefaultParam2, "Write value of Parameter 2", &aux },
}

IfmEditProperties (pDoc, "Properties of IFM Plugin", "My parameters: ", props, 2); // last number is amount of parameters.
[/i][/color]

The best place of the code is on [b]OnEditDocument[/b]. Don't forget to declare the default values (&DefaultParam1) and the variables for the parameter itself (&par1).

More sophisticated manners are using fully Qt stuff (i.e. design your own *.ui file).

Cheers,

Carlos
Posted Tue, 16 Sep 2014 16:07:04 GMT by Denim Umeshkumar Anajwala
Hi.

Thanks a lot, this is exactly what I was looking for. I modified a little the code to read string variables (input2) and store them outside the OnEditDocument callback for later use in another callback

[color=blue]// Callbacks
/* Global variables to store data from OnEditDocument callback and use them later */
double global_input_1;  
char* global_input_2;

void CPlug_In1::OnEditDocument (IfmDocument pDoc, Widget wParent)
{
double input1 = global_input_1; // User input variable 1 initialization: DOUBLE TYPE
char* input2= global_input_2 ; // User input variable 2 initialization STRING TYPE

IfmProperty props[] = {
{"Parameter 1 (double)", IfmPROP_DOUBLE, &input1 ,NULL, "This field captures a DOUBLE  variable" },
{"Parameter 2 (string)",IfmPROP_STRING, &input2, NULL, "This field (and only) captures a STRING variable" },
};

IfmEditProperties (pDoc, "Properties of Parameters 1 & 2 in User Plugin", "My parameters: ", props, 2); // Last number is amount of input values.

global_input_1 = input1; // Taking the values from variables in this callback to
global_input_2 = input2; // use them in another callback
}[/color]

You must be signed in to post in this forum.