- 积分
- 8
- 注册时间
- 2010-7-6
- 仿真币
-
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2011-9-27 19:13:35
|
显示全部楼层
来自 浙江杭州
本帖最后由 hylovegj 于 2011-9-27 21:22 编辑
Guys,I think I have solved the problem of updating the offset of beam elements,all you need to do is to use the "Insert Java Statements"parsing tool to create a method(in other programming languages it is called function) to calculate the offset,and then use the "Insert Calculation"parsing tool to call the method.The source code of the method is as follows,- float offset(String section)
- {
- int H,W,t;
- float area,static_moment;
- String[] size = section.split("[\\D]+");
- H = Integer.parseInt(size[1]);
- W = Integer.parseInt(size[2]);
- t = Integer.parseInt(size[3]);
- area = (H-t)*t + W*t;
- static_moment = (float) ((H-t)*t*(H-t)/2.0 + W*t*(H-t/2.0));
- return static_moment/area;
- }
复制代码 In the method,I use the beam section specification,for example,"L125*80*8",as the input parameter.In the method body,first we extract the substrings standing for the sizes of the beam section,they are,as with the previous example,"125","80"and"8";then we transform the numerical substrings to their corresponding numerical values,that is,125,80 and 8;at last we calculate the offset and return it.
Please pay attension to the use of regular expresion and forced type conversion. |
|