ATTENTIONThis 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 |
#2
|
||||
|
||||
I've tried to use "viewtofile" but Flexsim crashes every time What issues do you have?
With the p-key I got a screenshot, but the view is always empty (just the window frame). |
#3
|
|||
|
|||
I'm not 100% sure, but I believe this is an issue with 5.1.2. I've looked at some of my old scripts and I've used viewtofile successfully in the past (5.0.?). I keep getting either an error that warns me of an improper parameter or sometimes a file access (can't delete file) error.
|
#4
|
|||
|
|||
Hi,
There is a bug in the viewtofilecommand (The x size of the window needs to be divisible by 4). The following script (Courtesy of Phil BoBo) will allow you to create a screenshot. treenode view = sv(); // There is a bug in viewtofile() that causes Flexsim to crash // unless the xsize of the window is divisible by 4 // This bug is fixed for the next version while(get(spatialsx(view))%4!=0) { set(spatialsx(view),get(spatialsx(view))-1); windowmove(windowfromnode(view),get(spatialx(view) ), get(spatialy(view)), get(spatialsx(view)), get(spatialsy(view))); } // Create the file path string startpath = modeldir(); if(stringlen(startpath) < 3) startpath = documentsdir(); string filepath = concat(startpath,"screenshots\\"); int counter = 1; string filename = concat(filepath, "screenshot", numtostring(counter,0,0), ".bmp"); while(fileexists(filename)&&counter<100) { counter++; filename = concat(filepath, "screenshot", numtostring(counter,0,0), ".bmp"); } // Take the screenshot if(stringlen(filename) > 3) { repaintview(view); viewtofile((view), filename); } |
The Following 4 Users Say Thank You to mark.gormley For This Useful Post: | ||
Todd Benanzer (07-26-2011) |
Tags |
screenshot, viewtofile |
Thread | Thread Starter | Forum | Replies | Last Post |
Capturing a 2D picture/drawing of a model. | Kenny Macleod | Q&A | 0 | 02-16-2011 06:41 PM |
Higher Resolution Model Images Or Screenshots | Thomas Kirk | Q&A | 3 | 02-08-2011 08:14 AM |
Capturing Video Advice - Video converter? | Sven Polz | Q&A | 5 | 08-10-2009 06:14 AM |