全球FlexSim系统仿真中文论坛

搜索
查看: 762|回复: 3
打印 上一主题 下一主题

如何实现一个发生器产生三种形状不同的产品

[复制链接]
跳转到指定楼层
1#
小妤学仿真 发表于 2022-11-24 15:43:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
产生三种产品的形状不相同应该怎么实现
2#
小赵同学 发表于 2022-11-25 09:08:50 | 只看该作者
可以使用setobjectshapeindex()语句实现
3#
 楼主| 小妤学仿真 发表于 2022-11-25 21:28:56 | 只看该作者
小赵同学 发表于 2022-11-25 09:08
可以使用setobjectshapeindex()语句实现

这个括号里的格式怎么写
4#
zorsite 发表于 2022-11-26 11:45:31 | 只看该作者
触发中有现成的代码,稍微修改一下就可以用。


  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);
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|全球FlexSim系统仿真中文论坛 ( 京ICP备14043114号-2 )

GMT+8, 2024-5-26 00:49 , Processed in 0.074719 second(s), 14 queries .

Powered by Discuz! X3.3© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表