- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
- targets Acad 2014 (VS 2012 project)
- the project only builds in debug/x64
- object arx search paths have to be changed in project properties
- the main command is called "SNAPSHOT" and requires to select some entities
- the view position and target are hard-coded for test purpose, however, a big-enough solid drawn @(0,0,0) should appear in the snapshot
- the interesting code is in ent_snapshot.cpp -> ent_snapshot::snapshot_to_file
- Note that when using AcGsView::RenderToImage on the same view, it works correctly (but I would need wireframe snapshots as well)
- as a brief summary the code process the following:
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.