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 > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 12-03-2007
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default Visualization of ASRSvehicle

Hi Everybody,

All I want to do is to have my own visualization of an ASRSvehicle.

I figured out that the visualization of an ASRSvechicle is the 3D Shape (corpus) and two yellow boxes and the platform. Where the platform (fork) is the main bit in my eyes.
I know that this is defined in the library in the ASRSvehicle under behaviour/cppfunctions/OnDraw.

All I want is to have my own visualization of the platform and I do not want to mess around in the library.

Normally what I would do is to use the Custom Draw Code and return 1 (do not show the library visualization) and draw my own box for the platform.
The problem is that I did not figure out where I can find the current Z location of the platform.

In the library in the OnDraw function curforkheight() is used, which seems to be parameter given to the function call. But it looks like this information is not stored anywhere or let me say I did not found where.

So my questions is, where is the current Z location of the platform (fork) stored?

Or how can I change the visualization of the ASRSvechicle platform without changing something in the library? So only make a change in the model.
How could I make my own OnDraw function?

I would appreciate any help and hint.

Thanks in advance
tom the (A)tom
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
  #2  
Old 12-03-2007
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

You should be able to call o(ASRSvehicle, current).curforkheight() in your draw trigger to get the current height (must be c++), although this is not a "supported" method of doing it. There isn't really any "supported" method for drawing a custom shape. Perhaps we should make it so that if you give the ASRSvehicle's shape frames, it will automatically draw frame1 at the fork location.
  #3  
Old 12-04-2007
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

Anthony,

I will try your suggestion later, but I do not like the idea to have C++ and need to compile just to draw my ASRSvehicle.

Would it not the simplest and easiest solution to put a node into the variables tree like ‘currentforkheight’. Than I could use this node in my draw code and I do not need to compile.

In my eyes some really important and useful information sometimes are not stored in nodes (current process time, current setup time, current fork height, assigned operator, traveled distance, etc.).
I know that we discussed about this subject in the past and some of these points are in the development request list.

I am just wondering if there are reasons not to have some more nodes in the variables tree.

Or is the questions more which information are really useful?
In my case with the ASRSvehicle I would think, if you need this information internal for functionality reasons this would be an information the user will also need.


I know, that I might be a little bit offtopic here, so sorry for that.

Take care
tom the (A)tom
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."
  #4  
Old 12-14-2007
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

Okay, with the help of Anthony (I really appreciate his effort) I/we found a solution for this task and I like to post the code here, that nobody hopefully in the future has to think about this again.

The Custom Draw Code of my ASRSvehicle is now:

/**TD: Draw platform and text*/
treenode current = ownerobject(c);
treenode view = parnode(1);
// CALCULATE CURRENT PLATFORM HEIGHT
// POINTER TO ASRS
treenode ASRS = current;
// LOCAL VARIABLES
double forkinitialheight = getvarnum(ASRS,"forkinitialheight");
double forkspeed = getvarnum(ASRS,"forkspeed");
double forkdestheight = getvarnum(ASRS,"forkdestheight");
double forkbegintime = getvarnum(ASRS,"forkbegintime");
double dCalculatedForkHeight = forkinitialheight;
double dCurrentForkHeight = dCalculatedForkHeight;
// IF FORK STARTS MOVING
if(forkbegintime != 0)
{
// IF DOWN MOVEMENT
if(forkdestheight >= forkinitialheight)
{
// CALCULATE CURRENT FORK HEIGHT
dCalculatedForkHeight = forkinitialheight + (time() - forkbegintime) * forkspeed;
// IF CALCULATED FORK HEIGHT IS UNDER FORK DEST HEIGHT THAN USE CALCULATED FORK HEIGHT ELSE USE FORK DEST HEIGHT
if(dCalculatedForkHeight < forkdestheight) dCurrentForkHeight = dCalculatedForkHeight; else dCurrentForkHeight = forkdestheight;
}
// IF UP MOVEMENT
if(forkdestheight < forkinitialheight)
{
// CALCULATE CURRENT FORK HEIGHT
dCalculatedForkHeight = forkinitialheight - (time() - forkbegintime) * forkspeed;
// IF CALCULATED FORK HEIGHT IS ABOVE FORK DEST HEIGHT THAN USE CALCULATED FORK HEIGHT ELSE USE FORK DEST HEIGHT
if(dCalculatedForkHeight >= forkdestheight) dCurrentForkHeight = dCalculatedForkHeight; else dCurrentForkHeight = forkdestheight;
}
}
// DRAW RELATIVE TO MODEL AND NOT TO CURRENT OBJECT
drawtomodelscale(current);
// DRAW PLATFORM
drawcube(0.06,-0.010,dCurrentForkHeight-0.10,xsize(current)-0.07,ysize(current)-0.02,zsize(current)/100,0,0,0,getcolorcomponent(current,1),getcolorcomponent(current,2),getcolorcomponent(current,3));
// DRAW CURRENT FORK HEIGHT
drawtext(view, concat("CurrentForkHeight: ",numtostring(dCurrentForkHeight,0,4)), 0, -2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0);
// RETURN ONE
return 1;

I managed now to keep the color of the fonts, but it still looses the tabs. But I guess, in this way the code is better readable even without tabs.

If there are any hints, suggestions or ideas how to improve the code, I will be happy to hear them. Thanks in advance.


Take care
tom the (A)tom
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."

Last edited by Anthony Johnson; 12-14-2007 at 10:32 AM.
The Following 2 Users Say Thank You to Tom David For This Useful Post:
zhang xin (09-07-2009)
  #5  
Old 09-07-2009
LINWEIXU
Guest
 
Posts: n/a
Downloads:
Uploads:
Default

hi,tom,i make a ASRSvehicle with your code ,i only use drawcube,
Attached Files
File Type: zip duiduoji.zip (976.7 KB, 242 views)



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.