How to get and set the current viewport in RealDWG?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
in RealDWG all acedXXX() functions are missing. Especially:
- AcDbObjectId acedActiveViewportId();
- Acad::ErrorStatus acedSetCurrentVPort(int vpnumber);
- Acad::ErrorStatus acedSetCurrentVPort(const AcDbViewport* pVp);
How can I implement them in RealDWG? IMO this should be possible because the information about the current layout and current viewport is in the AcDbDatabase. So it should not depend on the AutoCAD editor.
I managed to implement AcDbObjectId acedGetCurViewportObjectId():
The current layout's BTR can be retrieved by AcDbDatabase::currentSpaceId(). There is no direct API to identify the active viewport within a layer. But the active viewport has DXFCODE 68 == 1. So it can be found using acdbEntGet(entname).
acedActiveViewportId() however should also return the active AcDbViewportTableRecord ID if TILEMODE=1. But how do I find the active one if there are more than one? They are all named "*Active".
In AutoCAD CVPORT holds an identifier for the viewport. But RealDWG has no acedGetVar()/acedSetVar() to access variables
and CVPORT can't be accessed from AcDbDatabase allthough it is store in the drawing.
I have no idea how to implement acedSetCurrentVPort(...). At least I could change DXFCODE 68 of a viewport if acdbEntMod(const struct resbuf*) would exist in RealDWG.
I implemented acdbEntGet(name) myself using dxfOut() with a custom AcDbDxfFiler that simply records written DXF-codes.
But I have no idea how to implement acdbEntMod(..)
Any ideas?