全球FlexSim系统仿真中文论坛

标题: 如何实现一个发生器产生三种形状不同的产品 [打印本页]

作者: 小妤学仿真    时间: 2022-11-24 15:43
标题: 如何实现一个发生器产生三种形状不同的产品
产生三种产品的形状不相同应该怎么实现

作者: 小赵同学    时间: 2022-11-25 09:08
可以使用setobjectshapeindex()语句实现
作者: 小妤学仿真    时间: 2022-11-25 21:28
小赵同学 发表于 2022-11-25 09:08
可以使用setobjectshapeindex()语句实现

这个括号里的格式怎么写
作者: zorsite    时间: 2022-11-26 11:45
触发中有现成的代码,稍微修改一下就可以用。
[attach]6011[/attach]

  1. /**Change 3D Shape*/
  2. Array shapename=["fs3d\\General\\Box.3ds","fs3d\\General\\Cylinder.3ds","fs3d\\General\\Sphere.3ds"];
  3. Array size=[[0.61,0.61,0.3],[0.7,0.7,0.8],[0.5,0.5,0.5]];
  4. double theindex = duniform(1,3);

  5. //Get the size of the item
  6. double x = size[theindex][1];
  7. double y = size[theindex][2];
  8. double z = size[theindex][3];

  9. //Change 3D Shape
  10. sets(shape(item),shapename[theindex]);
  11. setobjectshapeindex(item,theindex);

  12. //Update the item size
  13. applyshapefactors(item);
  14. setsize(item, x, y, z);

  15. //Set item Type and color
  16. item.Type=theindex;
  17. item.color=Color.byNumber(theindex);
复制代码





欢迎光临 全球FlexSim系统仿真中文论坛 (http://www.flexsimasia.com/) Powered by Discuz! X3.3