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 07-23-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default Are there functions / keyboard shortcuts for controlling the Flexsim debugger?

Hi,

I am wondering if there are functions for controlling the Flexsim debugger, i.e. next line, step-into, continue and stop simulation clock. I would want to use these commands with the keyboard instead of having to press the buttons with the mouse. I tried to look at the debug() function, but did not get it working and I am not sure if that is the way it is supposed to be used anyhow.

I know how to create the keyboard shortcuts (see https://www.flexsim.com/community/fo...board+shortcut) if there are functions that can control the debug.

Anyone who knows if this can be done?

Thank you!

Kind regards,
Axel
  #2  
Old 07-23-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

To make it clearer I tried to use the debug command like below. I called this function from the perspective view/eventfunctions/onKeyDown node. The shortcuts are working as the prints work, but the debug instructions throw me "exception: Exception caught in flexscript execution of MODEL:/Tools/UserCommands/customKeyboardShortcuts/code line 8 instruction 12. Discontinuing execution."

Code:
/**customKeyboardShortcuts*/
//pf(lastkeydown());pr();
treenode debugObject = parnode(1);
if(lastkeydown()){ //key pressed? 
	switch (lastkeydown()){ 
		case 113:    //p.e. F2-Key
			pt("F2");pr();
			debug(DEBUG_STEP);
			break;
		//F3 key
		case 114: 
			pt("F3"); pr();
			debug(DEBUG_STEP_INTO);
			break;
		//F4 key
		case 115:
			pt("F4");pr();
			debug(DEBUG_CONTINUE);
			break;
		case 116:
			pt("F5");pr();
			debug(DEBUG_STOP_SIMULATION);
			break;
		case 117:
			pt("F6");pr();
			debug(DEBUG_STOP);
			break;
	}
}
  #3  
Old 07-23-2015
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

You need to pass in the code node as the second parameter, and that will change depending on which code you're debugging. Also your method requires you to click into the perspective view when you want to start stepping through.

I've asked that we add it to the debugger.
The Following 4 Users Say Thank You to Jason Lightfoot For This Useful Post:
RalfGruber (07-24-2015)
  #4  
Old 07-24-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

Thank you Jason,

That makes sense. Do you know of some good way to get the current code node, i.e. the one that the debugger is active in? Or how can I get it? Is there a way to have a onKeyTrigger in the editor instead of the perspective view? That way the onKeyTrigger would be fired in the correct node more easily.

Thank you! That would make the debugger easier to use!

Kind regards,
Axel
  #5  
Old 07-24-2015
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

From the perspective view you'd have to scan through the Views:active>documents/code entries and find the code editor window that had the active debugger and then find the object that was focused on.

From the debugger, the onkeyDown would need to be in a number of view levels of the GUI to detect which had your mouse focus - and then the path to the objectfocus code node pointer of the code editor will be changing for each event.

Both are just a little messy/clunky - hopefully our developers can come up with something better.
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Axel Kohonen (07-24-2015)
  #6  
Old 07-24-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

Hi Jason,

Thank you for the suggestions! I will try to get one of those working when I get the time for it.

Yes, it would be great if they would as I think many of the Flexsim users would appreciate it.

Axel
  #7  
Old 07-24-2015
Alessio Merlo Alessio Merlo is offline
Flexsim User
 
Join Date: Oct 2013
Posts: 1
Downloads: 13
Uploads: 0
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0
Alessio Merlo is on a distinguished road
Default

Jason, will you insert this function in the next release of Flexsim 7.7?

Without using perspective, Axel, you can edit OnKeyUp with the switch case directly in the CodeEditor GUI saved in VIEW:/standardviews/code/CodeEditor.
The Following User Says Thank You to Alessio Merlo For This Useful Post:
Axel Kohonen (08-02-2015)
  #8  
Old 07-24-2015
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

Not for me to say - sorry - but they seem to always do a good job of putting things in if they can. If I hear back I'll post here or maybe one of the guys will.
  #9  
Old 08-02-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

Thank you Alessio and Jason,

Alessio, I cannot seem to find the onKeyUp within the View:/standardview/code/codeEditor. I assume it would be in the eventfunctions node, but there is no onKeyUp node there. Where did you find it (I am using Flexsim 7.5.2)? Also, I tried to add the node, but it disappears when I save, close and reopen the model. Is there a way to save the node so that it stays there also when you save and close and reopen the model?

Thank you!
Axel
  #10  
Old 08-03-2015
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

You can use create a module to make the change 'stick'.
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Axel Kohonen (08-03-2015)
  #11  
Old 08-03-2015
Axel Kohonen
Guest
 
Posts: n/a
Downloads: 22
Uploads: 0
Default

Thank you Jason,

You mean as mentioned in these posts?
https://www.flexsim.com/community/fo...=create+module

and

https://www.flexsim.com/community/fo...ight=bitbucket

If that is the case then I guess I need to maintain my changes in later versions, right? Until the functionality is added in the official release at least.

Thank you!
Axel

Tags
debugging


Thread Thread Starter Forum Replies Last Post
Problem with redefined keyboard keys Danny Pavan Q&A 2 06-21-2010 09:26 AM
COM Object for Controlling Flexsim Anthony Johnson User Development 6 02-25-2009 11:43 AM
Flexsim Debugger Anthony Johnson Gripes and Goodies 6 02-06-2009 05:37 AM
Controlling Flexsim Remotely Anthony Johnson Wiki Articles 2 01-02-2009 12:36 PM
Change Flexsim keyboard shortcut AlanZhang Q&A 1 12-03-2008 02:41 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.