|
void getCurrentView(AcDbViewTableRecord& view) {
struct resbuf var;
struct resbuf WCS, UCS, DCS;
WCS.restype = RTSHORT;
WCS.resval.rint = 0;
UCS.restype = RTSHORT;
UCS.resval.rint = 1;
DCS.restype = RTSHORT;
DCS.resval.rint = 2;
ads_getvar(L"VIEWMODE", &var);
view.setPerspectiveEnabled(var.resval.rint & 1);
view.setFrontClipEnabled(var.resval.rint & 2 ? true : false);
view.setBackClipEnabled(var.resval.rint & 4 ? true : false);
view.setFrontClipAtEye(!(var.resval.rint & 16));
ads_getvar(L"BACKZ", &var);
view.setBackClipDistance(var.resval.rreal);
ads_getvar(L"VIEWCTR", &var);
ads_trans(var.resval.rpoint, &UCS, &DCS, NULL, var.resval.rpoint);
view.setCenterPoint(AcGePoint2d(var.resval.rpoint[X], var.resval.rpoint[Y]));
ads_getvar(L"FRONTZ", &var);
view.setFrontClipDistance(var.resval.rreal);
ads_getvar(L"LENSLENGTH", &var);
view.setLensLength(var.resval.rreal);
ads_getvar(L"TARGET", &var);
ads_trans(var.resval.rpoint, &UCS, &WCS, NULL, var.resval.rpoint);
view.setTarget(AcGePoint3d(var.resval.rpoint[X], var.resval.rpoint[Y],
var.resval.rpoint[Z]));
ads_getvar(L"VIEWDIR", &var);
ads_trans(var.resval.rpoint, &UCS, &WCS, TRUE, var.resval.rpoint);
view.setViewDirection(AcGeVector3d(var.resval.rpoint[X], var.resval.rpoint[Y],
var.resval.rpoint[Z]));
ads_getvar(L"VIEWSIZE", &var);
view.setHeight(var.resval.rreal);
double tst = view.width();
} |
|