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 09-25-2012
Vadim Fooks's Avatar
Vadim Fooks Vadim Fooks is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 67
Downloads: 26
Uploads: 0
Thanks: 50
Thanked 24 Times in 13 Posts
Rep Power: 118
Vadim Fooks will become famous soon enough
Default How to debug nodefunctions?

Ladies and Gentlemen,

is there an easy way of setting breakpoints in nodes toggled as flexscript?

Thanks!
Vadim
  #2  
Old 09-25-2012
Esther Bennett Esther Bennett is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 115
Downloads: 27
Uploads: 0
Thanks: 103
Thanked 116 Times in 50 Posts
Rep Power: 271
Esther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to all
Default

Hello Vadim,

What Flexscript nodes do you mean? On the triggers of a Trigger page of an object, you can add breakpoints for debugging.

It is also possible to add breakpoints in User Commands.

So if you are talking about user defined flexscript nodes, you could either call a User Command in the Flexscript node or create a GUI where you make the Flexscript node visible.

I am not sure if you can debug easily in Flexsim 6 when you are using the default settings, but if you switch off the 'use logic builder by default' on the Environments tab of the Global Preferences, you will see the code as in Flexsim 5.

Esther
  #3  
Old 09-25-2012
Vadim Fooks's Avatar
Vadim Fooks Vadim Fooks is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 67
Downloads: 26
Uploads: 0
Thanks: 50
Thanked 24 Times in 13 Posts
Rep Power: 118
Vadim Fooks will become famous soon enough
Default

Edited:
I have found the answer to my question. Please see next post.


Was:

Hi Esther,
I am not using the logic builder. Sorry if my previous post was not clear - I am referring to flexscript saved in nodes in an arbitrary location rather than in triggers and User Commands.
I am trying to figure out a way to structurize my code by pulling function implementations from User Commands to flexscript-toggled nodes inside the objects from which they are called as a way of preserving object-orientedness in order to improve component reusability (I know I can add a customized object to a user library, but if it will not work if a function it uses is implemented elsewhere). It works, but debugging those nodefunctions is a nightmare. While adding a breakpoints in triggers and user commands is trivial, placing a breakpoint in a nodefunction in an arbitrary location on a tree is very difficult - if I can step into the function it will be opened in the debugger and then I can add a breakpoint. For nodefunctions called via TASKTYPE_NODEFUNCTION this approach does not work at all.
One work around is creating a clone of a routine in User Commands for debugging, but it is impractical for commercial software development.
I was hoping there is an easy way to create a node on the tree, toggle it as flexscript, and set a breakpoint there.
I wonder how difficult is it to set a breakpoint via the command prompt window by executing something like setbreakpoint("MAIN:/project/model/MyObject>methods/MyMethod", 1) in the command prompt in order to set a breakpoint in the nodefunction MyMethod, line 1 within MyObject. There's got to be something like that happening in the background when you toggle a breakpoint by clicking.
  #4  
Old 09-25-2012
Vadim Fooks's Avatar
Vadim Fooks Vadim Fooks is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 67
Downloads: 26
Uploads: 0
Thanks: 50
Thanked 24 Times in 13 Posts
Rep Power: 118
Vadim Fooks will become famous soon enough
Default

Never mind, just found an answer.

Code:
 
debug([num operation, num/obj p2, num/obj p3]) 
Description: 
For developer use. 
This command is used to control the Flexscript step debugger. 
Calling this command without any parameters will behave as if there is a breakpoint at that line of code. 
Operations: 
DEBUG_STOP 0 
DEBUG_STEP 1 
DEBUG_CONTINUE 2 
DEBUG_IS_STOPPED 3 
DEBUG_GET_LINE_NR 4 
DEBUG_DUMP_VARIABLES 5 
DEBUG_STOP_SIMULATION 6 
DEBUG_REFRESH_BREAK_POINTS 7 
DEBUG_ADD_BREAK_POINT 8 
DEBUG_DELETE_BREAK_POINT 9 
DEBUG_GET_WATCH_VARIABLE 10 
DEBUG_ENABLE_CODE_PROFILING 11 
DEBUG_PRINT_CODE_PROFILING_INFO 12 
DEBUG_RESET_CODE_PROFILING 13 
Example:
debug();
The Following 3 Users Say Thank You to Vadim Fooks For This Useful Post:
Esther Bennett (09-25-2012)
  #5  
Old 09-25-2012
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

Right click the node and select Explore As Code. Then you can place the breakpoints in the normal way.
The Following 8 Users Say Thank You to Jason Lightfoot For This Useful Post:
Vadim Fooks (09-25-2012)


Thread Thread Starter Forum Replies Last Post
How to debug through vcpp project? william aponte Q&A 3 04-08-2010 03:42 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.