Hi all,
I try to implement a "per-entity" png creation feature using AcGsView::getSnapShot.
This feature is inteded to create image files from one or several entities without changing the current autocad view. To achieve this, I've used some code found on ADN (from Fenton Webb) which created a snapshot of the current view. I've modified this code to create a view (instead of using the current one) and an off-screen device (this to setup correct camera position and target to match my needs on the created view).
It seems that in this case, AcGsView::getSnapShot doesn't work (black image is created).
I've attached a sample project that reproduce the issue (please do not pay too much attention to the coding style since it has been hugely modified for test purpose), here are some remarks on this project:
1 - Create an AcGsModel (AcGsClassFactory::createAutoCADModel), an AcGsView (AcGsClassFactory::createView) and an off screen AcGsDevice (AcGsClassFactory::createOffScreenDevice)
2 - setting some device properties (palette, bk color, renderer type)
3 - setting view properties (AcGsView::setView) - with hard coded values
4 - adding the view to the device
5 - adding entities to the view
6 - building atil image
7 - processing snapshot
8 - freeing all the stuff
Thank you for your help
loic
Solved! Go to Solution.
Solved by Balaji_Ram. Go to Solution.
Hi Loic,
Sorry for the delay.
I have attached a C++ and a .Net sample project that demonstrates creating a snapshot from selected entities.
Some of the helper methods in those samples are from the BlockView sample from the 2009 SDK.
Hope this helps.
Regards,
Balaji
Hi Balaji,
Thank you very much for this update. It works well.
I would however remark that it's not required to build an annonymous block (cloning entities into it), adding entities to the created AcGsView works as well.
Thanks a lot
loic