I want to change the Frame of a 3D model with the process flow, FlexSim 2019

I want to change the Frame of a 3D model with the process flow, FlexSim 2019

rawel51550
Community Visitor Community Visitor
119 Views
2 Replies
Message 1 of 3

I want to change the Frame of a 3D model with the process flow, FlexSim 2019

rawel51550
Community Visitor
Community Visitor

Hi everyone, i'm trying to change the frame of a 3D model and i use process flow, but it doesn't work. I recive a number from my backend and i put it in a global table, then i take it from the table to the function (Send message), and then i send it to the Model 3D;
this is the code of the send message:

 

Object current = ownerobject(c);
Object item = param(1);
int rownumber = param(2); //row number of the schedule/sequence table
 
{ // ************* PickOption Start ************* //
 
 
int NoDelay = -1;
Variant tableID="StatiVigneto";
Variant row = 1;
Variant col = 1;
Table table;
switch (tableID.type){
case VAR_TYPE_NODE: table=tableID; break;
case VAR_TYPE_STRING: table=Table(tableID.as(string));break;
default:
table = reftable(tableID.as(int));
break;
}
double delaytime = /** \nDelay Time: *//***tag:delaytime*//**/0/**list:NoDelay~0~10~current.messageDelay*/;
treenode toobject = /** \nTo: *//***tag:to*//**/Model.find("Shape62")/**/;
treenode fromobject = /** \nFrom: *//***tag:from*//**/current/**/;
double param1 = /** \nParam1: *//***tag:par1*//**/ (table[row][col])  /**/;
double param2 = /** \nParam2: *//***tag:par2*//**/0/**/;
double param3 = /** \nParam3: *//***tag:par3*//**/0/**/;
/**\n\nDelay Time:\nNoDelay: message sent immediately within trigger context\n0: delayed message sent in 0 time*/
if (/** \nCondition: *//***tag:condition*//**/true/**/) {
if (delaytime == NoDelay)
sendmessage(toobject,fromobject,param1,param2,param3);
 
else 
senddelayedmessage(toobject, max(0,delaytime), fromobject,param1,param2,param3);
}
 
}

 

0 Likes
120 Views
2 Replies
Replies (2)
Message 2 of 3

moehlmann_fe
Enthusiast
Enthusiast

You say that you use Process Flow but the code header is from the source's On Creation trigger (?)

The code you posted has mismatched braces (three "}" but only one "{") which should lead to a compile error. Currently the noDelay, table, row and column variables are all not defined in the bottom part of the code since the scope in which they exist ends with the first right brace.

 

All you really need code-wise is the following to send the message.

sendmessage(Model.find("Shape62"), current, Table("StatiVigneto")[1][1]);

And this in a code snippet in the On Message trigger to change the frame.

setframe(current, msgparam1);

 

0 Likes
Message 3 of 3

rawel51550
Community Visitor
Community Visitor

At the end i used a token to take it from the http request and set it on the send message code:

 

Get the value from the http request:

Token token = param(3);

//Other code

.....

Variant risultato = gets(result);
token.stato = stringtonum(risultato);

 

Set the token for the send message:

Object current = param(1);
treenode activity = param(2);
Token token = param(3);

//Other code

....
double param1 = /** \nParam1: *//***tag:par1*//**/(token.stato)/**/;

0 Likes