hexagon logo

Scripts for model auto-generation

Hi Folks,
Here is part of my script for auto-generation of force in a model.
1-     variable create variable_name=n integer_value=1
2-     while condition=(n < (eval(total_roller_number+1)))
3-     force create direct general_force &
4-     general_force_name=.SRB.(eval("Roller_OR_Contact_"//n)) &
5-     adams_id=(eval(10000+n)) &
6-     i_marker_name=.SRB.(eval("Roller_"//n)).Roller_center &
7-     j_part_name=.SRB.OR &
8-     ref_marker_name=.SRB.ground.Ground&
9-     user_function = ({(eval(1000+n)), 2002, roller_r}) &
10-  routine = "contact::Gfosub"
11-  mdi graphic_force object=.SRB.(eval("Roller_OR_Contact_"//n)) type=1
12-  group modify group=SELECT_LIST object=.SRB.(eval("Roller_OR_Contact_"//n))
13-  variable modify variable_name=n integer_value=(eval(n+1))
14-  end
15-  variable delete variable_name=n
Variable ”n” changes from 1 to “total_roller_number” via a “while” loop in line 2 and creates a general force under the name “Roller_OR_Contact”. The assigned Adams id would be “10000+n” as indicated in line 5. I need to have an “if” condition for adams id. The condition is if the variable “slice_flag” is equal to one, I would like to have adams id “10000+n”, otherwise adams id should be “11000+n”.
I have tried the following modification into line 65 but I get errors and the script cannot be compiled. Please advise.
The error is
ERROR: 'if' is not a valid parameter.
ERROR: The command was not executed.
ERROR: +1&> if cond=(slice_flag==1)
 
******************************
!! the same as line 4 and before
if cond=( slice_flag ==1)
adams_id=(eval(10000+n)) &
else
adams_id=(eval(11000+n)) &
end
!!the same as line 6 and after
******************************