Thanks very much but unfortunately, what I need is a simple screen grab. The reason that I need this is one of those nested loop situations...
- Customer needs a simulation of a cable actuated door.
- This assembly can be modeled in motion, including the speed up/down of the motor, but the cable can't be shown visually.
If this was an animation, I can draw the cable in context and it rebuilds nicely every frame like in the following...
But the situation (motor sizing, etc) really needs the physics calculations.
- I wrote a macro that interrupts the motion simulation every step and rebuilds. Unfortunately when you replay the
animation it reverts to not rebuilding so the cable stays the same length.
- Next tried the print screen (SaveAs3) but it stops the Motion study.
- Next thought, a simple Image Grab after each frame rebuild. It does grab the image during the motion study but with no
way to save the images off, I only see the last one.
Bummer. So my need is to be able to save what is in the clipboard to a file. This is one of those situations where one feels quite surprised that something that seems so fundamental is so difficult. I have found some examples, but they are quite old (<2009) and when you try to use them the first step is that the compiler rejects the " Declare Function" lines and suggests you investigate that these functions are applicable to 64 bit systems and then change this to "Declare PtrSafe Function". This works sometimes, but once in a while corrupts the base memory (yikes). This seems possible in VB.NET but so far no luck in VBA.
Anyway, this would be a good opportunity to thank you for all the selfless work you do. I find your name at the top of so many useful posts that I have mentioned to people your name to look for when they have SolidWorks problems and need to look through the forum posts.
I think I missed what you were guiding me to. You were answering a question in that forum from someone who already had the capability to do what I needed, you were giving them a way of furthering that to a *.jpg. So the first posting in that forum had the key piece of code that I needed...
If ModelDoc2.SaveBMP(filenameIn, widthIn, heightIn) Then
Thanks again Deepak Gupta!
Hi Alan, yes I mean that only but then reading your reply I thought it might be something different than what has been posted. Glad it worked for you.