ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 08-15-2012
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default Rotating BasicTE

Attached is a sample model with some custom code in a BasicTE.

The code is mostly default code in the Begin/Update/Finish Offset triggers. The difference is a few lines in the Begin Offset code that determines the shortest angle to rotate to pickup the flowitem:

Code:
double mz = fmod(zrot(current),360);
double theta = radianstodegrees(atan2(y,x));
double rz = theta - mz;
while(rz > 180) rz -= 360;
while(rz < -180) rz += 360;
In addition to rotating one end to pick up an item, this BasicTE was built to show functionality for arms on both ends of the machine. It chooses which end of the machine to use based on the itemtype of the item.

To use the other end, the calculation just needs to add 180 degrees to mz in the code:

Code:
if(getitemtype(item) == 2)
	mz += 180;
Attached Thumbnails
Click image for larger version
Name:	basicte_rotation.jpg
Views:	152
Size:	14.0 KB
ID:	1902  
Attached Files
File Type: fsm basicte_rotation.fsm (33.6 KB, 159 views)

Last edited by Phil BoBo; 08-15-2012 at 03:47 PM.
The Following 7 Users Say Thank You to Phil BoBo For This Useful Post:
syseo (08-15-2012)


Thread Thread Starter Forum Replies Last Post
why the BasicTE can not move? LINWEIXU Q&A 0 08-14-2009 09:24 PM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.