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-22-2011
Todd Benanzer Todd Benanzer is offline
Flexsim User
 
Join Date: Mar 2010
Location: Champaign, IL
Posts: 6
Downloads: 3
Uploads: 0
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 0
Todd Benanzer is on a distinguished road
Default Capturing Screenshots

Is anyone else having an issue using the viewtofile command for the latest version of FlexSim?
  #2  
Old 07-22-2011
Carsten Seehafer's Avatar
Carsten Seehafer Carsten Seehafer is offline
FlexSim Geek
 
Join Date: Oct 2008
Location: Ritterhude, Deutschland
Posts: 230
Downloads: 45
Uploads: 1
Thanks: 474
Thanked 320 Times in 143 Posts
Rep Power: 379
Carsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud of
Default

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  
Old 07-22-2011
Todd Benanzer Todd Benanzer is offline
Flexsim User
 
Join Date: Mar 2010
Location: Champaign, IL
Posts: 6
Downloads: 3
Uploads: 0
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 0
Todd Benanzer is on a distinguished road
Default

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  
Old 07-25-2011
mark.gormley mark.gormley is offline
Flexsim User
 
Join Date: Oct 2008
Posts: 58
Downloads: 12
Uploads: 0
Thanks: 32
Thanked 63 Times in 29 Posts
Rep Power: 181
mark.gormley has a spectacular aura aboutmark.gormley has a spectacular aura about
Default

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)
  #5  
Old 07-26-2011
Todd Benanzer Todd Benanzer is offline
Flexsim User
 
Join Date: Mar 2010
Location: Champaign, IL
Posts: 6
Downloads: 3
Uploads: 0
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 0
Todd Benanzer is on a distinguished road
Default

Thanks Mark. I'm guessing I never would've figured that one out on my own.

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


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.