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
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 07-02-2010
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 680
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default Questions about new drawsurrogate functions

I'm trying to create my own ASRS and I'm looking into the code of the current ASRS and I found a few new functions that are either not explained or very limited.

1. there is a eventfunction called "scalecomponents". When is this eventfunction triggered?
2. "setpickingdrawfocus". What does it exactly do? and how to use it? (same for getpickingdrawfocus)
3. "drawobjectpart" What does it exactly do? and how to use it?

Hope that somebody from Flexsim can help me out here!

Oh and I think those last 2 functions are not available for the DLL yet!

Steven

Last edited by Steven Hamoen; 07-02-2010 at 08:02 AM.
Reply With Quote
  #2  
Old 07-02-2010
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: 731
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

scalecomponents is only used on the ASRSvehicle (and maybe the Crane). They just implement these as nodefunctions to call when they want to resize the sub-components of the object when the user is dragging on sizers. The engine has no special meaning for "scalecomponents." It's just a nodefunction that the ASRS decided to put in eventfunctions.

setpickingdrawfocus() allows you to define what "pick type" subsequent draw commands will be applied to. When the user clicks/mouse-moves/hovers in the 3D/2D/tree view, the engine does an unrendered drawing pass to find out what is being clicked/moved/hovered. Use getpickingmode() in your draw trigger to figure out if the drawing pass is one of these "pick" passes. Then use setpickingdrawfocus() to define what you want subsequent draw commands to be associated with. You can do this, first off, to "dupe" the engine into selecting a different object than the one doing the drawing, or, more useful in my opinion, to define special "pick types" for certain drawn parts. You can use standard pick types like PICK_SIZERX, which would cause the subsequent drawn polygons to behave like the user is clicking on the red x-sizer, i.e. if the user clicks on that part and drags to the right, the x size of the object will increase. Or you can define your own pick types, and then in the object's OnClick() or OnMouseMove() or OnDrag(), use getpickingdrawfocus() to get information on what "focus" was picked, and then do different things based on that. The obvious application for this to me is implementing different drawn "handles" on a conveyor, where you can add sections, resize sections, rotate sections, etc. all from within the 3D view.

For setpickingdrawfocus()'s parameters, focus is the object that will be selected if you click/hover/etc., "what" is the pick type. For this parameter, it would usually either be 0 (meaning just the object itself), PICK_SIZERX, PICK_SIZERXNEG, PICK_SIZERY, ... or your own defined pick type (any positive number because negative numbers are the reserved types). Secondary focus is just an extra storage identifier so you can store an alternate object reference if needed and then get it with getpickingdrawfocus(). detectdrag defines how you want the engine to detect dragging operations with this item picked, i.e. should it only detect dragging along the object's z-axis, along the xy plane, etc. Then you get that information out in the OnDrag() with the draginfo() command.

drawobjectpart() is not part of the commandlist, so it's technically not "supported" yet, but it basically taps into the engine's standard mechanism for drawing object parts like sizers, red highlights, yellow highlights, etc.

If you're going to use getpickingdrawfocus(), make sure you're updated to 5.0.4. We slipped in the "pickedid" parameter so you need to include that parameter to be forward-compatible.
Reply With Quote
The Following User Says Thank You to Anthony Johnson For This Useful Post:
Steven Hamoen (07-05-2010)
  #3  
Old 07-02-2010
LINWEIXU
Guest
 
Posts: n/a
Downloads:
Uploads:
Default

hi anthony ,can you give us a small example?

Last edited by LINWEIXU; 07-03-2010 at 12:46 AM.
Reply With Quote
  #4  
Old 07-05-2010
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: 731
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

Look in the ASRSvehicle and Crane's draw and click code in the library
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
An example of using drawsurrogate to control transparency in Flexsim 5 Phil BoBo Tips and Tricks 12 01-24-2011 12:45 AM
Two questions that are raised David Chan Container Terminal (CT) Library 6 01-22-2010 09:23 AM
How to create probability functions in patient tracks? Lionel Lim FlexSim HC: Q&A 9 11-20-2009 03:29 PM
While functions Xavier Jackson Q&A 12 08-12-2008 01:32 PM
BasicFR Advanced Functions Cliff King Q&A 0 11-13-2007 08:02 PM


All times are GMT -6. The time now is 06:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.